From Tomasz Mon via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8503 :
[metze/wireshark/wip.git] / wiretap / wtap.h
index 97be9728194e0b3f122c15b26f651e06de205a6e..8baf366026b8bd27efcb38a5f5ce876ae6da3e3e 100644 (file)
@@ -243,6 +243,7 @@ extern "C" {
 #define WTAP_ENCAP_SCTP                         150
 #define WTAP_ENCAP_INFINIBAND                   151
 #define WTAP_ENCAP_JUNIPER_SVCS                 152
+#define WTAP_ENCAP_USBPCAP                      153
 
 #define WTAP_NUM_ENCAP_TYPES                    wtap_get_num_encap_types()
 
@@ -1094,6 +1095,13 @@ typedef struct wtap_dumper wtap_dumper;
 
 typedef struct wtap_reader *FILE_T;
 
+/*
+ * Types of comments.
+ */
+#define WTAP_COMMENT_PER_SECTION       0x00000001      /* per-file/per-file-section */
+#define WTAP_COMMENT_PER_INTERFACE     0x00000002      /* per-interface */
+#define WTAP_COMMENT_PER_PACKET                0x00000004      /* per-packet */
+
 struct file_type_info {
     /* the file type name */
     /* should be NULL for all "pseudo" types that are only internally used and not read/writeable */
@@ -1120,6 +1128,9 @@ struct file_type_info {
     /* should be FALSE is this file type doesn't support name resolution records */
     gboolean has_name_resolution;
 
+    /* what types of comment does this file support? */
+    guint32 supported_comment_types;
+
     /* can this type write this encapsulation format? */
     /* should be NULL is this file type doesn't have write support */
     int (*can_write_encap)(int);
@@ -1228,8 +1239,6 @@ void wtap_close(wtap *wth);
 /*** dump packets into a capture file ***/
 WS_DLL_PUBLIC
 gboolean wtap_dump_can_open(int filetype);
-WS_DLL_PUBLIC
-gboolean wtap_dump_can_write_encap(int filetype, int encap);
 
 /**
  * Given a GArray of WTAP_ENCAP_ types, return the per-file encapsulation
@@ -1239,16 +1248,26 @@ WS_DLL_PUBLIC
 int wtap_dump_file_encap_type(const GArray *file_encaps);
 
 /**
- * Return TRUE if a capture with a given GArray of WTAP_ENCAP_ types
- * can be written in a specified format, and FALSE if it can't.
+ * Return TRUE if we can write this capture file format out in
+ * compressed form, FALSE if not.
  */
 WS_DLL_PUBLIC
-gboolean wtap_dump_can_write_encaps(int ft, const GArray *file_encaps);
+gboolean wtap_dump_can_compress(int filetype);
 
+/**
+ * Return TRUE if this capture file format supports storing name
+ * resolution information in it, FALSE if not.
+ */
 WS_DLL_PUBLIC
-gboolean wtap_dump_can_compress(int filetype);
 gboolean wtap_dump_has_name_resolution(int filetype);
 
+/**
+ * Return TRUE if this capture file format supports all the comment
+ * types specified, FALSE if not.
+ */
+WS_DLL_PUBLIC
+gboolean wtap_dump_supports_comment_types(int filetype, guint32 comment_types);
+
 WS_DLL_PUBLIC
 wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
     int snaplen, gboolean compressed, int *err);
@@ -1280,13 +1299,21 @@ gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, struct addrinfo *addrinfo
 WS_DLL_PUBLIC
 gboolean wtap_dump_close(wtap_dumper *, int *);
 
+/**
+ * Return TRUE if we can write a file out with the given GArray of file
+ * encapsulations and the given bitmask of comment types.
+ */
+WS_DLL_PUBLIC
+gboolean wtap_dump_can_write(const GArray *file_encaps, guint32 required_comment_types);
+
 /**
  * Get a GArray of WTAP_FILE_ values for file types that can be used
  * to save a file of a given type with a given GArray of WTAP_ENCAP_
- * types.
+ * types and the given bitmask of comment types.
  */
 WS_DLL_PUBLIC
-GArray *wtap_get_savable_file_types(int file_type, const GArray *file_encaps);
+GArray *wtap_get_savable_file_types(int file_type, const GArray *file_encaps,
+    guint32 required_comment_types);
 
 /*** various string converter functions ***/
 WS_DLL_PUBLIC