aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lapd.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-lapd.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-lapd.c')
-rw-r--r--epan/dissectors/packet-lapd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c
index b087ba0494..414de55e97 100644
--- a/epan/dissectors/packet-lapd.c
+++ b/epan/dissectors/packet-lapd.c
@@ -69,7 +69,7 @@ static gint ett_lapd_address = -1;
static gint ett_lapd_control = -1;
static gint ett_lapd_checksum = -1;
-static guint pref_lapd_rtp_payload_type = 0;
+static range_t *pref_lapd_rtp_payload_type_range = NULL;
static guint pref_lapd_sctp_ppi = 0;
static expert_field ei_lapd_abort = EI_INIT;
@@ -706,11 +706,11 @@ proto_register_lapd(void)
"Use GSM SAPI values",
"Use SAPI values as specified in TS 48 056",
&global_lapd_gsm_sapis);
- prefs_register_uint_preference(lapd_module, "rtp_payload_type",
- "RTP payload type for embedded LAPD",
- "RTP payload type for embedded LAPD. It must be one of the dynamic types "
- "from 96 to 127. Set it to 0 to disable.",
- 10, &pref_lapd_rtp_payload_type);
+ prefs_register_range_preference(lapd_module, "rtp_payload_type",
+ "RTP payload types for embedded LAPD",
+ "RTP payload types for embedded LAPD"
+ "; values must be in the range 1 - 127",
+ &pref_lapd_rtp_payload_type_range, 127);
prefs_register_uint_preference(lapd_module, "sctp_payload_protocol_identifier",
"SCTP Payload Protocol Identifier for LAPD",
"SCTP Payload Protocol Identifier for LAPD. It is a "
@@ -722,7 +722,7 @@ void
proto_reg_handoff_lapd(void)
{
static gboolean init = FALSE;
- static guint lapd_rtp_payload_type;
+ static range_t* lapd_rtp_payload_type_range = NULL;
static guint lapd_sctp_ppi;
if (!init) {
@@ -736,16 +736,16 @@ proto_reg_handoff_lapd(void)
init = TRUE;
} else {
- if ((lapd_rtp_payload_type > 95) && (lapd_rtp_payload_type < 128))
- dissector_delete_uint("rtp.pt", lapd_rtp_payload_type, lapd_bitstream_handle);
+ dissector_delete_uint_range("rtp.pt", lapd_rtp_payload_type_range, lapd_bitstream_handle);
+ wmem_free(wmem_epan_scope(), lapd_rtp_payload_type_range);
if (lapd_sctp_ppi > 0)
dissector_delete_uint("sctp.ppi", lapd_sctp_ppi, lapd_handle);
}
- lapd_rtp_payload_type = pref_lapd_rtp_payload_type;
- if ((lapd_rtp_payload_type > 95) && (lapd_rtp_payload_type < 128))
- dissector_add_uint("rtp.pt", lapd_rtp_payload_type, lapd_bitstream_handle);
+ lapd_rtp_payload_type_range = range_copy(wmem_epan_scope(), pref_lapd_rtp_payload_type_range);
+ range_remove_value(wmem_epan_scope(), &lapd_rtp_payload_type_range, 0);
+ dissector_add_uint_range("rtp.pt", lapd_rtp_payload_type_range, lapd_bitstream_handle);
lapd_sctp_ppi = pref_lapd_sctp_ppi;
if (lapd_sctp_ppi > 0)