summaryrefslogtreecommitdiff
path: root/epan/dissectors/asn1/ulp
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/asn1/ulp
parent11d3224142c0531879fb8e415daf9639a4eace66 (diff)
downloadwireshark-268841f3e00b7cf0f16c81dd2b3b952172130b8b.tar.gz
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/asn1/ulp')
-rw-r--r--epan/dissectors/asn1/ulp/packet-ulp-template.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/epan/dissectors/asn1/ulp/packet-ulp-template.c b/epan/dissectors/asn1/ulp/packet-ulp-template.c
index 6a8ab185fc..4861779d73 100644
--- a/epan/dissectors/asn1/ulp/packet-ulp-template.c
+++ b/epan/dissectors/asn1/ulp/packet-ulp-template.c
@@ -51,8 +51,8 @@ static dissector_handle_t lpp_handle;
* oma-ulp 7275/tcp OMA UserPlane Location
* oma-ulp 7275/udp OMA UserPlane Location
*/
-static guint gbl_ulp_tcp_port = 7275;
-static guint gbl_ulp_udp_port = 7275;
+#define ULP_PORT 7275
+static guint gbl_ulp_udp_port = ULP_PORT;
/* Initialize the protocol and registered fields */
static int proto_ulp = -1;
@@ -428,11 +428,6 @@ void proto_register_ulp(void) {
&ulp_desegment);
/* Register a configuration option for port */
- prefs_register_uint_preference(ulp_module, "tcp.port",
- "ULP TCP Port",
- "Set the TCP port for ULP messages (IANA registered port is 7275)",
- 10,
- &gbl_ulp_tcp_port);
prefs_register_uint_preference(ulp_module, "udp.port",
"ULP UDP Port",
"Set the UDP port for ULP messages (IANA registered port is 7275)",
@@ -448,7 +443,7 @@ proto_reg_handoff_ulp(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t ulp_udp_handle;
- static guint local_ulp_tcp_port, local_ulp_udp_port;
+ static guint local_ulp_udp_port;
if (!initialized) {
dissector_add_string("media_type","application/oma-supl-ulp", ulp_tcp_handle);
@@ -456,14 +451,12 @@ proto_reg_handoff_ulp(void)
ulp_udp_handle = create_dissector_handle(dissect_ULP_PDU_PDU, proto_ulp);
rrlp_handle = find_dissector_add_dependency("rrlp", proto_ulp);
lpp_handle = find_dissector_add_dependency("lpp", proto_ulp);
+ dissector_add_uint_with_preference("tcp.port", ULP_PORT, ulp_tcp_handle);
initialized = TRUE;
} else {
- dissector_delete_uint("tcp.port", local_ulp_tcp_port, ulp_tcp_handle);
dissector_delete_uint("udp.port", local_ulp_udp_port, ulp_udp_handle);
}
- local_ulp_tcp_port = gbl_ulp_tcp_port;
- dissector_add_uint("tcp.port", gbl_ulp_tcp_port, ulp_tcp_handle);
local_ulp_udp_port = gbl_ulp_udp_port;
dissector_add_uint("udp.port", gbl_ulp_udp_port, ulp_udp_handle);
}