2003-09-19 04:16:23 +00:00
|
|
|
/* packet-rtp-events.c
|
|
|
|
*
|
|
|
|
* Routines for RFC 2833 RTP Events dissection
|
|
|
|
* Copyright 2003, Kevin A. Noll <knoll[AT]poss.com>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-09-19 04:16:23 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-09-19 04:16:23 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
2009-06-21 18:27:34 +00:00
|
|
|
* Ref http://www.ietf.org/rfc/rfc4733.txt?number=4733
|
2003-09-19 04:16:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This dissector tries to dissect RTP Events.
|
2008-11-26 23:43:09 +00:00
|
|
|
*
|
|
|
|
* Cisco NSE is now supported, additions by
|
|
|
|
* Gonzalo Salgueiro <gsalguei@cisco.com>
|
|
|
|
* Chidambaram Arunachalam <carunach@cisco.com>
|
|
|
|
* Copyright 2008, Cisco Systems, Inc.
|
2003-09-19 04:16:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
#include "packet-rtp-events.h"
|
2005-03-10 19:32:22 +00:00
|
|
|
#include "packet-rtp.h"
|
|
|
|
#include <epan/tap.h>
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
/* rtp_event_payload_type_value is the value used globally
|
|
|
|
to set the appropriate payload type
|
|
|
|
*/
|
|
|
|
static guint rtp_event_payload_type_value = 101;
|
|
|
|
|
2008-11-26 23:43:09 +00:00
|
|
|
/* cisco_nse_pt_value is used globally
|
|
|
|
to set the appropriate Cisco NSE payload type value
|
|
|
|
*/
|
|
|
|
static guint cisco_nse_pt_value = 100;
|
|
|
|
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
/* RTP Event Fields */
|
|
|
|
|
|
|
|
static int proto_rtp_events = -1;
|
2005-03-10 19:32:22 +00:00
|
|
|
static int rtp_event_tap = -1;
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
static int hf_rtp_events_event = -1; /* one byte */
|
|
|
|
static int hf_rtp_events_end = -1; /* one bit */
|
|
|
|
static int hf_rtp_events_reserved = -1; /* one bit */
|
|
|
|
static int hf_rtp_events_volume = -1; /* six bits */
|
|
|
|
static int hf_rtp_events_duration = -1; /* sixteen bits */
|
|
|
|
|
|
|
|
|
|
|
|
/* RTP Events fields defining a subtree */
|
|
|
|
|
|
|
|
static gint ett_rtp_events = -1;
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rtp_events(void);
|
|
|
|
|
2005-03-10 19:32:22 +00:00
|
|
|
static struct _rtp_event_info rtp_event_info;
|
|
|
|
|
2003-09-19 04:16:23 +00:00
|
|
|
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;
|
2005-03-10 19:32:22 +00:00
|
|
|
struct _rtp_conversation_info *p_conv_data = NULL;
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
guint8 rtp_evt;
|
2003-09-19 04:27:48 +00:00
|
|
|
guint8 octet;
|
2003-09-19 04:16:23 +00:00
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP EVENT");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-09-19 04:16:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Get event fields */
|
|
|
|
|
|
|
|
rtp_evt = tvb_get_guint8(tvb, offset );
|
|
|
|
|
2005-03-10 19:32:22 +00:00
|
|
|
/* 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;
|
|
|
|
|
|
|
|
|
2003-09-19 04:16:23 +00:00
|
|
|
if ( check_col( pinfo->cinfo, COL_INFO) )
|
2008-09-03 16:42:35 +00:00
|
|
|
{
|
2003-09-19 04:16:23 +00:00
|
|
|
col_add_fstr( pinfo->cinfo, COL_INFO,
|
|
|
|
"Payload type=RTP Event, %s",
|
|
|
|
val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" ));
|
2008-09-03 16:42:35 +00:00
|
|
|
}
|
2003-09-19 04:16:23 +00:00
|
|
|
|
2008-09-03 16:42:35 +00:00
|
|
|
ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, FALSE );
|
|
|
|
rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events );
|
2003-09-19 04:16:23 +00:00
|
|
|
|
2008-09-03 16:42:35 +00:00
|
|
|
proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt);
|
2009-06-21 18:27:34 +00:00
|
|
|
offset++;
|
|
|
|
octet = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset, 1, octet);
|
|
|
|
proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset, 1, octet);
|
|
|
|
proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset, 1, octet);
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
/* The duration field indicates the duration of the event or segment
|
|
|
|
* being reported, in timestamp units.
|
|
|
|
*/
|
|
|
|
rtp_event_info.info_duration = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_item ( rtp_events_tree, hf_rtp_events_duration, tvb, offset, 2, FALSE);
|
2004-05-01 14:22:00 +00:00
|
|
|
|
2006-02-23 20:02:23 +00:00
|
|
|
/* set the end info for the tap */
|
|
|
|
if (octet & 0x80)
|
|
|
|
{
|
|
|
|
rtp_event_info.info_end = TRUE;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
rtp_event_info.info_end = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-09-03 16:42:35 +00:00
|
|
|
/* Make end-of-event packets obvious in the info column */
|
2010-01-13 20:32:01 +00:00
|
|
|
if ((octet & 0x80))
|
2008-09-03 16:42:35 +00:00
|
|
|
{
|
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, " (end)");
|
|
|
|
}
|
2004-05-01 14:22:00 +00:00
|
|
|
|
2005-03-10 19:32:22 +00:00
|
|
|
tap_queue_packet(rtp_event_tap, pinfo, &rtp_event_info);
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_rtp_events(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
module_t *rtp_events_module;
|
|
|
|
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
&hf_rtp_events_event,
|
|
|
|
{
|
|
|
|
"Event ID",
|
2003-09-19 04:27:48 +00:00
|
|
|
"rtpevent.event_id",
|
2003-09-19 04:16:23 +00:00
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
VALS(rtp_event_type_values),
|
|
|
|
0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&hf_rtp_events_end,
|
|
|
|
{
|
|
|
|
"End of Event",
|
2003-09-19 04:27:48 +00:00
|
|
|
"rtpevent.end_of_event",
|
2003-09-19 04:16:23 +00:00
|
|
|
FT_BOOLEAN,
|
2003-09-19 04:27:48 +00:00
|
|
|
8,
|
2003-09-19 04:16:23 +00:00
|
|
|
NULL,
|
2003-09-19 04:27:48 +00:00
|
|
|
0x80,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&hf_rtp_events_reserved,
|
|
|
|
{
|
|
|
|
"Reserved",
|
2003-09-19 04:27:48 +00:00
|
|
|
"rtpevent.reserved",
|
2003-09-19 04:16:23 +00:00
|
|
|
FT_BOOLEAN,
|
2003-09-19 04:27:48 +00:00
|
|
|
8,
|
2003-09-19 04:16:23 +00:00
|
|
|
NULL,
|
2003-09-19 04:27:48 +00:00
|
|
|
0x40,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&hf_rtp_events_volume,
|
|
|
|
{
|
|
|
|
"Volume",
|
2003-09-19 04:27:48 +00:00
|
|
|
"rtpevent.volume",
|
2003-09-19 04:16:23 +00:00
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2003-09-19 04:27:48 +00:00
|
|
|
0x3F,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
&hf_rtp_events_duration,
|
|
|
|
{
|
|
|
|
"Event Duration",
|
2003-09-19 04:27:48 +00:00
|
|
|
"rtpevent.duration",
|
2003-09-19 04:16:23 +00:00
|
|
|
FT_UINT16,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
|
|
|
0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] =
|
|
|
|
{
|
|
|
|
&ett_rtp_events,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
proto_rtp_events = proto_register_protocol("RFC 2833 RTP Event", "RTP Event", "rtpevent");
|
|
|
|
proto_register_field_array(proto_rtp_events, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
|
2008-09-03 16:42:35 +00:00
|
|
|
/* Register preferences */
|
|
|
|
rtp_events_module = prefs_register_protocol (proto_rtp_events, proto_reg_handoff_rtp_events);
|
|
|
|
prefs_register_uint_preference (rtp_events_module,
|
2003-09-19 04:16:23 +00:00
|
|
|
"event_payload_type_value", "Payload Type for RFC2833 RTP Events",
|
|
|
|
"This is the value of the Payload Type field"
|
2008-11-26 23:43:09 +00:00
|
|
|
" that specifies RTP Events", 10,
|
2003-09-19 04:16:23 +00:00
|
|
|
&rtp_event_payload_type_value);
|
2008-11-26 23:43:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2005-03-10 19:32:22 +00:00
|
|
|
register_dissector("rtpevent", dissect_rtp_events, proto_rtp_events);
|
|
|
|
rtp_event_tap = register_tap("rtpevent");
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rtp_events(void)
|
|
|
|
{
|
|
|
|
static dissector_handle_t rtp_events_handle;
|
2008-09-03 16:42:35 +00:00
|
|
|
/* saved_payload_type_value is a temporary place to save */
|
|
|
|
/* the value so we can properly reinitialize when the */
|
2008-11-26 23:43:09 +00:00
|
|
|
/* settings get changed. */
|
2008-09-03 16:42:35 +00:00
|
|
|
static guint saved_payload_type_value;
|
2008-11-26 23:43:09 +00:00
|
|
|
static guint saved_cisco_nse_pt_value;
|
2008-09-03 16:42:35 +00:00
|
|
|
static gboolean rtp_events_prefs_initialized = FALSE;
|
2003-09-19 04:16:23 +00:00
|
|
|
|
2008-11-26 23:43:09 +00:00
|
|
|
if (!rtp_events_prefs_initialized) {
|
2008-09-03 16:42:35 +00:00
|
|
|
rtp_events_handle = find_dissector("rtpevent");
|
|
|
|
dissector_add_string("rtp_dyn_payload_type", "telephone-event", rtp_events_handle);
|
2008-11-26 23:43:09 +00:00
|
|
|
dissector_add_string("rtp_dyn_payload_type", "X-NSE", rtp_events_handle);
|
2003-09-19 04:16:23 +00:00
|
|
|
rtp_events_prefs_initialized = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dissector_delete("rtp.pt", saved_payload_type_value, rtp_events_handle);
|
2008-11-26 23:43:09 +00:00
|
|
|
dissector_delete("rtp.pt", saved_cisco_nse_pt_value, rtp_events_handle);
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
saved_payload_type_value = rtp_event_payload_type_value;
|
|
|
|
/* rtp_event_payload_type_value is set from preferences */
|
2008-11-26 23:43:09 +00:00
|
|
|
saved_cisco_nse_pt_value = cisco_nse_pt_value;
|
|
|
|
/* cisco_nse_pt_value is set from preferences */
|
2003-09-19 04:16:23 +00:00
|
|
|
|
2008-09-03 16:42:35 +00:00
|
|
|
dissector_add("rtp.pt", saved_payload_type_value, rtp_events_handle);
|
2008-11-26 23:43:09 +00:00
|
|
|
dissector_add("rtp.pt", saved_cisco_nse_pt_value, rtp_events_handle);
|
2003-09-19 04:16:23 +00:00
|
|
|
}
|