/* 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);
/*
* 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,
/* 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);
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
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.
*
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);
/* 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
* 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.
* 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 */