diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-05-22 20:01:31 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-05-23 03:02:32 +0000 |
commit | c0c480d08c175eed4524ea9e73ec86298f468cf4 (patch) | |
tree | 1234cd09094dcc8447e3fb2b13671f12aba5ae69 /capture_info.c | |
parent | 6287efb9c05482531ea675bb5a3d23b03b5715ab (diff) |
Allow wtap_read() and wtap_seek_read() to return non-packet records.
This is the first step towards implementing the mechanisms requestd in
bug 8590; currently, we don't return any records other than packet
records from libwiretap, and just ignore non-packet records in the rest
of Wireshark, but this at least gets the ball rolling.
Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574
Reviewed-on: https://code.wireshark.org/review/1736
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capture_info.c')
-rw-r--r-- | capture_info.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/capture_info.c b/capture_info.c index 3ef12df504..c3c232816c 100644 --- a/capture_info.c +++ b/capture_info.c @@ -232,9 +232,11 @@ gboolean capture_info_new_file(const char *new_filename) } -/* new packets arrived */ -void capture_info_new_packets(int to_read) +/* new records arrived */ +void capture_info_new_records(int to_read) { + int rec_type; + int packets_read = 0; int err; gchar *err_info; gint64 data_offset; @@ -244,25 +246,27 @@ void capture_info_new_packets(int to_read) const guchar *buf; - info_data.ui.new_packets = to_read; - /*g_warning("new packets: %u", to_read);*/ while (to_read > 0) { wtap_cleareof(info_data.wtap); - if (wtap_read(info_data.wtap, &err, &err_info, &data_offset)) { - phdr = wtap_phdr(info_data.wtap); - pseudo_header = &phdr->pseudo_header; - wtap_linktype = phdr->pkt_encap; - buf = wtap_buf_ptr(info_data.wtap); + if ((rec_type = wtap_read(info_data.wtap, &err, &err_info, &data_offset)) != -1) { + if (rec_type == REC_TYPE_PACKET) { + phdr = wtap_phdr(info_data.wtap); + pseudo_header = &phdr->pseudo_header; + wtap_linktype = phdr->pkt_encap; + buf = wtap_buf_ptr(info_data.wtap); - capture_info_packet(&info_data.counts, wtap_linktype, buf, phdr->caplen, pseudo_header); + capture_info_packet(&info_data.counts, wtap_linktype, buf, phdr->caplen, pseudo_header); + packets_read++; - /*g_warning("new packet");*/ + /*g_warning("new packet");*/ + } to_read--; } } + info_data.ui.new_packets = packets_read; capture_info_ui_update(&info_data.ui); } |