diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2012-10-16 21:50:57 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2012-10-16 21:50:57 +0000 |
commit | 78631020b83c7aab12934f0cff72dbb5e3f0ba4a (patch) | |
tree | 826f6248fcdb37ec849abebc3bdcc650e0df6c61 /wiretap | |
parent | d7ae273d7a2373ab6fcc1c58d235b4a7dc4df0e9 (diff) |
Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.
svn path=/trunk/; revision=45601
Diffstat (limited to 'wiretap')
50 files changed, 259 insertions, 237 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c index f746c45548..9629c2e691 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -108,12 +108,11 @@ static gboolean _5views_read_rec_data(FILE_T fh, guint8 *pd, int length, static int _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr, int *err, gchar **err_info); static gboolean _5views_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); -static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); +static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const guint8 *pd, int *err); static gboolean _5views_dump_close(wtap_dumper *wdh, int *err); @@ -268,7 +267,7 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) case WTAP_ENCAP_ETHERNET: /* We assume there's no FCS in this frame. */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; break; } @@ -323,9 +322,10 @@ _5views_read_header(wtap *wth _U_, FILE_T fh, t_5VW_TimeStamped_Header *hdr, static gboolean _5views_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; /* @@ -400,7 +400,6 @@ gboolean _5views_dump_open(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { _5views_dump_t *_5views = (_5views_dump_t *)wdh->priv; diff --git a/wiretap/aethra.c b/wiretap/aethra.c index 0f83be815e..c219ae84e4 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -117,7 +117,7 @@ typedef struct { static gboolean aethra_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean aethra_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean aethra_read_rec_header(FILE_T fh, struct aethrarec_hdr *hdr, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); @@ -204,7 +204,7 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info, *data_offset = file_tell(wth->fh); /* Read record header. */ - if (!aethra_read_rec_header(wth->fh, &hdr, &wth->pseudo_header, + if (!aethra_read_rec_header(wth->fh, &hdr, &wth->phdr.pseudo_header, err, err_info)) return FALSE; @@ -303,9 +303,10 @@ found: static gboolean aethra_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct aethrarec_hdr hdr; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c index 0907bca42d..1a77ea427e 100644 --- a/wiretap/ascendtext.c +++ b/wiretap/ascendtext.c @@ -85,7 +85,7 @@ typedef struct { static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean ascend_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_head, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); /* Seeks to the beginning of the next packet, and returns the @@ -166,7 +166,7 @@ found: if (file_seek(wth->fh, packet_off, SEEK_SET, err) == -1) return -1; - wth->pseudo_header.ascend.type = type; + wth->phdr.pseudo_header.ascend.type = type; return packet_off; } @@ -195,14 +195,14 @@ int ascend_open(wtap *wth, int *err, gchar **err_info) /* Do a trial parse of the first packet just found to see if we might really have an Ascend file */ init_parse_ascend(); - if (parse_ascend(wth->fh, buf, &wth->pseudo_header.ascend, &header, + if (parse_ascend(wth->fh, buf, &wth->phdr.pseudo_header.ascend, &header, &dummy_seek_start) != PARSED_RECORD) { return 0; } wth->file_type = WTAP_FILE_ASCEND; - switch(wth->pseudo_header.ascend.type) { + switch(wth->phdr.pseudo_header.ascend.type) { case ASCEND_PFX_ISDN_X: case ASCEND_PFX_ISDN_R: wth->file_encap = WTAP_ENCAP_ISDN; @@ -284,7 +284,7 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, offset = ascend_seek(wth, err, err_info); if (offset == -1) return FALSE; - if (parse_ascend(wth->fh, buf, &wth->pseudo_header.ascend, &header, + if (parse_ascend(wth->fh, buf, &wth->phdr.pseudo_header.ascend, &header, &(ascend->next_packet_seek_start)) != PARSED_RECORD) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error"); @@ -293,7 +293,7 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, buffer_assure_space(wth->frame_buffer, wth->snapshot_length); - config_pseudo_header(&wth->pseudo_header); + config_pseudo_header(&wth->phdr.pseudo_header); if (! ascend->adjusted) { ascend->adjusted = 1; @@ -325,9 +325,10 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, } static gboolean ascend_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_head, guint8 *pd, int len _U_, + struct wtap_pkthdr *phdr, guint8 *pd, int len _U_, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_head = &phdr->pseudo_header; ascend_t *ascend = (ascend_t *)wth->priv; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) diff --git a/wiretap/ber.c b/wiretap/ber.c index 22a1336877..6e50113a6a 100644 --- a/wiretap/ber.c +++ b/wiretap/ber.c @@ -88,7 +88,7 @@ static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off return TRUE; } -static gboolean ber_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, +static gboolean ber_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_, guint8 *pd, int length, int *err, gchar **err_info) { int packet_size = length; diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c index c23bf2cc1e..4b7820dd4a 100644 --- a/wiretap/btsnoop.c +++ b/wiretap/btsnoop.c @@ -74,7 +74,7 @@ const gint64 KUnixTimeBase = G_GINT64_CONSTANT(0x00dcddb30f2f8000); /* offset fr static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean snoop_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err, gchar **err_info); @@ -207,33 +207,34 @@ static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info, wth->phdr.len = orig_size; if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR) { - wth->pseudo_header.p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE; + wth->phdr.pseudo_header.p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE; } else if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_HCI) { - wth->pseudo_header.bthci.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE; + wth->phdr.pseudo_header.bthci.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE; if(flags & KHciLoggerCommandOrEvent) { - if(wth->pseudo_header.bthci.sent) + if(wth->phdr.pseudo_header.bthci.sent) { - wth->pseudo_header.bthci.channel = BTHCI_CHANNEL_COMMAND; + wth->phdr.pseudo_header.bthci.channel = BTHCI_CHANNEL_COMMAND; } else { - wth->pseudo_header.bthci.channel = BTHCI_CHANNEL_EVENT; + wth->phdr.pseudo_header.bthci.channel = BTHCI_CHANNEL_EVENT; } } else { - wth->pseudo_header.bthci.channel = BTHCI_CHANNEL_ACL; + wth->phdr.pseudo_header.bthci.channel = BTHCI_CHANNEL_ACL; } } return TRUE; } static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int bytes_read; struct btsnooprec_hdr hdr; guint32 flags; @@ -374,9 +375,9 @@ static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_, /* FIXME: How do we support multiple backends?*/ static gboolean btsnoop_dump_h1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct btsnooprec_hdr rec_hdr; if (!btsnoop_dump_partial_rec_hdr(wdh, phdr, pseudo_header, pd, err, &rec_hdr)) @@ -403,9 +404,9 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh, static gboolean btsnoop_dump_h4(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct btsnooprec_hdr rec_hdr; if (!btsnoop_dump_partial_rec_hdr(wdh, phdr, pseudo_header, pd, err, &rec_hdr)) diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index 9482bfd117..f12a4570b9 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -108,13 +108,12 @@ static const gchar catapult_dct2000_magic[] = "Session Transcript"; static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static void catapult_dct2000_close(wtap *wth); static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); @@ -480,7 +479,7 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_, g_hash_table_insert(file_externals->packet_prefix_table, pkey, line_prefix_info); /* Set pseudo-header if necessary */ - set_pseudo_header_info(wth, encap, this_offset, &wth->pseudo_header, + set_pseudo_header_info(wth, encap, this_offset, &wth->phdr.pseudo_header, direction, aal_header_chars); /* OK, we have packet details to return */ @@ -500,9 +499,10 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_, /**************************************************/ static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; gint64 offset = 0; long dollar_offset, before_time_offset, after_time_offset; static gchar linebuff[MAX_LINE_LENGTH+1]; @@ -671,9 +671,9 @@ catapult_dct2000_dump_can_write_encap(int encap) static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; guint32 n; line_prefix_info_t *prefix = NULL; gchar time_string[16]; diff --git a/wiretap/commview.c b/wiretap/commview.c index 81bcfcd802..1a95056f08 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -83,13 +83,12 @@ typedef struct commview_header { static gboolean commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean commview_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err, gchar **err_info); static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); int commview_open(wtap *wth, int *err, gchar **err_info) @@ -187,7 +186,7 @@ commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) return FALSE; } - commview_set_pseudo_header(&cv_hdr, &wth->pseudo_header); + commview_set_pseudo_header(&cv_hdr, &wth->phdr.pseudo_header); buffer_assure_space(wth->frame_buffer, cv_hdr.data_len); bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), @@ -219,10 +218,11 @@ commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) } static gboolean -commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header - *pseudo_header, guint8 *pd, int length, int *err, +commview_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, + guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; commview_header_t cv_hdr; int bytes_read; @@ -323,9 +323,9 @@ gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_) * Returns TRUE on success, FALSE on failure. */ static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; commview_header_t cv_hdr; struct tm *tm; diff --git a/wiretap/cosine.c b/wiretap/cosine.c index ebd11709b2..73f305fd91 100644 --- a/wiretap/cosine.c +++ b/wiretap/cosine.c @@ -171,7 +171,7 @@ static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info); static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean cosine_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static int parse_cosine_rec_hdr(wtap *wth, const char *line, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); @@ -317,7 +317,7 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, return FALSE; /* Parse the header */ - pkt_len = parse_cosine_rec_hdr(wth, line, &wth->pseudo_header, err, + pkt_len = parse_cosine_rec_hdr(wth, line, &wth->phdr.pseudo_header, err, err_info); if (pkt_len == -1) return FALSE; @@ -340,9 +340,10 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean cosine_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; char line[COSINE_LINE_LENGTH]; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) diff --git a/wiretap/csids.c b/wiretap/csids.c index b8d24a83b1..9555e005da 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -45,7 +45,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean csids_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); struct csids_header { @@ -204,7 +204,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info, static gboolean csids_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int len, int *err, diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c index c6c51b351f..47d1475eee 100644 --- a/wiretap/daintree-sna.c +++ b/wiretap/daintree-sna.c @@ -83,7 +83,7 @@ static gboolean daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean daintree_sna_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int len, int *err, gchar **err_info); @@ -190,8 +190,8 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) /* Read the capture file randomly * Wireshark opens the capture file for random access when displaying user-selected packets */ static gboolean -daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header - *pseudo_header _U_, guint8 *pd, int len, int *err, +daintree_sna_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_, + guint8 *pd, int len, int *err, gchar **err_info) { char readLine[DAINTREE_MAX_LINE_SIZE]; diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 867bb40221..6a276045ef 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -89,7 +89,7 @@ static const char dbs_etherwatch_rec_magic[] = static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static int parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err, gchar **err_info); @@ -234,7 +234,7 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info, /* * We don't have an FCS in this frame. */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; *data_offset = offset; return TRUE; @@ -243,9 +243,10 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int pkt_len; if (file_seek(wth->random_fh, seek_off - 1, SEEK_SET, err) == -1) diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c index ac58b5785f..9bbae29cfc 100644 --- a/wiretap/dct3trace.c +++ b/wiretap/dct3trace.c @@ -76,7 +76,7 @@ static const char dct3trace_magic_end[] = "</dump>"; static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); /* @@ -347,7 +347,7 @@ static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info, int buf_len; unsigned char buf[MAX_PACKET_LEN]; - if( !dct3trace_get_packet(wth->fh, &wth->pseudo_header, buf, &buf_len, err, err_info) ) + if( !dct3trace_get_packet(wth->fh, &wth->phdr.pseudo_header, buf, &buf_len, err, err_info) ) { return FALSE; } @@ -371,9 +371,10 @@ static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean dct3trace_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int buf_len; unsigned char buf[MAX_PACKET_LEN]; diff --git a/wiretap/erf.c b/wiretap/erf.c index fdb0f23fbf..54f8c945f7 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -69,7 +69,7 @@ static int erf_read_header(FILE_T fh, static gboolean erf_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean erf_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static const struct { @@ -290,7 +290,7 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info, do { if (!erf_read_header(wth->fh, - &wth->phdr, &wth->pseudo_header, &erf_header, + &wth->phdr, &wth->phdr.pseudo_header, &erf_header, err, err_info, &bytes_read, &packet_size)) { return FALSE; } @@ -306,9 +306,10 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info, } static gboolean erf_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int length _U_, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; erf_header_t erf_header; guint32 packet_size; @@ -577,10 +578,10 @@ static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pse static gboolean erf_dump( wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; union wtap_pseudo_header other_phdr; int encap; gint64 alignbytes = 0; diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 6c5c78a82e..841a58d2f7 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -95,7 +95,7 @@ static const unsigned char eyesdn_hdr_magic[] = static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static gboolean parse_eyesdn_packet_data(FILE_T fh, int pkt_len, guint8* buf, int *err, gchar **err_info); @@ -172,7 +172,7 @@ static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info, return FALSE; /* Parse the header */ - pkt_len = parse_eyesdn_rec_hdr(wth, wth->fh, &wth->pseudo_header, err, + pkt_len = parse_eyesdn_rec_hdr(wth, wth->fh, &wth->phdr.pseudo_header, err, err_info); if (pkt_len == -1) return FALSE; @@ -192,9 +192,10 @@ static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean eyesdn_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int pkt_len; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) @@ -431,7 +432,6 @@ esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err) static gboolean eyesdn_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err); gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err) @@ -469,10 +469,10 @@ int eyesdn_dump_can_write_encap(int encap) * Returns TRUE on success, FALSE on failure. */ static gboolean eyesdn_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { static const guint8 start_flag = 0xff; + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; guint8 buf[EYESDN_HDR_LENGTH]; int usecs; time_t secs; diff --git a/wiretap/file_access.c b/wiretap/file_access.c index bf24f55241..4706035e77 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -1370,9 +1370,9 @@ static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean c } gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) + const guint8 *pd, int *err) { - return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err); + return (wdh->subtype_write)(wdh, phdr, pd, err); } void wtap_dump_flush(wtap_dumper *wdh) diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c index cf7ca8df90..21a7d11e65 100644 --- a/wiretap/hcidump.c +++ b/wiretap/hcidump.c @@ -82,15 +82,16 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info, wth->phdr.caplen = packet_size; wth->phdr.len = packet_size; - wth->pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE); + wth->phdr.pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE); return TRUE; } static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct dump_hdr dh; int bytes_read; diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index 647ce51d62..6ce3dab1e1 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -38,7 +38,7 @@ typedef struct { static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err, gchar **err_info); @@ -189,16 +189,17 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info, break; } - i4b_set_pseudo_header(&hdr, &wth->pseudo_header); + i4b_set_pseudo_header(&hdr, &wth->phdr.pseudo_header); return TRUE; } static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int ret; i4b_trace_hdr_t hdr; diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c index 2d7d0d3f68..805d49caf7 100644 --- a/wiretap/ipfix.c +++ b/wiretap/ipfix.c @@ -92,7 +92,7 @@ ipfix_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean ipfix_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static void ipfix_close(wtap *wth); @@ -289,9 +289,10 @@ ipfix_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) /* classic wtap: seek to file position and read packet */ static gboolean ipfix_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length _U_, + struct wtap_pkthdr *phdr, guint8 *pd, int length _U_, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; ipfix_message_header_t msg_hdr; (void) pseudo_header; /* avoids compiler warning about unused variable */ diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index ee343aa3e6..a2b8ec5feb 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -33,13 +33,13 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info); static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info); static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len, @@ -221,7 +221,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info, /* Fill in the pseudo-header. */ fill_in_pseudo_header(wth->phdr.pkt_encap, data_ptr, wth->phdr.caplen, - &wth->pseudo_header, header); + &wth->phdr.pseudo_header, header); /* If the per-file encapsulation isn't known, set it to this packet's encapsulation. @@ -240,9 +240,10 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info, } static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int ret; guint8 header[IPTRACE_1_0_PHDR_SIZE]; int pkt_encap; @@ -433,7 +434,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info, /* Fill in the pseudo-header. */ fill_in_pseudo_header(wth->phdr.pkt_encap, data_ptr, wth->phdr.caplen, - &wth->pseudo_header, header); + &wth->phdr.pseudo_header, header); /* If the per-file encapsulation isn't known, set it to this packet's encapsulation. @@ -452,9 +453,10 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info, } static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int ret; guint8 header[IPTRACE_2_0_PHDR_SIZE]; int pkt_encap; diff --git a/wiretap/iseries.c b/wiretap/iseries.c index 3dea66fd7f..ff8990c408 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -167,7 +167,7 @@ typedef struct { static gboolean iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset); static gboolean iseries_seek_read (wtap * wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, guint8 * pd, int len, int *err, gchar ** err_info); static gboolean iseries_check_file_type (wtap * wth, int *err, gchar **err_info, @@ -420,7 +420,7 @@ iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset) * Parse the packet and extract the various fields */ pkt_len = - iseries_parse_packet (wth, wth->fh, &wth->pseudo_header, NULL, err, + iseries_parse_packet (wth, wth->fh, &wth->phdr.pseudo_header, NULL, err, err_info); if (pkt_len == -1) return FALSE; @@ -510,9 +510,10 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info) */ static gboolean iseries_seek_read (wtap * wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 * pd, + struct wtap_pkthdr *phdr, guint8 * pd, int len, int *err, gchar ** err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int pkt_len; /* seek to packet location */ diff --git a/wiretap/k12.c b/wiretap/k12.c index 38102d80c6..eba4d4e25f 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -466,39 +466,40 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off buffer_assure_space(&(k12->extra_info), extra_len); memcpy(buffer_start_ptr(&(k12->extra_info)), buffer + K12_PACKET_FRAME + wth->phdr.caplen, extra_len); - wth->pseudo_header.k12.extra_info = (void*)buffer_start_ptr(&(k12->extra_info)); - wth->pseudo_header.k12.extra_length = extra_len; + wth->phdr.pseudo_header.k12.extra_info = (void*)buffer_start_ptr(&(k12->extra_info)); + wth->phdr.pseudo_header.k12.extra_length = extra_len; - wth->pseudo_header.k12.input = src_id; + wth->phdr.pseudo_header.k12.input = src_id; K12_DBG(5,("k12_read: wth->pseudo_header.k12.input=%x wth->phdr.len=%i input_name='%s' stack_file='%s' type=%x", wth->pseudo_header.k12.input,wth->phdr.len,src_desc->input_name,src_desc->stack_file,src_desc->input_type));\ - wth->pseudo_header.k12.input_name = src_desc->input_name; - wth->pseudo_header.k12.stack_file = src_desc->stack_file; - wth->pseudo_header.k12.input_type = src_desc->input_type; + wth->phdr.pseudo_header.k12.input_name = src_desc->input_name; + wth->phdr.pseudo_header.k12.stack_file = src_desc->stack_file; + wth->phdr.pseudo_header.k12.input_type = src_desc->input_type; switch(src_desc->input_type) { case K12_PORT_ATMPVC: if ((long)(K12_PACKET_FRAME + wth->phdr.len + K12_PACKET_OFFSET_CID) < len) { - wth->pseudo_header.k12.input_info.atm.vp = pntohs(buffer + (K12_PACKET_FRAME + wth->phdr.caplen + K12_PACKET_OFFSET_VP)); - wth->pseudo_header.k12.input_info.atm.vc = pntohs(buffer + (K12_PACKET_FRAME + wth->phdr.caplen + K12_PACKET_OFFSET_VC)); - wth->pseudo_header.k12.input_info.atm.cid = *((unsigned char*)(buffer + K12_PACKET_FRAME + wth->phdr.len + K12_PACKET_OFFSET_CID)); + wth->phdr.pseudo_header.k12.input_info.atm.vp = pntohs(buffer + (K12_PACKET_FRAME + wth->phdr.caplen + K12_PACKET_OFFSET_VP)); + wth->phdr.pseudo_header.k12.input_info.atm.vc = pntohs(buffer + (K12_PACKET_FRAME + wth->phdr.caplen + K12_PACKET_OFFSET_VC)); + wth->phdr.pseudo_header.k12.input_info.atm.cid = *((unsigned char*)(buffer + K12_PACKET_FRAME + wth->phdr.len + K12_PACKET_OFFSET_CID)); break; } /* Fall through */ default: - memcpy(&(wth->pseudo_header.k12.input_info),&(src_desc->input_info),sizeof(src_desc->input_info)); + memcpy(&(wth->phdr.pseudo_header.k12.input_info),&(src_desc->input_info),sizeof(src_desc->input_info)); break; } - wth->pseudo_header.k12.stuff = k12; + wth->phdr.pseudo_header.k12.stuff = k12; return TRUE; } -static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, int *err _U_, gchar **err_info) { +static gboolean k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err _U_, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; k12_t *k12 = (k12_t *)wth->priv; k12_src_desc_t* src_desc; guint8* buffer; @@ -530,8 +531,8 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head buffer_assure_space(&(k12->extra_info), extra_len); memcpy(buffer_start_ptr(&(k12->extra_info)), buffer + K12_PACKET_FRAME + length, extra_len); - wth->pseudo_header.k12.extra_info = (void*)buffer_start_ptr(&(k12->extra_info)); - wth->pseudo_header.k12.extra_length = extra_len; + wth->phdr.pseudo_header.k12.extra_info = (void*)buffer_start_ptr(&(k12->extra_info)); + wth->phdr.pseudo_header.k12.extra_length = extra_len; if (pseudo_header) { pseudo_header->k12.extra_info = (void*)buffer_start_ptr(&(k12->extra_info)); pseudo_header->k12.extra_length = extra_len; @@ -573,21 +574,21 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head } } - wth->pseudo_header.k12.input_name = src_desc->input_name; - wth->pseudo_header.k12.stack_file = src_desc->stack_file; - wth->pseudo_header.k12.input_type = src_desc->input_type; + wth->phdr.pseudo_header.k12.input_name = src_desc->input_name; + wth->phdr.pseudo_header.k12.stack_file = src_desc->stack_file; + wth->phdr.pseudo_header.k12.input_type = src_desc->input_type; switch(src_desc->input_type) { case K12_PORT_ATMPVC: if ((long)(K12_PACKET_FRAME + length + K12_PACKET_OFFSET_CID) < len) { - wth->pseudo_header.k12.input_info.atm.vp = pntohs(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_VP); - wth->pseudo_header.k12.input_info.atm.vc = pntohs(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_VC); - wth->pseudo_header.k12.input_info.atm.cid = *((unsigned char*)(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_CID)); + wth->phdr.pseudo_header.k12.input_info.atm.vp = pntohs(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_VP); + wth->phdr.pseudo_header.k12.input_info.atm.vc = pntohs(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_VC); + wth->phdr.pseudo_header.k12.input_info.atm.cid = *((unsigned char*)(buffer + K12_PACKET_FRAME + length + K12_PACKET_OFFSET_CID)); } break; /* Fall through */ default: - memcpy(&(wth->pseudo_header.k12.input_info),&(src_desc->input_info),sizeof(src_desc->input_info)); + memcpy(&(wth->phdr.pseudo_header.k12.input_info),&(src_desc->input_info),sizeof(src_desc->input_info)); break; } @@ -600,9 +601,9 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head pseudo_header->k12.stack_file = "unknown stack file"; } - memset(&(wth->pseudo_header.k12),0,sizeof(wth->pseudo_header.k12)); - wth->pseudo_header.k12.input_name = "unknown port"; - wth->pseudo_header.k12.stack_file = "unknown stack file"; + memset(&(wth->phdr.pseudo_header.k12),0,sizeof(wth->phdr.pseudo_header.k12)); + wth->phdr.pseudo_header.k12.input_name = "unknown port"; + wth->phdr.pseudo_header.k12.stack_file = "unknown stack file"; } @@ -611,8 +612,8 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head pseudo_header->k12.stuff = k12; } - wth->pseudo_header.k12.input = input; - wth->pseudo_header.k12.stuff = k12; + wth->phdr.pseudo_header.k12.input = input; + wth->phdr.pseudo_header.k12.stuff = k12; K12_DBG(5,("k12_seek_read: DONE OK")); @@ -982,8 +983,8 @@ static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) { } static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; k12_dump_t *k12 = (k12_dump_t *)wdh->priv; guint32 len; union { diff --git a/wiretap/k12text.l b/wiretap/k12text.l index 6071bcacd8..13f197dfb1 100644 --- a/wiretap/k12text.l +++ b/wiretap/k12text.l @@ -276,7 +276,7 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset) wth->phdr.caplen = wth->phdr.len = ii; wth->phdr.pkt_encap = g_encap; - k12text_set_pseudo_header(g_encap, &wth->pseudo_header); + k12text_set_pseudo_header(g_encap, &wth->phdr.pseudo_header); buffer_assure_space(wth->frame_buffer, wth->phdr.caplen); memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen); @@ -285,9 +285,9 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset) } static gboolean -k12text_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, int *err, char **err_info) +k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, char **err_info) { - + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) { return FALSE; } @@ -364,7 +364,6 @@ static const struct { int e; const char* s; } encaps[] = { static gboolean k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { #define K12BUF_SIZE 196808 char *buf; diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index e699615d76..7798b3f3f8 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -268,7 +268,7 @@ typedef struct { static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err); @@ -571,7 +571,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info, case WTAP_ENCAP_ETHERNET: /* We assume there's no FCS in this frame. */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; break; } @@ -579,9 +579,10 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info, } static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int bytes_read; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) @@ -675,7 +676,6 @@ static void my_timersub(const struct timeval *a, *---------------------------------------------------*/ static gboolean lanalyzer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { double x; diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index bec6cf6435..64df307385 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -68,7 +68,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err); static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int libpcap_read_header(wtap *wth, int *err, gchar **err_info, struct pcaprec_ss990915_hdr *hdr); @@ -76,7 +76,7 @@ static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr); static gboolean libpcap_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err, gchar **err_info); static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); int libpcap_open(wtap *wth, int *err, gchar **err_info) { @@ -651,7 +651,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, libpcap = (libpcap_t *)wth->priv; phdr_len = pcap_process_pseudo_header(wth->fh, wth->file_type, wth->file_encap, packet_size, TRUE, &wth->phdr, - &wth->pseudo_header, err, err_info); + &wth->phdr.pseudo_header, err, err_info); if (phdr_len < 0) return FALSE; /* error */ @@ -679,22 +679,23 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, } else { /* Set interface ID for ERF format */ wth->phdr.presence_flags |= WTAP_HAS_INTERFACE_ID; - wth->phdr.interface_id = wth->pseudo_header.erf.phdr.flags & 0x03; + wth->phdr.interface_id = wth->phdr.pseudo_header.erf.phdr.flags & 0x03; } wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; pcap_read_post_process(wth->file_type, wth->file_encap, - &wth->pseudo_header, buffer_start_ptr(wth->frame_buffer), + &wth->phdr.pseudo_header, buffer_start_ptr(wth->frame_buffer), wth->phdr.caplen, libpcap->byte_swapped, -1); return TRUE; } static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int phdr_len; libpcap_t *libpcap; @@ -945,9 +946,9 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct pcaprec_ss990915_hdr rec_hdr; size_t hdr_size; int phdrsize; diff --git a/wiretap/mime_file.c b/wiretap/mime_file.c index 16ba58a751..eb5f3ac239 100644 --- a/wiretap/mime_file.c +++ b/wiretap/mime_file.c @@ -127,7 +127,7 @@ mime_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) } static gboolean -mime_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, guint8 *pd, int length, int *err, gchar **err_info) +mime_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_, guint8 *pd, int length, int *err, gchar **err_info) { if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) { *err_info = NULL; diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c index aa31ee2f1b..b6538ef2d2 100644 --- a/wiretap/mp2t.c +++ b/wiretap/mp2t.c @@ -128,7 +128,7 @@ mp2t_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean mp2t_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, guint8 *pd, int length, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int length, int *err, gchar **err_info) { if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err)) { diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c index 8eec67974b..9d6640ea60 100644 --- a/wiretap/mpeg.c +++ b/wiretap/mpeg.c @@ -239,7 +239,7 @@ mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean mpeg_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, guint8 *pd, int length, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int length, int *err, gchar **err_info) { if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 436a6d95fd..3c388e2fa7 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -177,7 +177,7 @@ static const int netmon_encap[] = { static gboolean netmon_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean netmon_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean netmon_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); @@ -187,7 +187,7 @@ static int netmon_read_rec_trailer(FILE_T fh, int trlr_size, int *err, gchar **err_info); static void netmon_sequential_close(wtap *wth); static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gboolean netmon_dump_close(wtap_dumper *wdh, int *err); int netmon_open(wtap *wth, int *err, gchar **err_info) @@ -584,7 +584,7 @@ again: packet_size); return FALSE; } - if (!netmon_read_atm_pseudoheader(wth->fh, &wth->pseudo_header, + if (!netmon_read_atm_pseudoheader(wth->fh, &wth->phdr.pseudo_header, err, err_info)) return FALSE; /* Read error */ @@ -694,10 +694,10 @@ again: if (wth->phdr.pkt_encap == 0) goto again; netmon_set_pseudo_header_info(wth->phdr.pkt_encap, - &wth->pseudo_header, data_ptr, packet_size); + &wth->phdr.pseudo_header, data_ptr, packet_size); } else { netmon_set_pseudo_header_info(wth->file_encap, - &wth->pseudo_header, data_ptr, packet_size); + &wth->phdr.pseudo_header, data_ptr, packet_size); } return TRUE; @@ -705,9 +705,10 @@ again: static gboolean netmon_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; netmon_t *netmon = (netmon_t *)wth->priv; int trlr_size; int pkt_encap; @@ -1002,8 +1003,9 @@ gboolean netmon_dump_open(wtap_dumper *wdh, int *err) /* Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) + const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; netmon_dump_t *netmon = (netmon_dump_t *)wdh->priv; struct netmonrec_1_x_hdr rec_1_x_hdr; struct netmonrec_2_x_hdr rec_2_x_hdr; diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c index d0765ae49b..c166626c58 100644 --- a/wiretap/netscaler.c +++ b/wiretap/netscaler.c @@ -503,7 +503,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean nstrace_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static void nstrace_close(wtap *wth); @@ -514,7 +514,7 @@ static gboolean nstrace_set_start_time(wtap *wth); static guint64 ns_hrtime2nsec(guint32 tm); static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); #define GET_READ_PAGE_SIZE(remaining_file_size) ((gint32)((remaining_file_size>NSPR_PAGESIZE)?NSPR_PAGESIZE:remaining_file_size)) @@ -751,10 +751,10 @@ static gboolean nstrace_set_start_time(wtap *wth) } #define __TNO(enumprefix,structprefix,structname,hdrname,structfieldname) \ - wth->pseudo_header.nstr.hdrname##_offset = enumprefix##_##hdrname##_offset; + wth->phdr.pseudo_header.nstr.hdrname##_offset = enumprefix##_##hdrname##_offset; #define __TNL(enumprefix,structprefix,structname,hdrname,structfieldname) \ - wth->pseudo_header.nstr.hdrname##_len = enumprefix##_##hdrname##_len; + wth->phdr.pseudo_header.nstr.hdrname##_len = enumprefix##_##hdrname##_len; #define __TNV1O(enumprefix,structprefix,structname,hdrname,structfieldname) \ __TNO(enumprefix,structprefix,structname,hdrname,structfieldname) @@ -932,7 +932,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 * nstrace->nstrace_buf_offset = nstrace_buf_offset + nspr_getv20recordsize((nspr_hd_v20_t *)fp);\ nstrace->nstrace_buflen = nstrace_buflen;\ nstrace->nsg_creltime = nsg_creltime;\ - wth->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\ + wth->phdr.pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\ return TRUE;\ }while(0) @@ -1072,9 +1072,10 @@ static gboolean nstrace_read(wtap *wth, int *err, gchar **err_info, gint64 *data static gboolean nstrace_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int bytes_read; *err = 0; @@ -1341,8 +1342,9 @@ nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, /* Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) + const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv; if (nstrace->page_offset == 0) diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index 8eb1843fe9..15242777c8 100644 --- a/wiretap/netscreen.c +++ b/wiretap/netscreen.c @@ -63,7 +63,7 @@ static gboolean netscreen_check_file_type(wtap *wth, int *err, static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean netscreen_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static int parse_netscreen_rec_hdr(wtap *wth, const char *line, char *cap_int, gboolean *cap_dir, char *cap_dst, @@ -234,7 +234,7 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, /* Parse the header */ pkt_len = parse_netscreen_rec_hdr(wth, line, cap_int, &cap_dir, cap_dst, - &wth->pseudo_header, err, err_info); + &wth->phdr.pseudo_header, err, err_info); if (pkt_len == -1) return FALSE; @@ -297,9 +297,10 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean netscreen_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; char line[NETSCREEN_LINE_LENGTH]; char cap_int[NETSCREEN_MAX_INT_NAME_LENGTH]; gboolean cap_dir; diff --git a/wiretap/nettl.c b/wiretap/nettl.c index ec75055fd7..266383062e 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -180,7 +180,7 @@ typedef struct { static gboolean nettl_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean nettl_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, @@ -188,7 +188,7 @@ static int nettl_read_rec_header(wtap *wth, FILE_T fh, static gboolean nettl_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err, gchar **err_info, gboolean fddihack); static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); int nettl_open(wtap *wth, int *err, gchar **err_info) { @@ -307,7 +307,7 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info, /* Read record header. */ *data_offset = file_tell(wth->fh); - ret = nettl_read_rec_header(wth, wth->fh, &wth->phdr, &wth->pseudo_header, + ret = nettl_read_rec_header(wth, wth->fh, &wth->phdr, &wth->phdr.pseudo_header, err, err_info, &fddihack); if (ret <= 0) { /* Read error or EOF */ @@ -352,18 +352,18 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info, static gboolean nettl_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int ret; - struct wtap_pkthdr phdr; gboolean fddihack=FALSE; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; /* Read record header. */ - ret = nettl_read_rec_header(wth, wth->random_fh, &phdr, pseudo_header, + ret = nettl_read_rec_header(wth, wth->random_fh, phdr, pseudo_header, err, err_info, &fddihack); if (ret <= 0) { /* Read error or EOF */ @@ -773,9 +773,9 @@ gboolean nettl_dump_open(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct nettlrec_hdr rec_hdr; guint8 dummyc[24]; diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c index fbd32639c5..2096d95594 100644 --- a/wiretap/network_instruments.c +++ b/wiretap/network_instruments.c @@ -101,7 +101,7 @@ static void init_gmt_to_localtime_offset(void) static gboolean observer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean observer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header, packet_entry_header *packet_header, int *err, gchar **err_info); @@ -110,7 +110,7 @@ static int read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_f static gboolean skip_to_next_packet(wtap *wth, int offset_to_next_packet, int current_offset_from_packet_header, int *err, char **err_info); static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gint observer_to_wtap_encap(int observer_encap); static gint wtap_to_observer_encap(int wtap_encap); @@ -272,7 +272,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info, *data_offset = file_tell(wth->fh); /* process the packet header, including TLVs */ - header_bytes_consumed = read_packet_header(wth->fh, &wth->pseudo_header, &packet_header, err, + header_bytes_consumed = read_packet_header(wth->fh, &wth->phdr.pseudo_header, &packet_header, err, err_info); if (header_bytes_consumed <= 0) return FALSE; /* EOF or error */ @@ -336,7 +336,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info, switch (wth->file_encap) { case WTAP_ENCAP_ETHERNET: /* There is no FCS in the frame */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; break; case WTAP_ENCAP_IEEE_802_11_WITH_RADIO: /* Updated in read_packet_header */ @@ -365,9 +365,10 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info, /* Reads a packet at an offset. */ static gboolean observer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; packet_entry_header packet_header; int offset; int data_bytes_consumed; @@ -669,7 +670,7 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err) /* Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, + const guint8 *pd, int *err) { observer_dump_private_state * private_state = NULL; diff --git a/wiretap/netxray.c b/wiretap/netxray.c index e05440dcca..88043fc7b5 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -319,7 +319,7 @@ typedef struct { static gboolean netxray_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean netxray_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int netxray_read_rec_header(wtap *wth, FILE_T fh, union netxrayrec_hdr *hdr, int *err, gchar **err_info); @@ -329,11 +329,11 @@ static gboolean netxray_read_rec_data(FILE_T fh, guint8 *data_ptr, guint32 packet_size, int *err, gchar **err_info); static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err); static gboolean netxray_dump_2_0(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err); int netxray_open(wtap *wth, int *err, gchar **err_info) @@ -998,7 +998,7 @@ reread: * Set the pseudo-header. */ padding = netxray_set_pseudo_header(wth, pd, packet_size, - &wth->pseudo_header, &hdr); + &wth->phdr.pseudo_header, &hdr); if (netxray->version_major == 0) { wth->phdr.presence_flags = WTAP_HAS_TS; @@ -1037,9 +1037,10 @@ reread: static gboolean netxray_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; union netxrayrec_hdr hdr; gboolean ret; @@ -1536,7 +1537,6 @@ gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv; @@ -1696,9 +1696,9 @@ gboolean netxray_dump_open_2_0(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean netxray_dump_2_0(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv; guint64 timestamp; guint32 t32; diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 246d6b5acc..ac8b9de065 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -499,7 +499,7 @@ static int process_rec_header2_v145(wtap *wth, unsigned char *buffer, static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info); static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random, guint16 *typep, guint16 *lengthp, int *err, gchar **err_info); @@ -523,7 +523,7 @@ static int fix_pseudo_header(int encap, const guint8 *pd, int len, static void ngsniffer_sequential_close(wtap *wth); static void ngsniffer_close(wtap *wth); static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err); static int SnifferDecompress( unsigned char * inbuf, size_t inlen, unsigned char * outbuf, size_t outlen, int *err ); @@ -1105,7 +1105,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) length -= sizeof frame2; /* we already read that much */ - set_pseudo_header_frame2(wth, &wth->pseudo_header, + set_pseudo_header_frame2(wth, &wth->phdr.pseudo_header, &frame2); goto found; @@ -1147,7 +1147,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) length -= sizeof frame4; } - set_pseudo_header_frame4(&wth->pseudo_header, &frame4); + set_pseudo_header_frame4(&wth->phdr.pseudo_header, &frame4); goto found; case REC_FRAME6: @@ -1166,7 +1166,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) length -= sizeof frame6; /* we already read that much */ - set_pseudo_header_frame6(wth, &wth->pseudo_header, + set_pseudo_header_frame6(wth, &wth->phdr.pseudo_header, &frame6); goto found; @@ -1217,7 +1217,7 @@ found: return FALSE; /* Read error */ wth->phdr.pkt_encap = fix_pseudo_header(wth->file_encap, pd, length, - &wth->pseudo_header); + &wth->phdr.pseudo_header); /* * 40-bit time stamp, in units of timeunit picoseconds. @@ -1254,9 +1254,10 @@ found: static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int ret; guint16 type, length; struct frame2_rec frame2; @@ -2091,8 +2092,9 @@ ngsniffer_dump_open(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) + const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; ngsniffer_dump_t *ngsniffer = (ngsniffer_dump_t *)wdh->priv; struct frame2_rec rec_hdr; char buf[6]; diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c index 03974b1bfb..07ba70eed9 100644 --- a/wiretap/packetlogger.c +++ b/wiretap/packetlogger.c @@ -49,7 +49,7 @@ typedef struct packetlogger_header { static gboolean packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean packetlogger_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean packetlogger_read_header(packetlogger_header_t *pl_hdr, @@ -138,8 +138,8 @@ packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) } static gboolean -packetlogger_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header - *pseudo_header _U_, guint8 *pd, int length, int *err, +packetlogger_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_, + guint8 *pd, int length, int *err, gchar **err_info) { packetlogger_header_t pl_hdr; diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index cfc438b3af..09cf088105 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -85,7 +85,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean pcapng_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static void pcapng_close(wtap *wth); @@ -2167,7 +2167,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) } wblock.frame_buffer = buffer_start_ptr(wth->frame_buffer); - wblock.pseudo_header = &wth->pseudo_header; + wblock.pseudo_header = &wth->phdr.pseudo_header; wblock.packet_header = &wth->phdr; wblock.file_encap = &wth->file_encap; @@ -2275,9 +2275,10 @@ got_packet: /* classic wtap: seek to file position and read packet */ static gboolean pcapng_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length _U_, + struct wtap_pkthdr *phdr, guint8 *pd, int length _U_, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; pcapng_t *pcapng = (pcapng_t *)wth->priv; guint64 bytes_read64; int bytes_read; @@ -3414,9 +3415,9 @@ pcapng_lookup_interface_id_by_encap(int wtap_encap, wtap_dumper *wdh) static gboolean pcapng_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; /*interface_data_t int_data;*/ pcapng_dump_t *pcapng = (pcapng_dump_t *)wdh->priv; /*int pcap_encap;*/ diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c index 5dfbd5ac2c..028947af73 100644 --- a/wiretap/peekclassic.c +++ b/wiretap/peekclassic.c @@ -143,12 +143,12 @@ typedef struct { static gboolean peekclassic_read_v7(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean peekclassic_seek_read_v7(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean peekclassic_read_v56(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean peekclassic_seek_read_v56(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); int @@ -399,15 +399,15 @@ peekclassic_read_v7(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) switch (wth->file_encap) { case WTAP_ENCAP_IEEE_802_11_AIROPEEK: - wth->pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */ - wth->pseudo_header.ieee_802_11.decrypted = FALSE; + wth->phdr.pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */ + wth->phdr.pseudo_header.ieee_802_11.decrypted = FALSE; break; case WTAP_ENCAP_ETHERNET: /* XXX - it appears that if the low-order bit of "status" is 0, there's an FCS in this frame, and if it's 1, there's 4 bytes of 0. */ - wth->pseudo_header.eth.fcs_len = (status & 0x01) ? 0 : 4; + wth->phdr.pseudo_header.eth.fcs_len = (status & 0x01) ? 0 : 4; break; } @@ -440,9 +440,10 @@ peekclassic_read_v7(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean peekclassic_seek_read_v7(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; guint8 ep_pkt[PEEKCLASSIC_V7_PKT_SIZE]; guint8 status; @@ -563,7 +564,7 @@ peekclassic_read_v56(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) case WTAP_ENCAP_ETHERNET: /* We assume there's no FCS in this frame. */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; break; } return TRUE; @@ -571,9 +572,10 @@ peekclassic_read_v56(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean peekclassic_seek_read_v56(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; guint8 ep_pkt[PEEKCLASSIC_V56_PKT_SIZE]; int pkt_encap; guint16 protoNum; diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c index 96558786b4..ebc7eae53a 100644 --- a/wiretap/peektagged.c +++ b/wiretap/peektagged.c @@ -95,7 +95,7 @@ typedef struct { static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean peektagged_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static int wtap_file_read_pattern (wtap *wth, const char *pattern, int *err, @@ -552,15 +552,15 @@ static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info, * whether it's an FCS or not, we should use that to determine * whether to supply it as an FCS or discard it. */ - wth->pseudo_header.ieee_802_11 = hdr_info.ieee_802_11; + wth->phdr.pseudo_header.ieee_802_11 = hdr_info.ieee_802_11; if (peektagged->has_fcs) - wth->pseudo_header.ieee_802_11.fcs_len = 4; + wth->phdr.pseudo_header.ieee_802_11.fcs_len = 4; else { - wth->pseudo_header.ieee_802_11.fcs_len = 0; + wth->phdr.pseudo_header.ieee_802_11.fcs_len = 0; wth->phdr.len -= 4; wth->phdr.caplen -= 4; } - wth->pseudo_header.ieee_802_11.decrypted = FALSE; + wth->phdr.pseudo_header.ieee_802_11.decrypted = FALSE; break; case WTAP_ENCAP_ETHERNET: @@ -568,7 +568,7 @@ static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info, * The last 4 bytes appear to be 0 in the captures I've seen; * are there any captures where it's an FCS? */ - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; wth->phdr.len -= 4; wth->phdr.caplen -= 4; break; @@ -580,9 +580,10 @@ static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info, static gboolean peektagged_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; peektagged_t *peektagged = (peektagged_t *)wth->priv; hdr_info_t hdr_info; diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 97e3edde47..0fc2e212c6 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -100,7 +100,7 @@ typedef enum { static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); /* @@ -361,7 +361,7 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) wth->phdr.ts.nsecs = state->tenths * 100000000; wth->phdr.pkt_encap = WTAP_ENCAP_PPP_WITH_PHDR; - wth->pseudo_header.p2p.sent = (direction == DIRECTION_SENT ? TRUE : FALSE); + wth->phdr.pseudo_header.p2p.sent = (direction == DIRECTION_SENT ? TRUE : FALSE); return TRUE; } @@ -707,12 +707,13 @@ done: static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int num_bytes; direction_enum direction; pppdump_t *state; diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 828ebf4438..0821498a2a 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -89,7 +89,7 @@ struct radcomrec_hdr { static gboolean radcom_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean radcom_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *pkhdr, guint8 *pd, int length, int *err, gchar **err_info); static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr, int *err, gchar **err_info); @@ -312,11 +312,11 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info, case WTAP_ENCAP_ETHERNET: /* XXX - is there an FCS? */ - wth->pseudo_header.eth.fcs_len = -1; + wth->phdr.pseudo_header.eth.fcs_len = -1; break; case WTAP_ENCAP_LAPB: - wth->pseudo_header.x25.flags = (hdr.dce & 0x1) ? + wth->phdr.pseudo_header.x25.flags = (hdr.dce & 0x1) ? 0x00 : FROM_DCE; break; @@ -362,9 +362,10 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info, static gboolean radcom_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *pkhdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &pkhdr->pseudo_header; int ret; struct radcomrec_hdr hdr; guint8 phdr[8]; diff --git a/wiretap/snoop.c b/wiretap/snoop.c index fd12e29004..c84d05158b 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -89,7 +89,7 @@ struct shomiti_trailer { static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean snoop_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info); static gboolean snoop_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); @@ -99,7 +99,7 @@ static gboolean snoop_read_shomiti_wireless_pseudoheader(FILE_T fh, static gboolean snoop_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err, gchar **err_info); static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); /* * See @@ -532,7 +532,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, packet_size); return FALSE; } - if (!snoop_read_atm_pseudoheader(wth->fh, &wth->pseudo_header, + if (!snoop_read_atm_pseudoheader(wth->fh, &wth->phdr.pseudo_header, err, err_info)) return FALSE; /* Read error */ @@ -551,9 +551,9 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, * is. (XXX - or should we treat it a "maybe"?) */ if (wth->file_type == WTAP_FILE_SHOMITI) - wth->pseudo_header.eth.fcs_len = 4; + wth->phdr.pseudo_header.eth.fcs_len = 4; else - wth->pseudo_header.eth.fcs_len = 0; + wth->phdr.pseudo_header.eth.fcs_len = 0; break; case WTAP_ENCAP_IEEE_802_11_WITH_RADIO: @@ -568,7 +568,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, return FALSE; } if (!snoop_read_shomiti_wireless_pseudoheader(wth->fh, - &wth->pseudo_header, err, err_info, &header_size)) + &wth->phdr.pseudo_header, err, err_info, &header_size)) return FALSE; /* Read error */ /* @@ -596,9 +596,9 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, * traffic it is based on the packet contents. */ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS && - wth->pseudo_header.atm.type == TRAF_LANE) { + wth->phdr.pseudo_header.atm.type == TRAF_LANE) { atm_guess_lane_type(buffer_start_ptr(wth->frame_buffer), - wth->phdr.caplen, &wth->pseudo_header); + wth->phdr.caplen, &wth->phdr.pseudo_header); } /* @@ -638,9 +638,10 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, static gboolean snoop_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, + struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; @@ -916,9 +917,9 @@ gboolean snoop_dump_open(wtap_dumper *wdh, int *err) Returns TRUE on success, FALSE on failure. */ static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct snooprec_hdr rec_hdr; int reclen; guint padlen; diff --git a/wiretap/tnef.c b/wiretap/tnef.c index c62ab49754..591a2f50dc 100644 --- a/wiretap/tnef.c +++ b/wiretap/tnef.c @@ -82,7 +82,7 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of } static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int length, int *err, gchar **err_info) { int packet_size = length; diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index 784d430be4..d09f76130c 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -110,7 +110,7 @@ static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' }; static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean toshiba_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset); @@ -243,7 +243,7 @@ static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info, return FALSE; /* Parse the header */ - pkt_len = parse_toshiba_rec_hdr(wth, wth->fh, &wth->pseudo_header, + pkt_len = parse_toshiba_rec_hdr(wth, wth->fh, &wth->phdr.pseudo_header, err, err_info); if (pkt_len == -1) return FALSE; @@ -263,9 +263,10 @@ static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean toshiba_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int pkt_len; if (file_seek(wth->random_fh, seek_off - 1, SEEK_SET, err) == -1) diff --git a/wiretap/visual.c b/wiretap/visual.c index 078396a49f..952894416d 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -163,12 +163,12 @@ struct visual_write_info static gboolean visual_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean visual_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size, + struct wtap_pkthdr *phdr, guint8 *pd, int packet_size, int *err, gchar **err_info); static void visual_set_pseudo_header(int encap, struct visual_pkt_hdr *vpkt_hdr, struct visual_atm_hdr *vatm_hdr, union wtap_pseudo_header *pseudo_header); static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err); + const guint8 *pd, int *err); static gboolean visual_dump_close(wtap_dumper *wdh, int *err); static void visual_dump_free(wtap_dumper *wdh); @@ -429,7 +429,7 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info, } /* Set the pseudo_header. */ - visual_set_pseudo_header(wth->file_encap, &vpkt_hdr, &vatm_hdr, &wth->pseudo_header); + visual_set_pseudo_header(wth->file_encap, &vpkt_hdr, &vatm_hdr, &wth->phdr.pseudo_header); /* Fill in the encapsulation. Visual files have a media type in the file header and an encapsulation type in each packet header. Files @@ -479,9 +479,10 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info, This gets the packet data and rebuilds the pseudo header so that the direction flag works. */ static gboolean visual_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { + union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct visual_pkt_hdr vpkt_hdr; struct visual_atm_hdr vatm_hdr; int phdr_size = sizeof(vpkt_hdr); @@ -695,8 +696,9 @@ gboolean visual_dump_open(wtap_dumper *wdh, int *err) /* Write a packet to a Visual dump file. Returns TRUE on success, FALSE on failure. */ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err) + const guint8 *pd, int *err) { + const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; struct visual_write_info * visual = (struct visual_write_info *)wdh->priv; struct visual_pkt_hdr vpkt_hdr; size_t hdr_size = sizeof vpkt_hdr; diff --git a/wiretap/vms.c b/wiretap/vms.c index 293654b6f0..d0def44f59 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -144,7 +144,7 @@ to handle them. static gboolean vms_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean vms_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset, int in_off, int remaining_bytes); @@ -312,7 +312,7 @@ static gboolean vms_read(wtap *wth, int *err, gchar **err_info, /* Used to read packets in random-access fashion */ static gboolean vms_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header _U_, + struct wtap_pkthdr *phdr _U_, guint8 *pd, int len, int *err, gchar **err_info) { int pkt_len; diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 8497ffd7de..94ddadc07a 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -608,7 +608,7 @@ static guint8 get_cck_rate(guint8 *plcp); static void setup_defaults(vwr_t *, guint16); static gboolean vwr_read(wtap *, int *, gchar **, gint64 *); -static gboolean vwr_seek_read(wtap *, gint64, union wtap_pseudo_header *, guchar *, +static gboolean vwr_seek_read(wtap *, gint64, struct wtap_pkthdr *phdr, guchar *, int, int *, gchar **); static gboolean vwr_read_rec_header(vwr_t *, FILE_T, int *, int *, int *, gchar **); @@ -756,7 +756,7 @@ static gboolean vwr_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off /* read a random frame in the middle of a file; the start of the PLCP frame is @ seek_off */ -static gboolean vwr_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, guchar *pd, int pkt_size _U_, +static gboolean vwr_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_, guchar *pd, int pkt_size _U_, int *err, gchar **err_info) { vwr_t *vwr = (vwr_t *)wth->priv; diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 759d4cdbba..2770dd7bc2 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -42,7 +42,7 @@ 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*, +typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, struct wtap_pkthdr *, guint8*, int, int *, char **); /** * Struct holding data of the currently read file. @@ -57,7 +57,6 @@ struct wtap { 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; void *priv; @@ -87,7 +86,6 @@ typedef void *WFILE_T; typedef gboolean (*subtype_write_func)(struct wtap_dumper*, const struct wtap_pkthdr*, - const union wtap_pseudo_header*, const guint8*, int*); typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*); diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 893847b86b..b5bd6ce2bf 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -900,12 +900,6 @@ wtap_phdr(wtap *wth) return &wth->phdr; } -union wtap_pseudo_header * -wtap_pseudoheader(wtap *wth) -{ - return &wth->pseudo_header; -} - guint8 * wtap_buf_ptr(wtap *wth) { @@ -914,9 +908,9 @@ wtap_buf_ptr(wtap *wth) gboolean wtap_seek_read(wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { - return wth->subtype_seek_read(wth, seek_off, pseudo_header, pd, len, + return wth->subtype_seek_read(wth, seek_off, phdr, pd, len, err, err_info); } diff --git a/wiretap/wtap.def b/wiretap/wtap.def index a7f9e0a6f4..d680b945c9 100644 --- a/wiretap/wtap.def +++ b/wiretap/wtap.def @@ -64,7 +64,6 @@ wtap_iscompressed wtap_open_offline wtap_pcap_encap_to_wtap_encap wtap_phdr -wtap_pseudoheader wtap_read wtap_read_so_far wtap_register_encap_type diff --git a/wiretap/wtap.h b/wiretap/wtap.h index fb957fa467..37beaf0d65 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -867,6 +867,8 @@ struct wtap_pkthdr { gchar *opt_comment; /* NULL if not available */ guint64 drop_count; /* number of packets lost (by the interface and the operating system) between this packet and the preceding one. */ guint32 pack_flags; /* XXX - 0 for now (any value for "we don't have it"?) */ + + union wtap_pseudo_header pseudo_header; }; /* @@ -1075,12 +1077,11 @@ gboolean wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); gboolean wtap_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); /*** get various information snippets about the current packet ***/ struct wtap_pkthdr *wtap_phdr(wtap *wth); -union wtap_pseudo_header *wtap_pseudoheader(wtap *wth); guint8 *wtap_buf_ptr(wtap *wth); /*** get various information snippets about the current file ***/ @@ -1140,8 +1141,7 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err); -gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, - const union wtap_pseudo_header *pseudo_header, const guint8 *, int *err); +gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const guint8 *, int *err); void wtap_dump_flush(wtap_dumper *); gint64 wtap_get_bytes_dumped(wtap_dumper *); void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped); |