diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | packet-h261.c | 15 | ||||
-rw-r--r-- | packet-h263.c | 15 | ||||
-rw-r--r-- | packet-mpeg1.c | 15 | ||||
-rw-r--r-- | packet-rtp.c | 78 | ||||
-rw-r--r-- | rtp_pt.h | 62 |
6 files changed, 108 insertions, 80 deletions
diff --git a/Makefile.am b/Makefile.am index e6c57655a8..3e46b1fb12 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.610 2003/08/23 04:18:17 sahlberg Exp $ +# $Id: Makefile.am,v 1.611 2003/08/23 06:36:45 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -754,6 +754,7 @@ ETHEREAL_COMMON_SRC = \ ringbuffer.c \ ringbuffer.h \ rpc_defrag.h \ + rtp_pt.h \ sctpppids.h \ smb.h \ tap.c \ diff --git a/packet-h261.c b/packet-h261.c index 3b8840b23e..c9f6679564 100644 --- a/packet-h261.c +++ b/packet-h261.c @@ -2,7 +2,7 @@ * * Routines for ITU-T Recommendation H.261 dissection * - * $Id: packet-h261.c,v 1.18 2003/01/03 20:42:43 sahlberg Exp $ + * $Id: packet-h261.c,v 1.19 2003/08/23 06:36:46 guy Exp $ * * Copyright 2000, Philips Electronics N.V. * Andreas Sikkema <andreas.sikkema@philips.com> @@ -29,8 +29,6 @@ /* * This dissector tries to dissect the H.261 protocol according to Annex C * of ITU-T Recommendation H.225.0 (02/98) - * - * This dissector is called by the RTP dissector */ @@ -44,6 +42,8 @@ #include <stdio.h> #include <string.h> +#include "rtp_pt.h" + /* H.261 header fields */ static int proto_h261 = -1; static int hf_h261_sbit = -1; @@ -251,6 +251,13 @@ proto_register_h261(void) "H.261", "h261"); proto_register_field_array(proto_h261, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_h261(void) +{ + dissector_handle_t h261_handle; - register_dissector("h261", dissect_h261, proto_h261); + h261_handle = create_dissector_handle(dissect_h261, proto_h261); + dissector_add("rtp.pt", PT_H261, h261_handle); } diff --git a/packet-h263.c b/packet-h263.c index 098fb2b24b..a4c8c4d463 100644 --- a/packet-h263.c +++ b/packet-h263.c @@ -5,7 +5,7 @@ * Copyright 2003 Niklas Ögren <niklas.ogren@7l.se> * Seven Levels Consultants AB * - * $Id: packet-h263.c,v 1.1 2003/08/23 04:19:22 sahlberg Exp $ + * $Id: packet-h263.c,v 1.2 2003/08/23 06:36:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -31,8 +31,6 @@ /* * This dissector tries to dissect the H.263 protocol according to * ITU-T Recommendations and RFC 2190 - * - * This dissector is called by the RTP dissector */ @@ -46,6 +44,8 @@ #include <stdio.h> #include <string.h> +#include "rtp_pt.h" + /* H.263 header fields */ static int proto_h263 = -1; @@ -485,6 +485,13 @@ proto_register_h263(void) "H.263", "h263"); proto_register_field_array(proto_h263, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_h263(void) +{ + dissector_handle_t h263_handle; - register_dissector("h263", dissect_h263, proto_h263); + h263_handle = create_dissector_handle(dissect_h263, proto_h263); + dissector_add("rtp.pt", PT_H263, h263_handle); } diff --git a/packet-mpeg1.c b/packet-mpeg1.c index 0c2d8800f0..a6dd2a088f 100644 --- a/packet-mpeg1.c +++ b/packet-mpeg1.c @@ -2,7 +2,7 @@ * * Routines for RFC 2250 MPEG-1 dissection * - * $Id: packet-mpeg1.c,v 1.9 2002/08/28 21:00:22 jmayer Exp $ + * $Id: packet-mpeg1.c,v 1.10 2003/08/23 06:36:46 guy Exp $ * * Copyright 2001, * Francisco Javier Cabello Torres, <fjcabello@vtools.es> @@ -28,8 +28,6 @@ /* * This dissector tries to dissect the MPEG-1 video streams. - * - * This dissector is called by the RTP dissector */ @@ -43,6 +41,8 @@ #include <stdio.h> #include <string.h> +#include "rtp_pt.h" + #define RTP_MPG_MBZ(word) ( word >> 11) #define RTP_MPG_T(word) ( (word >> 10) & 1 ) #define RTP_MPG_TR(word) ( word & 0x3ff ) @@ -382,6 +382,13 @@ proto_register_mpeg1(void) proto_mpg = proto_register_protocol("RFC 2250 MPEG1","MPEG1","mpeg1"); proto_register_field_array(proto_mpg, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_mpeg1(void) +{ + dissector_handle_t mpeg1_handle; - register_dissector("mpeg1", dissect_mpeg1, proto_mpg); + mpeg1_handle = create_dissector_handle(dissect_mpeg1, proto_mpg); + dissector_add("rtp.pt", PT_MPV, mpeg1_handle); } diff --git a/packet-rtp.c b/packet-rtp.c index df5f76273b..ed028ef8b2 100644 --- a/packet-rtp.c +++ b/packet-rtp.c @@ -6,7 +6,7 @@ * Copyright 2000, Philips Electronics N.V. * Written by Andreas Sikkema <andreas.sikkema@philips.com> * - * $Id: packet-rtp.c,v 1.40 2003/08/23 04:18:18 sahlberg Exp $ + * $Id: packet-rtp.c,v 1.41 2003/08/23 06:36:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -62,11 +62,14 @@ #include <string.h> #include "packet-rtp.h" +#include "rtp_pt.h" #include <epan/conversation.h> #include "tap.h" static int rtp_tap = -1; +static dissector_table_t rtp_pt_dissector_table; + /* RTP header fields */ static int proto_rtp = -1; static int hf_rtp_version = -1; @@ -93,9 +96,6 @@ static gint ett_rtp = -1; static gint ett_csrc_list = -1; static gint ett_hdr_ext = -1; -static dissector_handle_t h261_handle; -static dissector_handle_t h263_handle; -static dissector_handle_t mpeg1_handle; static dissector_handle_t data_handle; static gboolean dissect_rtp_heur( tvbuff_t *tvb, packet_info *pinfo, @@ -138,40 +138,6 @@ static const value_string rtp_version_vals[] = /* Payload type is the last 7 bits */ #define RTP_PAYLOAD_TYPE(octet) ((octet) & 0x7F) -/* - * RTP Payload types - * Table B.2 / H.225.0 - * Also RFC 1890, and - * - * http://www.iana.org/assignments/rtp-parameters - */ -#define PT_PCMU 0 /* RFC 1890 */ -#define PT_1016 1 /* RFC 1890 */ -#define PT_G721 2 /* RFC 1890 */ -#define PT_GSM 3 /* RFC 1890 */ -#define PT_G723 4 /* From Vineet Kumar of Intel; see the Web page */ -#define PT_DVI4_8000 5 /* RFC 1890 */ -#define PT_DVI4_16000 6 /* RFC 1890 */ -#define PT_LPC 7 /* RFC 1890 */ -#define PT_PCMA 8 /* RFC 1890 */ -#define PT_G722 9 /* RFC 1890 */ -#define PT_L16_STEREO 10 /* RFC 1890 */ -#define PT_L16_MONO 11 /* RFC 1890 */ -#define PT_QCELP 12 /* Qualcomm Code Excited Linear Predictive coding? */ -#define PT_CN 13 /* RFC 3389 */ -#define PT_MPA 14 /* RFC 1890, RFC 2250 */ -#define PT_G728 15 /* RFC 1890 */ -#define PT_DVI4_11025 16 /* from Joseph Di Pol of Sun; see the Web page */ -#define PT_DVI4_22050 17 /* from Joseph Di Pol of Sun; see the Web page */ -#define PT_G729 18 -#define PT_CELB 25 /* RFC 2029 */ -#define PT_JPEG 26 /* RFC 2435 */ -#define PT_NV 28 /* RFC 1890 */ -#define PT_H261 31 /* RFC 2032 */ -#define PT_MPV 32 /* RFC 2250 */ -#define PT_MP2T 33 /* RFC 2250 */ -#define PT_H263 34 /* from Chunrong Zhu of Intel; see the Web page */ - static const value_string rtp_payload_type_vals[] = { { PT_PCMU, "ITU-T G.711 PCMU" }, @@ -311,29 +277,10 @@ dissect_rtp_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { tvbuff_t *newtvb; - switch( payload_type ) { - case PT_H261: - newtvb = tvb_new_subset( tvb, offset, data_len, - data_reported_len ); - call_dissector(h261_handle, newtvb, pinfo, tree); - break; - - case PT_H263: - newtvb = tvb_new_subset( tvb, offset, data_len, - data_reported_len ); - call_dissector(h263_handle, newtvb, pinfo, tree); - break; - - case PT_MPV: - newtvb = tvb_new_subset( tvb, offset, data_len, - data_reported_len ); - call_dissector(mpeg1_handle, newtvb, pinfo, tree); - break; - - default: - proto_tree_add_item( rtp_tree, hf_rtp_data, tvb, offset, data_len, FALSE ); - break; - } + 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 ); } static void @@ -805,6 +752,9 @@ proto_register_rtp(void) register_dissector("rtp", dissect_rtp, proto_rtp); rtp_tap = register_tap("rtp"); + rtp_pt_dissector_table = register_dissector_table("rtp.pt", + "RTP payload type", FT_UINT8, BASE_DEC); + #if 0 register_init_routine( &rtp_init ); #endif @@ -815,12 +765,6 @@ proto_reg_handoff_rtp(void) { dissector_handle_t rtp_handle; - /* - * Get handles for the H.261 and MPEG-1 dissectors. - */ - h261_handle = find_dissector("h261"); - h263_handle = find_dissector("h263"); - mpeg1_handle = find_dissector("mpeg1"); data_handle = find_dissector("data"); /* diff --git a/rtp_pt.h b/rtp_pt.h new file mode 100644 index 0000000000..8cc09da8d2 --- /dev/null +++ b/rtp_pt.h @@ -0,0 +1,62 @@ +/* rtp_pt.h + * Defines RTP payload types + * + * $Id: rtp_pt.h,v 1.1 2003/08/23 06:36:46 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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. + */ + +#ifndef __RTP_PT_H__ +#define __RTP_PT_H__ + +/* + * RTP Payload types + * Table B.2 / H.225.0 + * Also RFC 1890, and + * + * http://www.iana.org/assignments/rtp-parameters + */ +#define PT_PCMU 0 /* RFC 1890 */ +#define PT_1016 1 /* RFC 1890 */ +#define PT_G721 2 /* RFC 1890 */ +#define PT_GSM 3 /* RFC 1890 */ +#define PT_G723 4 /* From Vineet Kumar of Intel; see the Web page */ +#define PT_DVI4_8000 5 /* RFC 1890 */ +#define PT_DVI4_16000 6 /* RFC 1890 */ +#define PT_LPC 7 /* RFC 1890 */ +#define PT_PCMA 8 /* RFC 1890 */ +#define PT_G722 9 /* RFC 1890 */ +#define PT_L16_STEREO 10 /* RFC 1890 */ +#define PT_L16_MONO 11 /* RFC 1890 */ +#define PT_QCELP 12 /* Qualcomm Code Excited Linear Predictive coding? */ +#define PT_CN 13 /* RFC 3389 */ +#define PT_MPA 14 /* RFC 1890, RFC 2250 */ +#define PT_G728 15 /* RFC 1890 */ +#define PT_DVI4_11025 16 /* from Joseph Di Pol of Sun; see the Web page */ +#define PT_DVI4_22050 17 /* from Joseph Di Pol of Sun; see the Web page */ +#define PT_G729 18 +#define PT_CELB 25 /* RFC 2029 */ +#define PT_JPEG 26 /* RFC 2435 */ +#define PT_NV 28 /* RFC 1890 */ +#define PT_H261 31 /* RFC 2032 */ +#define PT_MPV 32 /* RFC 2250 */ +#define PT_MP2T 33 /* RFC 2250 */ +#define PT_H263 34 /* from Chunrong Zhu of Intel; see the Web page */ + +#endif |