aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-idmp.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-10-07 16:25:01 -0400
committerMichael Mann <mmann78@netscape.net>2016-10-08 02:44:53 +0000
commit268841f3e00b7cf0f16c81dd2b3b952172130b8b (patch)
tree359e01cf5eba83308760531888713fe0ff0bc10b /epan/dissectors/packet-idmp.c
parent11d3224142c0531879fb8e415daf9639a4eace66 (diff)
Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-idmp.c')
-rw-r--r--epan/dissectors/packet-idmp.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/epan/dissectors/packet-idmp.c b/epan/dissectors/packet-idmp.c
index e5bd4cb574..bf0816559b 100644
--- a/epan/dissectors/packet-idmp.c
+++ b/epan/dissectors/packet-idmp.c
@@ -55,13 +55,11 @@
void proto_register_idmp(void);
void proto_reg_handoff_idm(void);
-static void prefs_register_idmp(void); /* forward declaration for use in preferences registration */
void register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name);
static gboolean idmp_desegment = TRUE;
-static guint global_idmp_tcp_port = 1102; /* made up for now */
+#define IDMP_TCP_PORT 1102 /* made up for now - not IANA registered */
static gboolean idmp_reassemble = TRUE;
-static guint tcp_port = 0;
static dissector_handle_t idmp_handle = NULL;
static proto_tree *top_tree = NULL;
@@ -173,7 +171,7 @@ static int hf_idmp_present = -1; /* INTEGER */
static int hf_idmp_absent = -1; /* NULL */
/*--- End of included file: packet-idmp-hf.c ---*/
-#line 132 "./asn1/idmp/packet-idmp-template.c"
+#line 130 "./asn1/idmp/packet-idmp-template.c"
/* Initialize the subtree pointers */
static gint ett_idmp = -1;
@@ -192,7 +190,7 @@ static gint ett_idmp_Code = -1;
static gint ett_idmp_InvokeId = -1;
/*--- End of included file: packet-idmp-ett.c ---*/
-#line 136 "./asn1/idmp/packet-idmp-template.c"
+#line 134 "./asn1/idmp/packet-idmp-template.c"
/*--- Included file: packet-idmp-fn.c ---*/
@@ -620,7 +618,7 @@ dissect_idmp_IDM_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
/*--- End of included file: packet-idmp-fn.c ---*/
-#line 138 "./asn1/idmp/packet-idmp-template.c"
+#line 136 "./asn1/idmp/packet-idmp-template.c"
void
register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name)
@@ -936,7 +934,7 @@ void proto_register_idmp(void)
NULL, HFILL }},
/*--- End of included file: packet-idmp-hfarr.c ---*/
-#line 321 "./asn1/idmp/packet-idmp-template.c"
+#line 319 "./asn1/idmp/packet-idmp-template.c"
};
/* List of subtrees */
@@ -959,7 +957,7 @@ void proto_register_idmp(void)
&ett_idmp_InvokeId,
/*--- End of included file: packet-idmp-ettarr.c ---*/
-#line 329 "./asn1/idmp/packet-idmp-template.c"
+#line 327 "./asn1/idmp/packet-idmp-template.c"
};
module_t *idmp_module;
@@ -977,7 +975,7 @@ void proto_register_idmp(void)
/* Register our configuration options for IDMP, particularly our port */
- idmp_module = prefs_register_protocol_subtree("OSI/X.500", proto_idmp, prefs_register_idmp);
+ idmp_module = prefs_register_protocol_subtree("OSI/X.500", proto_idmp, NULL);
prefs_register_bool_preference(idmp_module, "desegment_idmp_messages",
"Reassemble IDMP messages spanning multiple TCP segments",
@@ -991,33 +989,10 @@ void proto_register_idmp(void)
" To use this option, you must also enable"
" \"Allow subdissectors to reassemble TCP streams\""
" in the TCP protocol settings.", &idmp_reassemble);
-
- prefs_register_uint_preference(idmp_module, "tcp.port", "IDMP TCP Port",
- "Set the port for Internet Directly Mapped Protocol requests/responses",
- 10, &global_idmp_tcp_port);
-
}
/*--- proto_reg_handoff_idm --- */
void proto_reg_handoff_idm(void) {
-
-}
-
-
-static void
-prefs_register_idmp(void)
-{
-
- /* de-register the old port */
- /* port 102 is registered by TPKT - don't undo this! */
- if(idmp_handle)
- dissector_delete_uint("tcp.port", tcp_port, idmp_handle);
-
- /* Set our port number for future use */
- tcp_port = global_idmp_tcp_port;
-
- if((tcp_port > 0) && idmp_handle)
- dissector_add_uint("tcp.port", global_idmp_tcp_port, idmp_handle);
-
+ dissector_add_uint_with_preference("tcp.port", IDMP_TCP_PORT, idmp_handle);
}