aboutsummaryrefslogtreecommitdiffstats
path: root/capture_info.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:02 +0000
committerGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:10 +0000
commita344c9736efe5519543da1290e1ad9065d0b0cff (patch)
tree7757d80d74ae710e5d4e4a1b0cb638d0ec644fc4 /capture_info.c
parent716fdc8e398ea7435b23192ab1f7d59e7b21e32b (diff)
Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capture_info.c')
-rw-r--r--capture_info.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/capture_info.c b/capture_info.c
index c3c232816c..3ef12df504 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -232,11 +232,9 @@ gboolean capture_info_new_file(const char *new_filename)
}
-/* new records arrived */
-void capture_info_new_records(int to_read)
+/* new packets arrived */
+void capture_info_new_packets(int to_read)
{
- int rec_type;
- int packets_read = 0;
int err;
gchar *err_info;
gint64 data_offset;
@@ -246,27 +244,25 @@ void capture_info_new_records(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 ((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);
+ 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);
- capture_info_packet(&info_data.counts, wtap_linktype, buf, phdr->caplen, pseudo_header);
- packets_read++;
+ capture_info_packet(&info_data.counts, wtap_linktype, buf, phdr->caplen, pseudo_header);
- /*g_warning("new packet");*/
- }
+ /*g_warning("new packet");*/
to_read--;
}
}
- info_data.ui.new_packets = packets_read;
capture_info_ui_update(&info_data.ui);
}