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>
This commit is contained in:
John Thacker 2020-06-07 16:15:49 -04:00 committed by Anders Broman
parent eddfa0f146
commit 18ffd52e8e
18 changed files with 220 additions and 215 deletions

View File

@ -79,7 +79,6 @@ static expert_field ei_amr_padding_bits_correct = EI_INIT;
static expert_field ei_amr_reserved = EI_INIT;
/* The dynamic payload types which will be dissected as AMR */
#define AMR_DEFAULT_DYN_PT_RANGE "0"
static range_t *global_amr_dynamic_payload_types;
static range_t *global_amr_wb_dynamic_payload_types;
static gint amr_encoding_type = 0;
@ -790,14 +789,14 @@ proto_register_amr(void)
prefs_register_range_preference(amr_module, "dynamic.payload.type",
"AMR dynamic payload types",
"The dynamic payload types which will be interpreted as AMR"
"(default " AMR_DEFAULT_DYN_PT_RANGE ")",
"Dynamic payload types which will be interpreted as AMR"
"; values must be in the range 1 - 127",
&global_amr_dynamic_payload_types, 127);
prefs_register_range_preference(amr_module, "wb.dynamic.payload.type",
"AMR-WB dynamic payload types",
"The dynamic payload types which will be interpreted as AMR-WB"
"(default " AMR_DEFAULT_DYN_PT_RANGE ")",
"Dynamic payload types which will be interpreted as AMR-WB"
"; values must be in the range 1-127",
&global_amr_wb_dynamic_payload_types, 127);
prefs_register_enum_preference(amr_module, "encoding.version",
@ -853,17 +852,17 @@ proto_reg_handoff_amr(void)
} else {
dissector_delete_uint_range("rtp.pt", amr_dynamic_payload_types, amr_handle);
dissector_delete_uint_range("rtp.pt", amr_wb_dynamic_payload_types, amr_wb_handle);
wmem_free(wmem_epan_scope(), amr_dynamic_payload_types);
wmem_free(wmem_epan_scope(), amr_wb_dynamic_payload_types);
}
amr_dynamic_payload_types = range_copy(wmem_epan_scope(), global_amr_dynamic_payload_types);
amr_wb_dynamic_payload_types = range_copy(wmem_epan_scope(), global_amr_wb_dynamic_payload_types);
if(!value_is_in_range(amr_dynamic_payload_types, 0)){
dissector_add_uint_range("rtp.pt", amr_dynamic_payload_types, amr_handle);
}
if (!value_is_in_range(amr_wb_dynamic_payload_types, 0)) {
dissector_add_uint_range("rtp.pt", amr_wb_dynamic_payload_types, amr_wb_handle);
}
range_remove_value(wmem_epan_scope(), &amr_dynamic_payload_types, 0);
dissector_add_uint_range("rtp.pt", amr_dynamic_payload_types, amr_handle);
range_remove_value(wmem_epan_scope(), &amr_wb_dynamic_payload_types, 0);
dissector_add_uint_range("rtp.pt", amr_wb_dynamic_payload_types, amr_wb_handle);
}
/*

View File

@ -147,6 +147,11 @@ evrc_variant_t;
/* Initialize the protocol and registered fields */
static int proto_evrc = -1;
static int proto_evrcb = -1;
static int proto_evrcwb = -1;
static int proto_evrcnw = -1;
static int proto_evrcnw2k = -1;
static int proto_evrc_legacy = -1;
static int hf_evrc_reserved = -1;
static int hf_evrc_reserved_2k = -1;
@ -570,6 +575,21 @@ proto_register_evrc(void)
proto_evrc =
proto_register_protocol("Enhanced Variable Rate Codec", "EVRC", "evrc");
proto_evrcb =
proto_register_protocol_in_name_only("Enhanced Variable Rate Codec B",
"EVRC-B", "evrcb", proto_evrc, FT_PROTOCOL);
proto_evrcwb =
proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Wideband",
"EVRC-WB", "evrcwb", proto_evrc, FT_PROTOCOL);
proto_evrcnw =
proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Narrowband-Wideband",
"EVRC-NW", "evrcnw", proto_evrc, FT_PROTOCOL);
proto_evrcnw2k =
proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Narrowband-Wideband plus 2kpbs",
"EVRC-NW2K", "evrcnw2k", proto_evrc, FT_PROTOCOL);
proto_evrc_legacy =
proto_register_protocol_in_name_only("Enhanced Variable Rate Codec (Legacy Encapsulation)",
"EVRC (Legacy)", "evrc_legacy", proto_evrc, FT_PROTOCOL);
proto_register_field_array(proto_evrc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@ -606,11 +626,11 @@ proto_reg_handoff_evrc(void)
dissector_handle_t evrcnw2k_handle;
evrc_handle = create_dissector_handle(dissect_evrc, proto_evrc);
evrcb_handle = create_dissector_handle(dissect_evrcb, proto_evrc);
evrcwb_handle = create_dissector_handle(dissect_evrcwb, proto_evrc);
evrcnw_handle = create_dissector_handle(dissect_evrcnw, proto_evrc);
evrcnw2k_handle = create_dissector_handle(dissect_evrcnw2k, proto_evrc);
evrc_legacy_handle = create_dissector_handle(dissect_evrc_legacy, proto_evrc);
evrcb_handle = create_dissector_handle(dissect_evrcb, proto_evrcb);
evrcwb_handle = create_dissector_handle(dissect_evrcwb, proto_evrcwb);
evrcnw_handle = create_dissector_handle(dissect_evrcnw, proto_evrcnw);
evrcnw2k_handle = create_dissector_handle(dissect_evrcnw2k, proto_evrcnw2k);
evrc_legacy_handle = create_dissector_handle(dissect_evrc_legacy, proto_evrc_legacy);
/* header-full mime types */
dissector_add_string("rtp_dyn_payload_type", "EVRC", evrc_handle);
@ -619,6 +639,14 @@ proto_reg_handoff_evrc(void)
dissector_add_string("rtp_dyn_payload_type", "EVRCNW", evrcnw_handle);
dissector_add_string("rtp_dyn_payload_type", "EVRCNW2K", evrcnw2k_handle);
dissector_add_for_decode_as("rtp.pt", evrc_handle);
dissector_add_for_decode_as("rtp.pt", evrcb_handle);
dissector_add_for_decode_as("rtp.pt", evrcwb_handle);
dissector_add_for_decode_as("rtp.pt", evrcnw_handle);
dissector_add_for_decode_as("rtp.pt", evrcnw2k_handle);
/* Since the draft legacy encapsulation only appears on PT 60, not
* adding it to decode as */
/* dissector_add_for_decode_as("rtp.pt", evrc_legacy_handle); */
evrc_prefs_initialized = TRUE;
}
else

