summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtp.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-rtp.c
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-rtp.c')
-rw-r--r--epan/dissectors/packet-rtp.c559
1 files changed, 298 insertions, 261 deletions
diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c
index 04d68a58..242521a7 100644
--- a/epan/dissectors/packet-rtp.c
+++ b/epan/dissectors/packet-rtp.c
@@ -85,10 +85,10 @@ typedef struct _rfc2198_hdr {
*/
typedef struct _rtp_multisegment_pdu {
/* the seqno of the segment where the pdu starts */
- guint32 startseq;
+ uint32_t startseq;
/* the seqno of the segment where the pdu ends */
- guint32 endseq;
+ uint32_t endseq;
} rtp_multisegment_pdu;
typedef struct _rtp_private_conv_info {
@@ -107,9 +107,9 @@ typedef struct _rtp_number_space {
/** Info to save in RTP conversation */
struct _rtp_conversation_info
{
- gchar method[MAX_RTP_SETUP_METHOD_SIZE + 1];
- guint32 frame_number; /**> the frame where this conversation is started */
- guint32 media_types;
+ char method[MAX_RTP_SETUP_METHOD_SIZE + 1];
+ uint32_t frame_number; /**> the frame where this conversation is started */
+ uint32_t media_types;
rtp_dyn_payload_t* rtp_dyn_payload; /**> the dynamic RTP payload info - see comments above */
wmem_map_t* ssrc_number_space; /**> maps the SSRCs to the last seen seqno and timestamp
@@ -120,7 +120,7 @@ struct _rtp_conversation_info
struct srtp_info* srtp_info; /* SRTP context */
bta2dp_codec_info_t* bta2dp_info;
btvdp_codec_info_t* btvdp_info;
- wmem_array_t* rtp_sdp_setup_info_list; /**> List with data from all SDP occurencies for this steram holding a call ID)*/
+ wmem_array_t* rtp_sdp_setup_info_list; /**> List with data from all SDP occurrences for this stream holding a call ID)*/
};
typedef struct {
@@ -138,19 +138,19 @@ struct _rtp_dyn_payload_t
static reassembly_table rtp_reassembly_table;
-static int hf_rtp_fragments = -1;
-static int hf_rtp_fragment = -1;
-static int hf_rtp_fragment_overlap = -1;
-static int hf_rtp_fragment_overlap_conflict = -1;
-static int hf_rtp_fragment_multiple_tails = -1;
-static int hf_rtp_fragment_too_long_fragment = -1;
-static int hf_rtp_fragment_error = -1;
-static int hf_rtp_fragment_count = -1;
-static int hf_rtp_reassembled_in = -1;
-static int hf_rtp_reassembled_length = -1;
+static int hf_rtp_fragments;
+static int hf_rtp_fragment;
+static int hf_rtp_fragment_overlap;
+static int hf_rtp_fragment_overlap_conflict;
+static int hf_rtp_fragment_multiple_tails;
+static int hf_rtp_fragment_too_long_fragment;
+static int hf_rtp_fragment_error;
+static int hf_rtp_fragment_count;
+static int hf_rtp_reassembled_in;
+static int hf_rtp_reassembled_length;
-static gint ett_rtp_fragment = -1;
-static gint ett_rtp_fragments = -1;
+static int ett_rtp_fragment;
+static int ett_rtp_fragments;
static const fragment_items rtp_fragment_items = {
&ett_rtp_fragment,
@@ -175,8 +175,6 @@ static dissector_handle_t rtp_rfc4571_handle;
static dissector_handle_t rtcp_handle;
static dissector_handle_t classicstun_handle;
static dissector_handle_t stun_handle;
-static dissector_handle_t classicstun_heur_handle;
-static dissector_handle_t stun_heur_handle;
static dissector_handle_t t38_handle;
static dissector_handle_t zrtp_handle;
static dissector_handle_t dtls_handle;
@@ -191,7 +189,7 @@ static dissector_handle_t bta2dp_handle;
static dissector_handle_t btvdp_handle;
static dissector_handle_t sbc_handle;
-static int rtp_tap = -1;
+static int rtp_tap;
static dissector_table_t rtp_pt_dissector_table;
static dissector_table_t rtp_dyn_pt_dissector_table;
@@ -199,76 +197,78 @@ static dissector_table_t rtp_dyn_pt_dissector_table;
static dissector_table_t rtp_hdr_ext_dissector_table;
static dissector_table_t rtp_hdr_ext_rfc5285_dissector_table;
-/* Used for storing data to be retreived by the SDP dissector*/
-static int proto_sdp = -1;
+/* Used for storing data to be retrieved by the SDP dissector*/
+static int proto_sdp;
/* 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;
-static int hf_rtp_csrc_count = -1;
-static int hf_rtp_marker = -1;
-static int hf_rtp_payload_type = -1;
-static int hf_rtp_seq_nr = -1;
-static int hf_rtp_ext_seq_nr = -1;
-static int hf_rtp_timestamp = -1;
-static int hf_rtp_ssrc = -1;
-static int hf_rtp_csrc_items = -1;
-static int hf_rtp_csrc_item = -1;
-static int hf_rtp_data = -1;
-static int hf_rtp_padding_data = -1;
-static int hf_rtp_padding_count= -1;
-static int hf_rtp_rfc2198_follow= -1;
-static int hf_rtp_rfc2198_tm_off= -1;
-static int hf_rtp_rfc2198_bl_len= -1;
+static int proto_rtp;
+static int proto_rtp_rfc2198;
+static int hf_rtp_version;
+static int hf_rtp_padding;
+static int hf_rtp_extension;
+static int hf_rtp_csrc_count;
+static int hf_rtp_marker;
+static int hf_rtp_payload_type;
+static int hf_rtp_seq_nr;
+static int hf_rtp_ext_seq_nr;
+static int hf_rtp_timestamp;
+static int hf_rtp_ext_timestamp;
+static int hf_rtp_ssrc;
+static int hf_rtp_csrc_items;
+static int hf_rtp_csrc_item;
+static int hf_rtp_data;
+static int hf_rtp_padding_data;
+static int hf_rtp_padding_count;
+static int hf_rtp_rfc2198_follow;
+static int hf_rtp_rfc2198_tm_off;
+static int hf_rtp_rfc2198_bl_len;
/* RTP header extension fields */
-static int hf_rtp_prof_define = -1;
-static int hf_rtp_length = -1;
-static int hf_rtp_hdr_exts = -1;
-static int hf_rtp_hdr_ext = -1;
+static int hf_rtp_prof_define;
+static int hf_rtp_length;
+static int hf_rtp_hdr_exts;
+static int hf_rtp_hdr_ext;
/* RTP setup fields */
-static int hf_rtp_setup = -1;
-static int hf_rtp_setup_frame = -1;
-static int hf_rtp_setup_method = -1;
+static int hf_rtp_setup;
+static int hf_rtp_setup_frame;
+static int hf_rtp_setup_method;
/* RTP fields defining a sub tree */
-static gint ett_rtp = -1;
-static gint ett_csrc_list = -1;
-static gint ett_hdr_ext = -1;
-static gint ett_hdr_ext_rfc5285 = -1;
-static gint ett_rtp_setup = -1;
-static gint ett_rtp_rfc2198 = -1;
-static gint ett_rtp_rfc2198_hdr = -1;
+static int ett_rtp;
+static int ett_csrc_list;
+static int ett_hdr_ext;
+static int ett_hdr_ext_rfc5285;
+static int ett_rtp_setup;
+static int ett_rtp_rfc2198;
+static int ett_rtp_rfc2198_hdr;
/* SRTP fields */
-static int hf_srtp_encrypted_payload = -1;
-/* static int hf_srtp_null_encrypted_payload = -1; */
-static int hf_srtp_mki = -1;
-static int hf_srtp_auth_tag = -1;
+static int hf_srtp_encrypted_payload;
+/* static int hf_srtp_null_encrypted_payload; */
+static int hf_srtp_mki;
+static int hf_srtp_auth_tag;
/* PacketCable CCC header fields */
-static int proto_pkt_ccc = -1;
-static int hf_pkt_ccc_id = -1;
-static int hf_pkt_ccc_ts = -1;
+static int proto_pkt_ccc;
+static int hf_pkt_ccc_id;
+static int hf_pkt_ccc_ts;
/* PacketCable CCC field defining a sub tree */
-static gint ett_pkt_ccc = -1;
+static int ett_pkt_ccc;
-static expert_field ei_rtp_fragment_unfinished = EI_INIT;
-static expert_field ei_rtp_padding_missing = EI_INIT;
+static expert_field ei_rtp_fragment_unfinished;
+static expert_field ei_rtp_padding_missing;
+static expert_field ei_rtp_padding_bogus;
/* RFC 5285 Header extensions */
-static int hf_rtp_ext_rfc5285_id = -1;
-static int hf_rtp_ext_rfc5285_length = -1;
-static int hf_rtp_ext_rfc5285_appbits = -1;
-static int hf_rtp_ext_rfc5285_data = -1;
+static int hf_rtp_ext_rfc5285_id;
+static int hf_rtp_ext_rfc5285_length;
+static int hf_rtp_ext_rfc5285_appbits;
+static int hf_rtp_ext_rfc5285_data;
/* RFC 4571 Header extension */
-static int hf_rfc4571_header_len = -1;
+static int hf_rfc4571_header_len;
#define RTP0_INVALID 0
#define RTP0_STUN 1
@@ -286,7 +286,7 @@ static const enum_val_t rtp_version0_types[] = {
{ "rfc7983", "Multiplexed as in RFC 7983", RTP0_RFC7983 },
{ NULL, NULL, 0 }
};
-static gint global_rtp_version0_type = 5;
+static int global_rtp_version0_type = 5;
/* Forward declaration we need below */
void proto_register_rtp(void);
@@ -294,20 +294,20 @@ void proto_reg_handoff_rtp(void);
void proto_register_pkt_ccc(void);
void proto_reg_handoff_pkt_ccc(void);
-static gint dissect_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
+static int dissect_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static struct _rtp_packet_info *get_rtp_packet_info(packet_info *pinfo, struct _rtp_info *rtp_info);
/* Preferences bool to control whether or not setup info should be shown */
-static gboolean global_rtp_show_setup_info = TRUE;
+static bool global_rtp_show_setup_info = true;
/* desegment RTP streams */
-static gboolean desegment_rtp = TRUE;
+static bool desegment_rtp = true;
/* RFC2198 Redundant Audio Data */
#define RFC2198_DEFAULT_PT_RANGE "99"
-static gboolean rfc2198_deencapsulate = TRUE;
+static bool rfc2198_deencapsulate = true;
@@ -669,9 +669,9 @@ static const value_string srtp_auth_alg_vals[] =
};
#endif
-static void rtp_prompt(packet_info *pinfo _U_, gchar* result)
+static void rtp_prompt(packet_info *pinfo _U_, char* result)
{
- guint payload_type = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_rtp, RTP_DECODE_AS_PROTO_DATA));
+ unsigned payload_type = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_rtp, RTP_DECODE_AS_PROTO_DATA));
/* Dynamic payload range, don't expose value as it may change within conversation */
if (payload_type > 95)
@@ -684,9 +684,9 @@ static void rtp_prompt(packet_info *pinfo _U_, gchar* result)
}
}
-static gpointer rtp_value(packet_info *pinfo)
+static void *rtp_value(packet_info *pinfo)
{
- guint payload_type = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_rtp, RTP_DECODE_AS_PROTO_DATA));
+ unsigned payload_type = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_rtp, RTP_DECODE_AS_PROTO_DATA));
return GUINT_TO_POINTER(payload_type);
}
@@ -694,8 +694,8 @@ static gpointer rtp_value(packet_info *pinfo)
#ifdef DEBUG_CONVERSATION
/* Called for each entry in the rtp_dyn_payload hash table. */
static void
-rtp_dyn_payload_table_foreach_func(gpointer key, gpointer value, gpointer user_data _U_) {
- guint pt = GPOINTER_TO_UINT(key);
+rtp_dyn_payload_table_foreach_func(void *key, void *value, void *user_data _U_) {
+ unsigned pt = GPOINTER_TO_UINT(key);
encoding_name_and_rate_t *encoding = (encoding_name_and_rate_t*) value;
DPRINT2(("pt=%d", pt));
@@ -740,23 +740,23 @@ rtp_dump_dyn_payload(rtp_dyn_payload_t *rtp_dyn_payload) {
single registered callback walk this GHashTable and destroy each member as well as this
GHashTable.
*/
-static GHashTable *rtp_dyn_payloads = NULL;
+static GHashTable *rtp_dyn_payloads;
static gboolean
-fmtp_free(gpointer key, gpointer value, gpointer user_data)
+fmtp_free(void *key, void *value, void *user_data)
{
wmem_allocator_t *scope = (wmem_allocator_t*)user_data;
wmem_free(scope, key);
wmem_free(scope, value);
- return TRUE;
+ return true;
}
/* the following is the GDestroyNotify function used when the individual rtp_dyn_payload_t
GHashTables are destroyed */
static void
-rtp_dyn_payload_value_destroy(gpointer data)
+rtp_dyn_payload_value_destroy(void *data)
{
encoding_name_and_rate_t *encoding_name_and_rate_pt = (encoding_name_and_rate_t*) data;
wmem_free(wmem_file_scope(), encoding_name_and_rate_pt->encoding_name);
@@ -767,7 +767,7 @@ rtp_dyn_payload_value_destroy(gpointer data)
/* this gets called by wmem_rtp_dyn_payload_destroy_cb */
static gboolean
-rtp_dyn_payloads_table_steal_func(gpointer key _U_, gpointer value, gpointer user_data _U_)
+rtp_dyn_payloads_table_steal_func(void *key _U_, void *value, void *user_data _U_)
{
rtp_dyn_payload_t *rtp_dyn_payload = (rtp_dyn_payload_t *)value;
@@ -789,7 +789,7 @@ rtp_dyn_payloads_table_steal_func(gpointer key _U_, gpointer value, gpointer use
g_hash_table_destroy(rtp_dyn_payload->table);
}
- return TRUE;
+ return true;
}
/* the following is used as the wmem callback to destroy *all* alive rtp_dyn_payload_t's,
@@ -808,7 +808,7 @@ wmem_rtp_dyn_payload_destroy_cb(wmem_allocator_t *allocator _U_, wmem_cb_event_t
rtp_dyn_payloads = NULL;
/* remove this callback? */
- return FALSE;
+ return false;
}
/* the following initializes the single GHashTable - this is invoked as an init_routine,
@@ -843,11 +843,11 @@ rtp_dyn_payload_t* rtp_dyn_payload_dup(rtp_dyn_payload_t *rtp_dyn_payload)
{
rtp_dyn_payload_t *rtp_dyn_payload2 = rtp_dyn_payload_new();
GHashTableIter iter;
- gpointer key, value;
+ void *key, *value;
g_hash_table_iter_init(&iter, rtp_dyn_payload->table);
while (g_hash_table_iter_next(&iter, &key, &value)) {
- const guint pt = GPOINTER_TO_UINT(key);
+ const unsigned pt = GPOINTER_TO_UINT(key);
encoding_name_and_rate_t *encoding_name_and_rate_pt =
(encoding_name_and_rate_t *)value;
@@ -872,7 +872,7 @@ rtp_dyn_payload_ref(rtp_dyn_payload_t *rtp_dyn_payload)
}
static void
-rtp_dyn_payload_add_fmtp_int(gpointer key, gpointer value, gpointer user_data)
+rtp_dyn_payload_add_fmtp_int(void *key, void *value, void *user_data)
{
wmem_map_t *fmtp_map = (wmem_map_t*)user_data;
const char *k = (const char*)key;
@@ -889,8 +889,8 @@ rtp_dyn_payload_add_fmtp_int(gpointer key, gpointer value, gpointer user_data)
*/
void
rtp_dyn_payload_insert_full(rtp_dyn_payload_t *rtp_dyn_payload,
- const guint pt,
- const gchar* encoding_name,
+ const unsigned pt,
+ const char* encoding_name,
const int sample_rate,
const unsigned channels,
wmem_map_t *fmtp_map)
@@ -918,8 +918,8 @@ rtp_dyn_payload_insert_full(rtp_dyn_payload_t *rtp_dyn_payload,
file or sooner if rtp_dyn_payload_free is called. */
void
rtp_dyn_payload_insert(rtp_dyn_payload_t *rtp_dyn_payload,
- const guint pt,
- const gchar* encoding_name,
+ const unsigned pt,
+ const char* encoding_name,
const int sample_rate,
const unsigned channels)
{
@@ -933,7 +933,7 @@ rtp_dyn_payload_insert(rtp_dyn_payload_t *rtp_dyn_payload,
*/
void
rtp_dyn_payload_add_fmtp(rtp_dyn_payload_t *rtp_dyn_payload,
- const guint pt,
+ const unsigned pt,
const char *key, const char *value)
{
if (rtp_dyn_payload && rtp_dyn_payload->table) {
@@ -955,8 +955,8 @@ rtp_dyn_payload_add_fmtp(rtp_dyn_payload_t *rtp_dyn_payload,
/* Not used anymore
void
rtp_dyn_payload_replace(rtp_dyn_payload_t *rtp_dyn_payload,
- const guint pt,
- const gchar* encoding_name,
+ const unsigned pt,
+ const char* encoding_name,
const int sample_rate)
{
if (rtp_dyn_payload && rtp_dyn_payload->table) {
@@ -971,8 +971,8 @@ rtp_dyn_payload_replace(rtp_dyn_payload_t *rtp_dyn_payload,
/* removes the given payload type */
/* Not used anymore
-gboolean
-rtp_dyn_payload_remove(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt)
+bool
+rtp_dyn_payload_remove(rtp_dyn_payload_t *rtp_dyn_payload, const unsigned pt)
{
return (rtp_dyn_payload && rtp_dyn_payload->table &&
g_hash_table_remove(rtp_dyn_payload->table, GUINT_TO_POINTER(pt)));
@@ -980,8 +980,8 @@ rtp_dyn_payload_remove(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt)
*/
/* retrieves the encoding name for the given payload type */
-const gchar*
-rtp_dyn_payload_get_name(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt)
+const char*
+rtp_dyn_payload_get_name(rtp_dyn_payload_t *rtp_dyn_payload, const unsigned pt)
{
encoding_name_and_rate_t *encoding_name_and_rate_pt;
@@ -1000,9 +1000,9 @@ rtp_dyn_payload_get_name(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt)
it if you need it long. Each of the three output parameters are optional and
can be NULL.
*/
-gboolean
-rtp_dyn_payload_get_full(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt,
- const gchar **encoding_name, int *sample_rate,
+bool
+rtp_dyn_payload_get_full(rtp_dyn_payload_t *rtp_dyn_payload, const unsigned pt,
+ const char **encoding_name, int *sample_rate,
unsigned *channels, wmem_map_t **fmtp_map)
{
encoding_name_and_rate_t *encoding_name_and_rate_pt;
@@ -1019,7 +1019,7 @@ rtp_dyn_payload_get_full(rtp_dyn_payload_t *rtp_dyn_payload, const guint pt,
*fmtp_map = NULL;
}
- if (!rtp_dyn_payload || !rtp_dyn_payload->table) return FALSE;
+ if (!rtp_dyn_payload || !rtp_dyn_payload->table) return false;
encoding_name_and_rate_pt = (encoding_name_and_rate_t*)g_hash_table_lookup(rtp_dyn_payload->table,
GUINT_TO_POINTER(pt));
@@ -1077,9 +1077,9 @@ rtp_dyn_payload_free(rtp_dyn_payload_t *rtp_dyn_payload)
}
void
-bluetooth_add_address(packet_info *pinfo, address *addr, guint32 stream_number,
- const gchar *setup_method, guint32 setup_frame_number,
- guint32 media_types, void *data)
+bluetooth_add_address(packet_info *pinfo, address *addr, uint32_t stream_number,
+ const char *setup_method, uint32_t setup_frame_number,
+ uint32_t media_types, void *data)
{
address null_addr;
conversation_t* p_conv;
@@ -1154,17 +1154,17 @@ static void
rtp_add_setup_info_if_no_duplicate(sdp_setup_info_t *setup_info, wmem_array_t *sdp_conv_info_list)
{
sdp_setup_info_t *stored_setup_info;
- guint i;
+ unsigned i;
for (i = 0; i < wmem_array_get_count(sdp_conv_info_list); i++) {
stored_setup_info = (sdp_setup_info_t *)wmem_array_index(sdp_conv_info_list, i);
- /* Check if we have the call id allready */
+ /* Check if we have the call id already */
if ((stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_STR) && (setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_STR)) {
if (strcmp(stored_setup_info->trace_id.str, setup_info->trace_id.str) == 0) {
return; /* Do not store the call id */
}
- } else if ((stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_GUINT32) && (setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_GUINT32)) {
+ } else if ((stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_UINT32) && (setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_UINT32)) {
if (stored_setup_info->trace_id.num == setup_info->trace_id.num) {
return; /* Do not store the call id */
}
@@ -1177,12 +1177,12 @@ rtp_add_setup_info_if_no_duplicate(sdp_setup_info_t *setup_info, wmem_array_t *s
/* Set up an SRTP conversation */
void
srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int port, int other_port,
- const gchar *setup_method, guint32 setup_frame_number,
- guint32 media_types _U_, rtp_dyn_payload_t *rtp_dyn_payload,
+ const char *setup_method, uint32_t setup_frame_number,
+ uint32_t media_types _U_, rtp_dyn_payload_t *rtp_dyn_payload,
struct srtp_info *srtp_info, sdp_setup_info_t *setup_info)
{
address null_addr;
- conversation_t* p_conv, *sdp_conv;
+ conversation_t* p_conv;
struct _rtp_conversation_info *p_conv_data;
wmem_array_t *rtp_conv_info_list = NULL;
wmem_map_t *ssrc_number_space = NULL;
@@ -1242,7 +1242,7 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
* can mean that the dissection is different on later passes.
*/
p_conv = conversation_new(setup_frame_number, addr, &null_addr, conversation_pt_to_conversation_type(ptype),
- (guint32)port, (guint32)other_port,
+ (uint32_t)port, (uint32_t)other_port,
NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
}
@@ -1263,7 +1263,7 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
} else if (ptype == PT_TCP) {
conversation_set_dissector(p_conv, rtp_rfc4571_handle);
} else {
- DISSECTOR_ASSERT(FALSE);
+ DISSECTOR_ASSERT(false);
}
/*
@@ -1323,10 +1323,14 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
wmem_array_append(p_conv_data->rtp_sdp_setup_info_list, setup_info, 1);
}
}
- sdp_conv = find_or_create_conversation(pinfo);
- if (sdp_conv && p_conv_data->rtp_sdp_setup_info_list) {
- /* Add the collected information to the SDP conversation */
- conversation_add_proto_data(sdp_conv, proto_sdp, p_conv_data->rtp_sdp_setup_info_list);
+ if (p_conv_data->rtp_sdp_setup_info_list) {
+ /* Convey the collected information to SDP */
+ /* This is pinfo->pool because this function might not have been called
+ * by SDP, in which case we don't need to save it, and SDP might have
+ * a file scoped transport info to store it in (using the Offer/Answer
+ * model, e.g. with SIP.)
+ */
+ p_add_proto_data(pinfo->pool, pinfo, proto_sdp, 0, p_conv_data->rtp_sdp_setup_info_list);
}
}
@@ -1334,26 +1338,26 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
/* Set up an RTP conversation */
void
rtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int port, int other_port,
- const gchar *setup_method, guint32 setup_frame_number,
- guint32 media_types , rtp_dyn_payload_t *rtp_dyn_payload)
+ const char *setup_method, uint32_t setup_frame_number,
+ uint32_t media_types, rtp_dyn_payload_t *rtp_dyn_payload)
{
srtp_add_address(pinfo, ptype, addr, port, other_port, setup_method, setup_frame_number, media_types, rtp_dyn_payload, NULL, NULL);
}
-static gboolean
+static bool
dissect_rtp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- guint8 octet1, octet2;
+ uint8_t octet1, octet2;
unsigned int version, payload_type;
unsigned int offset = 0;
- gint padding_count;
+ int padding_count;
if (tvb_captured_length_remaining(tvb, offset) < 2) {
- return FALSE;
+ return false;
}
/* Get the fields in the first octet */
- octet1 = tvb_get_guint8( tvb, offset );
+ octet1 = tvb_get_uint8( tvb, offset );
version = RTP_VERSION( octet1 );
/* XXX: Why are we calling these dissectors from the *heuristic*
@@ -1363,38 +1367,46 @@ dissect_rtp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
* dissectors handle this.
*/
if (version == 0) {
- if (!(tvb_memeql(tvb, 4, (const guint8*)"ZRTP", 4)))
+ if (!(tvb_memeql(tvb, 4, (const uint8_t*)"ZRTP", 4)))
{
call_dissector_only(zrtp_handle, tvb, pinfo, tree, NULL);
- return TRUE;
+ return true;
} else {
switch (global_rtp_version0_type) {
+
+ /*
+ * The two STUN dissectors return 0 if the packet doesn't appear
+ * to be a STUN packet and the number of bytes dissected if
+ * it does. Just call that and test whether the return value
+ * is != 0 or not.
+ */
case RTP0_STUN:
- return call_dissector_only(stun_heur_handle, tvb, pinfo, tree, NULL);
+ return call_dissector_only(stun_handle, tvb, pinfo, tree, NULL) != 0;
case RTP0_CLASSICSTUN:
- return call_dissector_only(classicstun_heur_handle, tvb, pinfo, tree, NULL);
+ return call_dissector_only(classicstun_handle, tvb, pinfo, tree, NULL) != 0;
case RTP0_T38:
/* XXX: Should really be calling a heuristic dissector for T38 ??? */
call_dissector_only(t38_handle, tvb, pinfo, tree, NULL);
- return TRUE;
+ return true;
case RTP0_SPRT:
+ /* XXX: Should really be calling a heuristic dissector for SPRT ??? */
call_dissector_only(sprt_handle, tvb, pinfo, tree, NULL);
- return TRUE;
+ return true;
case RTP0_INVALID:
case RTP0_RFC7983:
default:
- return FALSE; /* Unknown or unsupported version */
+ return false; /* Unknown or unsupported version */
}
}
} else if (version != 2) {
/* Unknown or unsupported version */
- return FALSE;
+ return false;
}
- octet2 = tvb_get_guint8( tvb, offset + 1 );
+ octet2 = tvb_get_uint8( tvb, offset + 1 );
payload_type = RTP_PAYLOAD_TYPE( octet2 );
if (payload_type >= 72 && payload_type <= 76) {
@@ -1405,7 +1417,7 @@ dissect_rtp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
* leaving those values only when specificed by other means
* (SDP, Decode As, etc.)
*/
- return FALSE;
+ return false;
}
/* Skip fixed header */
@@ -1414,20 +1426,20 @@ dissect_rtp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
offset += 4 * RTP_CSRC_COUNT( octet1 );
if (RTP_EXTENSION( octet1 )) {
if (tvb_captured_length_remaining(tvb, offset) < 4) {
- return FALSE;
+ return false;
}
- offset += 4 + 4*tvb_get_guint16(tvb, offset+2, ENC_BIG_ENDIAN);
+ offset += 4 + 4*tvb_get_uint16(tvb, offset+2, ENC_BIG_ENDIAN);
}
if (tvb_reported_length(tvb) < offset) {
- return FALSE;
+ return false;
}
if (RTP_PADDING( octet1 )) {
if (tvb_captured_length(tvb) == tvb_reported_length(tvb)) {
/* We can test the padding if the last octet is present. */
- padding_count = tvb_get_guint8(tvb, tvb_reported_length(tvb) - 1);
+ padding_count = tvb_get_uint8(tvb, tvb_reported_length(tvb) - 1);
if (tvb_reported_length_remaining(tvb, offset) < padding_count ||
padding_count == 0) {
- return FALSE;
+ return false;
}
}
}
@@ -1456,7 +1468,7 @@ dissect_rtp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
p_conv_data->btvdp_info = NULL;
}
dissect_rtp( tvb, pinfo, tree, data );
- return TRUE;
+ return true;
}
/*
@@ -1507,7 +1519,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
} if (p_packet_data && p_packet_data->bta2dp_info) {
tvbuff_t *nexttvb;
- gint suboffset = 0;
+ int suboffset = 0;
if (p_packet_data->bta2dp_info->content_protection_type == BTAVDTP_CONTENT_PROTECTION_TYPE_SCMS_T) {
nexttvb = tvb_new_subset_length(newtvb, 0, 1);
@@ -1525,7 +1537,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
} if (p_packet_data && p_packet_data->btvdp_info) {
tvbuff_t *nexttvb;
- gint suboffset = 0;
+ int suboffset = 0;
if (p_packet_data->btvdp_info->content_protection_type == BTAVDTP_CONTENT_PROTECTION_TYPE_SCMS_T) {
nexttvb = tvb_new_subset_length(newtvb, 0, 1);
@@ -1548,7 +1560,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
if (p_packet_data && payload_type >= PT_UNDF_96 && payload_type <= PT_UNDF_127) {
/* if the payload type is dynamic, we check if the conv is set and we look for the pt definition */
if (p_packet_data->rtp_dyn_payload) {
- const gchar *payload_type_str = rtp_dyn_payload_get_name(p_packet_data->rtp_dyn_payload, payload_type);
+ const char *payload_type_str = rtp_dyn_payload_get_name(p_packet_data->rtp_dyn_payload, payload_type);
if (payload_type_str) {
int len;
len = dissector_try_string(rtp_dyn_pt_dissector_table,
@@ -1567,7 +1579,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
}
/* if we don't found, it is static OR could be set static from the preferences */
- if (dissector_try_uint_new(rtp_pt_dissector_table, payload_type, newtvb, pinfo, tree, TRUE, rtp_info))
+ if (dissector_try_uint_new(rtp_pt_dissector_table, payload_type, newtvb, pinfo, tree, true, rtp_info))
proto_item_set_hidden(rtp_data);
}
@@ -1592,11 +1604,11 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
tvbuff_t *newtvb;
struct _rtp_packet_info *p_packet_data;
- gboolean must_desegment = FALSE;
+ bool must_desegment = false;
rtp_private_conv_info *finfo = NULL;
rtp_multisegment_pdu *msp;
- guint32 seqno;
- guint16 save_can_desegment;
+ uint32_t seqno;
+ uint16_t save_can_desegment;
/* Retrieve RTPs idea of a conversation */
p_packet_data = (struct _rtp_packet_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rtp, RTP_CONVERSATION_PROTO_DATA);
@@ -1633,7 +1645,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
msp = (rtp_multisegment_pdu *)wmem_tree_lookup32_le(finfo->multisegment_pdus, seqno-1);
if(msp && msp->startseq < seqno && msp->endseq >= seqno) {
- guint32 fid = msp->startseq;
+ uint32_t fid = msp->startseq;
fragment_head *fd_head;
#ifdef DEBUG_FRAGMENTS
@@ -1647,7 +1659,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
fd_head = fragment_add_seq(&rtp_reassembly_table,
tvb, offset, pinfo, fid, NULL,
seqno-msp->startseq, data_len,
- FALSE, 0);
+ false, 0);
newtvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled RTP", fd_head,
&rtp_fragment_items, NULL, tree);
@@ -1682,7 +1694,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* the higher-level dissector has asked for some more data - ie,
the end of this segment does not coincide with the end of a
higher-level PDU. */
- must_desegment = TRUE;
+ must_desegment = true;
}
}
@@ -1706,7 +1718,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* the higher-level dissector has asked for some more data - ie,
the end of this segment does not coincide with the end of a
higher-level PDU. */
- must_desegment = TRUE;
+ must_desegment = true;
}
}
@@ -1715,8 +1727,8 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
if(must_desegment)
{
- guint32 deseg_offset = pinfo->desegment_offset;
- guint32 frag_len = tvb_reported_length_remaining(newtvb, deseg_offset);
+ uint32_t deseg_offset = pinfo->desegment_offset;
+ uint32_t frag_len = tvb_reported_length_remaining(newtvb, deseg_offset);
fragment_head *fd_head;
#ifdef DEBUG_FRAGMENTS
@@ -1740,7 +1752,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
fd_head = fragment_add_seq(&rtp_reassembly_table,
newtvb, deseg_offset, pinfo, seqno, NULL, 0, frag_len,
- TRUE, 0);
+ true, 0);
if(fd_head != NULL)
{
@@ -1791,9 +1803,9 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
dissect_rtp_rfc2198(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- volatile gint offset = 0;
+ volatile int offset = 0;
int cnt;
- gboolean hdr_follow = TRUE;
+ bool hdr_follow = true;
proto_tree *rfc2198_tree;
rfc2198_hdr *hdr_last;
rfc2198_hdr *hdr_chain = NULL;
@@ -1819,9 +1831,9 @@ dissect_rtp_rfc2198(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
while (hdr_follow) {
proto_item *ti;
proto_tree *rfc2198_hdr_tree;
- const gchar *payload_type_str;
+ const char *payload_type_str;
rfc2198_hdr *hdr_new;
- guint8 octet1;
+ uint8_t octet1;
cnt++;
payload_type_str = NULL;
@@ -1829,7 +1841,7 @@ dissect_rtp_rfc2198(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
/* Allocate and fill in header */
hdr_new = wmem_new0(pinfo->pool, rfc2198_hdr);
hdr_new->next = NULL;
- octet1 = tvb_get_guint8(tvb, offset);
+ octet1 = tvb_get_uint8(tvb, offset);
hdr_new->pt = RTP_PAYLOAD_TYPE(octet1);
hdr_follow = (octet1 & 0x80);
@@ -1874,7 +1886,7 @@ dissect_rtp_rfc2198(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
offset += 3;
} else {
hdr_new->len = -1;
- hdr_follow = FALSE;
+ hdr_follow = false;
}
if (hdr_last) {
@@ -1956,8 +1968,8 @@ dissect_full_rfc4571(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
| LENGTH | RTP or RTCP packet ... |
---------------------------------------------------------------
*/
- gint offset = 0;
- guint32 length = 0;
+ int offset = 0;
+ uint32_t length = 0;
proto_tree_add_item_ret_uint(tree, hf_rfc4571_header_len, tvb, offset, 2, ENC_NA, &length);
if (length == 0) {
return 2;
@@ -1971,11 +1983,11 @@ dissect_full_rfc4571(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
return tvb_reported_length(tvb);
}
-static guint
+static unsigned
get_rtp_rfc4571_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
- guint16 rtp_length = tvb_get_ntohs(tvb, offset); /* length field is at the beginning, 2 bytes */
- return (guint)rtp_length + 2; /* plus the length field */
+ uint16_t rtp_length = tvb_get_ntohs(tvb, offset); /* length field is at the beginning, 2 bytes */
+ return (unsigned)rtp_length + 2; /* plus the length field */
}
#define RTP_RFC4571_HEADER_LEN 2
@@ -1983,7 +1995,7 @@ get_rtp_rfc4571_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *dat
static int
dissect_rtp_rfc4571(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, RTP_RFC4571_HEADER_LEN,
+ tcp_dissect_pdus(tvb, pinfo, tree, true, RTP_RFC4571_HEADER_LEN,
get_rtp_rfc4571_len, dissect_full_rfc4571, data);
return tvb_captured_length(tvb);
}
@@ -1993,18 +2005,18 @@ dissect_rtp_hext_rfc5285_onebyte( tvbuff_t *tvb, packet_info *pinfo,
proto_tree *rtp_hext_tree )
{
proto_tree *rtp_hext_rfc5285_tree = NULL;
- guint ext_offset = 0;
+ unsigned ext_offset = 0;
while (ext_offset < tvb_captured_length (tvb)) {
- guint8 ext_hdr_hdr;
- guint8 ext_id;
- guint8 ext_length;
- guint start_ext_offset;
+ uint8_t ext_hdr_hdr;
+ uint8_t ext_id;
+ uint8_t ext_length;
+ unsigned start_ext_offset;
tvbuff_t *subtvb;
/* Skip bytes with the value 0, they are padding */
start_ext_offset = ext_offset;
- while (tvb_get_guint8 (tvb, ext_offset) == 0) {
+ while (tvb_get_uint8 (tvb, ext_offset) == 0) {
ext_offset ++;
if (ext_offset >= tvb_captured_length (tvb))
return;
@@ -2014,7 +2026,7 @@ dissect_rtp_hext_rfc5285_onebyte( tvbuff_t *tvb, packet_info *pinfo,
if (ext_offset > start_ext_offset)
proto_tree_add_item(rtp_hext_tree, hf_rtp_padding_data, tvb, start_ext_offset, ext_offset-start_ext_offset, ENC_NA );
- ext_hdr_hdr = tvb_get_guint8 (tvb, ext_offset);
+ ext_hdr_hdr = tvb_get_uint8 (tvb, ext_offset);
ext_id = ext_hdr_hdr >> 4;
/* 15 is for future extensibility, ignore length, etc and stop processing packet if it shows up */
@@ -2049,20 +2061,20 @@ dissect_rtp_hext_rfc5285_onebyte( tvbuff_t *tvb, packet_info *pinfo,
static void
-dissect_rtp_hext_rfc5285_twobytes(tvbuff_t *parent_tvb, guint id_offset,
- guint8 id, tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtp_hext_tree)
+dissect_rtp_hext_rfc5285_twobytes(tvbuff_t *parent_tvb, unsigned id_offset,
+ uint8_t id, tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtp_hext_tree)
{
proto_tree *rtp_hext_rfc5285_tree = NULL;
- guint ext_offset = 0, start_ext_offset;
+ unsigned ext_offset = 0, start_ext_offset;
while (ext_offset + 2 < tvb_captured_length (tvb)) {
- guint8 ext_id;
- guint8 ext_length;
+ uint8_t ext_id;
+ uint8_t ext_length;
tvbuff_t *subtvb;
/* Skip bytes with the value 0, they are padding */
start_ext_offset = ext_offset;
- while (tvb_get_guint8 (tvb, ext_offset) == 0) {
+ while (tvb_get_uint8 (tvb, ext_offset) == 0) {
if (ext_offset + 2 >= tvb_captured_length (tvb))
return;
ext_offset ++;
@@ -2071,8 +2083,8 @@ dissect_rtp_hext_rfc5285_twobytes(tvbuff_t *parent_tvb, guint id_offset,
if (ext_offset > start_ext_offset)
proto_tree_add_item(rtp_hext_tree, hf_rtp_padding_data, tvb, start_ext_offset, ext_offset-start_ext_offset, ENC_NA );
- ext_id = tvb_get_guint8 (tvb, ext_offset);
- ext_length = tvb_get_guint8 (tvb, ext_offset + 1);
+ ext_id = tvb_get_uint8 (tvb, ext_offset);
+ ext_length = tvb_get_uint8 (tvb, ext_offset + 1);
if (rtp_hext_tree) {
rtp_hext_rfc5285_tree = proto_tree_add_subtree(rtp_hext_tree, tvb, ext_offset, ext_length + 2,
@@ -2094,27 +2106,27 @@ dissect_rtp_hext_rfc5285_twobytes(tvbuff_t *parent_tvb, guint id_offset,
}
}
-static gint
+static int
dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti = NULL;
proto_tree *volatile rtp_tree = NULL;
- guint8 octet1, octet2;
+ uint8_t octet1, octet2;
unsigned int version;
- gboolean padding_set;
- gboolean extension_set;
+ bool padding_set;
+ bool extension_set;
unsigned int csrc_count;
- gboolean marker_set;
+ bool marker_set;
unsigned int payload_type;
- const gchar *payload_type_str = NULL;
- gboolean is_srtp = FALSE;
+ const char *payload_type_str = NULL;
+ bool is_srtp = false;
unsigned int i;
- gint length, reported_length;
+ int length, reported_length;
int data_len;
volatile unsigned int offset = 0;
- guint16 seq_num;
- guint32 timestamp;
- guint32 sync_src;
+ uint16_t seq_num;
+ uint32_t timestamp;
+ uint32_t sync_src;
struct _rtp_packet_info *p_packet_data;
/*struct srtp_info *srtp_info = NULL;*/
/*unsigned int srtp_offset;*/
@@ -2129,7 +2141,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
};
/* Get the fields in the first octet */
- octet1 = tvb_get_guint8( tvb, offset );
+ octet1 = tvb_get_uint8( tvb, offset );
version = RTP_VERSION( octet1 );
/* RFC 7983 gives current best practice in demultiplexing RTP packets:
@@ -2189,7 +2201,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
case 3:
if (octet1 == 0xFF) {
- if (tvb_get_guint8( tvb, offset + 1 ) == 0x10) {
+ if (tvb_get_uint8( tvb, offset + 1 ) == 0x10) {
/* Special MS-TURN Multiplexed TURN Channel */
call_dissector(stun_handle, tvb, pinfo, tree);
return tvb_captured_length(tvb);
@@ -2218,7 +2230,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return tvb_captured_length(tvb);
case RTP0_INVALID:
- if (!(tvb_memeql(tvb, 4, (const guint8*)"ZRTP", 4)))
+ if (!(tvb_memeql(tvb, 4, (const uint8_t*)"ZRTP", 4)))
{
call_dissector(zrtp_handle, tvb,pinfo, tree);
return tvb_captured_length(tvb);
@@ -2259,7 +2271,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
csrc_count = RTP_CSRC_COUNT( octet1 );
/* Get the fields in the second octet */
- octet2 = tvb_get_guint8( tvb, offset + 1 );
+ octet2 = tvb_get_uint8( tvb, offset + 1 );
marker_set = RTP_MARKER( octet2 );
payload_type = RTP_PAYLOAD_TYPE( octet2 );
@@ -2286,12 +2298,12 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
rtp_info->info_timestamp = timestamp;
rtp_info->info_extended_timestamp = timestamp; /* initial with timestamp */
rtp_info->info_sync_src = sync_src;
- rtp_info->info_is_srtp = FALSE;
+ rtp_info->info_is_srtp = false;
rtp_info->info_setup_frame_num = 0;
rtp_info->info_payload_type_str = NULL;
rtp_info->info_payload_rate = 0;
rtp_info->info_payload_fmtp_map = NULL;
- rtp_info->info_is_ed137 = FALSE;
+ rtp_info->info_is_ed137 = false;
rtp_info->info_ed137_info = NULL;
/*
@@ -2303,7 +2315,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
* Yes.
*/
- rtp_info->info_all_data_present = TRUE;
+ rtp_info->info_all_data_present = true;
rtp_info->info_data_len = reported_length;
/*
@@ -2322,7 +2334,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
* No - packet was cut short at capture time.
*/
- rtp_info->info_all_data_present = FALSE;
+ rtp_info->info_all_data_present = false;
rtp_info->info_data_len = 0;
rtp_info->info_data = NULL;
}
@@ -2331,7 +2343,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
p_packet_data = get_rtp_packet_info(pinfo, rtp_info);
- if (p_packet_data && p_packet_data->srtp_info) is_srtp = TRUE;
+ if (p_packet_data && p_packet_data->srtp_info) is_srtp = true;
rtp_info->info_is_srtp = is_srtp;
col_set_str( pinfo->cinfo, COL_PROTOCOL, (is_srtp) ? "SRTP" : "RTP" );
@@ -2438,6 +2450,10 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/* Timestamp 32 bits (4 octets) */
proto_tree_add_uint( rtp_tree, hf_rtp_timestamp, tvb, offset, 4, timestamp );
+ if(p_packet_data != NULL) {
+ item = proto_tree_add_uint64(rtp_tree, hf_rtp_ext_timestamp, tvb, offset, 4, p_packet_data->extended_timestamp);
+ proto_item_set_generated(item);
+ }
offset += 4;
/* Synchronization source identifier 32 bits (4 octets) */
@@ -2449,7 +2465,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/* CSRC list*/
if ( csrc_count > 0 ) {
proto_tree *rtp_csrc_tree;
- guint32 csrc_item;
+ uint32_t csrc_item;
ti = proto_tree_add_item(rtp_tree, hf_rtp_csrc_items, tvb, offset,
csrc_count * 4, ENC_NA);
proto_item_append_text(ti, " (%u items)", csrc_count);
@@ -2498,7 +2514,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
pinfo, rtp_hext_tree);
}
else {
- if ( !(dissector_try_uint_new(rtp_hdr_ext_dissector_table, hdr_extension_id, newtvb, pinfo, rtp_hext_tree, FALSE, rtp_info)) ) {
+ if ( !(dissector_try_uint_new(rtp_hdr_ext_dissector_table, hdr_extension_id, newtvb, pinfo, rtp_hext_tree, false, rtp_info)) ) {
unsigned int hdrext_offset;
hdrext_offset = offset;
@@ -2521,6 +2537,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* that can be ignored at the end of the packet.
*/
volatile unsigned int padding_count;
+ volatile bool padding_bogus = false;
if (tvb_captured_length(tvb) < tvb_reported_length(tvb)) {
/*
* We don't *have* the last octet of the
@@ -2537,7 +2554,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return tvb_captured_length(tvb);
}
- padding_count = tvb_get_guint8( tvb,
+ padding_count = tvb_get_uint8( tvb,
tvb_reported_length( tvb ) - 1 );
data_len =
tvb_reported_length_remaining( tvb, offset ) - padding_count;
@@ -2598,29 +2615,38 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* The padding count is bigger than the
* amount of RTP payload in the packet!
* Clip the padding count.
- *
- * XXX - put an item in the tree to indicate
- * that the padding count is bogus?
*/
padding_count =
tvb_reported_length_remaining(tvb, offset);
- }
- if (padding_count > 1) {
+ padding_bogus = true;
+ }
+ if (padding_count) {
+ if (padding_count > 1) {
+ /*
+ * There's more than one byte of padding;
+ * show all but the last byte as padding
+ * data.
+ */
+ proto_tree_add_item( rtp_tree, hf_rtp_padding_data,
+ tvb, offset, padding_count - 1, ENC_NA );
+ offset += padding_count - 1;
+ }
/*
- * There's more than one byte of padding;
- * show all but the last byte as padding
- * data.
+ * Show the last byte in the PDU as the padding
+ * count.
+ */
+ ti = proto_tree_add_item( rtp_tree, hf_rtp_padding_count,
+ tvb, offset, 1, ENC_BIG_ENDIAN );
+ if (padding_bogus) {
+ expert_add_info(pinfo, ti, &ei_rtp_padding_bogus);
+ }
+ } else {
+ /* The padding length includes itself, so zero is an illegal
+ * value. Trying to add it to the tree at this point would
+ * create a malformed error by running off the end of the tvb.
*/
- proto_tree_add_item( rtp_tree, hf_rtp_padding_data,
- tvb, offset, padding_count - 1, ENC_NA );
- offset += padding_count - 1;
+ proto_tree_add_expert_format(rtp_tree, pinfo, &ei_rtp_padding_bogus, tvb, tvb_reported_length(tvb) - 1, 1, "Frame has padding, but of illegal length zero");
}
- /*
- * Show the last byte in the PDU as the padding
- * count.
- */
- proto_tree_add_item( rtp_tree, hf_rtp_padding_count,
- tvb, offset, 1, ENC_BIG_ENDIAN );
}
else {
/*
@@ -2674,24 +2700,24 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return offset;
}
-gint
-dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto_tree *tree, struct _rtp_info *rtp_info)
+int
+dissect_rtp_shim_header(tvbuff_t *tvb, int start, packet_info *pinfo _U_, proto_tree *tree, struct _rtp_info *rtp_info)
{
proto_item *rtp_ti = NULL;
proto_tree *rtp_tree = NULL;
proto_item *ti;
- guint8 octet1, octet2;
+ uint8_t octet1, octet2;
unsigned int version;
- gboolean padding_set;
- gboolean extension_set;
+ bool padding_set;
+ bool extension_set;
unsigned int csrc_count;
- gboolean marker_set;
+ bool marker_set;
unsigned int payload_type;
unsigned int i;
- gint offset = start;
- guint16 seq_num;
- guint32 timestamp;
- guint32 sync_src;
+ int offset = start;
+ uint16_t seq_num;
+ uint32_t timestamp;
+ uint32_t sync_src;
const char *pt = NULL;
static int * const octet1_fields[] = {
&hf_rtp_version,
@@ -2702,7 +2728,7 @@ dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto
};
/* Get the fields in the first octet */
- octet1 = tvb_get_guint8( tvb, offset );
+ octet1 = tvb_get_uint8( tvb, offset );
version = RTP_VERSION( octet1 );
/* fill in the rtp_info structure */
@@ -2726,7 +2752,7 @@ dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto
csrc_count = RTP_CSRC_COUNT( octet1 );
/* Get the fields in the second octet */
- octet2 = tvb_get_guint8( tvb, offset + 1 );
+ octet2 = tvb_get_uint8( tvb, offset + 1 );
marker_set = RTP_MARKER( octet2 );
payload_type = RTP_PAYLOAD_TYPE( octet2 );
@@ -2745,16 +2771,16 @@ dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto
rtp_info->info_timestamp = timestamp;
rtp_info->info_sync_src = sync_src;
rtp_info->info_data_len = 0;
- rtp_info->info_all_data_present = FALSE;
+ rtp_info->info_all_data_present = false;
rtp_info->info_payload_offset = 0;
rtp_info->info_payload_len = 0;
- rtp_info->info_is_srtp = FALSE;
+ rtp_info->info_is_srtp = false;
rtp_info->info_setup_frame_num = 0;
rtp_info->info_data = NULL;
rtp_info->info_payload_type_str = NULL;
rtp_info->info_payload_rate = 0;
rtp_info->info_payload_fmtp_map = NULL;
- rtp_info->info_is_ed137 = FALSE;
+ rtp_info->info_is_ed137 = false;
rtp_info->info_ed137_info = NULL;
}
@@ -2793,7 +2819,7 @@ dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto
/* CSRC list*/
if ( csrc_count > 0 ) {
proto_tree *rtp_csrc_tree;
- guint32 csrc_item;
+ uint32_t csrc_item;
ti = proto_tree_add_item(rtp_tree, hf_rtp_csrc_items, tvb, offset,
csrc_count * 4, ENC_NA);
proto_item_append_text(ti, " (%u items)", csrc_count);
@@ -2843,10 +2869,10 @@ dissect_rtp_shim_header(tvbuff_t *tvb, gint start, packet_info *pinfo _U_, proto
/* calculate the extended sequence number - top 16 bits of the previous sequence number,
* plus our own; then correct for wrapping */
-static guint32
-calculate_extended_seqno(guint32 previous_seqno, guint16 raw_seqno)
+static uint32_t
+calculate_extended_seqno(uint32_t previous_seqno, uint16_t raw_seqno)
{
- guint32 seqno = (previous_seqno & 0xffff0000) | raw_seqno;
+ uint32_t seqno = (previous_seqno & 0xffff0000) | raw_seqno;
if (seqno + 0x8000 < previous_seqno) {
seqno += 0x10000;
} else if (previous_seqno + 0x8000 < seqno) {
@@ -2859,10 +2885,10 @@ calculate_extended_seqno(guint32 previous_seqno, guint16 raw_seqno)
/* calculate the extended sequence number - top 16 bits of the previous sequence number,
* plus our own; then correct for wrapping */
-static guint64
-calculate_extended_timestamp(guint64 previous_timestamp, guint32 raw_timestamp)
+static uint64_t
+calculate_extended_timestamp(uint64_t previous_timestamp, uint32_t raw_timestamp)
{
- guint64 timestamp = (previous_timestamp & 0xffffffff00000000) | raw_timestamp;
+ uint64_t timestamp = (previous_timestamp & 0xffffffff00000000) | raw_timestamp;
if (timestamp + 0x80000000 < previous_timestamp) {
timestamp += 0x100000000;
} else if (previous_timestamp + 0x80000000 < timestamp) {
@@ -2921,8 +2947,8 @@ get_rtp_packet_info(packet_info *pinfo, struct _rtp_info *rtp_info)
conversation_add_proto_data(p_conv, proto_rtp, p_conv_data);
}
- guint32 seqno;
- guint64 timestamp;
+ uint32_t seqno;
+ uint64_t timestamp;
/* Save this conversation info into packet info */
/* This is file scoped because we only do this on the first pass.
@@ -3006,7 +3032,7 @@ show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_generated(item);
if (p_packet_data->rtp_sdp_setup_info_list){
- guint i;
+ unsigned i;
sdp_setup_info_t *stored_setup_info;
for (i = 0; i < wmem_array_get_count(p_packet_data->rtp_sdp_setup_info_list); i++) {
stored_setup_info = (sdp_setup_info_t *)wmem_array_index(p_packet_data->rtp_sdp_setup_info_list, i);
@@ -3014,13 +3040,13 @@ show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_STR) {
item = proto_tree_add_string(rtp_setup_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.str);
proto_item_set_generated(item);
- if (stored_setup_info->add_hidden == TRUE) {
+ if (stored_setup_info->add_hidden == true) {
proto_item_set_hidden(item);
}
- } else if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_GUINT32) {
+ } else if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_UINT32) {
item = proto_tree_add_uint(rtp_setup_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.num);
proto_item_set_generated(item);
- if (stored_setup_info->add_hidden == TRUE) {
+ if (stored_setup_info->add_hidden == true) {
proto_item_set_hidden(item);
}
}
@@ -3086,7 +3112,7 @@ proto_register_pkt_ccc(void)
};
- static gint *ett[] =
+ static int *ett[] =
{
&ett_pkt_ccc,
};
@@ -3227,6 +3253,18 @@ proto_register_rtp(void)
}
},
{
+ &hf_rtp_ext_timestamp,
+ {
+ "Extended timestamp",
+ "rtp.timestamp_ext",
+ FT_UINT64,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL, HFILL
+ }
+ },
+ {
&hf_rtp_ssrc,
{
"Synchronization Source identifier",
@@ -3565,7 +3603,7 @@ proto_register_rtp(void)
};
- static gint *ett[] =
+ static int *ett[] =
{
&ett_rtp,
&ett_csrc_list,
@@ -3580,7 +3618,8 @@ proto_register_rtp(void)
static ei_register_info ei[] = {
{ &ei_rtp_fragment_unfinished, { "rtp.fragment_unfinished", PI_REASSEMBLE, PI_CHAT, "RTP fragment, unfinished", EXPFILL }},
- { &ei_rtp_padding_missing, { "rtp.padding_missing", PI_MALFORMED, PI_ERROR, "Frame has padding, but not all the frame data was captured", EXPFILL }},
+ { &ei_rtp_padding_missing, { "rtp.padding_missing", PI_UNDECODED, PI_WARN, "Frame has padding, but not all the frame data was captured", EXPFILL }},
+ { &ei_rtp_padding_bogus, { "rtp.padding_bogus", PI_PROTOCOL, PI_WARN, "Frame has padding length value greater than payload length", EXPFILL }},
};
/* Decode As handling */
@@ -3638,7 +3677,7 @@ proto_register_rtp(void)
"If an RTP version 0 packet is encountered, it can be treated as "
"an invalid or ZRTP packet, a CLASSIC-STUN packet, or a T.38 packet",
&global_rtp_version0_type,
- rtp_version0_types, FALSE);
+ rtp_version0_types, false);
prefs_register_obsolete_preference(rtp_module, "rfc2198_payload_type");
prefs_register_bool_preference(rtp_module, "rfc2198_deencapsulate",
@@ -3672,8 +3711,6 @@ proto_reg_handoff_rtp(void)
rtcp_handle = find_dissector_add_dependency("rtcp", proto_rtp);
stun_handle = find_dissector_add_dependency("stun-udp", proto_rtp);
classicstun_handle = find_dissector_add_dependency("classicstun", proto_rtp);
- classicstun_heur_handle = find_dissector_add_dependency("classicstun-heur", proto_rtp);
- stun_heur_handle = find_dissector_add_dependency("stun-heur", proto_rtp);
t38_handle = find_dissector_add_dependency("t38_udp", proto_rtp);
zrtp_handle = find_dissector_add_dependency("zrtp", proto_rtp);
dtls_handle = find_dissector_add_dependency("dtls", proto_rtp);