Pass Buffer pointers rather than packet data pointers in some more cases.

Change-Id: I35299464560aff2785a52217d4052da3ffedcd6a
Reviewed-on: https://code.wireshark.org/review/32729
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-04-04 20:30:53 -07:00
parent 8a5b26efb1
commit 58afae4bd0
2 changed files with 8 additions and 11 deletions

10
file.c
View File

@ -1165,7 +1165,7 @@ void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode)
static void
add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
epan_dissect_t *edt, dfilter_t *dfcode, column_info *cinfo,
wtap_rec *rec, const guint8 *pd, gboolean add_to_packet_list)
wtap_rec *rec, Buffer *buf, gboolean add_to_packet_list)
{
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
&cf->provider.ref, cf->provider.prev_dis);
@ -1192,7 +1192,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
/* Dissect the frame. */
epan_dissect_run_with_taps(edt, cf->cd_t, rec,
frame_tvbuff_new(&cf->provider, fdata, pd),
frame_tvbuff_new_buffer(&cf->provider, fdata, buf),
fdata, cinfo);
/* If we don't have a display filter, set "passed_dfilter" to 1. */
@ -1287,8 +1287,7 @@ read_record(capture_file *cf, wtap_rec *rec, Buffer *buf, dfilter_t *dfcode,
/* When a redissection is in progress (or queued), do not process packets.
* This will be done once all (new) packets have been scanned. */
if (!cf->redissecting && cf->redissection_queued == RESCAN_NONE) {
add_packet_to_packet_list(fdata, cf, edt, dfcode,
cinfo, rec, ws_buffer_start_ptr(buf), TRUE);
add_packet_to_packet_list(fdata, cf, edt, dfcode, cinfo, rec, buf, TRUE);
}
}
@ -1856,8 +1855,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
}
add_packet_to_packet_list(fdata, cf, &edt, dfcode,
cinfo, &cf->rec,
ws_buffer_start_ptr(&cf->buf),
cinfo, &cf->rec, &cf->buf,
add_to_packet_list);
/* If this frame is displayed, and this is the first frame we've

View File

@ -233,7 +233,7 @@ sharkd_epan_new(capture_file *cf)
static gboolean
process_packet(capture_file *cf, epan_dissect_t *edt,
gint64 offset, wtap_rec *rec, const guchar *pd)
gint64 offset, wtap_rec *rec, Buffer *buf)
{
frame_data fdlocal;
gboolean passed;
@ -276,7 +276,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
}
epan_dissect_run(edt, cf->cd_t, rec,
frame_tvbuff_new(&cf->provider, &fdlocal, pd),
frame_tvbuff_new_buffer(&cf->provider, &fdlocal, buf),
&fdlocal, NULL);
/* Run the read filter if we have one. */
@ -354,8 +354,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
ws_buffer_init(&buf, 1500);
while (wtap_read(cf->provider.wth, &rec, &buf, &err, &err_info, &data_offset)) {
if (process_packet(cf, edt, data_offset, &rec,
ws_buffer_start_ptr(&buf))) {
if (process_packet(cf, edt, data_offset, &rec, &buf)) {
/* 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.
@ -688,7 +687,7 @@ sharkd_retap(void)
fdata->frame_ref_num = (framenum != 1) ? 1 : 0;
fdata->prev_dis_num = framenum - 1;
epan_dissect_run_with_taps(&edt, cfile.cd_t, &rec,
frame_tvbuff_new(&cfile.provider, fdata, ws_buffer_start_ptr(&buf)),
frame_tvbuff_new_buffer(&cfile.provider, fdata, &buf),
fdata, cinfo);
epan_dissect_reset(&edt);
}