aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-26 11:55:39 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-26 11:55:39 +0000
commit193b8c9bfbd15afde08076ee1dc09abf914b9abe (patch)
treef9dc3f0b5ba0d6e395231161279cca2f2f326a53 /epan/packet.h
parentfa431b988f316fe5ff99b107242a50b2cb99b2e3 (diff)
Allow dissectors to be registered as "old-style" or "new-style"
dissectors. "Old-style" dissectors return nothing. "New-style" dissectors return one of: a positive integer, giving the number of bytes worth of data in the tvbuff that it considered to be part of the PDU in the tvbuff; zero, if it didn't consider the data in the tvbuff to be a PDU for its protocol; a negative integer, giving the number of additional bytes worth of data in needs to get the complete PDU (for use with fragmentation/segmentation when the length of the PDU isn't known to the protocol atop the one the dissector is dissecting). Have "call_dissector()" return the return value of new-style dissectors, and the length of the tvbuff handed to it for old-style dissectors. Have "dissector_try_port()" return FALSE if the subdissector is a new-style dissector and returned 0. Make the EAP dissector a new-style dissector, and have a "EAP fragment" dissector that is also a new-style dissector and handles fragmentation of EAP messages (as happens above, for example, RADIUS). Also, clean up some signed vs. unsigned comparison problems. Reassemble EAP-Message AVPs in RADIUS. svn path=/trunk/; revision=4811
Diffstat (limited to 'epan/packet.h')
-rw-r--r--epan/packet.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/epan/packet.h b/epan/packet.h
index 3adb41364e..8429ee4457 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.53 2002/02/24 06:45:14 guy Exp $
+ * $Id: packet.h,v 1.54 2002/02/26 11:55:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -90,9 +90,25 @@ typedef struct dissector_handle *dissector_handle_t;
struct dissector_table;
typedef struct dissector_table *dissector_table_t;
-/* types for sub-dissector lookup */
+/*
+ * Dissector that returns nothing.
+ */
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
+ * 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
+ * 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 *);
+
typedef void (*DATFunc) (gchar *table_name, gpointer key, gpointer value, gpointer user_data);
typedef void (*DATFunc_handle) (gchar *table_name, gpointer value, gpointer user_data);
@@ -184,6 +200,8 @@ extern gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
/* Register a dissector. */
extern void register_dissector(const char *name, dissector_t dissector,
int proto);
+extern void new_register_dissector(const char *name, new_dissector_t dissector,
+ int proto);
/* Get the short name of the protocol for a dissector handle. */
extern char *dissector_handle_get_short_name(dissector_handle_t handle);
@@ -196,7 +214,7 @@ extern dissector_handle_t create_dissector_handle(dissector_t dissector,
int proto);
/* Call a dissector through a handle. */
-extern void call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
+extern int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree);
/* Do all one-time initialization. */