diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2008-04-19 10:41:45 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2008-04-19 10:41:45 +0000 |
commit | 81db026301251bc1e08e1355e5aa085ab0679723 (patch) | |
tree | a6adb1eec119415dbba8bea1255a262426dcd5af /plugins | |
parent | 8301b1e6949d26fa21f0ec185108c02e9bd708d9 (diff) |
Fix for bug 2475:
Add a preference to the UNISTIM dissector so that you can set the default port back to 5000, even though this conflicts with other dissectors.
svn path=/trunk/; revision=25118
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/unistim/packet-unistim.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/plugins/unistim/packet-unistim.c b/plugins/unistim/packet-unistim.c index ee96003eb7..0bb4de60a6 100644 --- a/plugins/unistim/packet-unistim.c +++ b/plugins/unistim/packet-unistim.c @@ -34,6 +34,7 @@ #include <epan/emem.h> #include <epan/expert.h> #include <epan/address.h> +#include <epan/prefs.h> #include <epan/dissectors/packet-rtp.h> #include <epan/dissectors/packet-rtcp.h> #include <string.h> @@ -54,6 +55,7 @@ static int global_unistim_port = 0; static unistim_info_t *uinfo; static int unistim_tap = -1; +void proto_reg_handoff_unistim(void); static void dissect_payload(proto_tree *unistim_tree,tvbuff_t *tvb,gint offset, packet_info *pinfo); static void dissect_unistim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static dissector_handle_t unistim_handle; @@ -168,33 +170,42 @@ static const value_string command_address[]={ void proto_register_unistim(void){ + module_t* unistim_module; + /* Setup protocol subtree array */ static gint *ett[] = { &ett_unistim }; - if(proto_unistim==-1){ - proto_unistim=proto_register_protocol( - "UNISTIM Protocol", - "UNISTIM", - "unistim"); - } + proto_unistim=proto_register_protocol("UNISTIM Protocol", "UNISTIM", "unistim"); proto_register_subtree_array(ett,array_length(ett)); proto_register_field_array(proto_unistim,hf,array_length(hf)); unistim_tap = register_tap("unistim"); + + unistim_module = prefs_register_protocol(proto_unistim, proto_reg_handoff_unistim); + + prefs_register_uint_preference(unistim_module, "udp.port", "UNISTIM UDP port", + "UNISTIM port (default 5000)", 10, &global_unistim_port); } void proto_reg_handoff_unistim(void) { static gboolean initialized=FALSE; + static int unistim_port = 0; + if(initialized!=TRUE){ unistim_handle=create_dissector_handle(dissect_unistim,proto_unistim); - dissector_add("udp.port",global_unistim_port,unistim_handle); initialized=TRUE; + } else { + dissector_delete("udp.port",unistim_port,unistim_handle); } + + unistim_port = global_unistim_port; + + dissector_add("udp.port",global_unistim_port,unistim_handle); } |