summaryrefslogtreecommitdiff
path: root/wiretap/visual.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/visual.c
parent6287efb9c05482531ea675bb5a3d23b03b5715ab (diff)
downloadwireshark-c0c480d08c175eed4524ea9e73ec86298f468cf4.tar.gz
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/visual.c')
-rw-r--r--wiretap/visual.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/wiretap/visual.c b/wiretap/visual.c
index cfa03bceac..67a7d481f9 100644
--- a/wiretap/visual.c
+++ b/wiretap/visual.c
@@ -158,9 +158,9 @@ struct visual_write_info
/* Local functions to handle file reads and writes */
-static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
+static int visual_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
+static int visual_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static gboolean visual_read_packet(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
@@ -281,7 +281,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
in a loop to sequentially read the entire file one time. After
the file has been read once, any Future access to the packets is
done through seek_read. */
-static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
+static int visual_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
struct visual_read_info *visual = (struct visual_read_info *)wth->priv;
@@ -292,31 +292,33 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
if (visual->current_pkt > visual->num_pkts)
{
*err = 0; /* it's just an EOF, not an error */
- return FALSE;
+ return -1;
}
visual->current_pkt++;
*data_offset = file_tell(wth->fh);
- return visual_read_packet(wth, wth->fh, &wth->phdr, wth->frame_buffer,
- err, err_info);
+ if (!visual_read_packet(wth, wth->fh, &wth->phdr, wth->frame_buffer,
+ err, err_info))
+ return -1;
+ return REC_TYPE_PACKET;
}
/* Read packet header and data for random access. */
-static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
+static int visual_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
/* Seek to the packet header */
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
- return FALSE;
+ return -1;
/* Read the packet. */
if (!visual_read_packet(wth, wth->random_fh, phdr, buf, err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
- return FALSE;
+ return -1;
}
- return TRUE;
+ return REC_TYPE_PACKET;
}
static gboolean