forked from osmocom/wireshark
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:
parent
8a5b26efb1
commit
58afae4bd0
10
file.c
10
file.c
|
@ -1165,7 +1165,7 @@ void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode)
|
||||||
static void
|
static void
|
||||||
add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
epan_dissect_t *edt, dfilter_t *dfcode, column_info *cinfo,
|
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,
|
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
|
||||||
&cf->provider.ref, cf->provider.prev_dis);
|
&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. */
|
/* Dissect the frame. */
|
||||||
epan_dissect_run_with_taps(edt, cf->cd_t, rec,
|
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);
|
fdata, cinfo);
|
||||||
|
|
||||||
/* If we don't have a display filter, set "passed_dfilter" to 1. */
|
/* 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.
|
/* When a redissection is in progress (or queued), do not process packets.
|
||||||
* This will be done once all (new) packets have been scanned. */
|
* This will be done once all (new) packets have been scanned. */
|
||||||
if (!cf->redissecting && cf->redissection_queued == RESCAN_NONE) {
|
if (!cf->redissecting && cf->redissection_queued == RESCAN_NONE) {
|
||||||
add_packet_to_packet_list(fdata, cf, edt, dfcode,
|
add_packet_to_packet_list(fdata, cf, edt, dfcode, cinfo, rec, buf, TRUE);
|
||||||
cinfo, rec, ws_buffer_start_ptr(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,
|
add_packet_to_packet_list(fdata, cf, &edt, dfcode,
|
||||||
cinfo, &cf->rec,
|
cinfo, &cf->rec, &cf->buf,
|
||||||
ws_buffer_start_ptr(&cf->buf),
|
|
||||||
add_to_packet_list);
|
add_to_packet_list);
|
||||||
|
|
||||||
/* If this frame is displayed, and this is the first frame we've
|
/* If this frame is displayed, and this is the first frame we've
|
||||||
|
|
9
sharkd.c
9
sharkd.c
|
@ -233,7 +233,7 @@ sharkd_epan_new(capture_file *cf)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_packet(capture_file *cf, epan_dissect_t *edt,
|
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;
|
frame_data fdlocal;
|
||||||
gboolean passed;
|
gboolean passed;
|
||||||
|
@ -276,7 +276,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
|
||||||
}
|
}
|
||||||
|
|
||||||
epan_dissect_run(edt, cf->cd_t, rec,
|
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);
|
&fdlocal, NULL);
|
||||||
|
|
||||||
/* Run the read filter if we have one. */
|
/* 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);
|
ws_buffer_init(&buf, 1500);
|
||||||
|
|
||||||
while (wtap_read(cf->provider.wth, &rec, &buf, &err, &err_info, &data_offset)) {
|
while (wtap_read(cf->provider.wth, &rec, &buf, &err, &err_info, &data_offset)) {
|
||||||
if (process_packet(cf, edt, data_offset, &rec,
|
if (process_packet(cf, edt, data_offset, &rec, &buf)) {
|
||||||
ws_buffer_start_ptr(&buf))) {
|
|
||||||
/* Stop reading if we have the maximum number of packets;
|
/* Stop reading if we have the maximum number of packets;
|
||||||
* When the -c option has not been used, max_packet_count
|
* When the -c option has not been used, max_packet_count
|
||||||
* starts at 0, which practically means, never stop reading.
|
* 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->frame_ref_num = (framenum != 1) ? 1 : 0;
|
||||||
fdata->prev_dis_num = framenum - 1;
|
fdata->prev_dis_num = framenum - 1;
|
||||||
epan_dissect_run_with_taps(&edt, cfile.cd_t, &rec,
|
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);
|
fdata, cinfo);
|
||||||
epan_dissect_reset(&edt);
|
epan_dissect_reset(&edt);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue