diff options
author | Bill Meier <wmeier@newsguy.com> | 2008-08-25 19:25:40 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2008-08-25 19:25:40 +0000 |
commit | 9c250392d85eb9e685364f6d60dbde17e3fd8a88 (patch) | |
tree | e7cc75b7e53af6c8b8960e219f403ba1fef45eee | |
parent | c249da955cdec9d55a96dba83d9204a479fac04a (diff) |
prefs_register_protocol not req'd since no prefs; simplify reg_handoff & do minor cleanup
svn path=/trunk/; revision=26080
-rw-r--r-- | epan/dissectors/packet-dplay.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-wsmp.c | 57 |
2 files changed, 21 insertions, 52 deletions
diff --git a/epan/dissectors/packet-dplay.c b/epan/dissectors/packet-dplay.c index 9b5b6daf27..7183f86c8c 100644 --- a/epan/dissectors/packet-dplay.c +++ b/epan/dissectors/packet-dplay.c @@ -30,19 +30,16 @@ #endif #include <epan/packet.h> -#include <epan/prefs.h> #include <epan/emem.h> #include <epan/aftypes.h> #include <string.h> /* function declarations */ -void proto_reg_handoff_dplay(void); static gboolean heur_dissect_dplay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static void dissect_dplay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static gint dissect_type1a_message(proto_tree *tree, tvbuff_t *tvb, gint offset); static int proto_dplay = -1; -static dissector_handle_t dplay_handle; /* Common data fields */ static int hf_dplay_size = -1; /* Size of the whole data */ @@ -1759,7 +1756,6 @@ void proto_register_dplay() &ett_dplay_type05_flags, &ett_dplay_type29_spp, }; - module_t *dplay_module; if(proto_dplay == -1) { @@ -1770,20 +1766,12 @@ void proto_register_dplay() ); proto_register_field_array(proto_dplay, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - dplay_module = prefs_register_protocol(proto_dplay, proto_reg_handoff_dplay); } } void proto_reg_handoff_dplay(void) { - static int initialized = FALSE; - - if(!initialized) - { - initialized = TRUE; - heur_dissector_add("udp", heur_dissect_dplay, proto_dplay); - heur_dissector_add("tcp", heur_dissect_dplay, proto_dplay); - dplay_handle = create_dissector_handle(dissect_dplay, proto_dplay); - } + heur_dissector_add("udp", heur_dissect_dplay, proto_dplay); + heur_dissector_add("tcp", heur_dissect_dplay, proto_dplay); } diff --git a/epan/dissectors/packet-wsmp.c b/epan/dissectors/packet-wsmp.c index 2faa1bbef8..207e503781 100644 --- a/epan/dissectors/packet-wsmp.c +++ b/epan/dissectors/packet-wsmp.c @@ -34,12 +34,8 @@ #include <string.h> #include <epan/packet.h> -#include <epan/prefs.h> #include <epan/etypes.h> -/* Forward declaration we need below */ -void proto_reg_handoff_wsmp(void); - static dissector_handle_t data_handle; /* Initialize the protocol and registered fields */ @@ -66,7 +62,7 @@ dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti, *wsmdata_item; proto_tree *wsmp_tree, *wsmdata_tree; - tvbuff_t *wsmdata_tvb; + tvbuff_t *wsmdata_tvb; guint16 acmlength, wsmlength, offset; char* acm; @@ -114,7 +110,7 @@ dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_wsmp_acmlength, tvb, offset, 1, FALSE); offset ++; - acm = tvb_get_ephemeral_string(tvb, offset, acmlength); + acm = tvb_get_ephemeral_string(tvb, offset, acmlength); proto_tree_add_item(wsmp_tree, hf_wsmp_acm, tvb, offset, acmlength, FALSE); offset +=acmlength; @@ -122,16 +118,16 @@ dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(wsmp_tree, hf_wsmp_wsmlength, tvb, offset, 2, TRUE); offset += 2; - - wsmdata_item = proto_tree_add_text (wsmp_tree, tvb, offset, wsmlength, - "Wave Short Message"); - wsmdata_tree = proto_item_add_subtree(wsmdata_item, ett_wsmdata); - - /* TODO: Branch on the application context and display accordingly - * Default call the data dissector - */ - wsmdata_tvb = tvb_new_subset(tvb, offset,wsmlength, wsmlength); - call_dissector(data_handle, wsmdata_tvb, pinfo, wsmdata_tree); + + wsmdata_item = proto_tree_add_text (wsmp_tree, tvb, offset, wsmlength, + "Wave Short Message"); + wsmdata_tree = proto_item_add_subtree(wsmdata_item, ett_wsmdata); + + /* TODO: Branch on the application context and display accordingly + * Default call the data dissector + */ + wsmdata_tvb = tvb_new_subset(tvb, offset,wsmlength, wsmlength); + call_dissector(data_handle, wsmdata_tvb, pinfo, wsmdata_tree); } } @@ -143,11 +139,9 @@ dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) that calls all the protocol registration. */ - void +void proto_register_wsmp(void) { - module_t *wsmp_module; - /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &hf_wsmp_version, @@ -200,33 +194,20 @@ proto_register_wsmp(void) proto_register_field_array(proto_wsmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - /* Register preferences module (See Section 2.6 for more on preferences) */ - wsmp_module = prefs_register_protocol(proto_wsmp, proto_reg_handoff_wsmp); - } /* If this dissector uses sub-dissector registration add a registration routine. This exact format is required because a script is used to find these routines and create the code that calls these routines. - - This function is also called by preferences whenever "Apply" is pressed - (see prefs_register_protocol above) so it should accommodate being called - more than once. */ - void + +void proto_reg_handoff_wsmp(void) { - static gboolean inited = FALSE; - if( !inited ) { - - dissector_handle_t wsmp_handle; + dissector_handle_t wsmp_handle; - wsmp_handle = create_dissector_handle(dissect_wsmp, - proto_wsmp); - dissector_add("ethertype", ETHERTYPE_WSMP, wsmp_handle); - data_handle = find_dissector("data"); - inited = TRUE; - } + wsmp_handle = create_dissector_handle(dissect_wsmp, proto_wsmp); + dissector_add("ethertype", ETHERTYPE_WSMP, wsmp_handle); + data_handle = find_dissector("data"); return; - } |