diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-05-23 10:50:02 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-05-23 10:50:10 +0000 |
commit | a344c9736efe5519543da1290e1ad9065d0b0cff (patch) | |
tree | 7757d80d74ae710e5d4e4a1b0cb638d0ec644fc4 /wiretap/network_instruments.c | |
parent | 716fdc8e398ea7435b23192ab1f7d59e7b21e32b (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 'wiretap/network_instruments.c')
-rw-r--r-- | wiretap/network_instruments.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c index 01ed983932..38abfab2cd 100644 --- a/wiretap/network_instruments.c +++ b/wiretap/network_instruments.c @@ -94,9 +94,9 @@ static void init_gmt_to_localtime_offset(void) } } -static int observer_read(wtap *wth, int *err, gchar **err_info, +static gboolean observer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); -static int observer_seek_read(wtap *wth, gint64 seek_off, +static gboolean observer_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info); static int read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header, packet_entry_header *packet_header, int *err, gchar **err_info); @@ -258,7 +258,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info) } /* Reads the next packet. */ -static int observer_read(wtap *wth, int *err, gchar **err_info, +static gboolean observer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { int header_bytes_consumed; @@ -273,7 +273,7 @@ static int observer_read(wtap *wth, int *err, gchar **err_info, header_bytes_consumed = read_packet_header(wth->fh, &wth->phdr.pseudo_header, &packet_header, err, err_info); if (header_bytes_consumed <= 0) - return -1; /* EOF or error */ + return FALSE; /* EOF or error */ if (packet_header.packet_type == PACKET_TYPE_DATA_PACKET) break; @@ -281,32 +281,32 @@ static int observer_read(wtap *wth, int *err, gchar **err_info, /* skip to next packet */ if (!skip_to_next_packet(wth, packet_header.offset_to_next_packet, header_bytes_consumed, err, err_info)) { - return -1; /* EOF or error */ + return FALSE; /* EOF or error */ } } if (!process_packet_header(wth, &packet_header, &wth->phdr, err, err_info)) - return -1; + return FALSE; /* read the frame data */ data_bytes_consumed = read_packet_data(wth->fh, packet_header.offset_to_frame, header_bytes_consumed, wth->frame_buffer, wth->phdr.caplen, err, err_info); if (data_bytes_consumed < 0) { - return -1; + return FALSE; } /* skip over any extra bytes following the frame data */ if (!skip_to_next_packet(wth, packet_header.offset_to_next_packet, header_bytes_consumed + data_bytes_consumed, err, err_info)) { - return -1; + return FALSE; } - return REC_TYPE_PACKET; + return TRUE; } /* Reads a packet at an offset. */ -static int observer_seek_read(wtap *wth, gint64 seek_off, +static gboolean observer_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; @@ -315,25 +315,25 @@ static int observer_seek_read(wtap *wth, gint64 seek_off, int data_bytes_consumed; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) - return -1; + return FALSE; /* process the packet header, including TLVs */ offset = read_packet_header(wth->random_fh, pseudo_header, &packet_header, err, err_info); if (offset <= 0) - return -1; /* EOF or error */ + return FALSE; /* EOF or error */ if (!process_packet_header(wth, &packet_header, phdr, err, err_info)) - return -1; + return FALSE; /* read the frame data */ data_bytes_consumed = read_packet_data(wth->random_fh, packet_header.offset_to_frame, offset, buf, phdr->caplen, err, err_info); if (data_bytes_consumed < 0) { - return -1; + return FALSE; } - return REC_TYPE_PACKET; + return TRUE; } static int |