diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2007-10-03 17:59:33 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2007-10-03 17:59:33 +0000 |
commit | 474bdf9687ff3c9bc7cb47749871d5fd1814349e (patch) | |
tree | c2e89d502da1d951944644a07a466ce48306ce24 /wiretap/wtap.h | |
parent | 0e400cafb406c3825e36c427cc4a9de033303305 (diff) |
fix some comments and sort functions by functionality
svn path=/trunk/; revision=23063
Diffstat (limited to 'wiretap/wtap.h')
-rw-r--r-- | wiretap/wtap.h | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/wiretap/wtap.h b/wiretap/wtap.h index e6fd162651..9472a639bd 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -650,7 +650,7 @@ struct file_type_info { const char *name; /* the file type short name, used as a shortcut for the command line tools */ - /* should be NULL for all "pseudo" types that are are only internally used and not read/writeable */ + /* should be NULL for all "pseudo" types that are only internally used and not read/writeable */ const char *short_name; /* the common file extensions for this type (seperated by semicolon) */ @@ -682,52 +682,42 @@ typedef int (*wtap_open_routine_t)(struct wtap*, int *, char **); * "int" pointed to by its second argument: * * a positive "errno" value if the capture file can't be opened; - * * a negative number, indicating the type of error, on other failures. */ struct wtap* wtap_open_offline(const char *filename, int *err, gchar **err_info, gboolean do_random); /* Returns TRUE if read was successful. FALSE if failure. data_offset is - * set the the offset in the file where the data for the read packet is + * set to the offset in the file where the data for the read packet is * located. */ gboolean wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); -/* - * Return an approximation of the amount of data we've read sequentially - * from the file so far. - */ -gint64 wtap_read_so_far(wtap *wth, int *err); +gboolean wtap_seek_read (wtap *wth, gint64 seek_off, + union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, + int *err, gchar **err_info); +/*** get various information snippets about the current packet ***/ struct wtap_pkthdr *wtap_phdr(wtap *wth); union wtap_pseudo_header *wtap_pseudoheader(wtap *wth); guint8 *wtap_buf_ptr(wtap *wth); +/*** get various information snippets about the current file ***/ + +/* Return an approximation of the amount of data we've read sequentially + * from the file so far. */ +gint64 wtap_read_so_far(wtap *wth, int *err); gint64 wtap_file_size(wtap *wth, int *err); int wtap_snapshot_length(wtap *wth); /* per file */ int wtap_file_type(wtap *wth); int wtap_file_encap(wtap *wth); int wtap_file_tsprecision(wtap *wth); -const char *wtap_file_type_string(int filetype); -const char *wtap_file_type_short_string(int filetype); -int wtap_short_string_to_file_type(const char *short_name); - -const char *wtap_file_extensions_string(int filetype); -const char *wtap_file_extension_default_string(int filetype); - -const char *wtap_encap_string(int encap); -const char *wtap_encap_short_string(int encap); -int wtap_short_string_to_encap(const char *short_name); - -const char *wtap_strerror(int err); +/*** close the current file ***/ void wtap_sequential_close(wtap *wth); void wtap_close(wtap *wth); -gboolean wtap_seek_read (wtap *wth, gint64 seek_off, - union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, - int *err, gchar **err_info); +/*** dump packets into a capture file ***/ gboolean wtap_dump_can_open(int filetype); gboolean wtap_dump_can_write_encap(int filetype, int encap); gboolean wtap_dump_can_compress(int filetype); @@ -738,14 +728,34 @@ wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen, gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const union wtap_pseudo_header *pseudo_header, const guchar *, int *err); void wtap_dump_flush(wtap_dumper *); -gboolean wtap_dump_close(wtap_dumper *, int *); gint64 wtap_get_bytes_dumped(wtap_dumper *); void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped); +gboolean wtap_dump_close(wtap_dumper *, int *); + +/*** various string converter functions ***/ +const char *wtap_file_type_string(int filetype); +const char *wtap_file_type_short_string(int filetype); +int wtap_short_string_to_file_type(const char *short_name); + +const char *wtap_file_extensions_string(int filetype); +const char *wtap_file_extension_default_string(int filetype); + +const char *wtap_encap_string(int encap); +const char *wtap_encap_short_string(int encap); +int wtap_short_string_to_encap(const char *short_name); + +const char *wtap_strerror(int err); + +/*** get available number of file types and encapsulations ***/ int wtap_get_num_encap_types(void); int wtap_get_num_file_types(void); -void wtap_register_open_routine(wtap_open_routine_t,gboolean); + +/*** dynamically register new file types and encapsulations ***/ +void wtap_register_open_routine(wtap_open_routine_t, gboolean has_magic); +int wtap_register_file_type(const struct file_type_info* fi); int wtap_register_encap_type(char* name, char* short_name); -int wtap_register_file_type(const struct file_type_info*); + + /* * Wiretap error codes. */ |