aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ilp.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-ilp.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-ilp.c')
-rw-r--r--epan/dissectors/packet-ilp.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/epan/dissectors/packet-ilp.c b/epan/dissectors/packet-ilp.c
index 868285c3a7..44516691a5 100644
--- a/epan/dissectors/packet-ilp.c
+++ b/epan/dissectors/packet-ilp.c
@@ -58,7 +58,7 @@ static dissector_handle_t ilp_handle;
/* IANA Registered Ports
* oma-ilp 7276/tcp OMA Internal Location
*/
-static guint gbl_ilp_port = 7276;
+#define ILP_TCP_PORT 7276
/* Initialize the protocol and registered fields */
static int proto_ilp = -1;
@@ -5863,21 +5863,13 @@ void proto_register_ilp(void) {
proto_register_field_array(proto_ilp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- ilp_module = prefs_register_protocol(proto_ilp,proto_reg_handoff_ilp);
+ ilp_module = prefs_register_protocol(proto_ilp, NULL);
prefs_register_bool_preference(ilp_module, "desegment_ilp_messages",
"Reassemble ILP messages spanning multiple TCP segments",
"Whether the ILP dissector should reassemble messages spanning multiple TCP segments."
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&ilp_desegment);
-
- /* Register a configuration option for port */
- prefs_register_uint_preference(ilp_module, "tcp.port",
- "ILP TCP Port",
- "Set the TCP port for ILP messages(IANA registered port is 7276)",
- 10,
- &gbl_ilp_port);
-
}
@@ -5885,18 +5877,9 @@ void proto_register_ilp(void) {
void
proto_reg_handoff_ilp(void)
{
- static gboolean initialized = FALSE;
- static guint local_ilp_port;
-
- if (!initialized) {
- dissector_add_string("media_type","application/oma-supl-ilp", ilp_handle);
- rrlp_handle = find_dissector_add_dependency("rrlp", proto_ilp);
- lpp_handle = find_dissector_add_dependency("lpp", proto_ilp);
- initialized = TRUE;
- } else {
- dissector_delete_uint("tcp.port", local_ilp_port, ilp_handle);
- }
+ dissector_add_string("media_type","application/oma-supl-ilp", ilp_handle);
+ rrlp_handle = find_dissector_add_dependency("rrlp", proto_ilp);
+ lpp_handle = find_dissector_add_dependency("lpp", proto_ilp);
- local_ilp_port = gbl_ilp_port;
- dissector_add_uint("tcp.port", gbl_ilp_port, ilp_handle);
+ dissector_add_uint_with_preference("tcp.port", ILP_TCP_PORT, ilp_handle);
}