diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
commit | 8c9edf12800bc6d68894dc457e7ebaf994429da8 (patch) | |
tree | ec6efefbd4e7f8227a7b96661f721ff4ba2986c3 /wiretap/wtap-int.h | |
parent | 3846abe34d6861c6ee0bba61fcd5baa4d213885c (diff) |
Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.
This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.
svn path=/trunk/; revision=49949
Diffstat (limited to 'wiretap/wtap-int.h')
-rw-r--r-- | wiretap/wtap-int.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 1c17a42ba5..fa22a8df65 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -44,7 +44,7 @@ int wtap_fstat(wtap *wth, ws_statb64 *statb, int *err); typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*); typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, - struct wtap_pkthdr *, guint8*, + struct wtap_pkthdr *, Buffer *buf, int, int *, char **); /** * Struct holding data of the currently read file. @@ -366,6 +366,19 @@ extern gint wtap_num_file_types; /*** get GSList of all compressed file extensions ***/ GSList *wtap_get_compressed_file_extensions(void); +/* + * Read packet data into a Buffer, growing the buffer as necessary. + * + * This returns an error on a short read, even if the short read hit + * the EOF immediately. (The assumption is that each packet has a + * header followed by raw packet data, and that we've already read the + * header, so if we get an EOF trying to read the packet data, the file + * has been cut short, even if the read didn't read any data at all.) + */ +gboolean +wtap_read_packet_bytes(FILE_T fh, Buffer *buf, guint length, int *err, + gchar **err_info); + #endif /* __WTAP_INT_H__ */ /* |