aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtpproxy.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-rtpproxy.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-rtpproxy.c')
-rw-r--r--epan/dissectors/packet-rtpproxy.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c
index fb4002678f..3600e56d9a 100644
--- a/epan/dissectors/packet-rtpproxy.c
+++ b/epan/dissectors/packet-rtpproxy.c
@@ -276,8 +276,8 @@ static gint ett_rtpproxy_reply = -1;
static gint ett_rtpproxy_ng_bencode = -1;
/* Default values */
-static guint rtpproxy_tcp_port = 22222;
-static guint rtpproxy_udp_port = 22222;
+#define RTPPROXY_PORT 22222 /* Not IANA registered */
+static guint rtpproxy_udp_port = RTPPROXY_PORT;
static gboolean rtpproxy_establish_conversation = TRUE;
/* See - https://www.opensips.org/html/docs/modules/1.10.x/rtpproxy.html#id293555 */
/* See - http://www.kamailio.org/docs/modules/4.3.x/modules/rtpproxy.html#idp15794952 */
@@ -1454,12 +1454,6 @@ proto_register_rtpproxy(void)
rtpproxy_module = prefs_register_protocol(proto_rtpproxy, proto_reg_handoff_rtpproxy);
- prefs_register_uint_preference(rtpproxy_module, "tcp.port",
- "RTPproxy TCP Port", /* Title */
- "RTPproxy TCP Port", /* Descr */
- 10,
- &rtpproxy_tcp_port);
-
prefs_register_uint_preference(rtpproxy_module, "udp.port",
"RTPproxy UDP Port", /* Title */
"RTPproxy UDP Port", /* Descr */
@@ -1482,7 +1476,6 @@ proto_register_rtpproxy(void)
void
proto_reg_handoff_rtpproxy(void)
{
- static guint old_rtpproxy_tcp_port = 0;
static guint old_rtpproxy_udp_port = 0;
static gboolean rtpproxy_initialized = FALSE;
@@ -1492,16 +1485,12 @@ proto_reg_handoff_rtpproxy(void)
if(!rtpproxy_initialized){
rtpproxy_tcp_handle = create_dissector_handle(dissect_rtpproxy, proto_rtpproxy);
rtpproxy_udp_handle = create_dissector_handle(dissect_rtpproxy, proto_rtpproxy);
+
+ /* Register TCP port for dissection */
+ dissector_add_uint_with_preference("tcp.port", RTPPROXY_PORT, rtpproxy_tcp_handle);
rtpproxy_initialized = TRUE;
}
- /* Register TCP port for dissection */
- if(old_rtpproxy_tcp_port != 0 && old_rtpproxy_tcp_port != rtpproxy_tcp_port)
- dissector_delete_uint("tcp.port", old_rtpproxy_tcp_port, rtpproxy_tcp_handle);
- if(rtpproxy_tcp_port != 0 && old_rtpproxy_tcp_port != rtpproxy_tcp_port)
- dissector_add_uint("tcp.port", rtpproxy_tcp_port, rtpproxy_tcp_handle);
- old_rtpproxy_tcp_port = rtpproxy_tcp_port;
-
/* Register UDP port for dissection */
if(old_rtpproxy_udp_port != 0 && old_rtpproxy_udp_port != rtpproxy_udp_port)
dissector_delete_uint("udp.port", old_rtpproxy_udp_port, rtpproxy_udp_handle);