View File

@ -59,8 +59,8 @@ static int ett_evs_header = -1;
static int ett_evs_speech = -1;
static int ett_evs_voice_data = -1;
/* The dynamic payload type which will be dissected as EVS */
static guint temp_dynamic_payload_type = 0;
/* The dynamic payload type range which will be dissected as EVS */
static range_t *temp_dynamic_payload_type_range = NULL;
static const value_string evs_protected_payload_sizes_value[] = {
{ 48, "EVS Primary SID 2.4" },
@ -905,12 +905,11 @@ proto_register_evs(void)
evs_module = prefs_register_protocol(proto_evs, proto_reg_handoff_evs);
prefs_register_uint_preference(evs_module, "dynamic.payload.type",
"EVS dynamic payload type",
"The dynamic payload type which will be interpreted as EVS"
"; The value must be greater than 95",
10,
&temp_dynamic_payload_type);
prefs_register_range_preference(evs_module, "dynamic.payload.type",
"EVS dynamic payload types",
"Dynamic payload types which will be interpreted as EVS"
"; values must be in the range 1 - 127",
&temp_dynamic_payload_type_range, 127);
evs_handle = register_dissector("evs", dissect_evs, proto_evs);
@ -919,7 +918,7 @@ proto_register_evs(void)
void
proto_reg_handoff_evs(void)
{
static guint dynamic_payload_type;
static range_t *dynamic_payload_type_range = NULL;
static gboolean evs_prefs_initialized = FALSE;
if (!evs_prefs_initialized) {
@ -927,15 +926,14 @@ proto_reg_handoff_evs(void)
evs_prefs_initialized = TRUE;
}
else {
if (dynamic_payload_type > 95)
dissector_delete_uint("rtp.pt", dynamic_payload_type, evs_handle);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, evs_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type = temp_dynamic_payload_type;
dynamic_payload_type_range = range_copy(wmem_epan_scope(), temp_dynamic_payload_type_range);
if (dynamic_payload_type > 95) {
dissector_add_uint("rtp.pt", dynamic_payload_type, evs_handle);
}
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, evs_handle);
}
/*

View File

@ -1629,6 +1629,7 @@ void proto_reg_handoff_h223(void)
dissector_add_for_decode_as_with_preference("tcp.port", create_dissector_handle( dissect_h223, proto_h223));
dissector_add_for_decode_as_with_preference("tcp.port", h223_bitswapped);
dissector_add_string("rtp_dyn_payload_type","CLEARMODE", h223_bitswapped);
dissector_add_for_decode_as("rtp.pt", h223_bitswapped);
dissector_add_uint("iax2.dataformat", AST_DATAFORMAT_H223_H245, create_dissector_handle(dissect_h223_bitswapped_circuit_data, proto_h223_bitswapped));
}

View File

@ -49,9 +49,9 @@ static gint ett_h263P_extra_hdr = -1;
static gint ett_h263P_payload = -1;
static gint ett_h263P_data = -1;
/* The dynamic payload type which will be dissected as H.263-1998/H263-2000 */
/* The dynamic payload type which will be dissected as H.263-1998/H.263-2000 */
static guint temp_dynamic_payload_type = 0;
static range_t *temp_dynamic_payload_type_range = NULL;
static dissector_handle_t h263P_handle;
@ -192,7 +192,7 @@ dissect_h263P( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
void
proto_reg_handoff_h263P(void)
{
static guint dynamic_payload_type;
static range_t *dynamic_payload_type_range;
static gboolean h263P_prefs_initialized = FALSE;
if (!h263P_prefs_initialized) {
@ -201,14 +201,12 @@ proto_reg_handoff_h263P(void)
h263P_prefs_initialized = TRUE;
}
else {
if ( dynamic_payload_type > 95 )
dissector_delete_uint("rtp.pt", dynamic_payload_type, h263P_handle);
}
dynamic_payload_type = temp_dynamic_payload_type;
if ( dynamic_payload_type > 95 ){
dissector_add_uint("rtp.pt", dynamic_payload_type, h263P_handle);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, h263P_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type_range = range_copy(wmem_epan_scope(), temp_dynamic_payload_type_range);
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, h263P_handle);
}
@ -382,20 +380,19 @@ proto_register_h263P(void)
proto_h263P = proto_register_protocol("ITU-T Recommendation H.263 RTP Payload header (RFC4629)",
"H263P", "h263p");
"H.263P", "h263p");
proto_register_field_array(proto_h263P, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
h263P_module = prefs_register_protocol(proto_h263P, proto_reg_handoff_h263P);
prefs_register_uint_preference(h263P_module,
prefs_register_range_preference(h263P_module,
"dynamic.payload.type",
"H263-1998 and H263-2000 dynamic payload type",
"The dynamic payload type which will be interpreted as H264"
"; The value must be greater than 95",
10,
&temp_dynamic_payload_type);
"H.263-1998 and H.263-2000 dynamic payload types",
"Dynamic payload types which will be interpreted as H.263"
"; values must be in the range 1 - 127",
&temp_dynamic_payload_type_range, 127);
h263P_handle = register_dissector("h263P", dissect_h263P, proto_h263P);
}

View File

@ -254,7 +254,6 @@ static dissector_handle_t h264_name_handle;
/* The dynamic payload type range which will be dissected as H.264 */
#define RTP_PT_DEFAULT_RANGE "0"
static range_t *temp_dynamic_payload_type_range = NULL;
static dissector_handle_t h264_handle;
@ -2711,16 +2710,6 @@ dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void*
}
static void range_delete_h264_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if (rtp_pt >= 96 && rtp_pt <= 127)
dissector_delete_uint("rtp.pt", rtp_pt, h264_handle);
}
static void range_add_h264_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if (rtp_pt >= 96 && rtp_pt <= 127)
dissector_add_uint("rtp.pt", rtp_pt, h264_handle);
}
void
proto_register_h264(void)
{
@ -3690,7 +3679,7 @@ proto_register_h264(void)
};
/* Register the protocol name and description */
proto_h264 = proto_register_protocol("H.264","H264", "h264");
proto_h264 = proto_register_protocol("H.264", "H.264", "h264");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_h264, hf, array_length(hf));
@ -3704,9 +3693,9 @@ proto_register_h264(void)
prefs_register_range_preference(h264_module, "dynamic.payload.type",
"H264 dynamic payload types",
"Dynamic payload types which will be interpreted as H264"
"; Values must be in the range 96 - 127",
"H.264 dynamic payload types",
"Dynamic payload types which will be interpreted as H.264"
"; values must be in the range 1 - 127",
&temp_dynamic_payload_type_range, 127);
h264_handle = register_dissector("h264", dissect_h264, proto_h264);
@ -3736,12 +3725,14 @@ proto_reg_handoff_h264(void)
}
h264_prefs_initialized = TRUE;
} else {
range_foreach(dynamic_payload_type_range, range_delete_h264_rtp_pt_callback, NULL);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, h264_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type_range = range_copy(wmem_epan_scope(), temp_dynamic_payload_type_range);
range_foreach(dynamic_payload_type_range, range_add_h264_rtp_pt_callback, NULL);
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, h264_handle);
}
/*

View File

@ -391,7 +391,6 @@ static expert_field ei_h265_value_to_large = EI_INIT;
/* The dynamic payload type range which will be dissected as H.265 */
#define RTP_PT_DEFAULT_RANGE "0"
static range_t *temp_dynamic_payload_type_range = NULL;
static dissector_handle_t h265_handle;
@ -2988,18 +2987,6 @@ dissect_h265(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
return tvb_captured_length(tvb);
}
static void
range_delete_h265_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if (rtp_pt >= 96 && rtp_pt <= 127)
dissector_delete_uint("rtp.pt", rtp_pt, h265_handle);
}
static void
range_add_h265_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if (rtp_pt >= 96 && rtp_pt <= 127)
dissector_add_uint("rtp.pt", rtp_pt, h265_handle);
}
void
proto_register_h265(void)
{
@ -4599,7 +4586,7 @@ proto_register_h265(void)
};
/* Register the protocol name and description */
proto_h265 = proto_register_protocol("H.265", "H265", "h265");
proto_h265 = proto_register_protocol("H.265", "H.265", "h265");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_h265, hf, array_length(hf));
@ -4613,9 +4600,9 @@ proto_register_h265(void)
prefs_register_range_preference(h265_module, "dynamic.payload.type",
"H265 dynamic payload types",
"Dynamic payload types which will be interpreted as H265"
"; Values must be in the range 96 - 127",
"H.265 dynamic payload types",
"Dynamic payload types which will be interpreted as H.265"
"; values must be in the range 1 - 127",
&temp_dynamic_payload_type_range, 127);
h265_handle = register_dissector("h265", dissect_h265, proto_h265);
@ -4634,12 +4621,13 @@ proto_reg_handoff_h265(void)
h265_prefs_initialized = TRUE;
}
else {
range_foreach(dynamic_payload_type_range, range_delete_h265_rtp_pt_callback, NULL);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, h265_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type_range = range_copy(wmem_epan_scope(), temp_dynamic_payload_type_range);
range_foreach(dynamic_payload_type_range, range_add_h265_rtp_pt_callback, NULL);
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, h265_handle);
}
/*

View File

@ -63,9 +63,11 @@ static void add_bits(offset_struct* poffset, gint len_bits);
/* Wireshark ID of the ISMACRYP protocol */
static int proto_ismacryp = -1;
static int proto_ismacryp_v11 = -1;
static int proto_ismacryp_v20 = -1;
/* parameters set in preferences */
static guint pref_dynamic_payload_type = 0; /* RTP dynamic payload type */
static range_t *pref_dynamic_payload_type_range = NULL; /* RTP dynamic payload types */
static guint pref_au_size_length = DEFAULT_AU_SIZE_LENGTH; /* default Au size length */
static guint pref_au_index_length = DEFAULT_AU_INDEX_LENGTH; /* default Au index length */
static guint pref_au_index_delta_length = DEFAULT_AU_INDEX_DELTA_LENGTH; /* default Au index delta length */
@ -844,6 +846,10 @@ void proto_register_ismacryp (void)
module_t *ismacryp_module;
proto_ismacryp = proto_register_protocol ("ISMACryp Protocol", "ISMACRYP", "ismacryp");
proto_ismacryp_v11 = proto_register_protocol_in_name_only ("ISMACryp Protocol v1.1",
"ISMACRYP 1.1", "ismacryp_v11", proto_ismacryp, FT_PROTOCOL);
proto_ismacryp_v20 = proto_register_protocol_in_name_only ("ISMACryp Protocol v2.0",
"ISMACRYP 2.0", "ismacryp_v20", proto_ismacryp, FT_PROTOCOL);
proto_register_field_array (proto_ismacryp, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
@ -851,11 +857,11 @@ void proto_register_ismacryp (void)
/* this registers our preferences, function proto_reg_handoff_ismacryp is called when preferences are applied */
ismacryp_module = prefs_register_protocol(proto_ismacryp, proto_reg_handoff_ismacryp);
prefs_register_uint_preference(ismacryp_module, "dynamic.payload.type",
"ISMACryp dynamic payload type",
"The dynamic payload type which will be interpreted as ISMACryp",
10,
&pref_dynamic_payload_type);
prefs_register_range_preference(ismacryp_module, "dynamic.payload.type",
"ISMACryp dynamic payload types",
"Dynamic payload types which will be interpreted as ISMACryp"
"; values must be in the range 1 - 127",
&pref_dynamic_payload_type_range, 127);
prefs_register_enum_preference(ismacryp_module, "version",
"ISMACryp version",
@ -989,14 +995,14 @@ void proto_reg_handoff_ismacryp(void)
{
static gboolean ismacryp_prefs_initialized = FALSE;
static dissector_handle_t ismacryp_handle;
static guint dynamic_payload_type;
static range_t *dynamic_payload_type_range;
if (!ismacryp_prefs_initialized) {
dissector_handle_t ismacryp_v11_handle;
dissector_handle_t ismacryp_v20_handle;
ismacryp_handle = create_dissector_handle(dissect_ismacryp, proto_ismacryp);
ismacryp_v11_handle = create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp);
ismacryp_v20_handle = create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp);
ismacryp_v11_handle = create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp_v11);
ismacryp_v20_handle = create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp_v20);
ismacryp_prefs_initialized = TRUE;
dissector_add_string("rtp_dyn_payload_type", "ISMACRYP", ismacryp_handle);
dissector_add_string("rtp_dyn_payload_type", "enc-mpeg4-generic", ismacryp_v11_handle);
@ -1004,15 +1010,14 @@ void proto_reg_handoff_ismacryp(void)
}
else { /* ismacryp_prefs_initialized = TRUE */
/* delete existing association of ismacryp with payload_type */
if ( dynamic_payload_type > 95 ) {
dissector_delete_uint("rtp.pt", dynamic_payload_type, ismacryp_handle);
}
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, ismacryp_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
/* always do the following */
dynamic_payload_type = pref_dynamic_payload_type; /*update payload_type to new value */
if ( dynamic_payload_type > 95 ) {
dissector_add_uint("rtp.pt", dynamic_payload_type, ismacryp_handle);
}
/* update payload_type to new value */
dynamic_payload_type_range = range_copy(wmem_epan_scope(), pref_dynamic_payload_type_range);
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, ismacryp_handle);
}

