From 78631020b83c7aab12934f0cff72dbb5e3f0ba4a Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Tue, 16 Oct 2012 21:50:57 +0000 Subject: Add wtap_pseudo_header union to wtap_pkthdr structure. Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601 --- capture_info.c | 4 +-- cfile.h | 2 +- editcap.c | 2 +- epan/epan.c | 4 +-- epan/epan.h | 2 +- epan/frame_data.h | 4 +-- epan/packet.c | 5 +-- epan/packet.h | 2 +- epan/packet_info.h | 1 + file.c | 73 ++++++++++++++++++++++--------------------- file.h | 2 +- mergecap.c | 3 +- proto_hier_stats.c | 2 +- randpkt.c | 11 +++---- rawshark.c | 9 ++---- reordercap.c | 20 +++++------- tshark.c | 36 ++++++++++----------- ui/gtk/iax2_analysis.c | 2 +- ui/gtk/main.c | 5 ++- ui/gtk/packet_list_store.c | 6 ++-- ui/gtk/packet_win.c | 24 +++++++------- ui/gtk/rlc_lte_graph.c | 2 +- ui/gtk/rtp_analysis.c | 2 +- ui/gtk/sctp_assoc_analyse.c | 2 +- ui/gtk/tcp_graph.c | 2 +- ui/qt/packet_list_model.cpp | 4 +-- ui/text_import.c | 2 +- wiretap/5views.c | 11 +++---- wiretap/aethra.c | 7 +++-- wiretap/ascendtext.c | 15 ++++----- wiretap/ber.c | 2 +- wiretap/btsnoop.c | 21 +++++++------ wiretap/catapult_dct2000.c | 10 +++--- wiretap/commview.c | 12 +++---- wiretap/cosine.c | 7 +++-- wiretap/csids.c | 4 +-- wiretap/daintree-sna.c | 6 ++-- wiretap/dbs-etherwatch.c | 7 +++-- wiretap/dct3trace.c | 7 +++-- wiretap/erf.c | 9 +++--- wiretap/eyesdn.c | 10 +++--- wiretap/file_access.c | 4 +-- wiretap/hcidump.c | 5 +-- wiretap/i4btrace.c | 7 +++-- wiretap/ipfix.c | 5 +-- wiretap/iptrace.c | 14 +++++---- wiretap/iseries.c | 7 +++-- wiretap/k12.c | 55 ++++++++++++++++---------------- wiretap/k12text.l | 7 ++--- wiretap/lanalyzer.c | 8 ++--- wiretap/libpcap.c | 15 ++++----- wiretap/mime_file.c | 2 +- wiretap/mp2t.c | 2 +- wiretap/mpeg.c | 2 +- wiretap/netmon.c | 16 +++++----- wiretap/netscaler.c | 16 +++++----- wiretap/netscreen.c | 7 +++-- wiretap/nettl.c | 14 ++++----- wiretap/network_instruments.c | 13 ++++---- wiretap/netxray.c | 14 ++++----- wiretap/ngsniffer.c | 18 ++++++----- wiretap/packetlogger.c | 6 ++-- wiretap/pcapng.c | 9 +++--- wiretap/peekclassic.c | 18 ++++++----- wiretap/peektagged.c | 15 ++++----- wiretap/pppdump.c | 7 +++-- wiretap/radcom.c | 9 +++--- wiretap/snoop.c | 21 +++++++------ wiretap/tnef.c | 2 +- wiretap/toshiba.c | 7 +++-- wiretap/visual.c | 12 ++++--- wiretap/vms.c | 4 +-- wiretap/vwr.c | 4 +-- wiretap/wtap-int.h | 4 +-- wiretap/wtap.c | 10 ++---- wiretap/wtap.def | 1 - wiretap/wtap.h | 8 ++--- 77 files changed, 369 insertions(+), 360 deletions(-) diff --git a/capture_info.c b/capture_info.c index 059269c63a..a4c5651fd3 100644 --- a/capture_info.c +++ b/capture_info.c @@ -236,7 +236,7 @@ void capture_info_new_packets(int to_read) int err; gchar *err_info; gint64 data_offset; - const struct wtap_pkthdr *phdr; + struct wtap_pkthdr *phdr; union wtap_pseudo_header *pseudo_header; int wtap_linktype; const guchar *buf; @@ -250,7 +250,7 @@ void capture_info_new_packets(int to_read) wtap_cleareof(info_data.wtap); if (wtap_read(info_data.wtap, &err, &err_info, &data_offset)) { phdr = wtap_phdr(info_data.wtap); - pseudo_header = wtap_pseudoheader(info_data.wtap); + pseudo_header = &phdr->pseudo_header; wtap_linktype = phdr->pkt_encap; buf = wtap_buf_ptr(info_data.wtap); diff --git a/cfile.h b/cfile.h index ea7935f818..f5ee3b3a82 100644 --- a/cfile.h +++ b/cfile.h @@ -106,7 +106,7 @@ typedef struct _capture_file { search_direction dir; /* Direction in which to do searches */ gboolean search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit N/B */ /* packet data */ - union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */ + struct wtap_pkthdr phdr; /* Packet header */ guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ /* frames */ frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */ diff --git a/editcap.c b/editcap.c index 67d46bf899..9b873733dc 100644 --- a/editcap.c +++ b/editcap.c @@ -1458,7 +1458,7 @@ main(int argc, char *argv[]) } } - if (!wtap_dump(pdh, phdr, wtap_pseudoheader(wth), buf, &err)) { + if (!wtap_dump(pdh, phdr, buf, &err)) { switch (err) { case WTAP_ERR_UNSUPPORTED_ENCAP: diff --git a/epan/epan.c b/epan/epan.c index 6437bad237..8a11d6c47a 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -189,13 +189,13 @@ epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols) } void -epan_dissect_run(epan_dissect_t *edt, void* pseudo_header, +epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr, const guint8* data, frame_data *fd, column_info *cinfo) { /* free all memory allocated during previous packet */ ep_free_all(); - dissect_packet(edt, pseudo_header, data, fd, cinfo); + dissect_packet(edt, phdr, data, fd, cinfo); } void diff --git a/epan/epan.h b/epan/epan.h index 00ec257208..24d751e3d1 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -151,7 +151,7 @@ epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols); /** run a single packet dissection */ void -epan_dissect_run(epan_dissect_t *edt, void* pseudo_header, +epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr, const guint8* data, frame_data *fd, column_info *cinfo); /** Prime a proto_tree using the fields/protocols used in a dfilter. */ diff --git a/epan/frame_data.h b/epan/frame_data.h index 87994cabf1..252a683be7 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -74,8 +74,8 @@ typedef struct _frame_data { #ifdef WANT_PACKET_EDITOR /* XXX, where this struct should go? */ typedef struct { - union wtap_pseudo_header ph; /**< Modified pseudo header */ - char *pd; /**< Modified packet data */ + struct wtap_pkthdr phdr; /**< Modified packet header */ + char *pd; /**< Modified packet data */ } modified_frame_data; #endif diff --git a/epan/packet.c b/epan/packet.c index cd0f6f1b49..a1287e112e 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -294,7 +294,7 @@ final_registration_all_protocols(void) /* Creates the top-most tvbuff and calls dissect_frame() */ void -dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header, +dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr, const guchar *pd, frame_data *fd, column_info *cinfo) { if (cinfo != NULL) @@ -303,7 +303,8 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header, edt->pi.current_proto = ""; edt->pi.cinfo = cinfo; edt->pi.fd = fd; - edt->pi.pseudo_header = pseudo_header; + edt->pi.phdr = phdr; + edt->pi.pseudo_header = &phdr->pseudo_header; edt->pi.dl_src.type = AT_NONE; edt->pi.dl_dst.type = AT_NONE; edt->pi.net_src.type = AT_NONE; diff --git a/epan/packet.h b/epan/packet.h index 06be789082..588a1f9e6a 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -436,7 +436,7 @@ extern void mark_frame_as_depended_upon(packet_info *pinfo, guint32 frame_num); * Dissectors should never modify the packet data. */ extern void dissect_packet(epan_dissect_t *edt, - union wtap_pseudo_header *pseudo_header, const guchar *pd, + struct wtap_pkthdr *phdr, const guchar *pd, frame_data *fd, column_info *cinfo); /* These functions are in packet-ethertype.c */ diff --git a/epan/packet_info.h b/epan/packet_info.h index 470452b259..369a09939d 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -50,6 +50,7 @@ typedef struct _packet_info { column_info *cinfo; /**< Column formatting information */ frame_data *fd; union wtap_pseudo_header *pseudo_header; + struct wtap_pkthdr *phdr; GSList *data_src; /**< Frame data sources */ address dl_src; /**< link-layer source address */ address dl_dst; /**< link-layer destination address */ diff --git a/file.c b/file.c index 46c48885de..2318282643 100644 --- a/file.c +++ b/file.c @@ -1089,7 +1089,7 @@ static int add_packet_to_packet_list(frame_data *fdata, capture_file *cf, dfilter_t *dfcode, gboolean filtering_tap_listeners, guint tap_flags, - union wtap_pseudo_header *pseudo_header, const guchar *buf, + struct wtap_pkthdr *phdr, const guchar *buf, gboolean refilter, gboolean add_to_packet_list) { @@ -1124,7 +1124,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, } tap_queue_init(&edt); - epan_dissect_run(&edt, pseudo_header, buf, fdata, cinfo); + epan_dissect_run(&edt, phdr, buf, fdata, cinfo); tap_push_tapped_queue(&edt); /* If we have a display filter, apply it if we're refiltering, otherwise @@ -1189,8 +1189,7 @@ static int read_packet(capture_file *cf, dfilter_t *dfcode, gboolean filtering_tap_listeners, guint tap_flags, gint64 offset) { - const struct wtap_pkthdr *phdr = wtap_phdr(cf->wth); - union wtap_pseudo_header *pseudo_header = wtap_pseudoheader(cf->wth); + struct wtap_pkthdr *phdr = wtap_phdr(cf->wth); const guchar *buf = wtap_buf_ptr(cf->wth); frame_data fdlocal; guint32 framenum; @@ -1217,7 +1216,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t edt; epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, cf->rfcode); - epan_dissect_run(&edt, pseudo_header, buf, &fdlocal, NULL); + epan_dissect_run(&edt, phdr, buf, &fdlocal, NULL); passed = dfilter_apply_edt(cf->rfcode, &edt); epan_dissect_cleanup(&edt); } @@ -1234,7 +1233,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode, if (!cf->redissecting) { row = add_packet_to_packet_list(fdata, cf, dfcode, filtering_tap_listeners, tap_flags, - pseudo_header, buf, TRUE, TRUE); + phdr, buf, TRUE, TRUE); } } @@ -1493,7 +1492,7 @@ cf_merge_files(char **out_filenamep, int in_file_count, phdr->interface_id = in_file->interface_id; phdr->presence_flags = phdr->presence_flags | WTAP_HAS_INTERFACE_ID; } - if (!wtap_dump(pdh, wtap_phdr(in_file->wth), wtap_pseudoheader(in_file->wth), + if (!wtap_dump(pdh, wtap_phdr(in_file->wth), wtap_buf_ptr(in_file->wth), &write_err)) { got_write_error = TRUE; break; @@ -1686,7 +1685,7 @@ cf_redissect_packets(capture_file *cf) gboolean cf_read_frame_r(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, guint8 *pd) + struct wtap_pkthdr *phdr, guint8 *pd) { int err; gchar *err_info; @@ -1702,13 +1701,13 @@ cf_read_frame_r(capture_file *cf, frame_data *fdata, return FALSE; } - *pseudo_header = frame->ph; + *phdr = frame->phdr; memcpy(pd, frame->pd, fdata->cap_len); return TRUE; } #endif - if (!wtap_seek_read(cf->wth, fdata->file_off, pseudo_header, pd, + if (!wtap_seek_read(cf->wth, fdata->file_off, phdr, pd, fdata->cap_len, &err, &err_info)) { display_basename = g_filename_display_basename(cf->filename); switch (err) { @@ -1740,7 +1739,7 @@ cf_read_frame_r(capture_file *cf, frame_data *fdata, gboolean cf_read_frame(capture_file *cf, frame_data *fdata) { - return cf_read_frame_r(cf, fdata, &cf->pseudo_header, cf->pd); + return cf_read_frame_r(cf, fdata, &cf->phdr, cf->pd); } /* Rescan the list of packets, reconstructing the CList. @@ -1950,7 +1949,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, preceding_frame = prev_frame; } add_packet_to_packet_list(fdata, cf, dfcode, filtering_tap_listeners, - tap_flags, &cf->pseudo_header, cf->pd, + tap_flags, &cf->phdr, cf->pd, refilter, add_to_packet_list); @@ -2165,11 +2164,9 @@ static psp_return_t process_specified_packets(capture_file *cf, packet_range_t *range, const char *string1, const char *string2, gboolean terminate_is_stop, gboolean (*callback)(capture_file *, frame_data *, - union wtap_pseudo_header *, const guint8 *, void *), + struct wtap_pkthdr *, const guint8 *, void *), void *callback_args) { - union wtap_pseudo_header pseudo_header; - guint32 framenum; frame_data *fdata; guint8 pd[WTAP_MAX_PACKET_SIZE+1]; @@ -2184,6 +2181,7 @@ process_specified_packets(capture_file *cf, packet_range_t *range, int progbar_nextstep; int progbar_quantum; range_process_e process_this; + struct wtap_pkthdr phdr; /* Update the progress bar when it gets to this value. */ progbar_nextstep = 0; @@ -2262,13 +2260,13 @@ process_specified_packets(capture_file *cf, packet_range_t *range, } /* Get the packet */ - if (!cf_read_frame_r(cf, fdata, &pseudo_header, pd)) { + if (!cf_read_frame_r(cf, fdata, &phdr, pd)) { /* Attempt to get the packet failed. */ ret = PSP_FAILED; break; } /* Process the packet */ - if (!callback(cf, fdata, &pseudo_header, pd, callback_args)) { + if (!callback(cf, fdata, &phdr, pd, callback_args)) { /* Callback failed. We assume it reported the error appropriately. */ ret = PSP_FAILED; break; @@ -2290,7 +2288,7 @@ typedef struct { static gboolean retap_packet(capture_file *cf _U_, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { retap_callback_args_t *args = argsp; @@ -2298,7 +2296,7 @@ retap_packet(capture_file *cf _U_, frame_data *fdata, epan_dissect_init(&edt, args->construct_protocol_tree, FALSE); tap_queue_init(&edt); - epan_dissect_run(&edt, pseudo_header, pd, fdata, args->cinfo); + epan_dissect_run(&edt, phdr, pd, fdata, args->cinfo); tap_push_tapped_queue(&edt); epan_dissect_cleanup(&edt); @@ -2370,7 +2368,7 @@ typedef struct { static gboolean print_packet(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { print_callback_args_t *args = argsp; @@ -2395,10 +2393,10 @@ print_packet(capture_file *cf, frame_data *fdata, information. */ if (args->print_args->print_summary) { col_custom_prime_edt(&edt, &cf->cinfo); - epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo); + epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo); epan_dissect_fill_in_columns(&edt, FALSE, TRUE); } else - epan_dissect_run(&edt, pseudo_header, pd, fdata, NULL); + epan_dissect_run(&edt, phdr, pd, fdata, NULL); if (args->print_formfeed) { if (!new_page(args->print_args->stream)) @@ -2680,7 +2678,7 @@ cf_print_packets(capture_file *cf, print_args_t *print_args) static gboolean write_pdml_packet(capture_file *cf _U_, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { FILE *fh = argsp; @@ -2688,7 +2686,7 @@ write_pdml_packet(capture_file *cf _U_, frame_data *fdata, /* Create the protocol tree, but don't fill in the column information. */ epan_dissect_init(&edt, TRUE, TRUE); - epan_dissect_run(&edt, pseudo_header, pd, fdata, NULL); + epan_dissect_run(&edt, phdr, pd, fdata, NULL); /* Write out the information in that tree. */ proto_tree_write_pdml(&edt, fh); @@ -2750,7 +2748,7 @@ cf_write_pdml_packets(capture_file *cf, print_args_t *print_args) static gboolean write_psml_packet(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { FILE *fh = argsp; @@ -2762,7 +2760,7 @@ write_psml_packet(capture_file *cf, frame_data *fdata, proto_tree_needed = have_custom_cols(&cf->cinfo); epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed); col_custom_prime_edt(&edt, &cf->cinfo); - epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo); + epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo); epan_dissect_fill_in_columns(&edt, FALSE, TRUE); /* Write out the information in that tree. */ @@ -2825,7 +2823,7 @@ cf_write_psml_packets(capture_file *cf, print_args_t *print_args) static gboolean write_csv_packet(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { FILE *fh = argsp; @@ -2837,7 +2835,7 @@ write_csv_packet(capture_file *cf, frame_data *fdata, proto_tree_needed = have_custom_cols(&cf->cinfo); epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed); col_custom_prime_edt(&edt, &cf->cinfo); - epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo); + epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo); epan_dissect_fill_in_columns(&edt, FALSE, TRUE); /* Write out the information in that tree. */ @@ -2900,14 +2898,14 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args) static gboolean write_carrays_packet(capture_file *cf _U_, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { FILE *fh = argsp; epan_dissect_t edt; epan_dissect_init(&edt, TRUE, TRUE); - epan_dissect_run(&edt, pseudo_header, pd, fdata, NULL); + epan_dissect_run(&edt, phdr, pd, fdata, NULL); proto_tree_write_carrays(fdata->num, fh, &edt); epan_dissect_cleanup(&edt); @@ -3000,7 +2998,7 @@ match_protocol_tree(capture_file *cf, frame_data *fdata, void *criterion) /* Construct the protocol tree, including the displayed text */ epan_dissect_init(&edt, TRUE, TRUE); /* We don't need the column information */ - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); /* Iterate through all the nodes, seeing if they have text that matches. */ mdata->cf = cf; @@ -3104,7 +3102,7 @@ match_summary_line(capture_file *cf, frame_data *fdata, void *criterion) /* Don't bother constructing the protocol tree */ epan_dissect_init(&edt, FALSE, FALSE); /* Get the column information */ - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, &cf->cinfo); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, &cf->cinfo); /* Find the Info column */ for (colx = 0; colx < cf->cinfo.num_cols; colx++) { @@ -3392,7 +3390,7 @@ match_dfilter(capture_file *cf, frame_data *fdata, void *criterion) epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); result = dfilter_apply_edt(sfcode, &edt) ? MR_MATCHED : MR_NOTMATCHED; epan_dissect_cleanup(&edt); return result; @@ -3725,7 +3723,7 @@ cf_select_packet(capture_file *cf, int row) cf->edt = epan_dissect_new(TRUE, TRUE); tap_build_interesting(cf->edt); - epan_dissect_run(cf->edt, &cf->pseudo_header, cf->pd, cf->current_frame, + epan_dissect_run(cf->edt, &cf->phdr, cf->pd, cf->current_frame, NULL); dfilter_macro_build_ftv_cache(cf->edt->tree); @@ -3909,7 +3907,7 @@ typedef struct { */ static gboolean save_packet(capture_file *cf _U_, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guint8 *pd, + struct wtap_pkthdr *phdr, const guint8 *pd, void *argsp) { save_callback_args_t *args = argsp; @@ -3918,6 +3916,7 @@ save_packet(capture_file *cf _U_, frame_data *fdata, gchar *display_basename; /* init the wtap header for saving */ + /* TODO: reuse phdr */ /* XXX - these are the only flags that correspond to data that we have in the frame_data structure and that matter on a per-packet basis. @@ -3943,12 +3942,14 @@ save_packet(capture_file *cf _U_, frame_data *fdata, hdr.interface_id = fdata->interface_id; /* identifier of the interface. */ /* options */ hdr.opt_comment = fdata->opt_comment; /* NULL if not available */ + /* pseudo */ + hdr.pseudo_header = phdr->pseudo_header; #if 0 hdr.drop_count = hdr.pack_flags = /* XXX - 0 for now (any value for "we don't have it"?) */ #endif /* and save the packet */ - if (!wtap_dump(args->pdh, &hdr, pseudo_header, pd, &err)) { + if (!wtap_dump(args->pdh, &hdr, pd, &err)) { if (err < 0) { /* Wiretap error. */ switch (err) { diff --git a/file.h b/file.h index 13d9df8ae9..ea182446d8 100644 --- a/file.h +++ b/file.h @@ -149,7 +149,7 @@ cf_read_status_t cf_read(capture_file *cf, gboolean from_save); * @return TRUE if the read succeeded, FALSE if there was an error */ gboolean cf_read_frame_r(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, guint8 *pd); + struct wtap_pkthdr *phdr, guint8 *pd); /** * Read the pseudo-header and raw data for a packet into a diff --git a/mergecap.c b/mergecap.c index 8ebed8789e..685b0da686 100644 --- a/mergecap.c +++ b/mergecap.c @@ -448,8 +448,7 @@ main(int argc, char *argv[]) phdr = &snap_phdr; } - if (!wtap_dump(pdh, phdr, wtap_pseudoheader(in_file->wth), - wtap_buf_ptr(in_file->wth), &write_err)) { + if (!wtap_dump(pdh, phdr, wtap_buf_ptr(in_file->wth), &write_err)) { got_write_error = TRUE; break; } diff --git a/proto_hier_stats.c b/proto_hier_stats.c index 50c8bd54e0..b950623937 100644 --- a/proto_hier_stats.c +++ b/proto_hier_stats.c @@ -140,7 +140,7 @@ static gboolean process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps) { epan_dissect_t edt; - union wtap_pseudo_header phdr; + struct wtap_pkthdr phdr; guint8 pd[WTAP_MAX_PACKET_SIZE]; double cur_time; diff --git a/randpkt.c b/randpkt.c index 83711cc872..caf50fd0ed 100644 --- a/randpkt.c +++ b/randpkt.c @@ -498,7 +498,7 @@ main(int argc, char **argv) wtap_dumper *dump; struct wtap_pkthdr pkthdr; - union wtap_pseudo_header ps_header; + union wtap_pseudo_header *ps_header = &pkthdr.pseudo_header; int i, j, len_this_pkt, len_random, err; guint8 buffer[65536]; @@ -575,14 +575,13 @@ main(int argc, char **argv) } memset(&pkthdr, 0, sizeof(pkthdr)); - memset(&ps_header, 0, sizeof(ps_header)); memset(buffer, 0, sizeof(buffer)); pkthdr.pkt_encap = example->sample_wtap_encap; /* Load the sample pseudoheader into our pseudoheader buffer */ if (example->pseudo_buffer) - memcpy(&ps_header, example->pseudo_buffer, example->pseudo_length); + memcpy(ps_header, example->pseudo_buffer, example->pseudo_length); /* Load the sample into our buffer */ if (example->sample_buffer) @@ -603,8 +602,8 @@ main(int argc, char **argv) pkthdr.len = len_this_pkt; pkthdr.ts.secs = i; /* just for variety */ - for (j = example->pseudo_length; j < (int) sizeof(ps_header); j++) { - ((guint8*)&ps_header)[j] = (rand() % 0x100); + for (j = example->pseudo_length; j < (int) sizeof(*ps_header); j++) { + ((guint8*)ps_header)[j] = (rand() % 0x100); } for (j = example->sample_length; j < len_this_pkt; j++) { @@ -617,7 +616,7 @@ main(int argc, char **argv) } } - wtap_dump(dump, &pkthdr, &ps_header, &buffer[0], &err); + wtap_dump(dump, &pkthdr, &buffer[0], &err); } wtap_dump_close(dump, &err); diff --git a/rawshark.c b/rawshark.c index d6f319ab76..ed36951066 100644 --- a/rawshark.c +++ b/rawshark.c @@ -142,7 +142,7 @@ static gboolean want_pcap_pkthdr; cf_status_t raw_cf_open(capture_file *cf, const char *fname); static int load_cap_file(capture_file *cf); static gboolean process_packet(capture_file *cf, gint64 offset, - const struct wtap_pkthdr *whdr, const guchar *pd); + struct wtap_pkthdr *whdr, const guchar *pd); static void show_print_file_io_error(int err); static void open_failure_message(const char *filename, int err, @@ -1010,14 +1010,13 @@ load_cap_file(capture_file *cf) } static gboolean -process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr, +process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr, const guchar *pd) { frame_data fdata; gboolean create_proto_tree; epan_dissect_t edt; gboolean passed; - union wtap_pseudo_header pseudo_header; int i; if(whdr->len == 0) @@ -1034,8 +1033,6 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr, return FALSE; } - memset(&pseudo_header, 0, sizeof(pseudo_header)); - /* Count this packet. */ cf->count++; @@ -1070,7 +1067,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr, /* We only need the columns if we're printing packet info but we're *not* verbose; in verbose mode, we print the protocol tree, not the protocol summary. */ - epan_dissect_run(&edt, &pseudo_header, pd, &fdata, &cf->cinfo); + epan_dissect_run(&edt, whdr, pd, &fdata, &cf->cinfo); tap_push_tapped_queue(&edt); diff --git a/reordercap.c b/reordercap.c index 5933abed37..e3e1dadf25 100644 --- a/reordercap.c +++ b/reordercap.c @@ -84,12 +84,10 @@ typedef struct FrameRecord_t { static void frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh) { - union wtap_pseudo_header pseudo_header; int err; gchar *errinfo; - const struct wtap_pkthdr *phdr; + struct wtap_pkthdr phdr; guint8 buf[65535]; - struct wtap_pkthdr new_phdr; DEBUG_PRINT("\nDumping frame (offset=%" G_GINT64_MODIFIER "u, length=%u)\n", frame->offset, frame->length); @@ -97,25 +95,21 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh) /* Re-read the first frame from the stored location */ wtap_seek_read(wth, frame->offset, - &pseudo_header, + &phdr, buf, frame->length, &err, &errinfo); DEBUG_PRINT("re-read: err is %d, buf is (%s)\n", err, buf); - /* Get packet header */ - /* XXX, this might not work */ - phdr = wtap_phdr(wth); - /* Copy, and set length and timestamp from item. */ - new_phdr = *phdr; - new_phdr.len = frame->length; - new_phdr.caplen = frame->length; - new_phdr.ts = frame->time; + /* TODO: remove when wtap_seek_read() will read phdr */ + phdr.len = frame->length; + phdr.caplen = frame->length; + phdr.ts = frame->time; /* Dump frame to outfile */ - if (!wtap_dump(pdh, &new_phdr, &pseudo_header, buf, &err)) { + if (!wtap_dump(pdh, &phdr, buf, &err)) { printf("Error (%s) writing frame to outfile\n", wtap_strerror(err)); exit(1); } diff --git a/tshark.c b/tshark.c index b3f75e96cb..46b7f451bb 100644 --- a/tshark.c +++ b/tshark.c @@ -164,7 +164,7 @@ static void report_counts_siginfo(int); static int load_cap_file(capture_file *, char *, int, gboolean, int, gint64); static gboolean process_packet(capture_file *cf, gint64 offset, - const struct wtap_pkthdr *whdr, union wtap_pseudo_header *pseudo_header, + struct wtap_pkthdr *whdr, const guchar *pd, gboolean filtering_tap_listeners, guint tap_flags); static void show_capture_file_io_error(const char *, int, gboolean); static void show_print_file_io_error(int err); @@ -2350,7 +2350,7 @@ capture_input_new_packets(capture_options *capture_opts, int to_read) cf->wth = NULL; } else { ret = process_packet(cf, data_offset, wtap_phdr(cf->wth), - wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth), + wtap_buf_ptr(cf->wth), filtering_tap_listeners, tap_flags); } if (ret != FALSE) { @@ -2519,8 +2519,8 @@ capture_cleanup(int signum _U_) static gboolean process_packet_first_pass(capture_file *cf, - gint64 offset, const struct wtap_pkthdr *whdr, - union wtap_pseudo_header *pseudo_header, const guchar *pd) + gint64 offset, struct wtap_pkthdr *whdr, + const guchar *pd) { frame_data fdlocal; guint32 framenum; @@ -2565,7 +2565,7 @@ process_packet_first_pass(capture_file *cf, frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, &first_ts, prev_dis, prev_cap); - epan_dissect_run(&edt, pseudo_header, pd, &fdlocal, NULL); + epan_dissect_run(&edt, whdr, pd, &fdlocal, NULL); /* Run the read filter if we have one. */ if (cf->rfcode) @@ -2591,7 +2591,7 @@ process_packet_first_pass(capture_file *cf, static gboolean process_packet_second_pass(capture_file *cf, frame_data *fdata, - union wtap_pseudo_header *pseudo_header, const guchar *pd, + struct wtap_pkthdr *phdr, const guchar *pd, gboolean filtering_tap_listeners, guint tap_flags) { gboolean create_proto_tree; @@ -2647,7 +2647,7 @@ process_packet_second_pass(capture_file *cf, frame_data *fdata, else cinfo = NULL; - epan_dissect_run(&edt, pseudo_header, pd, fdata, cinfo); + epan_dissect_run(&edt, phdr, pd, fdata, cinfo); tap_push_tapped_queue(&edt); @@ -2817,7 +2817,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, while (wtap_read(cf->wth, &err, &err_info, &data_offset)) { if (process_packet_first_pass(cf, data_offset, wtap_phdr(cf->wth), - wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth))) { + wtap_buf_ptr(cf->wth))) { /* Stop reading if we have the maximum number of packets; * When the -c option has not been used, max_packet_count * starts at 0, which practically means, never stop reading. @@ -2841,18 +2841,16 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) { fdata = frame_data_sequence_find(cf->frames, framenum); - if (wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header, + if (wtap_seek_read(cf->wth, fdata->file_off, &cf->phdr, cf->pd, fdata->cap_len, &err, &err_info)) { if (process_packet_second_pass(cf, fdata, - &cf->pseudo_header, cf->pd, + &cf->phdr, cf->pd, filtering_tap_listeners, tap_flags)) { /* Either there's no read filtering or this packet passed the filter, so, if we're writing to a capture file, write this packet out. */ if (pdh != NULL) { - if (!wtap_dump(pdh, wtap_phdr(cf->wth), - wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth), - &err)) { + if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err)) { /* Error writing to a capture file */ switch (err) { @@ -2898,15 +2896,13 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, framenum++; if (process_packet(cf, data_offset, wtap_phdr(cf->wth), - wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth), + wtap_buf_ptr(cf->wth), filtering_tap_listeners, tap_flags)) { /* Either there's no read filtering or this packet passed the filter, so, if we're writing to a capture file, write this packet out. */ if (pdh != NULL) { - if (!wtap_dump(pdh, wtap_phdr(cf->wth), - wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth), - &err)) { + if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err)) { /* Error writing to a capture file */ switch (err) { @@ -3039,8 +3035,8 @@ out: } static gboolean -process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr, - union wtap_pseudo_header *pseudo_header, const guchar *pd, +process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr, + const guchar *pd, gboolean filtering_tap_listeners, guint tap_flags) { frame_data fdata; @@ -3105,7 +3101,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr, frame_data_set_before_dissect(&fdata, &cf->elapsed_time, &first_ts, prev_dis, prev_cap); - epan_dissect_run(&edt, pseudo_header, pd, &fdata, cinfo); + epan_dissect_run(&edt, whdr, pd, &fdata, cinfo); tap_push_tapped_queue(&edt); diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index 8d569777c3..d284c71ca4 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -3633,7 +3633,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_) return; /* error reading the frame */ epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); /* if it is not an iax2 frame, show an error dialog */ frame_matched = dfilter_apply_edt(sfcode, &edt); diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 5e83697c08..7997cc367c 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -550,7 +550,7 @@ get_ip_address_list_from_packet_list_row(gpointer data) epan_dissect_init(&edt, FALSE, FALSE); col_custom_prime_edt(&edt, &cfile.cinfo); - epan_dissect_run(&edt, &cfile.pseudo_header, cfile.pd, fdata, &cfile.cinfo); + epan_dissect_run(&edt, &cfile.phdr, cfile.pd, fdata, &cfile.cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); /* First check selected column */ @@ -590,8 +590,7 @@ get_filter_from_packet_list_row_and_column(gpointer data) epan_dissect_init(&edt, have_custom_cols(&cfile.cinfo), FALSE); col_custom_prime_edt(&edt, &cfile.cinfo); - epan_dissect_run(&edt, &cfile.pseudo_header, cfile.pd, fdata, - &cfile.cinfo); + epan_dissect_run(&edt, &cfile.phdr, cfile.pd, fdata, &cfile.cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); if ((cfile.cinfo.col_custom_occurrence[column]) || diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index 600f3a6d21..d10e7fb356 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -1139,7 +1139,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * column_info *cinfo; gint col; gboolean create_proto_tree; - union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */ + struct wtap_pkthdr phdr; /* Packet header */ guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ g_return_if_fail(packet_list); @@ -1160,7 +1160,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * else cinfo = NULL; - if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd)) { + if (!cf_read_frame_r(&cfile, fdata, &phdr, pd)) { /* * Error reading the frame. * @@ -1201,7 +1201,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * * XXX - need to catch an OutOfMemoryError exception and * attempt to recover from it. */ - epan_dissect_run(&edt, &pseudo_header, pd, fdata, cinfo); + epan_dissect_run(&edt, &phdr, pd, fdata, cinfo); if (dissect_color) fdata->color_filter = color_filters_colorize_packet(&edt); diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index e350cf9422..da9183d1b7 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -74,8 +74,8 @@ /* Data structure holding information about a packet-detail window. */ struct PacketWinData { frame_data *frame; /* The frame being displayed */ - union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */ - guint8 *pd; /* Data for packet */ + struct wtap_pkthdr phdr; /* Packet header */ + guint8 *pd; /* Packet data */ GtkWidget *main; GtkWidget *tv_scrollw; GtkWidget *tree_view; @@ -90,8 +90,8 @@ struct PacketWinData { #ifdef WANT_PACKET_EDITOR struct FieldinfoWinData { frame_data *frame; /* The frame being displayed */ - union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */ - guint8 *pd; /* Data for packet */ + struct wtap_pkthdr phdr; /* Packet header */ + guint8 *pd; /* Packet data */ int start_offset; field_info *finfo; @@ -222,7 +222,7 @@ finfo_window_refresh(struct FieldinfoWinData *DataPtr) if (old_finfo->hfinfo) proto_tree_prime_hfid(edt.tree, old_finfo->hfinfo->id); */ - epan_dissect_run(&edt, &DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame, NULL); + epan_dissect_run(&edt, &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL); /* Try to find finfo which looks like old_finfo. * We might not found one, if protocol requires specific magic values, etc... */ @@ -667,7 +667,7 @@ edit_pkt_tree_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, GtkTre struct FieldinfoWinData data; data.frame = DataPtr->frame; - data.pseudo_header = DataPtr->pseudo_header; + data.phdr = DataPtr->phdr; data.pd = g_memdup(DataPtr->pd, DataPtr->frame->cap_len); data.start_offset = (int) (finfo->ds_tvb->real_data - DataPtr->pd); @@ -679,13 +679,13 @@ edit_pkt_tree_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, GtkTre data.pd_bitoffset = 0; if (new_finfo_window(DataPtr->main, &data) == GTK_RESPONSE_ACCEPT) { - /* DataPtr->pseudo_header = data.pseudo_header; */ + /* DataPtr->phdr = data.phdr; */ memcpy(DataPtr->pd, data.pd, DataPtr->frame->cap_len); proto_tree_draw(NULL, DataPtr->tree_view); epan_dissect_cleanup(&(DataPtr->edt)); epan_dissect_init(&(DataPtr->edt), TRUE, TRUE); - epan_dissect_run(&(DataPtr->edt), &DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame, NULL); + epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL); add_byte_views(&(DataPtr->edt), DataPtr->tree_view, DataPtr->bv_nb_ptr); proto_tree_draw(DataPtr->edt.tree, DataPtr->tree_view); } @@ -808,7 +808,7 @@ edit_pkt_win_key_pressed_cb(GtkWidget *win _U_, GdkEventKey *event, gpointer use proto_tree_draw(NULL, DataPtr->tree_view); epan_dissect_cleanup(&(DataPtr->edt)); epan_dissect_init(&(DataPtr->edt), TRUE, TRUE); - epan_dissect_run(&(DataPtr->edt), &DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame, NULL); + epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL); add_byte_views(&(DataPtr->edt), DataPtr->tree_view, DataPtr->bv_nb_ptr); proto_tree_draw(DataPtr->edt.tree, DataPtr->tree_view); } @@ -892,12 +892,12 @@ void new_packet_window(GtkWidget *w _U_, gboolean editable _U_) DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData)); DataPtr->frame = cfile.current_frame; - memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header); + DataPtr->phdr = cfile.phdr; DataPtr->pd = g_malloc(DataPtr->frame->cap_len); memcpy(DataPtr->pd, cfile.pd, DataPtr->frame->cap_len); epan_dissect_init(&(DataPtr->edt), TRUE, TRUE); - epan_dissect_run(&(DataPtr->edt), &DataPtr->pseudo_header, DataPtr->pd, + epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd, DataPtr->frame, &cfile.cinfo); epan_dissect_fill_in_columns(&(DataPtr->edt), FALSE, TRUE); @@ -975,7 +975,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean editable _U_) modified_frame_data *mfd = g_malloc(sizeof(modified_frame_data)); mfd->pd = DataPtr->pd; - mfd->ph = DataPtr->pseudo_header; + mfd->phdr = DataPtr->phdr; if (cfile.edited_frames == NULL) cfile.edited_frames = g_tree_new_full(g_direct_compare_func, NULL, NULL, modifed_frame_data_free); diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c index f44ec9ec88..33510c1355 100644 --- a/ui/gtk/rlc_lte_graph.c +++ b/ui/gtk/rlc_lte_graph.c @@ -928,7 +928,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); tap_queue_init(&edt); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); tap_push_tapped_queue(&edt); epan_dissect_cleanup(&edt); remove_tap_listener(&th); diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index 858bd01e0b..4ee4eb6a86 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -3807,7 +3807,7 @@ void rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_) return; /* error reading the frame */ epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); /* if it is not an rtp frame, show the rtpstream dialog */ frame_matched = dfilter_apply_edt(sfcode, &edt); diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c index 615b9807e1..de61d76de4 100644 --- a/ui/gtk/sctp_assoc_analyse.c +++ b/ui/gtk/sctp_assoc_analyse.c @@ -880,7 +880,7 @@ static void sctp_analyse_cb(struct sctp_analyse* u_data, gboolean ext) epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); frame_matched = dfilter_apply_edt(sfcode, &edt); /* if it is not an sctp frame, show the dialog */ diff --git a/ui/gtk/tcp_graph.c b/ui/gtk/tcp_graph.c index 324070164f..eb53152a49 100644 --- a/ui/gtk/tcp_graph.c +++ b/ui/gtk/tcp_graph.c @@ -1936,7 +1936,7 @@ static struct tcpheader *select_tcpip_session (capture_file *cf, struct segment epan_dissect_init(&edt, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); tap_queue_init(&edt); - epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + epan_dissect_run(&edt, &cf->phdr, cf->pd, fdata, NULL); tap_push_tapped_queue(&edt); epan_dissect_cleanup(&edt); remove_tap_listener(&th); diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index c40a84d3b8..71cb19f71f 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -165,7 +165,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const epan_dissect_t edt; column_info *cinfo; gboolean create_proto_tree; - union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */ + struct wtap_pkthdr phdr; /* Packet header */ guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ gboolean dissect_columns = TRUE; // XXX - Currently only a placeholder @@ -214,7 +214,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const if (dissect_columns) col_custom_prime_edt(&edt, cinfo); - epan_dissect_run(&edt, &pseudo_header, pd, fdata, cinfo); + epan_dissect_run(&edt, &phdr, pd, fdata, cinfo); if (enable_color_) fdata->color_filter = color_filters_colorize_packet(&edt); diff --git a/ui/text_import.c b/ui/text_import.c index 912022425e..c8a122f4ba 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -531,7 +531,7 @@ write_current_packet (void) pkthdr.pack_flags = 0; pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS; - wtap_dump(wdh, &pkthdr, NULL, packet_buf, &err); + wtap_dump(wdh, &pkthdr, packet_buf, &err); } } 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[] = ""; 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); -- cgit v1.2.1