summaryrefslogtreecommitdiff
path: root/wiretap/camins.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/camins.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/camins.c')
-rw-r--r--wiretap/camins.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/wiretap/camins.c b/wiretap/camins.c
index ccc618498a..d49cf96b80 100644
--- a/wiretap/camins.c
+++ b/wiretap/camins.c
@@ -256,7 +256,7 @@ create_pseudo_hdr(guint8 *buf, guint8 dat_trans_type, guint16 dat_len)
}
-static gboolean
+static int
camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
@@ -266,7 +266,7 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
gint offset, bytes_read;
if (!find_next_pkt_dat_type_len(fh, &dat_trans_type, &dat_len, err, err_info))
- return FALSE;
+ return -1;
buffer_assure_space(buf, DVB_CI_PSEUDO_HDR_LEN+dat_len);
p = buffer_start_ptr(buf);
@@ -276,7 +276,7 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
/* shouldn't happen, all invalid packets must be detected by
find_next_pkt_dat_type_len() */
*err = WTAP_ERR_INTERNAL;
- return FALSE;
+ return -1;
}
bytes_read = read_packet_data(fh, dat_trans_type,
@@ -284,7 +284,7 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
/* 0<=bytes_read<=dat_len is very likely a corrupted packet
we let the dissector handle this */
if (bytes_read < 0)
- return FALSE;
+ return -1;
offset += bytes_read;
phdr->pkt_encap = WTAP_ENCAP_DVBCI;
@@ -292,11 +292,11 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
phdr->caplen = offset;
phdr->len = offset;
- return TRUE;
+ return REC_TYPE_PACKET;
}
-static gboolean
+static int
camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
*data_offset = file_tell(wth->fh);
@@ -306,12 +306,12 @@ camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
}
-static gboolean
+static int
camins_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *pkthdr, Buffer *buf, int *err, gchar **err_info)
{
if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err))
- return FALSE;
+ return -1;
return camins_read_packet(wth->random_fh, pkthdr, buf, err, err_info);
}