aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtp.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2020-06-07 16:15:49 -0400
committerAnders Broman <a.broman58@gmail.com>2020-06-12 06:06:21 +0000
commit18ffd52e8edb219717e7b530b3fe73451f1f1600 (patch)
treecd198b9ab857d6b64b3673eebf279a11c0aa557b /epan/dissectors/packet-rtp.c
parenteddfa0f1467b8707630bd0191549b34d06d60509 (diff)
RTP: Make Decode As handling consistent across subdissectors
RTP has two dissector tables, one directly associated with payload types, and one which is associated with strings that appear in SDP commands. This makes all dissectors that are registered as a dynamic payload type that can be configured by SDP appear as a Decode As option for the RTP PT table. Some protocols were registered in the table for configuration by SDP but had no way to register with the rtp.pt table. These include EVRC, H.223, and v150fw. Other protocols had a long standing preference to set a dynamic payload type, but they still did not appear in the Decode As menu unless that preference was changed from the default, largely because of the way that the preference was not actually registered with the rtp.pt table unless it had a value in the dynamic payload type range. These include EVS, H.263P, H.264, H.265, ISMACryp, IuUP, LAPD, MP4V-ES, RTP-MIDI, and VP8. RFC 3551 says that not just the dynamic payload types, but also the unassigned and even the statically assigned payload types MAY be dynamically reassigned as necessary, so this patch also allows these preferences to be set for payload types less than 96. The only payload type not allowed is 0 (which RFCs 3551 and 7007 say must be μ-law PCM), which is handy anyone for backwards compatibility with preferences that used to be uints (where 0 meant disabled.) All protcols which formerly used a uint preference are all converted to a range preference, and the text is changed to be similar for each. This works in a backwards compatible fashion, and any defaults are maintained. The patch also adds some of the dissector variants as PINOs so that they will show up with distinct names in the Decode As menus, and changes some of the protocol short names so that the entry in Decode As is clearer and matches what is used for other similar protocols. Change-Id: I68627b5c3e495d9fc813d88208f3b62e47e0c4de Reviewed-on: https://code.wireshark.org/review/37396 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-rtp.c')
-rw-r--r--epan/dissectors/packet-rtp.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c
index 7e8029bd1d..404f51378e 100644
--- a/epan/dissectors/packet-rtp.c
+++ b/epan/dissectors/packet-rtp.c
@@ -169,6 +169,7 @@ static int proto_sdp = -1;
/* RTP header fields */
static int proto_rtp = -1;
+static int proto_rtp_rfc2198 = -1;
static int hf_rtp_version = -1;
static int hf_rtp_padding = -1;
static int hf_rtp_extension = -1;
@@ -267,7 +268,8 @@ static gboolean global_rtp_show_setup_info = TRUE;
static gboolean desegment_rtp = TRUE;
/* RFC2198 Redundant Audio Data */
-static guint rtp_rfc2198_pt = 99;
+#define RFC2198_DEFAULT_PT_RANGE "99"
+static range_t *rtp_rfc2198_pt_range = NULL;
/* Proto data key values */
#define RTP_CONVERSATION_PROTO_DATA 0
@@ -3183,6 +3185,8 @@ proto_register_rtp(void)
expert_module_t *expert_rtp;
proto_rtp = proto_register_protocol("Real-Time Transport Protocol", "RTP", "rtp");
+ proto_rtp_rfc2198 = proto_register_protocol_in_name_only("RTP Payload for Redundant Audio Data (RFC 2198)",
+ "RAD (RFC2198)", "rtp_rfc2198", proto_rtp, FT_PROTOCOL);
proto_register_field_array(proto_rtp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@@ -3190,7 +3194,7 @@ proto_register_rtp(void)
expert_register_field_array(expert_rtp, ei, array_length(ei));
rtp_handle = register_dissector("rtp", dissect_rtp, proto_rtp);
- rtp_rfc2198_handle = register_dissector("rtp.rfc2198", dissect_rtp_rfc2198, proto_rtp);
+ rtp_rfc2198_handle = register_dissector("rtp.rfc2198", dissect_rtp_rfc2198, proto_rtp_rfc2198);
rtp_rfc4571_handle = register_dissector("rtp.rfc4571", dissect_rtp_rfc4571, proto_rtp);
rtp_tap = register_tap("rtp");
@@ -3227,11 +3231,12 @@ proto_register_rtp(void)
"an invalid or ZRTP packet, a CLASSIC-STUN packet, or a T.38 packet",
&global_rtp_version0_type,
rtp_version0_types, FALSE);
- prefs_register_uint_preference(rtp_module,
- "rfc2198_payload_type", "Payload Type for RFC2198",
- "Payload Type for RFC2198 Redundant Audio Data",
- 10,
- &rtp_rfc2198_pt);
+ range_convert_str(wmem_epan_scope(), &rtp_rfc2198_pt_range, RFC2198_DEFAULT_PT_RANGE, 127);
+ prefs_register_range_preference(rtp_module,
+ "rfc2198_payload_type", "Payload Types for RFC2198",
+ "Payload Types for RFC2198 Redundant Audio Data"
+ "; values must be in the range 1-127",
+ &rtp_rfc2198_pt_range, 127);
reassembly_table_register(&rtp_reassembly_table,
&addresses_reassembly_table_functions);
@@ -3244,7 +3249,7 @@ void
proto_reg_handoff_rtp(void)
{
static gboolean rtp_prefs_initialized = FALSE;
- static guint rtp_saved_rfc2198_pt;
+ static range_t *rtp_saved_rfc2198_pt_range = NULL;
if (!rtp_prefs_initialized) {
@@ -3276,15 +3281,18 @@ proto_reg_handoff_rtp(void)
sbc_handle = find_dissector_add_dependency("sbc", proto_rtp);
dissector_add_string("rtp_dyn_payload_type", "v150fw", v150fw_handle);
+ dissector_add_for_decode_as("rtp.pt", v150fw_handle);
dissector_add_for_decode_as("btl2cap.cid", rtp_handle);
rtp_prefs_initialized = TRUE;
} else {
- dissector_delete_uint("rtp.pt", rtp_saved_rfc2198_pt, rtp_rfc2198_handle);
+ dissector_delete_uint_range("rtp.pt", rtp_saved_rfc2198_pt_range, rtp_rfc2198_handle);
+ wmem_free(wmem_epan_scope(), rtp_saved_rfc2198_pt_range);
}
- dissector_add_uint("rtp.pt", rtp_rfc2198_pt, rtp_rfc2198_handle);
- rtp_saved_rfc2198_pt = rtp_rfc2198_pt;
+ rtp_saved_rfc2198_pt_range = range_copy(wmem_epan_scope(), rtp_rfc2198_pt_range);
+ range_remove_value(wmem_epan_scope(), &rtp_saved_rfc2198_pt_range, 0);
+ dissector_add_uint_range("rtp.pt", rtp_saved_rfc2198_pt_range, rtp_rfc2198_handle);
proto_sdp = proto_get_id_by_filter_name("sdp");
}