From c0c480d08c175eed4524ea9e73ec86298f468cf4 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 22 May 2014 20:01:31 -0700 Subject: 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 --- wiretap/ascendtext.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'wiretap/ascendtext.c') diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c index 32d4d49418..58ea2fbea6 100644 --- a/wiretap/ascendtext.c +++ b/wiretap/ascendtext.c @@ -74,9 +74,9 @@ static const ascend_magic_string ascend_magic[] = { { ASCEND_PFX_ETHER, "ETHER" }, }; -static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, +static int ascend_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); -static gboolean ascend_seek_read(wtap *wth, gint64 seek_off, +static int ascend_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info); @@ -237,36 +237,36 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, packet's header because we might mistake part of it for a new header. */ if (file_seek(wth->fh, ascend->next_packet_seek_start, SEEK_SET, err) == -1) - return FALSE; + return -1; offset = ascend_seek(wth, err, err_info); if (offset == -1) - return FALSE; + return -1; if (parse_ascend(ascend, wth->fh, &wth->phdr, wth->frame_buffer, wth->snapshot_length) != PARSED_RECORD) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error"); - return FALSE; + return -1; } *data_offset = offset; - return TRUE; + return REC_TYPE_PACKET; } -static gboolean ascend_seek_read(wtap *wth, gint64 seek_off, +static int ascend_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { ascend_t *ascend = (ascend_t *)wth->priv; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) - return FALSE; + return -1; if (parse_ascend(ascend, wth->random_fh, phdr, buf, wth->snapshot_length) != PARSED_RECORD) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error"); - return FALSE; + return -1; } - return TRUE; + return REC_TYPE_PACKET; } -- cgit v1.2.1