summaryrefslogtreecommitdiff
path: root/wiretap/ngsniffer.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 /wiretap/ngsniffer.c
parent716fdc8e398ea7435b23192ab1f7d59e7b21e32b (diff)
downloadwireshark-a344c9736efe5519543da1290e1ad9065d0b0cff.tar.gz
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/ngsniffer.c')
-rw-r--r--wiretap/ngsniffer.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 1eafa3f150..8138a31f44 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -509,9 +509,9 @@ static int process_rec_header2_v2(wtap *wth, unsigned char *buffer,
guint16 length, int *err, gchar **err_info);
static int process_rec_header2_v145(wtap *wth, unsigned char *buffer,
guint16 length, gint16 maj_vers, int *err, gchar **err_info);
-static int ngsniffer_read(wtap *wth, int *err, gchar **err_info,
+static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static int ngsniffer_seek_read(wtap *wth, gint64 seek_off,
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static int ngsniffer_process_record(wtap *wth, gboolean is_random,
guint *padding, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
@@ -1053,7 +1053,7 @@ process_rec_header2_v145(wtap *wth, unsigned char *buffer, guint16 length,
}
/* Read the next packet */
-static int
+static gboolean
ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
ngsniffer_t *ngsniffer;
@@ -1075,7 +1075,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
&wth->phdr, wth->frame_buffer, err, err_info);
if (ret < 0) {
/* Read error or short read */
- return -1;
+ return FALSE;
}
/*
@@ -1093,16 +1093,16 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
if (padding != 0) {
if (!ng_file_skip_seq(wth, padding, err,
err_info))
- return -1;
+ return FALSE;
}
- return REC_TYPE_PACKET;
+ return TRUE;
case REC_EOF:
/*
* End of file. Return an EOF indication.
*/
*err = 0; /* EOF, not error */
- return -1;
+ return FALSE;
default:
/*
@@ -1114,26 +1114,26 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
if (padding != 0) {
if (!ng_file_skip_seq(wth, padding, err,
err_info))
- return -1;
+ return FALSE;
}
break;
}
}
}
-static int
+static gboolean
ngsniffer_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
int ret;
if (!ng_file_seek_rand(wth, seek_off, err, err_info))
- return -1;
+ return FALSE;
ret = ngsniffer_process_record(wth, TRUE, NULL, phdr, buf, err, err_info);
if (ret < 0) {
/* Read error or short read */
- return -1;
+ return FALSE;
}
/*
@@ -1152,10 +1152,10 @@ ngsniffer_seek_read(wtap *wth, gint64 seek_off,
* "Can't happen".
*/
g_assert_not_reached();
- return -1;
+ return FALSE;
}
- return REC_TYPE_PACKET;
+ return TRUE;
}
/*