aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/pcapng_module.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-04 20:33:02 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-05 04:37:38 +0000
commitb8121932e9be9d61e3dff8f608d1d438dd163f27 (patch)
tree68d0c62af01034b9943d085fcf35b09b84527e8e /wiretap/pcapng_module.h
parent8556f65e0740af647482a6fca86371bbc498b68e (diff)
Have block read routines indicate whether the block should be returned.
Some blocks should be returned by wtap_read(), others are just processed internally. Add a Boolean flag to wtapng_block_t, have the routines that read particular block types set it appropriately, and have the read and seek-read routines check that flag rather than checking for the block types that should be returned. Pass a pointer to the wtapng_block_t to packet type plugin read routines, rather than passing it some members of the wtapng_block_t. This means that 1) for new block types, we don't have to update any tests and 2) plugin handlers for block types can indicate whether they processed the block internally and the caller shouldn't see it or 2) the block should be provided to the caller. Bug: 14388 Change-Id: Iccc2031a277f55c7fa8b4f692c776b482b792b4f Reviewed-on: https://code.wireshark.org/review/25609 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/pcapng_module.h')
-rw-r--r--wiretap/pcapng_module.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/wiretap/pcapng_module.h b/wiretap/pcapng_module.h
index 048f14cf85..e55602f627 100644
--- a/wiretap/pcapng_module.h
+++ b/wiretap/pcapng_module.h
@@ -37,11 +37,29 @@
* Event/Security Block
*/
+/* Block data to be passed between functions during reading */
+typedef struct wtapng_block_s {
+ guint32 type; /* block_type as defined by pcapng */
+ gboolean internal; /* TRUE if this block type shouldn't be returned from pcapng_read() */
+ wtap_block_t block;
+
+ /*
+ * XXX - currently don't know how to handle these!
+ *
+ * For one thing, when we're reading a block, they must be
+ * writable, i.e. not const, so that we can read into them,
+ * but, when we're writing a block, they can be const, and,
+ * in fact, they sometimes point to const values.
+ */
+ struct wtap_pkthdr *packet_header;
+ Buffer *frame_buffer;
+} wtapng_block_t;
+
/*
* Reader and writer routines for pcapng block types.
*/
-typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, struct wtap_pkthdr *,
- Buffer *, int *, gchar **);
+typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, wtapng_block_t *,
+ int *, gchar **);
typedef gboolean (*block_writer)(wtap_dumper *, const struct wtap_pkthdr *,
const guint8 *, int *);