diff options
Diffstat (limited to 'epan/dissectors/packet-mausb.c')
-rw-r--r-- | epan/dissectors/packet-mausb.c | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/epan/dissectors/packet-mausb.c b/epan/dissectors/packet-mausb.c index 00a450f173..52ff45ae85 100644 --- a/epan/dissectors/packet-mausb.c +++ b/epan/dissectors/packet-mausb.c @@ -27,7 +27,6 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> #include <epan/expert.h> #include <epan/oui.h> #include "packet-tcp.h" @@ -673,9 +672,6 @@ static guint mausb_get_pkt_len(packet_info *pinfo _U_, tvbuff_t *tvb, return tvb_get_letohs(tvb, offset + 2); } -/* Global Port Preference */ -static unsigned int mausb_udp_port_pref = 0; - /* Initialize the subtree pointers */ static gint ett_mausb = -1; static gint ett_mausb_flags = -1; @@ -2249,12 +2245,10 @@ proto_register_mausb(void) }, }; - module_t *mausb_module; expert_module_t* expert_mausb; /* Register the protocol name and description */ - proto_mausb = proto_register_protocol("Media Agnostic USB", - "MAUSB", "mausb"); + proto_mausb = proto_register_protocol("Media Agnostic USB", "MAUSB", "mausb"); /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_mausb, hf, array_length(hf)); @@ -2267,45 +2261,23 @@ proto_register_mausb(void) expert_mausb = expert_register_protocol(proto_mausb); expert_register_field_array(expert_mausb, ei, array_length(ei)); - /* Register Protocol preferences */ - mausb_module = prefs_register_protocol(proto_mausb, proto_reg_handoff_mausb); - - /* Register UDP port preference */ - prefs_register_uint_preference(mausb_module, "udp.port", "MAUSB UDP Port", - "Set the port for Media Agnostic Packets", - 10, &mausb_udp_port_pref); - llc_add_oui(OUI_WFA, "llc.wfa_pid", "LLC WFA OUI PID", oui_hf, proto_mausb); } void proto_reg_handoff_mausb(void) { - static gboolean initialized = FALSE; - static dissector_handle_t mausb_tcp_handle; - static dissector_handle_t mausb_pkt_handle; - static guint saved_mausb_udp_port_pref; - - if (!initialized) { - /* only initialize once */ - mausb_tcp_handle = create_dissector_handle(dissect_mausb, - proto_mausb); + dissector_handle_t mausb_tcp_handle; + dissector_handle_t mausb_pkt_handle; - mausb_pkt_handle = create_dissector_handle(dissect_mausb_pkt, - proto_mausb); + mausb_tcp_handle = create_dissector_handle(dissect_mausb, proto_mausb); - dissector_add_uint("llc.wfa_pid", PID_MAUSB, mausb_pkt_handle); - initialized = TRUE; - - dissector_add_uint_range_with_preference("tcp.port", "", mausb_tcp_handle); - } else { - /* if we have already been initialized */ - dissector_delete_uint("udp.port", saved_mausb_udp_port_pref, mausb_pkt_handle); - } + mausb_pkt_handle = create_dissector_handle(dissect_mausb_pkt, proto_mausb); - saved_mausb_udp_port_pref = mausb_udp_port_pref; + dissector_add_uint("llc.wfa_pid", PID_MAUSB, mausb_pkt_handle); - dissector_add_uint("udp.port", mausb_udp_port_pref, mausb_pkt_handle); + dissector_add_uint_range_with_preference("tcp.port", "", mausb_tcp_handle); + dissector_add_for_decode_as_with_preference("udp.port", mausb_pkt_handle); } /* |