aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-h501.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-10-05 16:33:54 -0400
committerMichael Mann <mmann78@netscape.net>2016-10-13 02:51:18 +0000
commit2eb7b05b8c9c6408268f0d1e81f0a18a02610f1c (patch)
treebd0a909e3d506ea2e61c446aa8a809b6f728af3b /epan/dissectors/packet-h501.c
parent4d8581d7e15fe4a80a53496b83a853271fc674b6 (diff)
Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67, convert dissectors that use "udp.port". More cleanup done on dissectors that use both TCP and UDP dissector tables, so that less preference callbacks exist. Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3 Reviewed-on: https://code.wireshark.org/review/18120 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-h501.c')
-rw-r--r--epan/dissectors/packet-h501.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/epan/dissectors/packet-h501.c b/epan/dissectors/packet-h501.c
index 61b525de72..b824cd9a61 100644
--- a/epan/dissectors/packet-h501.c
+++ b/epan/dissectors/packet-h501.c
@@ -418,8 +418,7 @@ static gint ett_h501_TerminationCause = -1;
static dissector_handle_t h501_pdu_handle;
/* Preferences */
-#define H501_TCP_PORT 2099
-static guint h501_udp_port = 2099;
+#define H501_PORT 2099
static gboolean h501_desegment_tcp = TRUE;
void proto_reg_handoff_h501(void);
@@ -2514,7 +2513,7 @@ static int dissect_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
/*--- End of included file: packet-h501-fn.c ---*/
-#line 61 "./asn1/h501/packet-h501-template.c"
+#line 60 "./asn1/h501/packet-h501-template.c"
static int
dissect_h501_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -3555,7 +3554,7 @@ void proto_register_h501(void) {
"INTEGER_1_65535", HFILL }},
/*--- End of included file: packet-h501-hfarr.c ---*/
-#line 97 "./asn1/h501/packet-h501-template.c"
+#line 96 "./asn1/h501/packet-h501-template.c"
};
/* List of subtrees */
@@ -3665,7 +3664,7 @@ void proto_register_h501(void) {
&ett_h501_TerminationCause,
/*--- End of included file: packet-h501-ettarr.c ---*/
-#line 103 "./asn1/h501/packet-h501-template.c"
+#line 102 "./asn1/h501/packet-h501-template.c"
};
/* Register protocol */
@@ -3677,11 +3676,7 @@ void proto_register_h501(void) {
h501_pdu_handle = register_dissector(PFNAME, dissect_h501_pdu, proto_h501);
- h501_module = prefs_register_protocol(proto_h501, proto_reg_handoff_h501);
- prefs_register_uint_preference(h501_module, "udp.port",
- "UDP port",
- "Port to be decoded as h501",
- 10, &h501_udp_port);
+ h501_module = prefs_register_protocol(proto_h501, NULL);
prefs_register_bool_preference(h501_module, "desegment",
"Desegment H.501 over TCP",
"Desegment H.501 messages that span more TCP segments",
@@ -3692,23 +3687,12 @@ void proto_register_h501(void) {
/*--- proto_reg_handoff_h501 -------------------------------------------*/
void proto_reg_handoff_h501(void)
{
- static gboolean h501_prefs_initialized = FALSE;
- static dissector_handle_t h501_udp_handle;
- static dissector_handle_t h501_tcp_handle;
- static guint saved_h501_udp_port;
-
- if (!h501_prefs_initialized) {
- h501_udp_handle = create_dissector_handle(dissect_h501_udp, proto_h501);
- h501_tcp_handle = create_dissector_handle(dissect_h501_tcp, proto_h501);
- dissector_add_uint_with_preference("tcp.port", H501_TCP_PORT, h501_tcp_handle);
- h501_prefs_initialized = TRUE;
- } else {
- dissector_delete_uint("udp.port", saved_h501_udp_port, h501_udp_handle);
- }
-
- /* Set our port number for future use */
- saved_h501_udp_port = h501_udp_port;
- dissector_add_uint("udp.port", saved_h501_udp_port, h501_udp_handle);
+ dissector_handle_t h501_udp_handle;
+ dissector_handle_t h501_tcp_handle;
+ h501_udp_handle = create_dissector_handle(dissect_h501_udp, proto_h501);
+ h501_tcp_handle = create_dissector_handle(dissect_h501_tcp, proto_h501);
+ dissector_add_uint_with_preference("tcp.port", H501_PORT, h501_tcp_handle);
+ dissector_add_uint_with_preference("udp.port", H501_PORT, h501_udp_handle);
}