aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cisco-wids.c
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2008-09-12 16:52:01 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2008-09-12 16:52:01 +0000
commit262bd008f6de80a3ed64f87a912dee602259afd3 (patch)
treeeb99a85eb5e8146975338d18b8909d3f7a20a759 /epan/dissectors/packet-cisco-wids.c
parent678ebb6f97045782b68aedaaf0df76a9fe192b58 (diff)
Small revisions related to proto_reg_handoff ....
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26185 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-cisco-wids.c')
-rw-r--r--epan/dissectors/packet-cisco-wids.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/epan/dissectors/packet-cisco-wids.c b/epan/dissectors/packet-cisco-wids.c
index 66b536826d..350438787d 100644
--- a/epan/dissectors/packet-cisco-wids.c
+++ b/epan/dissectors/packet-cisco-wids.c
@@ -55,7 +55,7 @@
#include <epan/expert.h>
#include <epan/prefs.h>
-static guint udp_port = 0;
+static guint global_udp_port = 0;
static int proto_cwids = -1;
static int hf_cwids_version = -1;
@@ -190,18 +190,30 @@ proto_register_cwids(void)
prefs_register_uint_preference(cwids_module, "udp.port",
"CWIDS port",
"Set the destination UDP port Cisco wireless IDS messages",
- 10, &udp_port);
+ 10, &global_udp_port);
}
void
proto_reg_handoff_cwids(void)
{
- dissector_handle_t cwids_handle;
-
- ieee80211_handle = find_dissector("wlan");
-
- cwids_handle = create_dissector_handle(dissect_cwids, proto_cwids);
- dissector_add("udp.port", udp_port, cwids_handle);
+ static dissector_handle_t cwids_handle;
+ static guint saved_udp_port;
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ cwids_handle = create_dissector_handle(dissect_cwids, proto_cwids);
+ dissector_add_handle("udp.port", cwids_handle);
+ ieee80211_handle = find_dissector("wlan");
+ initialized = TRUE;
+ } else {
+ if (saved_udp_port != 0) {
+ dissector_delete("udp.port", saved_udp_port, cwids_handle);
+ }
+ }
+ if (global_udp_port != 0) {
+ dissector_add("udp.port", global_udp_port, cwids_handle);
+ }
+ saved_udp_port = global_udp_port;
}