aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wiretap/wtap-int.h321
1 files changed, 161 insertions, 160 deletions
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
index 6e13e2b2ed..b2c1e906fe 100644
--- a/wiretap/wtap-int.h
+++ b/wiretap/wtap-int.h
@@ -43,41 +43,41 @@ int wtap_fstat(wtap *wth, ws_statb64 *statb, int *err);
typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*);
typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, union wtap_pseudo_header*,
- guint8*, int, int *, char **);
+ guint8*, int, int *, char **);
/**
* Struct holding data of the currently read file.
*/
struct wtap {
- FILE_T fh;
- FILE_T random_fh; /**< Secondary FILE_T for random access */
- int file_type;
- guint snapshot_length;
- struct Buffer *frame_buffer;
- struct wtap_pkthdr phdr;
- struct wtapng_section_s shb_hdr;
- guint number_of_interfaces; /**< The number of interfaces a capture was made on, number of IDB:s in a pcapng file or equivalent(?)*/
- GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?)*/
- union wtap_pseudo_header pseudo_header;
-
- gint64 data_offset;
-
- void *priv;
-
- subtype_read_func subtype_read;
- subtype_seek_read_func subtype_seek_read;
- void (*subtype_sequential_close)(struct wtap*);
- void (*subtype_close)(struct wtap*);
- int file_encap; /* per-file, for those
- * file formats that have
- * per-file encapsulation
- * types
- */
- int tsprecision; /* timestamp precision of the lower 32bits
- * e.g. WTAP_FILE_TSPREC_USEC
- */
- wtap_new_ipv4_callback_t add_new_ipv4;
- wtap_new_ipv6_callback_t add_new_ipv6;
- GPtrArray *fast_seek;
+ FILE_T fh;
+ FILE_T random_fh; /**< Secondary FILE_T for random access */
+ int file_type;
+ guint snapshot_length;
+ struct Buffer *frame_buffer;
+ struct wtap_pkthdr phdr;
+ struct wtapng_section_s shb_hdr;
+ guint number_of_interfaces; /**< The number of interfaces a capture was made on, number of IDB:s in a pcapng file or equivalent(?)*/
+ GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?)*/
+ union wtap_pseudo_header pseudo_header;
+
+ gint64 data_offset;
+
+ void *priv;
+
+ subtype_read_func subtype_read;
+ subtype_seek_read_func subtype_seek_read;
+ void (*subtype_sequential_close)(struct wtap*);
+ void (*subtype_close)(struct wtap*);
+ int file_encap; /* per-file, for those
+ * file formats that have
+ * per-file encapsulation
+ * types
+ */
+ int tsprecision; /* timestamp precision of the lower 32bits
+ * e.g. WTAP_FILE_TSPREC_USEC
+ */
+ wtap_new_ipv4_callback_t add_new_ipv4;
+ wtap_new_ipv6_callback_t add_new_ipv6;
+ GPtrArray *fast_seek;
};
struct wtap_dumper;
@@ -88,30 +88,31 @@ struct wtap_dumper;
typedef void *WFILE_T;
typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
- const struct wtap_pkthdr*, const union wtap_pseudo_header*,
- const guint8*, int*);
+ const struct wtap_pkthdr*,
+ const union wtap_pseudo_header*,
+ const guint8*, int*);
typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
struct wtap_dumper {
- WFILE_T fh;
- int file_type;
- int snaplen;
- int encap;
- gboolean compressed;
- gint64 bytes_dumped;
-
- void *priv;
-
- subtype_write_func subtype_write;
- subtype_close_func subtype_close;
-
- int tsprecision; /**< timestamp precision of the lower 32bits
- * e.g. WTAP_FILE_TSPREC_USEC
- */
- struct addrinfo *addrinfo_list;
- struct wtapng_section_s *shb_hdr;
- guint number_of_interfaces; /**< The number of interfaces a capture was made on, number of IDB:s in a pcapng file or equivalent(?)*/
- GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?) NULL if not present.*/
+ WFILE_T fh;
+ int file_type;
+ int snaplen;
+ int encap;
+ gboolean compressed;
+ gint64 bytes_dumped;
+
+ void *priv;
+
+ subtype_write_func subtype_write;
+ subtype_close_func subtype_close;
+
+ int tsprecision; /**< timestamp precision of the lower 32bits
+ * e.g. WTAP_FILE_TSPREC_USEC
+ */
+ struct addrinfo *addrinfo_list;
+ struct wtapng_section_s *shb_hdr;
+ guint number_of_interfaces; /**< The number of interfaces a capture was made on, number of IDB:s in a pcapng file or equivalent(?)*/
+ GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?) NULL if not present.*/
};
extern gboolean wtap_dump_file_write(wtap_dumper *wdh, const void *buf,
@@ -124,59 +125,59 @@ extern gint wtap_num_file_types;
/* Macros to byte-swap 64-bit, 32-bit and 16-bit quantities. */
#define BSWAP64(x) \
- ((((x)&G_GINT64_CONSTANT(0xFF00000000000000U))>>56) | \
- (((x)&G_GINT64_CONSTANT(0x00FF000000000000U))>>40) | \
- (((x)&G_GINT64_CONSTANT(0x0000FF0000000000U))>>24) | \
- (((x)&G_GINT64_CONSTANT(0x000000FF00000000U))>>8) | \
- (((x)&G_GINT64_CONSTANT(0x00000000FF000000U))<<8) | \
- (((x)&G_GINT64_CONSTANT(0x0000000000FF0000U))<<24) | \
- (((x)&G_GINT64_CONSTANT(0x000000000000FF00U))<<40) | \
- (((x)&G_GINT64_CONSTANT(0x00000000000000FFU))<<56))
-#define BSWAP32(x) \
- ((((x)&0xFF000000)>>24) | \
- (((x)&0x00FF0000)>>8) | \
- (((x)&0x0000FF00)<<8) | \
- (((x)&0x000000FF)<<24))
-#define BSWAP16(x) \
- ((((x)&0xFF00)>>8) | \
- (((x)&0x00FF)<<8))
+ ((((x)&G_GINT64_CONSTANT(0xFF00000000000000U))>>56) | \
+ (((x)&G_GINT64_CONSTANT(0x00FF000000000000U))>>40) | \
+ (((x)&G_GINT64_CONSTANT(0x0000FF0000000000U))>>24) | \
+ (((x)&G_GINT64_CONSTANT(0x000000FF00000000U))>>8) | \
+ (((x)&G_GINT64_CONSTANT(0x00000000FF000000U))<<8) | \
+ (((x)&G_GINT64_CONSTANT(0x0000000000FF0000U))<<24) | \
+ (((x)&G_GINT64_CONSTANT(0x000000000000FF00U))<<40) | \
+ (((x)&G_GINT64_CONSTANT(0x00000000000000FFU))<<56))
+#define BSWAP32(x) \
+ ((((x)&0xFF000000)>>24) | \
+ (((x)&0x00FF0000)>>8) | \
+ (((x)&0x0000FF00)<<8) | \
+ (((x)&0x000000FF)<<24))
+#define BSWAP16(x) \
+ ((((x)&0xFF00)>>8) | \
+ (((x)&0x00FF)<<8))
/* Macros to byte-swap possibly-unaligned 64-bit, 32-bit and 16-bit quantities;
* they take a pointer to the quantity, and byte-swap it in place.
*/
#define PBSWAP64(p) \
- { \
- guint8 tmp; \
- tmp = (p)[7]; \
- (p)[7] = (p)[0]; \
- (p)[0] = tmp; \
- tmp = (p)[6]; \
- (p)[6] = (p)[1]; \
- (p)[1] = tmp; \
- tmp = (p)[5]; \
- (p)[5] = (p)[2]; \
- (p)[2] = tmp; \
- tmp = (p)[4]; \
- (p)[4] = (p)[3]; \
- (p)[3] = tmp; \
- }
+ { \
+ guint8 tmp; \
+ tmp = (p)[7]; \
+ (p)[7] = (p)[0]; \
+ (p)[0] = tmp; \
+ tmp = (p)[6]; \
+ (p)[6] = (p)[1]; \
+ (p)[1] = tmp; \
+ tmp = (p)[5]; \
+ (p)[5] = (p)[2]; \
+ (p)[2] = tmp; \
+ tmp = (p)[4]; \
+ (p)[4] = (p)[3]; \
+ (p)[3] = tmp; \
+ }
#define PBSWAP32(p) \
- { \
- guint8 tmp; \
- tmp = (p)[3]; \
- (p)[3] = (p)[0]; \
- (p)[0] = tmp; \
- tmp = (p)[2]; \
- (p)[2] = (p)[1]; \
- (p)[1] = tmp; \
- }
+ { \
+ guint8 tmp; \
+ tmp = (p)[3]; \
+ (p)[3] = (p)[0]; \
+ (p)[0] = tmp; \
+ tmp = (p)[2]; \
+ (p)[2] = (p)[1]; \
+ (p)[1] = tmp; \
+ }
#define PBSWAP16(p) \
- { \
- guint8 tmp; \
- tmp = (p)[1]; \
- (p)[1] = (p)[0]; \
- (p)[0] = tmp; \
- }
+ { \
+ guint8 tmp; \
+ tmp = (p)[1]; \
+ (p)[1] = (p)[0]; \
+ (p)[0] = tmp; \
+ }
/* Turn host-byte-order values into little-endian values. */
#define htoles(s) GUINT16_TO_LE(s)
@@ -261,93 +262,93 @@ extern gint wtap_num_file_types;
#ifndef phtons
#define phtons(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 8); \
- (p)[1] = (guint8)((v) >> 0); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 8); \
+ (p)[1] = (guint8)((v) >> 0); \
+ }
#endif
#ifndef phton24
#define phton24(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 16); \
- (p)[1] = (guint8)((v) >> 8); \
- (p)[2] = (guint8)((v) >> 0); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 16); \
+ (p)[1] = (guint8)((v) >> 8); \
+ (p)[2] = (guint8)((v) >> 0); \
+ }
#endif
#ifndef phtonl
#define phtonl(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 24); \
- (p)[1] = (guint8)((v) >> 16); \
- (p)[2] = (guint8)((v) >> 8); \
- (p)[3] = (guint8)((v) >> 0); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 24); \
+ (p)[1] = (guint8)((v) >> 16); \
+ (p)[2] = (guint8)((v) >> 8); \
+ (p)[3] = (guint8)((v) >> 0); \
+ }
#endif
#ifndef phtonll
#define phtonll(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 56); \
- (p)[1] = (guint8)((v) >> 48); \
- (p)[2] = (guint8)((v) >> 40); \
- (p)[3] = (guint8)((v) >> 32); \
- (p)[4] = (guint8)((v) >> 24); \
- (p)[5] = (guint8)((v) >> 16); \
- (p)[6] = (guint8)((v) >> 8); \
- (p)[7] = (guint8)((v) >> 0); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 56); \
+ (p)[1] = (guint8)((v) >> 48); \
+ (p)[2] = (guint8)((v) >> 40); \
+ (p)[3] = (guint8)((v) >> 32); \
+ (p)[4] = (guint8)((v) >> 24); \
+ (p)[5] = (guint8)((v) >> 16); \
+ (p)[6] = (guint8)((v) >> 8); \
+ (p)[7] = (guint8)((v) >> 0); \
+ }
#endif
#ifndef phtoles
#define phtoles(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 0); \
- (p)[1] = (guint8)((v) >> 8); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 0); \
+ (p)[1] = (guint8)((v) >> 8); \
+ }
#endif
#ifndef phtolell
#define phtolell(p, v) \
- { \
- (p)[0] = (guint8)((v) >> 0); \
- (p)[1] = (guint8)((v) >> 8); \
- (p)[2] = (guint8)((v) >> 16); \
- (p)[3] = (guint8)((v) >> 24); \
- (p)[4] = (guint8)((v) >> 32); \
- (p)[5] = (guint8)((v) >> 40); \
- (p)[6] = (guint8)((v) >> 48); \
- (p)[7] = (guint8)((v) >> 56); \
- }
+ { \
+ (p)[0] = (guint8)((v) >> 0); \
+ (p)[1] = (guint8)((v) >> 8); \
+ (p)[2] = (guint8)((v) >> 16); \
+ (p)[3] = (guint8)((v) >> 24); \
+ (p)[4] = (guint8)((v) >> 32); \
+ (p)[5] = (guint8)((v) >> 40); \
+ (p)[6] = (guint8)((v) >> 48); \
+ (p)[7] = (guint8)((v) >> 56); \
+ }
#endif
#define wtap_file_read_unknown_bytes(target, num_bytes, fh, err, err_info) \
- G_STMT_START \
- { \
- int _bytes_read; \
- _bytes_read = file_read((target), (num_bytes), (fh)); \
- if (_bytes_read != (int) (num_bytes)) { \
- *(err) = file_error((fh), (err_info)); \
- return FALSE; \
- } \
- } \
- G_STMT_END
+ G_STMT_START \
+ { \
+ int _bytes_read; \
+ _bytes_read = file_read((target), (num_bytes), (fh)); \
+ if (_bytes_read != (int) (num_bytes)) { \
+ *(err) = file_error((fh), (err_info)); \
+ return FALSE; \
+ } \
+ } \
+ G_STMT_END
#define wtap_file_read_expected_bytes(target, num_bytes, fh, err, err_info) \
- G_STMT_START \
- { \
- int _bytes_read; \
- _bytes_read = file_read((target), (num_bytes), (fh)); \
- if (_bytes_read != (int) (num_bytes)) { \
- *(err) = file_error((fh), (err_info)); \
- if (*(err) == 0 && _bytes_read > 0) { \
- *(err) = WTAP_ERR_SHORT_READ; \
- } \
- return FALSE; \
- } \
- } \
- G_STMT_END
+ G_STMT_START \
+ { \
+ int _bytes_read; \
+ _bytes_read = file_read((target), (num_bytes), (fh)); \
+ if (_bytes_read != (int) (num_bytes)) { \
+ *(err) = file_error((fh), (err_info)); \
+ if (*(err) == 0 && _bytes_read > 0) { \
+ *(err) = WTAP_ERR_SHORT_READ; \
+ } \
+ return FALSE; \
+ } \
+ } \
+ G_STMT_END
/* glib doesn't have g_ptr_array_len of all things!*/
#ifndef g_ptr_array_len