aboutsummaryrefslogtreecommitdiffstats
path: root/capture_info.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 /capture_info.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 'capture_info.c')
-rw-r--r--capture_info.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/capture_info.c b/capture_info.c
index f51f3a3fe7..7e7fab6d4c 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -40,32 +40,36 @@ void capture_info_new_packets(int to_read, info_data_t* cap_info)
int err;
gchar *err_info;
gint64 data_offset;
- wtap_rec *rec;
+ wtap_rec rec;
+ Buffer buf;
union wtap_pseudo_header *pseudo_header;
int wtap_linktype;
- const guchar *buf;
-
cap_info->ui.new_packets = to_read;
/*g_warning("new packets: %u", to_read);*/
+ wtap_rec_init(&rec);
+ ws_buffer_init(&buf, 1500);
while (to_read > 0) {
wtap_cleareof(cap_info->wtap);
- if (wtap_read(cap_info->wtap, &err, &err_info, &data_offset)) {
- rec = wtap_get_rec(cap_info->wtap);
- if (rec->rec_type == REC_TYPE_PACKET) {
- pseudo_header = &rec->rec_header.packet_header.pseudo_header;
- wtap_linktype = rec->rec_header.packet_header.pkt_encap;
- buf = wtap_get_buf_ptr(cap_info->wtap);
+ if (wtap_read(cap_info->wtap, &rec, &buf, &err, &err_info, &data_offset)) {
+ if (rec.rec_type == REC_TYPE_PACKET) {
+ pseudo_header = &rec.rec_header.packet_header.pseudo_header;
+ wtap_linktype = rec.rec_header.packet_header.pkt_encap;
- capture_info_packet(cap_info, wtap_linktype, buf, rec->rec_header.packet_header.caplen, pseudo_header);
+ capture_info_packet(cap_info, wtap_linktype,
+ ws_buffer_start_ptr(&buf),
+ rec.rec_header.packet_header.caplen,
+ pseudo_header);
/*g_warning("new packet");*/
to_read--;
}
}
}
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
capture_info_ui_update(&cap_info->ui);
}