summaryrefslogtreecommitdiff
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/README.dissector72
-rw-r--r--doc/packet-PROTOABBREV.c2
2 files changed, 34 insertions, 40 deletions
diff --git a/doc/README.dissector b/doc/README.dissector
index e15ca6e26c..68a83cc0f3 100644
--- a/doc/README.dissector
+++ b/doc/README.dissector
@@ -3028,31 +3028,29 @@ Where: module - Returned by the prefs_register_protocol routine
These functions are declared in <epan/prefs.h>.
-An example from packet-beep.c -
+An example from packet-rtpproxy.c -
- proto_beep = proto_register_protocol("Blocks Extensible Exchange Protocol",
- "BEEP", "beep");
+ proto_rtpproxy = proto_register_protocol ( "Sippy RTPproxy Protocol", "RTPproxy", "rtpproxy");
...
- /* Register our configuration options for BEEP, particularly our port */
+ rtpproxy_module = prefs_register_protocol(proto_rtpproxy, proto_reg_handoff_rtpproxy);
- beep_module = prefs_register_protocol(proto_beep, proto_reg_handoff_beep);
+ prefs_register_bool_preference(rtpproxy_module, "establish_conversation",
+ "Establish Media Conversation",
+ "Specifies that RTP/RTCP/T.38/MSRP/etc streams are decoded based "
+ "upon port numbers found in RTPproxy answers",
+ &rtpproxy_establish_conversation);
- prefs_register_uint_preference(beep_module, "tcp.port", "BEEP TCP Port",
- "Set the port for BEEP messages (if other"
- " than the default of 10288)",
- 10, &global_beep_tcp_port);
+ prefs_register_uint_preference(rtpproxy_module, "reply.timeout",
+ "RTPproxy reply timeout", /* Title */
+ "Maximum timeout value in waiting for reply from RTPProxy (in milliseconds).", /* Descr */
+ 10,
+ &rtpproxy_timeout);
- prefs_register_bool_preference(beep_module, "strict_header_terminator",
- "BEEP Header Requires CRLF",
- "Specifies that BEEP requires CRLF as a "
- "terminator, and not just CR or LF",
- &global_beep_strict_term);
-
-This will create preferences "beep.tcp.port" and
-"beep.strict_header_terminator", the first of which is an unsigned
-integer and the second of which is a Boolean.
+This will create preferences "rtpproxy.establish_conversation" and
+"rtpproxy.reply.timeout", the first of which is an Boolean and the
+second of which is a unsigned integer.
Note that a warning will pop up if you've saved such preference to the
preference file and you subsequently take the code out. The way to make
@@ -3086,36 +3084,32 @@ example, stolen from packet-dns.c:
#include "packet-tcp.h"
- dissector_handle_t dns_udp_handle;
- dissector_handle_t dns_tcp_handle;
- dissector_handle_t mdns_udp_handle;
+ dissector_handle_t hartip_tcp_handle;
+ dissector_handle_t hartip_udp_handle;
- dns_udp_handle = create_dissector_handle(dissect_dns_udp,
- proto_dns);
- dns_tcp_handle = create_dissector_handle(dissect_dns_tcp,
- proto_dns);
- mdns_udp_handle = create_dissector_handle(dissect_mdns_udp,
- proto_dns);
+ hartip_tcp_handle = create_dissector_handle(dissect_hartip_tcp, proto_hartip);
+ hartip_udp_handle = create_dissector_handle(dissect_hartip_udp, proto_hartip);
- dissector_add_uint("udp.port", UDP_PORT_DNS, dns_udp_handle);
- dissector_add_uint("tcp.port", TCP_PORT_DNS, dns_tcp_handle);
- dissector_add_uint("udp.port", UDP_PORT_MDNS, mdns_udp_handle);
- dissector_add_uint("tcp.port", TCP_PORT_MDNS, dns_tcp_handle);
+ dissector_add_uint("udp.port", HARTIP_PORT, hartip_udp_handle);
+ dissector_add_uint_with_preference("tcp.port", HARTIP_PORT, hartip_tcp_handle);
-The dissect_dns_udp function does very little work and calls
-dissect_dns_common, while dissect_dns_tcp calls tcp_dissect_pdus with a
+The dissect_hartip_udp function does very little work and calls
+dissect_hartip_common, while dissect_hartip_tcp calls tcp_dissect_pdus with a
reference to a callback which will be called with reassembled data:
static int
- dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- void *data _U_)
+ dissect_hartip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ void *data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, dns_desegment, 2,
- get_dns_pdu_len, dissect_dns_tcp_pdu, data);
- return tvb_captured_length(tvb);
+ if (!tvb_bytes_exist(tvb, 0, HARTIP_HEADER_LENGTH))
+ return 0;
+
+ tcp_dissect_pdus(tvb, pinfo, tree, hartip_desegment, HARTIP_HEADER_LENGTH,
+ get_dissect_hartip_len, dissect_hartip_pdu, data);
+ return tvb_reported_length(tvb);
}
-(The dissect_dns_tcp_pdu function acts similarly to dissect_dns_udp.)
+(The dissect_hartip_pdu function acts similarly to dissect_hartip_udp.)
The arguments to tcp_dissect_pdus are:
the tvbuff pointer, packet_info pointer, and proto_tree pointer
diff --git a/doc/packet-PROTOABBREV.c b/doc/packet-PROTOABBREV.c
index eee649d712..52a38890cb 100644
--- a/doc/packet-PROTOABBREV.c
+++ b/doc/packet-PROTOABBREV.c
@@ -342,7 +342,7 @@ proto_reg_handoff_PROTOABBREV(void)
*/
PROTOABBREV_handle = create_dissector_handle(dissect_PROTOABBREV,
proto_PROTOABBREV);
- dissector_add_uint("tcp.port", PROTOABBREV_TCP_PORT, PROTOABBREV_handle);
+ dissector_add_uint_with_preference("tcp.port", PROTOABBREV_TCP_PORT, PROTOABBREV_handle);
}
#endif