}
}
+static void free_encoding_name_str (encoding_name_and_rate_t *encoding_name_and_rate)
+{
+ if (encoding_name_and_rate->encoding_name) {
+ g_free(encoding_name_and_rate->encoding_name);
+ }
+}
+
static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_channel_lcl)
{
gint *key;
/* (S)RTP, (S)RTCP */
if (upcoming_channel_lcl->rfc2198 > 0) {
- rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
+ encoding_name_and_rate_t *encoding_name_and_rate = g_malloc( sizeof(encoding_name_and_rate_t));
+ rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_encoding_name_str);
+ encoding_name_and_rate->encoding_name = g_strdup("red");
+ encoding_name_and_rate->sample_rate = 8000;
key = g_malloc(sizeof(gint));
*key = upcoming_channel_lcl->rfc2198;
- g_hash_table_insert(rtp_dyn_payload, key, g_strdup("red"));
+ g_hash_table_insert(rtp_dyn_payload, key, encoding_name_and_rate);
}
if (upcoming_channel_lcl->srtp_flag) {
/*
* IOS 5 4.2.90
*/
+static void free_encoding_name_str (encoding_name_and_rate_t *encoding_name_and_rate)
+{
+ if (encoding_name_and_rate->encoding_name) {
+ g_free(encoding_name_and_rate->encoding_name);
+ }
+}
+
static guint8
elem_a2p_bearer_format(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{
GHashTable *rtp_dyn_payload;
gint *key;
- rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
+ rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_encoding_name_str);
first_assigned_found = FALSE;
format_assigned &&
(first_assigned_found == FALSE))
{
+ encoding_name_and_rate_t *encoding_name_and_rate = g_malloc( sizeof(encoding_name_and_rate_t));
key = (gint *)g_malloc(sizeof(gint));
*key = rtp_payload_type;
- g_hash_table_insert(rtp_dyn_payload, key, g_strdup(mime_type));
+ encoding_name_and_rate->encoding_name = g_strdup(mime_type);
+ /* Assumtion; all pt:s above have a sample rate of 8000 */
+ encoding_name_and_rate->sample_rate = 8000;
+ g_hash_table_insert(rtp_dyn_payload, key, encoding_name_and_rate);
first_assigned_found = TRUE;
}
}
+static void free_encoding_name_str (encoding_name_and_rate_t *encoding_name_and_rate)
+{
+ if (encoding_name_and_rate->encoding_name) {
+ g_free(encoding_name_and_rate->encoding_name);
+ }
+}
+
static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_channel_lcl)
{
gint *key;
/* (S)RTP, (S)RTCP */
if (upcoming_channel_lcl->rfc2198 > 0) {
- rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
+ encoding_name_and_rate_t *encoding_name_and_rate = g_malloc( sizeof(encoding_name_and_rate_t));
+ rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_encoding_name_str);
+ encoding_name_and_rate->encoding_name = g_strdup("red");
+ encoding_name_and_rate->sample_rate = 8000;
key = g_malloc(sizeof(gint));
*key = upcoming_channel_lcl->rfc2198;
- g_hash_table_insert(rtp_dyn_payload, key, g_strdup("red"));
+ g_hash_table_insert(rtp_dyn_payload, key, encoding_name_and_rate);
}
if (upcoming_channel_lcl->srtp_flag) {
static int hf_h245_encryptedAlphanumeric = -1; /* EncryptedAlphanumeric */
/*--- End of included file: packet-h245-hf.c ---*/
-#line 373 "packet-h245-template.c"
+#line 383 "packet-h245-template.c"
/* Initialize the subtree pointers */
static int ett_h245 = -1;
static gint ett_h245_MobileMultilinkReconfigurationIndication = -1;
/*--- End of included file: packet-h245-ett.c ---*/
-#line 378 "packet-h245-template.c"
+#line 388 "packet-h245-template.c"
/* Forward declarations */
static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
/*--- End of included file: packet-h245-fn.c ---*/
-#line 387 "packet-h245-template.c"
+#line 397 "packet-h245-template.c"
static void
dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
"h245.EncryptedAlphanumeric", HFILL }},
/*--- End of included file: packet-h245-hfarr.c ---*/
-#line 463 "packet-h245-template.c"
+#line 473 "packet-h245-template.c"
};
/* List of subtrees */
&ett_h245_MobileMultilinkReconfigurationIndication,
/*--- End of included file: packet-h245-ettarr.c ---*/
-#line 470 "packet-h245-template.c"
+#line 480 "packet-h245-template.c"
};
module_t *h245_module;
else if ( (payload_type >= PT_UNDF_96 && payload_type <= PT_UNDF_127) ) {
if (p_conv_data && p_conv_data->rtp_dyn_payload) {
gchar *payload_type_str = NULL;
- payload_type_str = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &payload_type);
+ encoding_name_and_rate_t *encoding_name_and_rate_pt = NULL;
+ encoding_name_and_rate_pt = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &payload_type);
+ payload_type_str = encoding_name_and_rate_pt->encoding_name;
if (payload_type_str){
found_match = dissector_try_string(rtp_dyn_pt_dissector_table,
payload_type_str, newtvb, pinfo, tree);
/* if it is dynamic payload, let use the conv data to see if it is defined */
if ((hdr_new->pt > 95) && (hdr_new->pt < 128)) {
if (p_conv_data && p_conv_data->rtp_dyn_payload){
+ encoding_name_and_rate_t *encoding_name_and_rate_pt = NULL;
payload_type_str = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &hdr_new->pt);
+ payload_type_str = encoding_name_and_rate_pt->encoding_name;
}
}
/* Add a subtree for this header and add items */
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;
/*
* Do we have all the data?
/* if it is dynamic payload, let use the conv data to see if it is defined */
if ( (payload_type>95) && (payload_type<128) ) {
if (p_conv_data && p_conv_data->rtp_dyn_payload){
- payload_type_str = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &payload_type);
- rtp_info->info_payload_type_str = payload_type_str;
+ encoding_name_and_rate_t *encoding_name_and_rate_pt = NULL;
+ encoding_name_and_rate_pt = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &payload_type);
+ rtp_info->info_payload_type_str = encoding_name_and_rate_pt->encoding_name;
+ rtp_info->info_payload_rate = encoding_name_and_rate_pt->sample_rate;
}
}
guint32 info_setup_frame_num; /* the frame num of the packet that set this RTP connection */
const guint8* info_data; /* pointer to raw rtp data */
gchar *info_payload_type_str;
+ gint info_payload_rate;
/*
* info_data: pointer to raw rtp data = header + payload incl. padding.
* That should be safe because the "epan_dissect_t" constructed for the packet
struct srtp_info *srtp_info; /* SRTP context */
};
+typedef struct {
+ char *encoding_name;
+ int sample_rate;
+} encoding_name_and_rate_t;
+
/* Add an RTP conversation with the given details */
void rtp_add_address(packet_info *pinfo,
address *addr, int port,
char *connection_address;
char *connection_type;
char *media_type;
- char *encoding_name[SDP_NO_OF_PT];
- char *encoding_name_and_rate[SDP_NO_OF_PT];
+ char *encoding_name[SDP_NO_OF_PT];
+ int sample_rate[SDP_NO_OF_PT];
char *media_port[SDP_MAX_RTP_CHANNELS];
char *media_proto[SDP_MAX_RTP_CHANNELS];
transport_media_pt_t media[SDP_MAX_RTP_CHANNELS];
transport_info_t *transport_info);
static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_item *ti, int length,transport_info_t *transport_info);
+static void free_encoding_name_str (encoding_name_and_rate_t *encoding_name_and_rate)
+{
+ if (encoding_name_and_rate->encoding_name) {
+ g_free(encoding_name_and_rate->encoding_name);
+ }
+}
+
static void
dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
transport_info.media_type=NULL;
for (n=0; n < SDP_NO_OF_PT; n++){
transport_info.encoding_name[n]=unknown_encoding;
- transport_info.encoding_name_and_rate[n]=unknown_encoding;
+ transport_info.sample_rate[n] = 0;
}
for (n=0; n < SDP_MAX_RTP_CHANNELS; n++)
{
transport_info.media_proto[n]=NULL;
transport_info.media[n].pt_count = 0;
transport_info.media[n].rtp_dyn_payload =
- g_hash_table_new_full( g_int_hash, g_int_equal, g_free, g_free);
+ g_hash_table_new_full( g_int_hash, g_int_equal, g_free, free_encoding_name_str);
}
transport_info.media_count = 0;
{
/* if the payload type is dynamic (96 to 127), check the hash table to add the desc in the SDP summary */
if ( (transport_info.media[n].pt[i] >=96) && (transport_info.media[n].pt[i] <=127) ) {
- gchar *str_dyn_pt = g_hash_table_lookup(transport_info.media[n].rtp_dyn_payload, &transport_info.media[n].pt[i]);
- if (str_dyn_pt)
- g_snprintf(sdp_pi->summary_str, 50, "%s %s", sdp_pi->summary_str, str_dyn_pt);
+ encoding_name_and_rate_t *encoding_name_and_rate_pt = g_hash_table_lookup(transport_info.media[n].rtp_dyn_payload, &transport_info.media[n].pt[i]);
+ if (encoding_name_and_rate_pt)
+ g_snprintf(sdp_pi->summary_str, 50, "%s %s", sdp_pi->summary_str, encoding_name_and_rate_pt->encoding_name);
else
g_snprintf(sdp_pi->summary_str, 50, "%s %d", sdp_pi->summary_str, transport_info.media[n].pt[i]);
} else
const char *h324ext_h223lcparm = "h324ext/h223lcparm";
gboolean has_more_pars = TRUE;
tvbuff_t *h245_tvb;
+ encoding_name_and_rate_t *encoding_name_and_rate;
offset = 0;
next_offset = 0;
break;
next_offset++;
}
- transport_info->encoding_name_and_rate[pt] = (char*)tvb_get_ephemeral_string(tvb, start_offset, next_offset - start_offset);
- proto_tree_add_text(sdp_media_attribute_tree, tvb, start_offset, next_offset - start_offset, "[Debug: %s]",transport_info->encoding_name_and_rate[pt]);
tokenlen = next_offset - offset;
proto_tree_add_item(sdp_media_attribute_tree, hf_media_sample_rate, tvb,
offset, tokenlen, FALSE);
+ transport_info->sample_rate[pt] = atoi(tvb_get_ephemeral_string(tvb, offset, tokenlen));
/* As per RFC2327 it is possible to have multiple Media Descriptions ("m=").
For example:
*/
if (transport_info->media_count == 0) {
for (n=0; n < SDP_MAX_RTP_CHANNELS; n++) {
- if (n==0)
+ encoding_name_and_rate = g_malloc( sizeof(encoding_name_and_rate_t));
+ encoding_name_and_rate->encoding_name = g_strdup(transport_info->encoding_name[pt]);
+ encoding_name_and_rate->sample_rate = transport_info->sample_rate[pt];
+ if (n==0){
g_hash_table_insert(transport_info->media[n].rtp_dyn_payload,
- key, g_strdup(transport_info->encoding_name[pt]));
+ key, encoding_name_and_rate);
+ }
else { /* we create a new key and encoding_name to assign to the other hash tables */
gint *key2;
key2=g_malloc( sizeof(gint) );
*key2=atol((char*)payload_type);
g_hash_table_insert(transport_info->media[n].rtp_dyn_payload,
- key2, g_strdup(transport_info->encoding_name[pt]));
+ key2, encoding_name_and_rate);
}
}
return;
/* if the "a=" is after an "m=", only apply to this "m=" */
}else
/* in case there is an overflow in SDP_MAX_RTP_CHANNELS, we keep always the last "m=" */
+ encoding_name_and_rate = g_malloc( sizeof(encoding_name_and_rate_t));
+ encoding_name_and_rate->encoding_name = g_strdup(transport_info->encoding_name[pt]);
+ encoding_name_and_rate->sample_rate = transport_info->sample_rate[pt];
if (transport_info->media_count == SDP_MAX_RTP_CHANNELS-1)
g_hash_table_insert(transport_info->media[ transport_info->media_count ].rtp_dyn_payload,
- key, g_strdup(transport_info->encoding_name[pt]));
+ key, encoding_name_and_rate);
else
g_hash_table_insert(transport_info->media[ transport_info->media_count-1 ].rtp_dyn_payload,
- key, g_strdup(transport_info->encoding_name[pt]));
+ key, encoding_name_and_rate);
break;
case SDP_FMTP:
if(sdp_media_attribute_tree){
clock_rate = 0;
statinfo->flags |= STAT_FLAG_PT_T_EVENT;
}else{
- clock_rate = get_dyn_pt_clock_rate(rtpinfo-> info_payload_type_str);
+ if(rtpinfo->info_payload_rate !=0){
+ clock_rate = rtpinfo->info_payload_rate;
+ }else{
+ clock_rate = get_dyn_pt_clock_rate(rtpinfo-> info_payload_type_str);
+ }
}
}else{
clock_rate = 0;