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/iseries.c | |
parent | 6287efb9c05482531ea675bb5a3d23b03b5715ab (diff) | |
download | wireshark-c0c480d08c175eed4524ea9e73ec86298f468cf4.tar.gz wireshark-c0c480d08c175eed4524ea9e73ec86298f468cf4.tar.bz2 wireshark-c0c480d08c175eed4524ea9e73ec86298f468cf4.zip |
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/iseries.c')
-rw-r--r-- | wiretap/iseries.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/wiretap/iseries.c b/wiretap/iseries.c index 0a171a6341..4c42fb4502 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -187,9 +187,9 @@ static gboolean iseries_seek_read (wtap * wth, gint64 seek_off, static gboolean iseries_check_file_type (wtap * wth, int *err, gchar **err_info, int format); static gint64 iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info); -static gboolean iseries_parse_packet (wtap * wth, FILE_T fh, - struct wtap_pkthdr *phdr, - Buffer * buf, int *err, gchar ** err_info); +static int iseries_parse_packet (wtap * wth, FILE_T fh, + struct wtap_pkthdr *phdr, + Buffer * buf, int *err, gchar ** err_info); static int iseries_UNICODE_to_ASCII (guint8 * buf, guint bytes); static gboolean iseries_parse_hex_string (const char * ascii, guint8 * buf, size_t len); @@ -370,7 +370,7 @@ iseries_check_file_type (wtap * wth, int *err, gchar **err_info, int format) /* * Find the next packet and parse it; called from wtap_read(). */ -static gboolean +static int iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset) { gint64 offset; @@ -457,14 +457,14 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info) /* * Read packets in random-access fashion */ -static gboolean +static int iseries_seek_read (wtap * wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer * buf, int *err, gchar ** err_info) { /* seek to packet location */ if (file_seek (wth->random_fh, seek_off - 1, SEEK_SET, err) == -1) - return FALSE; + return -1; /* * Parse the packet and extract the various fields @@ -554,7 +554,7 @@ done: } /* Parses a packet. */ -static gboolean +static int iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { @@ -581,7 +581,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, if (file_gets (data, ISERIES_LINE_LENGTH, fh) == NULL) { *err = file_error (fh, err_info); - return FALSE; + return -1; } /* Convert UNICODE data to ASCII */ if (iseries->format == ISERIES_FORMAT_UNICODE) @@ -615,7 +615,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup ("iseries: packet header isn't valid"); - return FALSE; + return -1; } phdr->presence_flags = WTAP_HAS_CAP_LEN; @@ -747,7 +747,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, if (ascii_offset == -1) { /* Bad line. */ - return FALSE; + return -1; } continue; } @@ -769,7 +769,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, if (ascii_offset == -1) { /* Bad line. */ - return FALSE; + return -1; } continue; } @@ -792,7 +792,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, if (ascii_offset == -1) { /* Bad line. */ - return FALSE; + return -1; } continue; } @@ -842,11 +842,11 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr, /* free buffer allocs and return */ *err = 0; g_free (ascii_buf); - return TRUE; + return REC_TYPE_PACKET; errxit: g_free (ascii_buf); - return FALSE; + return -1; } /* |