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/netscreen.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/netscreen.c')
-rw-r--r-- | wiretap/netscreen.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index 91c82c796d..bbb4a535e9 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 int netscreen_read(wtap *wth, int *err, gchar **err_info, +static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); -static int netscreen_seek_read(wtap *wth, gint64 seek_off, +static gboolean 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 int netscreen_read(wtap *wth, int *err, gchar **err_info, +static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; @@ -203,19 +203,19 @@ static int 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 -1; + return FALSE; /* 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 -1; + return FALSE; /* 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 -1; + return FALSE; /* * If the per-file encapsulation isn't known, set it to this @@ -233,11 +233,11 @@ static int netscreen_read(wtap *wth, int *err, gchar **err_info, } *data_offset = offset; - return REC_TYPE_PACKET; + return TRUE; } /* Used to read packets in random-access fashion */ -static int +static gboolean 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 -1; + return FALSE; } 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 -1; + return FALSE; } pkt_len = parse_netscreen_rec_hdr(phdr, line, cap_int, &cap_dir, cap_dst, err, err_info); if (pkt_len == -1) - return -1; + return FALSE; if (!parse_netscreen_hex_dump(wth->random_fh, pkt_len, cap_int, cap_dst, phdr, buf, err, err_info)) - return -1; - return REC_TYPE_PACKET; + return FALSE; + return TRUE; } /* Parses a packet record header. There are a few possible formats: |