More 'char*' -> 'const char*' changes to fix warnings.
[obnox/wireshark/wip.git] / epan / packet.h
index 5d16892b7d13a78d77d6d70dd9e0be350175b4b7..05f6195eb77aa230917564544eca43ebb2426fb8 100644 (file)
@@ -86,10 +86,14 @@ typedef enum {
 
 /* Struct for boolean enumerations */
 typedef struct true_false_string {
-       char    *true_string;
-       char    *false_string;
+       const char      *true_string;
+       const char      *false_string;
 } true_false_string;
 
+/**
+* A default set of true/false strings that dissectors can use for 
+* FT_BOOLEAN header fields.
+**/
 extern const true_false_string flags_set_truth;
 
 extern void packet_init(void);
@@ -113,17 +117,27 @@ typedef void (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *);
 /*
  * Dissector that returns:
  *
- *     the amount of data in the protocol's PDU, if it was able to
+ *     The amount of data in the protocol's PDU, if it was able to
  *     dissect all the data;
  *
  *     0, if the tvbuff doesn't contain a PDU for that protocol;
  *
- *     the negative of the amount of additional data needed, if
+ *     The negative of the amount of additional data needed, if
  *     we need more data (e.g., from subsequent TCP segments) to
  *     dissect the entire PDU.
  */
 typedef int (*new_dissector_t)(tvbuff_t *, packet_info *, proto_tree *);
 
+/** Type of a heuristic dissector, used in heur_dissector_add().
+ *
+ * @param tvb the tv_buff with the (remaining) packet data
+ * @param pinfo the packet info of this packet (additional info)
+ * @param tree the protocol tree to be build or NULL
+ * @return TRUE if the packet was recognized by the sub-dissector (stop dissection here)
+ */
+typedef gboolean (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
+       proto_tree *tree);
+
 typedef void (*DATFunc) (gchar *table_name, ftenum_t selector_type,
     gpointer key, gpointer value, gpointer user_data);
 typedef void (*DATFunc_handle) (gchar *table_name, gpointer value,
@@ -149,7 +163,7 @@ extern void dissector_all_tables_foreach_table (DATFunc_table func,
 
 /* a protocol uses the function to register a sub-dissector table */
 extern dissector_table_t register_dissector_table(const char *name,
-    char *ui_name, ftenum_t type, int base);
+    const char *ui_name, ftenum_t type, int base);
 
 /* Find a dissector table by table name. */
 extern dissector_table_t find_dissector_table(const char *name);
@@ -194,7 +208,7 @@ extern dissector_handle_t dissector_get_port_handle(
     dissector_table_t sub_dissectors, guint32 port);
 
 /* Add an entry to a string dissector table. */
-extern void dissector_add_string(const char *name, gchar *pattern,
+extern void dissector_add_string(const char *name, const gchar *pattern,
     dissector_handle_t handle);
 
 /* Delete the entry for a dissector in a string dissector table
@@ -253,16 +267,6 @@ extern void register_heur_dissector_list(const char *name,
 extern gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
     tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
 
-/** Type of a heuristic dissector, used in heur_dissector_add().
- *
- * @param tvb the tv_buff with the (remaining) packet data
- * @param pinfo the packet info of this packet (additional info)
- * @param tree the protocol tree to be build or NULL
- * @return TRUE if the packet was recognized by the sub-dissector (stop dissection here)
- */
-typedef gboolean (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
-       proto_tree *tree);
-
 /** Add a sub-dissector to a heuristic dissector list.
  *  Call this in the proto_handoff function of the sub-dissector.
  *
@@ -294,9 +298,35 @@ extern dissector_handle_t create_dissector_handle(dissector_t dissector,
 extern dissector_handle_t new_create_dissector_handle(new_dissector_t dissector,
     int proto);
 
-/* Call a dissector through a handle. */
+/* Call a dissector through a handle and if no dissector was found
+ * pass if over to the "data" dissector instead.
+ *
+ *   @param handle The dissector to call.
+ *   @param  tvb The buffer to dissect.
+ *   @param  pinfo Packet Info.
+ *   @param  tree The protocol tree.
+ *   @return  If the protocol for that handle isn't enabled call the data 
+ *   dissector. Otherwise, if the handle refers to a new-style 
+ *   dissector, call the dissector and return its return value, otherwise call 
+ *   it and return the length of the tvbuff pointed to by the argument.
+ */
 extern int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
     packet_info *pinfo, proto_tree *tree);
+    
+/* Call a dissector through a handle but if no dissector was found
+ * just return 0 and do not call the "data" dissector instead.
+ *
+ *   @param handle The dissector to call.
+ *   @param  tvb The buffer to dissect.
+ *   @param  pinfo Packet Info.
+ *   @param  tree The protocol tree.
+ *   @return  If the protocol for that handle isn't enabled, return 0 without
+ *   calling the dissector. Otherwise, if the handle refers to a new-style 
+ *   dissector, call the dissector and return its return value, otherwise call 
+ *   it and return the length of the tvbuff pointed to by the argument.
+ */
+extern int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
+    packet_info *pinfo, proto_tree *tree);
 
 /* Do all one-time initialization. */
 extern void dissect_init(void);
@@ -318,6 +348,9 @@ extern void register_init_routine(void (*func)(void));
 /* Initialize all data structures used for dissection. */
 extern void init_dissection(void);
 
+/* Free data structures allocated for dissection. */
+extern void cleanup_dissection(void);
+
 /* Allow protocols to register a "cleanup" routine to be
  * run after the initial sequential run through the packets.
  * Note that the file can still be open after this; this is not
@@ -346,7 +379,7 @@ final_registration_all_protocols(void);
  * the tvbuff for the data source and its name.
  */
 extern void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
-    char *name);
+    const char *name);
 
 /*
  * Free up a frame's list of data sources.
@@ -371,6 +404,6 @@ extern void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_ethertype,
  * Dump layer/selector/dissector records in a fashion similar to the
  * proto_registrar_dump_* routines.
  */
-extern void dissector_dump_decodes();
+extern void dissector_dump_decodes(void);
 
 #endif /* packet.h */