Call the H.261 dissector through a handle.

Set the reported length of the tvbuff we hand to the H.261 dissector.

svn path=/trunk/; revision=3464
This commit is contained in:
Guy Harris 2001-05-27 07:37:46 +00:00
parent d2cd48b086
commit ddec2eb25b
4 changed files with 29 additions and 47 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.327 2001/05/27 07:15:26 guy Exp $
# $Id: Makefile.am,v 1.328 2001/05/27 07:37:46 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@ -271,7 +271,6 @@ noinst_HEADERS = \
packet-fddi.h \
packet-fr.h \
packet-frame.h \
packet-h261.h \
packet-hclnfsd.h \
packet-http.h \
packet-ieee80211.h \

View File

@ -6,7 +6,7 @@
* Andreas Sikkema <andreas.sikkema@philips.com>
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
*
@ -51,8 +51,6 @@
#include <stdio.h>
#include <string.h>
#include "packet-h261.h"
/* H.261 header fields */
static int proto_h261 = -1;
static int hf_h261_sbit = -1;
@ -69,7 +67,7 @@ static int hf_h261_data = -1;
/* H.261 fields defining a sub tree */
static gint ett_h261 = -1;
void
static void
dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
{
proto_item *ti = NULL;
@ -259,4 +257,6 @@ 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));
register_dissector("h261", dissect_h261, proto_h261);
}

View File

@ -1,30 +0,0 @@
/* packet-h261.h
*
* Routines for ITU-T Recommendation H.261 dissection
*
* Copyright 2000, Philips Electronics N.V.
* Andreas Sikkema <andreas.sikkema@philips.com>
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* 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.
*/
void dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree );
void proto_register_h261( void );

View File

@ -7,7 +7,7 @@
* Written by Andreas Sikkema <andreas.sikkema@philips.com>
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
*
@ -55,7 +55,6 @@
#include <string.h>
#include "packet-rtp.h"
#include "packet-h261.h"
#include "conversation.h"
/* RTP header fields */
@ -84,6 +83,8 @@ static gint ett_rtp = -1;
static gint ett_csrc_list = -1;
static gint ett_hdr_ext = -1;
static dissector_handle_t h261_handle;
/*
* Fields in the first octet of the RTP header.
*/
@ -273,18 +274,18 @@ dissect_rtp_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
return TRUE;
}
void
dissect_rtp_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *rtp_tree, int offset, unsigned int data_len, unsigned int payload_type )
static void
dissect_rtp_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *rtp_tree, int offset, unsigned int data_len,
unsigned int data_reported_len, unsigned int payload_type )
{
tvbuff_t *newtvb;
switch( payload_type ) {
case PT_H261:
/*
* What does reported length DO?
*/
newtvb = tvb_new_subset( tvb, offset, data_len, -1 );
dissect_h261(newtvb, pinfo, tree);
newtvb = tvb_new_subset( tvb, offset, data_len,
data_reported_len );
call_dissector(h261_handle, newtvb, pinfo, tree);
break;
default:
proto_tree_add_bytes( rtp_tree, hf_rtp_data, tvb, offset, data_len, tvb_get_ptr( tvb, offset, data_len ) );
@ -426,7 +427,11 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
if ( padding_set ) {
padding_count = tvb_get_guint8( tvb, tvb_length( tvb ) - 1 );
if ( padding_count > 0 ) {
dissect_rtp_data( tvb, pinfo, tree, rtp_tree, offset, tvb_length( tvb ) - padding_count, payload_type );
dissect_rtp_data( tvb, pinfo, tree, rtp_tree,
offset,
tvb_length( tvb ) - padding_count,
tvb_reported_length( tvb ) - padding_count,
payload_type );
offset = tvb_length( tvb ) - padding_count;
proto_tree_add_item( rtp_tree, hf_rtp_padding_data, tvb, offset, padding_count - 1, FALSE );
offset += padding_count - 1;
@ -437,7 +442,10 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
}
}
else {
dissect_rtp_data( tvb, pinfo, tree, rtp_tree, offset, tvb_length_remaining( tvb, offset ) - padding_count, payload_type );
dissect_rtp_data( tvb, pinfo, tree, rtp_tree, offset,
tvb_length_remaining( tvb, offset ) - padding_count,
tvb_reported_length_remaining( tvb, offset ) - padding_count,
payload_type );
}
}
}
@ -662,6 +670,11 @@ proto_register_rtp(void)
void
proto_reg_handoff_rtp(void)
{
/*
* Get handle for the H.261 dissector.
*/
h261_handle = find_dissector("h261");
/*
* Register this dissector as one that can be assigned to a
* UDP conversation.