aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netscreen.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-22 20:01:31 -0700
committerGuy Harris <guy@alum.mit.edu>2014-05-23 03:02:32 +0000
commitc0c480d08c175eed4524ea9e73ec86298f468cf4 (patch)
tree1234cd09094dcc8447e3fb2b13671f12aba5ae69 /wiretap/netscreen.c
parent6287efb9c05482531ea675bb5a3d23b03b5715ab (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/netscreen.c')
-rw-r--r--wiretap/netscreen.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c
index bbb4a535e9..91c82c796d 100644
--- a/wiretap/netscreen.c
+++ b/wiretap/netscreen.c
@@ -67,9 +67,9 @@ static gint64 netscreen_seek_next_packet(wtap *wth, int *err, gchar **err_info,
char *hdr);
static gboolean netscreen_check_file_type(wtap *wth, int *err,
gchar **err_info);
-static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
+static int netscreen_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean netscreen_seek_read(wtap *wth, gint64 seek_off,
+static int netscreen_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info);
static int parse_netscreen_rec_hdr(struct wtap_pkthdr *phdr, const char *line,
@@ -190,7 +190,7 @@ int netscreen_open(wtap *wth, int *err, gchar **err_info)
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
+static int netscreen_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
gint64 offset;
@@ -203,19 +203,19 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
/* Find the next packet */
offset = netscreen_seek_next_packet(wth, err, err_info, line);
if (offset < 0)
- return FALSE;
+ return -1;
/* Parse the header */
pkt_len = parse_netscreen_rec_hdr(&wth->phdr, line, cap_int, &cap_dir,
cap_dst, err, err_info);
if (pkt_len == -1)
- return FALSE;
+ return -1;
/* Convert the ASCII hex dump to binary data, and fill in some
struct wtap_pkthdr fields */
if (!parse_netscreen_hex_dump(wth->fh, pkt_len, cap_int,
cap_dst, &wth->phdr, wth->frame_buffer, err, err_info))
- return FALSE;
+ return -1;
/*
* If the per-file encapsulation isn't known, set it to this
@@ -233,11 +233,11 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
}
*data_offset = offset;
- return TRUE;
+ return REC_TYPE_PACKET;
}
/* Used to read packets in random-access fashion */
-static gboolean
+static int
netscreen_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
@@ -249,7 +249,7 @@ netscreen_seek_read(wtap *wth, gint64 seek_off,
char cap_dst[13];
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
- return FALSE;
+ return -1;
}
if (file_gets(line, NETSCREEN_LINE_LENGTH, wth->random_fh) == NULL) {
@@ -257,18 +257,18 @@ netscreen_seek_read(wtap *wth, gint64 seek_off,
if (*err == 0) {
*err = WTAP_ERR_SHORT_READ;
}
- return FALSE;
+ return -1;
}
pkt_len = parse_netscreen_rec_hdr(phdr, line, cap_int, &cap_dir,
cap_dst, err, err_info);
if (pkt_len == -1)
- return FALSE;
+ return -1;
if (!parse_netscreen_hex_dump(wth->random_fh, pkt_len, cap_int,
cap_dst, phdr, buf, err, err_info))
- return FALSE;
- return TRUE;
+ return -1;
+ return REC_TYPE_PACKET;
}
/* Parses a packet record header. There are a few possible formats: