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 /wiretap/commview.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 'wiretap/commview.c')
-rw-r--r-- | wiretap/commview.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c index e2a868a6b2..fa7660bbff 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -78,11 +78,11 @@ typedef struct commview_header { #define MEDIUM_WIFI 1 #define MEDIUM_TOKEN_RING 2 -static gboolean commview_read(wtap *wth, int *err, gchar **err_info, - gint64 *data_offset); -static gboolean commview_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, - Buffer *buf, int *err, gchar **err_info); +static int commview_read(wtap *wth, int *err, gchar **err_info, + gint64 *data_offset); +static int commview_seek_read(wtap *wth, gint64 seek_off, + struct wtap_pkthdr *phdr, + Buffer *buf, int *err, gchar **err_info); static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err, gchar **err_info); static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, @@ -136,7 +136,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, struct tm tm; if(!commview_read_header(&cv_hdr, fh, err, err_info)) - return FALSE; + return -1; switch(cv_hdr.flags & FLAGS_MEDIUM) { @@ -162,7 +162,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("commview: unsupported encap: %u", cv_hdr.flags & FLAGS_MEDIUM); - return FALSE; + return -1; } tm.tm_year = cv_hdr.year - 1900; @@ -181,10 +181,12 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, phdr->ts.secs = mktime(&tm); phdr->ts.nsecs = cv_hdr.usecs * 1000; - return wtap_read_packet_bytes(fh, buf, phdr->caplen, err, err_info); + if (!wtap_read_packet_bytes(fh, buf, phdr->caplen, err, err_info)) + return -1; + return REC_TYPE_PACKET; } -static gboolean +static int commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { *data_offset = file_tell(wth->fh); @@ -193,12 +195,12 @@ commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) err_info); } -static gboolean +static int commview_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) - return FALSE; + return -1; return commview_read_packet(wth->random_fh, phdr, buf, err, err_info); } |