diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2005-03-10 19:32:22 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2005-03-10 19:32:22 +0000 |
commit | 008054453bbf4cc3fc54cae4a602ebcc869b4e92 (patch) | |
tree | fbe4ef788b1e4c8a766ae877769c7588528ccfa0 /epan/dissectors | |
parent | 8ee0a507c7807e32e7bad409df068e43f0eb1e18 (diff) | |
download | wireshark-008054453bbf4cc3fc54cae4a602ebcc869b4e92.tar.gz wireshark-008054453bbf4cc3fc54cae4a602ebcc869b4e92.tar.bz2 wireshark-008054453bbf4cc3fc54cae4a602ebcc869b4e92.zip |
From Alejandro Vaquero:
- Automatic dissection of RTP events (RFC2833) set in SDP sessions.
- Add RTP events (RFC2833) to the Voip Graph
svn path=/trunk/; revision=13697
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-h245.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-rtp-events.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-rtp-events.h | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-rtp.c | 26 | ||||
-rw-r--r-- | epan/dissectors/packet-rtp.h | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-rtsp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 46 | ||||
-rw-r--r-- | epan/dissectors/packet-skinny.c | 4 |
8 files changed, 98 insertions, 16 deletions
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c index 1132e5b06d..da923e1878 100644 --- a/epan/dissectors/packet-h245.c +++ b/epan/dissectors/packet-h245.c @@ -9866,7 +9866,7 @@ dissect_h245_OLC_rev_multiplexParameters(tvbuff_t *tvb, int offset, packet_info src_addr.len=4; src_addr.data=(char *)&ipv4_address; - rtp_add_address(pinfo, &src_addr, ipv4_port, 0, "H245", pinfo->fd->num); + rtp_add_address(pinfo, &src_addr, ipv4_port, 0, "H245", pinfo->fd->num, 0); } if((!pinfo->fd->flags.visited) && rtcp_ipv4_address!=0 && rtcp_ipv4_port!=0 && rtcp_handle){ address src_addr; @@ -12527,7 +12527,7 @@ dissect_h245_T_forwardMultiplexAckParameters(tvbuff_t *tvb, int offset, packet_i src_addr.len=4; src_addr.data=(char *)&ipv4_address; - rtp_add_address(pinfo, &src_addr, ipv4_port, 0, "H245", pinfo->fd->num); + rtp_add_address(pinfo, &src_addr, ipv4_port, 0, "H245", pinfo->fd->num, 0); } if((!pinfo->fd->flags.visited) && rtcp_ipv4_address!=0 && rtcp_ipv4_port!=0 && rtcp_handle){ address src_addr; diff --git a/epan/dissectors/packet-rtp-events.c b/epan/dissectors/packet-rtp-events.c index 2cb137b399..c44f96c264 100644 --- a/epan/dissectors/packet-rtp-events.c +++ b/epan/dissectors/packet-rtp-events.c @@ -40,6 +40,9 @@ #include <stdio.h> #include <string.h> #include "packet-rtp-events.h" +#include "packet-rtp.h" +#include <epan/conversation.h> +#include <epan/tap.h> /* rtp_event_payload_type_value is the value used globally to set the appropriate payload type @@ -54,6 +57,7 @@ static guint saved_payload_type_value; /* RTP Event Fields */ static int proto_rtp_events = -1; +static int rtp_event_tap = -1; static int hf_rtp_events_event = -1; /* one byte */ static int hf_rtp_events_end = -1; /* one bit */ @@ -69,12 +73,15 @@ static gint ett_rtp_events = -1; void proto_reg_handoff_rtp_events(void); +static struct _rtp_event_info rtp_event_info; + static void dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) { proto_item *ti = NULL; proto_tree *rtp_events_tree = NULL; unsigned int offset = 0; + struct _rtp_conversation_info *p_conv_data = NULL; guint8 rtp_evt; guint8 octet; @@ -91,13 +98,21 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) rtp_evt = tvb_get_guint8(tvb, offset ); + /* get tap info */ + rtp_event_info.info_rtp_evt = rtp_evt; + + p_conv_data = p_get_proto_data(pinfo->fd, proto_get_id_by_filter_name("rtp")); + if (p_conv_data) + rtp_event_info.info_setup_frame_num = p_conv_data->frame_number; + else + rtp_event_info.info_setup_frame_num = 0; + + if ( check_col( pinfo->cinfo, COL_INFO) ) { col_add_fstr( pinfo->cinfo, COL_INFO, "Payload type=RTP Event, %s", val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" )); - - } if ( tree ) @@ -121,6 +136,7 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) } } + tap_queue_packet(rtp_event_tap, pinfo, &rtp_event_info); } @@ -214,6 +230,8 @@ proto_register_rtp_events(void) "This is the value of the Payload Type field" "that specifies RTP Events", 10, &rtp_event_payload_type_value); + register_dissector("rtpevent", dissect_rtp_events, proto_rtp_events); + rtp_event_tap = register_tap("rtpevent"); } diff --git a/epan/dissectors/packet-rtp-events.h b/epan/dissectors/packet-rtp-events.h index 76c972f1d1..4a0f5ed9d7 100644 --- a/epan/dissectors/packet-rtp-events.h +++ b/epan/dissectors/packet-rtp-events.h @@ -251,3 +251,8 @@ static const value_string rtp_event_type_values[] = { RTP_NEWMWATTTN, "New milliwatt tone (1004 Hz)"}, { 0, NULL }, }; + +struct _rtp_event_info { + guint8 info_rtp_evt; + guint32 info_setup_frame_num; /* the frame num of the packet that set this RTP connection */ +};
\ No newline at end of file diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c index adcfe3390e..9e84d03d3f 100644 --- a/epan/dissectors/packet-rtp.c +++ b/epan/dissectors/packet-rtp.c @@ -70,6 +70,7 @@ static dissector_handle_t rtp_handle; static dissector_handle_t stun_handle; +static dissector_handle_t rtpevent_handle=NULL; static int rtp_tap = -1; @@ -238,7 +239,7 @@ const value_string rtp_payload_type_short_vals[] = void rtp_add_address(packet_info *pinfo, address *addr, int port, int other_port, - gchar *setup_method, guint32 setup_frame_number) + gchar *setup_method, guint32 setup_frame_number, int rtp_event_pt) { address null_addr; conversation_t* p_conv; @@ -296,6 +297,7 @@ void rtp_add_address(packet_info *pinfo, strncpy(p_conv_data->method, setup_method, MAX_RTP_SETUP_METHOD_SIZE); p_conv_data->method[MAX_RTP_SETUP_METHOD_SIZE] = '\0'; p_conv_data->frame_number = setup_frame_number; + p_conv_data->rtp_event_pt = rtp_event_pt; } static void rtp_init( void ) @@ -368,11 +370,25 @@ dissect_rtp_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int data_reported_len, unsigned int payload_type ) { tvbuff_t *newtvb; + struct _rtp_conversation_info *p_conv_data = NULL; newtvb = tvb_new_subset( tvb, offset, data_len, data_reported_len ); - if (!dissector_try_port(rtp_pt_dissector_table, payload_type, newtvb, - pinfo, tree)) - proto_tree_add_item( rtp_tree, hf_rtp_data, newtvb, 0, -1, FALSE ); + + /* if this is part of a conv set by a SDP, we know the payload type for dynamic payloads */ + p_conv_data = p_get_proto_data(pinfo->fd, proto_rtp); + if (p_conv_data && (strcmp(p_conv_data->method, "SDP") == 0) ) { + if ( (p_conv_data->rtp_event_pt != 0) && (p_conv_data->rtp_event_pt == (guint32)payload_type) ) + { + call_dissector(rtpevent_handle, newtvb, pinfo, tree); + } else + { + proto_tree_add_item( rtp_tree, hf_rtp_data, newtvb, 0, -1, FALSE ); + } + } else { + /* is not part of a conv, use the preference saved value do decode the payload type */ + if (!dissector_try_port(rtp_pt_dissector_table, payload_type, newtvb, pinfo, tree)) + proto_tree_add_item( rtp_tree, hf_rtp_data, newtvb, 0, -1, FALSE ); + } } static struct _rtp_info rtp_info; @@ -715,6 +731,7 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) p_conv_packet_data = g_mem_chunk_alloc(rtp_conversations); strcpy(p_conv_packet_data->method, p_conv_data->method); p_conv_packet_data->frame_number = p_conv_data->frame_number; + p_conv_packet_data->rtp_event_pt = p_conv_data->rtp_event_pt; p_add_proto_data(pinfo->fd, proto_rtp, p_conv_packet_data); } } @@ -1031,6 +1048,7 @@ proto_reg_handoff_rtp(void) { data_handle = find_dissector("data"); stun_handle = find_dissector("stun"); + rtpevent_handle = find_dissector("rtpevent"); /* * Register this dissector as one that can be selected by a diff --git a/epan/dissectors/packet-rtp.h b/epan/dissectors/packet-rtp.h index 2f8e852b3b..bbe9d8017b 100644 --- a/epan/dissectors/packet-rtp.h +++ b/epan/dissectors/packet-rtp.h @@ -58,10 +58,13 @@ struct _rtp_conversation_info { gchar method[MAX_RTP_SETUP_METHOD_SIZE + 1]; guint32 frame_number; + guint32 rtp_event_pt; /* this is payload type for dynamic RTP events (RFC2833) */ }; /* Add an RTP conversation with the given details */ void rtp_add_address(packet_info *pinfo, address *addr, int port, int other_port, - gchar *setup_method, guint32 setup_frame_number); + gchar *setup_method, + guint32 setup_frame_number, + int rtp_event_pt); diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 9104e798bd..f1b8888a83 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -462,7 +462,7 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, if (rtp_transport) { rtp_add_address(pinfo, &pinfo->dst, c_data_port, s_data_port, - "RTSP", pinfo->fd->num); + "RTSP", pinfo->fd->num, 0); if (!c_mon_port) return; diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index e31e586536..2e0f64323b 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -170,6 +170,7 @@ typedef struct { char *media_port[SDP_MAX_RTP_CHANNELS]; char *media_proto[SDP_MAX_RTP_CHANNELS]; gint8 media_count; + guint32 rtp_event_pt; } transport_info_t; /* static functions */ @@ -189,7 +190,7 @@ static void dissect_sdp_encryption_key(tvbuff_t *tvb, proto_item * ti); static void dissect_sdp_session_attribute(tvbuff_t *tvb, proto_item *ti); static void dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, transport_info_t *transport_info); -static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item *ti); +static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item *ti, transport_info_t *transport_info); static void dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -227,6 +228,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Initialise RTP channel info */ transport_info.connection_address=NULL; transport_info.connection_type=NULL; + transport_info.rtp_event_pt=0; for (n=0; n < SDP_MAX_RTP_CHANNELS; n++) { transport_info.media_port[n]=NULL; @@ -415,7 +417,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) src_addr.data=(char *)&ipaddr; if(rtp_handle){ rtp_add_address(pinfo, &src_addr, port, 0, - "SDP", pinfo->fd->num); + "SDP", pinfo->fd->num, transport_info.rtp_event_pt); set_rtp = TRUE; } if(rtcp_handle){ @@ -473,7 +475,7 @@ call_sdp_subdissector(tvbuff_t *tvb, int hf, proto_tree* ti, transport_info_t *t } else if ( hf == hf_media ) { dissect_sdp_media(tvb,ti,transport_info); } else if ( hf == hf_media_attribute ){ - dissect_sdp_media_attribute(tvb,ti); + dissect_sdp_media_attribute(tvb,ti,transport_info); } } @@ -921,9 +923,12 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, } -static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item * ti){ +static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item * ti, transport_info_t *transport_info){ proto_tree *sdp_media_attribute_tree; gint offset, next_offset, tokenlen; + guint8 *field_name; + guint8 *payload_type; + guint8 *encoding_name; offset = 0; next_offset = 0; @@ -943,11 +948,44 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item * ti){ hf_media_attribute_field, tvb, offset, tokenlen, FALSE); + field_name = tvb_get_string(tvb, offset, tokenlen); + offset = next_offset + 1; proto_tree_add_item(sdp_media_attribute_tree, hf_media_attribute_value, tvb, offset, -1, FALSE); + /* decode the rtpmap to see if it is DynamicPayload for RTP-Events RFC2833 to dissect them automatic */ + if (strcmp(field_name, "rtpmap") == 0) { + next_offset = tvb_find_guint8(tvb,offset,-1,' '); + g_free(field_name); + + if(next_offset == -1) + return; + + tokenlen = next_offset - offset; + + payload_type = tvb_get_string(tvb, offset, tokenlen); + + offset = next_offset + 1; + + next_offset = tvb_find_guint8(tvb,offset,-1,'/'); + + if(next_offset == -1){ + g_free(payload_type); + return; + } + + tokenlen = next_offset - offset; + + encoding_name = tvb_get_string(tvb, offset, tokenlen); + + if (strcmp(encoding_name, "telephone-event") == 0) + transport_info->rtp_event_pt = atol(payload_type); + + g_free(payload_type); + g_free(encoding_name); + } else g_free(field_name); } void diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c index 89cdbc7626..b77f98a644 100644 --- a/epan/dissectors/packet-skinny.c +++ b/epan/dissectors/packet-skinny.c @@ -1396,7 +1396,7 @@ static void dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr src_addr.len=4; src_addr.data=(char *)&ipv4_address; tvb_memcpy(tvb, (char *)&ipv4_address, offset+16, 4); - rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+20), 0, "Skinny", pinfo->fd->num); + rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+20), 0, "Skinny", pinfo->fd->num, 0); } break; @@ -1777,7 +1777,7 @@ static void dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr src_addr.len=4; src_addr.data=(char *)&ipv4_address; tvb_memcpy(tvb, (char *)&ipv4_address, offset+20, 4); - rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+24), 0, "Skinny", pinfo->fd->num); + rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+24), 0, "Skinny", pinfo->fd->num, 0); } break; |