summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-01-24 00:26:57 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-01-24 00:26:57 +0000
commit1ff8c4272fb224666efd7427a9876a01311019c9 (patch)
tree7bd0e6363b39ccedfb52e81c484c482978ba4881
parentda9e0c68313aff629b50f89d2b87276e8fa088ef (diff)
downloadwireshark-1ff8c4272fb224666efd7427a9876a01311019c9.tar.gz
Add register_postdissector() to the API.
Dissectors registered with register_postdissector() will be called after all other dissectors have been called. Use it to register mate. svn path=/trunk/; revision=17089
-rw-r--r--epan/dissectors/packet-frame.c7
-rw-r--r--epan/libethereal.def1
-rw-r--r--epan/packet.c20
-rw-r--r--epan/packet.h7
-rw-r--r--plugins/mate/packet-mate.c7
5 files changed, 37 insertions, 5 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 03dabf2d17..e67f77fb4a 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -65,7 +65,6 @@ static int frame_tap = -1;
static dissector_handle_t data_handle;
static dissector_handle_t docsis_handle;
-static dissector_handle_t mate_handle = NULL;
/* Preferences */
static gboolean show_file_off = FALSE;
@@ -314,9 +313,10 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
pinfo->layer_names = NULL;
}
- tap_queue_packet(frame_tap, pinfo, NULL);
+ call_all_postdissectors(tvb,pinfo,tree);
- if (mate_handle) call_dissector(mate_handle,tvb, pinfo, parent_tree);
+ tap_queue_packet(frame_tap, pinfo, NULL);
+
if (frame_end_routines) {
g_slist_foreach(frame_end_routines, &call_frame_end_routine, NULL);
@@ -519,5 +519,4 @@ proto_reg_handoff_frame(void)
{
data_handle = find_dissector("data");
docsis_handle = find_dissector("docsis");
- mate_handle = find_dissector("mate");
}
diff --git a/epan/libethereal.def b/epan/libethereal.def
index cfdf8a2dd7..157ff66ff6 100644
--- a/epan/libethereal.def
+++ b/epan/libethereal.def
@@ -523,6 +523,7 @@ register_giop_user_module
register_heur_dissector_list
register_init_routine
register_postseq_cleanup_routine
+register_postdissector
register_stat_cmd_arg
register_tap
register_tap_listener
diff --git a/epan/packet.c b/epan/packet.c
index e3c62828bd..e739f5bbf3 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1782,3 +1782,23 @@ void
dissector_dump_decodes() {
dissector_all_tables_foreach(dissector_dump_decodes_display, NULL);
}
+
+static GPtrArray* post_dissectors = NULL;
+static guint num_of_postdissectors = 0;
+
+void register_postdissector(dissector_hanlde_t handle) {
+ if (!post_dissectors)
+ post_dissectors = g_ptr_array_new();
+
+ g_ptr_array_add(post_dissectors, handle);
+ num_of_postdissectors++;
+}
+
+extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+ guint i;
+ for(i=0;i<num_of_postdissectors;i++) {
+ call_dissector((dissector_handle_t) g_ptr_array_index(post_dissectors,i),
+ tvb,pinfo,tree);
+ }
+}
+
diff --git a/epan/packet.h b/epan/packet.h
index e65a4875a7..6445928aed 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -406,4 +406,11 @@ extern void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_ethertype,
*/
extern void dissector_dump_decodes(void);
+/*
+ * post dissectors are to be called by packet-frame.c after every other
+ * dissector has been called.
+ */
+extern void register_postdissector(dissector_handle_t);
+extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
#endif /* packet.h */
diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c
index 81d4165321..bdfd371bbe 100644
--- a/plugins/mate/packet-mate.c
+++ b/plugins/mate/packet-mate.c
@@ -367,7 +367,8 @@ void
proto_register_mate(void)
{
module_t *mate_module;
-
+ dissector_handle_t mate_handle;
+
proto_mate = proto_register_protocol("Meta Analysis Tracing Engine", "MATE", "mate");
register_dissector("mate",mate_tree,proto_mate);
mate_module = prefs_register_protocol(proto_mate, proto_reg_handoff_mate);
@@ -375,5 +376,9 @@ proto_register_mate(void)
"Configuration Filename",
"The name of the file containing the mate module's configuration",
&pref_mate_config_filename);
+
+ mate_handle = create_dissector_handle(mate_tree, proto_mate);
+
+ register_postdissector(mate_handle);
}