aboutsummaryrefslogtreecommitdiffstats
path: root/sharkd.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-04-04 18:56:27 -0700
committerGuy Harris <guy@alum.mit.edu>2019-04-05 02:49:43 +0000
commit8a5b26efb14b7f8f5375383436f03108d52d9aed (patch)
treeeb57791fc53deab1c618b259e11092f122a8ee97 /sharkd.c
parentb572b65e518937f43b630991c07369d8e0c79f53 (diff)
Have wtap_read() fill in a wtap_rec and Buffer.
That makes it - and the routines that implement it - work more like the seek-read routine. Change-Id: I0cace2d0e4c9ebfc21ac98fd1af1ec70f60a240d Reviewed-on: https://code.wireshark.org/review/32727 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'sharkd.c')
-rw-r--r--sharkd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sharkd.c b/sharkd.c
index 7388df61b2..21d74f8d32 100644
--- a/sharkd.c
+++ b/sharkd.c
@@ -320,6 +320,8 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
int err;
gchar *err_info = NULL;
gint64 data_offset;
+ wtap_rec rec;
+ Buffer buf;
epan_dissect_t *edt = NULL;
{
@@ -348,9 +350,12 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
}
- while (wtap_read(cf->provider.wth, &err, &err_info, &data_offset)) {
- if (process_packet(cf, edt, data_offset, wtap_get_rec(cf->provider.wth),
- wtap_get_buf_ptr(cf->provider.wth))) {
+ wtap_rec_init(&rec);
+ 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))) {
/* 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.
@@ -368,6 +373,9 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
edt = NULL;
}
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
+
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->provider.wth);