View File

@ -150,7 +150,7 @@ static dissector_handle_t iuup_handle;
static gboolean dissect_fields = FALSE;
static gboolean two_byte_pseudoheader = FALSE;
static guint global_dynamic_payload_type = 0;
static range_t *global_dynamic_payload_type_range = 0;
#define PDUTYPE_DATA_WITH_CRC 0
@ -828,22 +828,20 @@ static int find_iuup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
void proto_reg_handoff_iuup(void) {
static gboolean iuup_prefs_initialized = FALSE;
static guint saved_dynamic_payload_type = 0;
static range_t *saved_dynamic_payload_type_range = NULL;
if (!iuup_prefs_initialized) {
dissector_add_string("rtp_dyn_payload_type","VND.3GPP.IUFP", iuup_handle);
iuup_prefs_initialized = TRUE;
} else {
if ( saved_dynamic_payload_type > 95 ) {
dissector_delete_uint("rtp.pt", saved_dynamic_payload_type, iuup_handle);
}
dissector_delete_uint_range("rtp.pt", saved_dynamic_payload_type_range, iuup_handle);
wmem_free(wmem_epan_scope(), saved_dynamic_payload_type_range);
}
saved_dynamic_payload_type = global_dynamic_payload_type;
saved_dynamic_payload_type_range = range_copy(wmem_epan_scope(), global_dynamic_payload_type_range);
if ( global_dynamic_payload_type > 95 ) {
dissector_add_uint("rtp.pt", global_dynamic_payload_type, iuup_handle);
}
range_remove_value(wmem_epan_scope(), &saved_dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", saved_dynamic_payload_type_range, iuup_handle);
}
@ -994,11 +992,11 @@ void proto_register_iuup(void) {
"The payload contains a two byte pseudoheader indicating direction and circuit_id",
&two_byte_pseudoheader);
prefs_register_uint_preference(iuup_module, "dynamic.payload.type",
prefs_register_range_preference(iuup_module, "dynamic.payload.type",
"IuUP dynamic payload type",
"The dynamic payload type which will be interpreted as IuUP",
10,
&global_dynamic_payload_type);
"Dynamic payload types which will be interpreted as IuUP"
"; values must be in the range 1 - 127",
&global_dynamic_payload_type_range, 127);
}
/*

View File

@ -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)

View File

@ -57,9 +57,9 @@ static expert_field ei_mp4ves_not_dissected_bits = EI_INIT;
static dissector_handle_t mp4ves_name_handle;
/* The dynamic payload type which will be dissected as MP4V-ES */
/* The dynamic payload types which will be dissected as MP4V-ES */
static guint global_dynamic_payload_type = 0;
static range_t *global_dynamic_payload_type_range = NULL;
static dissector_handle_t mp4ves_handle;
@ -1014,19 +1014,19 @@ proto_register_mp4ves(void)
/* Register a configuration option for port */
mp4ves_module = prefs_register_protocol(proto_mp4ves, proto_reg_handoff_mp4ves);
prefs_register_uint_preference(mp4ves_module,
prefs_register_range_preference(mp4ves_module,
"dynamic.payload.type",
"MP4V-ES dynamic payload type",
"The dynamic payload type which will be interpreted as MP4V-ES",
10,
&global_dynamic_payload_type);
"MP4V-ES dynamic payload types",
"Dynamic payload types which will be interpreted as MP4V-ES"
"; values must be in the range 1 - 127",
&global_dynamic_payload_type_range, 127);
}
void
proto_reg_handoff_mp4ves(void)
{
static guint dynamic_payload_type;
static range_t *dynamic_payload_type_range = NULL;
static gboolean mp4ves_prefs_initialized = FALSE;
if (!mp4ves_prefs_initialized) {
@ -1043,14 +1043,13 @@ proto_reg_handoff_mp4ves(void)
dissector_add_string("h245.gef.content", ftr->id, create_dissector_handle(ftr->content_pdu, proto_mp4ves));
}
}else{
if ( dynamic_payload_type > 95 )
dissector_delete_uint("rtp.pt", dynamic_payload_type, mp4ves_handle);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, mp4ves_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type = global_dynamic_payload_type;
dynamic_payload_type_range = range_copy(wmem_epan_scope(), global_dynamic_payload_type_range);
if ( dynamic_payload_type > 95 ){
dissector_add_uint("rtp.pt", dynamic_payload_type, mp4ves_handle);
}
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, mp4ves_handle);
}
/*

View File

@ -160,7 +160,7 @@ static reassembly_table mtp2_reassembly_table;
/* variables needed for property registration to wireshark menu */
static range_t *mtp2_rtp_payload_types;
static range_t *pref_mtp2_rtp_payload_types;
static range_t *pref_mtp2_rtp_payload_types = NULL;
static gboolean reverse_bit_order_mtp2 = FALSE;
static expert_field ei_mtp2_checksum_error = EI_INIT;
@ -1296,8 +1296,8 @@ proto_register_mtp2(void)
&reverse_bit_order_mtp2);
prefs_register_range_preference(mtp2_module, "rtp_payload_type",
"RTP payload types for embedded packets in RTP stream",
"RTP payload types for embedded packets in RTP stream. Must be of the dynamic types "
"from 96 to 127.",
"RTP payload types for embedded packets in RTP stream"
"; values must be in the range 1 - 127",
&pref_mtp2_rtp_payload_types,
127);
register_init_routine(&mtp2_init_routine);
@ -1323,15 +1323,13 @@ proto_reg_handoff_mtp2(void)
dissector_add_string("rtp_dyn_payload_type", "MTP2", mtp2_bitstream_handle);
init = TRUE;
} else {
if (!value_is_in_range(mtp2_rtp_payload_types, 0)) {
dissector_delete_uint_range("rtp.pt", mtp2_rtp_payload_types, mtp2_bitstream_handle);
}
dissector_delete_uint_range("rtp.pt", mtp2_rtp_payload_types, mtp2_bitstream_handle);
wmem_free(wmem_epan_scope(), mtp2_rtp_payload_types);
}
mtp2_rtp_payload_types = range_copy(wmem_epan_scope(), pref_mtp2_rtp_payload_types);
if (!value_is_in_range(mtp2_rtp_payload_types, 0)) {
dissector_add_uint_range("rtp.pt", mtp2_rtp_payload_types, mtp2_bitstream_handle);
}
range_remove_value(wmem_epan_scope(), &mtp2_rtp_payload_types, 0);
dissector_add_uint_range("rtp.pt", mtp2_rtp_payload_types, mtp2_bitstream_handle);
}
/*

View File

@ -570,7 +570,7 @@ proto_register_rfc2190(void)
proto_register_subtree_array(ett, array_length(ett));
proto_rfc2190 = proto_register_protocol("H.263 RTP Payload header (RFC2190)",
"RFC2190", "rfc2190");
"H.263 (RFC2190)", "rfc2190");
proto_register_field_array(proto_rfc2190, hf, array_length(hf));
rfc2190_handle = register_dissector("rfc2190", dissect_rfc2190, proto_rfc2190);

View File

@ -34,15 +34,11 @@
void proto_register_rtp_events(void);
void proto_reg_handoff_rtp_events(void);
/* rtp_event_payload_type_value is the value used globally
to set the appropriate payload type
*/
static guint rtp_event_payload_type_value = 101;
#define RTP_EVENT_DEFAULT_PT_RANGE "101"
static range_t *rtp_event_payload_type_range = NULL;
/* cisco_nse_pt_value is used globally
to set the appropriate Cisco NSE payload type value
*/
static guint cisco_nse_pt_value = 100;
#define CISCO_NSE_DEFAULT_PT_RANGE "100"
static range_t *cisco_nse_pt_range = NULL;
/* RTP Event Fields */
@ -470,18 +466,24 @@ proto_register_rtp_events(void)
/* Register preferences */
rtp_events_module = prefs_register_protocol (proto_rtp_events, proto_reg_handoff_rtp_events);
prefs_register_uint_preference (rtp_events_module,
"event_payload_type_value", "Payload Type for RFC2833 RTP Events",
"This is the value of the Payload Type field"
" that specifies RTP Events", 10,
&rtp_event_payload_type_value);
range_convert_str(wmem_epan_scope(), &rtp_event_payload_type_range,
RTP_EVENT_DEFAULT_PT_RANGE, 127);
prefs_register_range_preference(rtp_events_module,
"event_payload_type_value",
"Payload Types for RFC2833 RTP Events",
"Payload Types for RFC2833 RTP Events"
"; values must be in the range 1 - 127",
&rtp_event_payload_type_range, 127);
prefs_register_uint_preference (rtp_events_module,
"cisco_nse_payload_type_value", "Payload Type for Cisco Named Signaling Events",
"This is the value of the Payload Type field"
" that specifies Cisco Named Signaling Events", 10,
&cisco_nse_pt_value);
range_convert_str(wmem_epan_scope(), &cisco_nse_pt_range,
CISCO_NSE_DEFAULT_PT_RANGE, 127);
prefs_register_range_preference(rtp_events_module,
"cisco_nse_payload_type_value",
"Payload Types for Cisco Named Signaling Events",
"Payload Types for Cisco Named Signaling Events"
"; values must be in the range 1 - 127",
&cisco_nse_pt_range, 127);
rtp_events_handle = register_dissector("rtpevent", dissect_rtp_events, proto_rtp_events);
rtp_event_tap = register_tap("rtpevent");
@ -495,8 +497,8 @@ proto_reg_handoff_rtp_events(void)
/* saved_payload_type_value is a temporary place to save */
/* the value so we can properly reinitialize when the */
/* settings get changed. */
static guint saved_payload_type_value;
static guint saved_cisco_nse_pt_value;
static range_t *saved_payload_type_range;
static range_t *saved_cisco_nse_pt_range;
static gboolean rtp_events_prefs_initialized = FALSE;
if (!rtp_events_prefs_initialized) {
@ -505,18 +507,18 @@ proto_reg_handoff_rtp_events(void)
rtp_events_prefs_initialized = TRUE;
}
else {
dissector_delete_uint("rtp.pt", saved_payload_type_value, rtp_events_handle);
dissector_delete_uint("rtp.pt", saved_cisco_nse_pt_value, rtp_events_handle);
dissector_delete_uint_range("rtp.pt", saved_payload_type_range, rtp_events_handle);
dissector_delete_uint_range("rtp.pt", saved_cisco_nse_pt_range, rtp_events_handle);
wmem_free(wmem_epan_scope(), saved_payload_type_range);
wmem_free(wmem_epan_scope(), saved_cisco_nse_pt_range);
}
saved_payload_type_value = rtp_event_payload_type_value;
/* rtp_event_payload_type_value is set from preferences */
saved_cisco_nse_pt_value = cisco_nse_pt_value;
/* cisco_nse_pt_value is set from preferences */
if(saved_payload_type_value != 0){
dissector_add_uint("rtp.pt", saved_payload_type_value, rtp_events_handle);
dissector_add_uint("rtp.pt", saved_cisco_nse_pt_value, rtp_events_handle);
}
saved_payload_type_range = range_copy(wmem_epan_scope(), rtp_event_payload_type_range);
saved_cisco_nse_pt_range = range_copy(wmem_epan_scope(), cisco_nse_pt_range);
range_remove_value(wmem_epan_scope(), &saved_payload_type_range, 0);
range_remove_value(wmem_epan_scope(), &saved_cisco_nse_pt_range, 0);
dissector_add_uint_range("rtp.pt", saved_payload_type_range, rtp_events_handle);
dissector_add_uint_range("rtp.pt", saved_cisco_nse_pt_range, rtp_events_handle);
}
/*

View File

@ -2883,8 +2883,8 @@ static gint ett_rtp_midi_sysex_common_nrt = -1;
static gint ett_rtp_midi_sysex_common_tune_note = -1;
static guint rtp_midi_payload_type_value = 0;
static guint saved_payload_type_value;
static range_t *rtp_midi_payload_type_range = NULL;
static range_t *saved_payload_type_range = NULL;
static int proto_rtp_midi = -1;
@ -10021,8 +10021,12 @@ proto_register_rtp_midi( void )
proto_register_field_array( proto_rtp_midi, hf, array_length( hf ) );
proto_register_subtree_array( ett, array_length( ett ) );
rtp_midi_module = prefs_register_protocol ( proto_rtp_midi, proto_reg_handoff_rtp_midi );
prefs_register_uint_preference ( rtp_midi_module, "midi_payload_type_value", "Payload Type for RFC 4695/6295 RTP-MIDI", "This is the value of the Payload Type field that specifies RTP-MIDI", 10, &rtp_midi_payload_type_value );
rtp_midi_module = prefs_register_protocol( proto_rtp_midi, proto_reg_handoff_rtp_midi );
prefs_register_range_preference( rtp_midi_module, "midi_payload_type_value",
"Payload Types for RFC 4695/6295 RTP-MIDI",
"Dynamic payload types which will be interpreted as RTP-MIDI"
"; values must be in the range 1 - 127",
&rtp_midi_payload_type_range, 127);
rtp_midi_handle = register_dissector( RTP_MIDI_DISSECTOR_ABBREVIATION, dissect_rtp_midi, proto_rtp_midi );
}
@ -10039,12 +10043,12 @@ proto_reg_handoff_rtp_midi( void )
rtp_midi_prefs_initialized = TRUE;
}
else {
dissector_delete_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
}
if ( rtp_midi_payload_type_value > 95 ){
saved_payload_type_value = rtp_midi_payload_type_value;
dissector_add_uint( "rtp.pt", saved_payload_type_value, rtp_midi_handle );
dissector_delete_uint_range( "rtp.pt", saved_payload_type_range, rtp_midi_handle );
wmem_free(wmem_epan_scope(), saved_payload_type_range);
}
saved_payload_type_range = range_copy(wmem_epan_scope(), rtp_midi_payload_type_range);
range_remove_value(wmem_epan_scope(), &saved_payload_type_range, 0);
dissector_add_uint_range( "rtp.pt", saved_payload_type_range, rtp_midi_handle );
}

View File

@ -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");
}

View File

@ -770,7 +770,7 @@ proto_register_v150fw(void)
};
/* register protocol name & description */
proto_v150fw = proto_register_protocol("v150fw State Signaling Event", "v150fw", "v150fw");
proto_v150fw = proto_register_protocol("V.150.1 State Signaling Event", "V.150.1 SSE", "v150fw");
/* required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_v150fw, hf, array_length(hf));

View File

@ -564,24 +564,12 @@ proto_register_vp8(void)
prefs_register_range_preference(vp8_module, "dynamic.payload.type",
"vp8 dynamic payload types",
"Dynamic payload types which will be interpreted as vp8"
"; Values must be in the range 96 - 127",
"; Values must be in the range 1 - 127",
&temp_dynamic_payload_type_range, 127);
vp8_handle = register_dissector("vp8", dissect_vp8, proto_vp8);
}
static void
range_delete_vp8_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if ((rtp_pt >= 96) && (rtp_pt <= 127))
dissector_delete_uint("rtp.pt", rtp_pt, vp8_handle);
}
static void
range_add_vp8_rtp_pt_callback(guint32 rtp_pt, gpointer ptr _U_) {
if ((rtp_pt >= 96) && (rtp_pt <= 127))
dissector_add_uint("rtp.pt", rtp_pt, vp8_handle);
}
void
proto_reg_handoff_vp8(void)
{
@ -592,12 +580,13 @@ proto_reg_handoff_vp8(void)
dissector_add_string("rtp_dyn_payload_type" , "VP8", vp8_handle);
vp8_prefs_initialized = TRUE;
} else {
range_foreach(dynamic_payload_type_range, range_delete_vp8_rtp_pt_callback, NULL);
dissector_delete_uint_range("rtp.pt", dynamic_payload_type_range, vp8_handle);
wmem_free(wmem_epan_scope(), dynamic_payload_type_range);
}
dynamic_payload_type_range = range_copy(wmem_epan_scope(), temp_dynamic_payload_type_range);
range_foreach(dynamic_payload_type_range, range_add_vp8_rtp_pt_callback, NULL);
range_remove_value(wmem_epan_scope(), &dynamic_payload_type_range, 0);
dissector_add_uint_range("rtp.pt", dynamic_payload_type_range, vp8_handle);
}
/*