Those two spaces before sdp were bctp (Q.1990), a protocol conveniently encoded to be two spaces in case of IPBCP (SDP+extras).

There's probably something similar in packet-isup.c

svn path=/trunk/; revision=20952
This commit is contained in:
Luis Ontanon 2007-03-01 00:24:57 +00:00
parent d3b873b60d
commit aa654a1f8a
4 changed files with 128 additions and 14 deletions

View File

@ -121,6 +121,7 @@ DISSECTOR_SRC = \
packet-ax4000.c \
packet-bacapp.c \
packet-bacnet.c \
packet-bctp.c \
packet-beep.c \
packet-ber.c \
packet-bfd.c \

View File

@ -0,0 +1,120 @@
/*
* packet-bctp.c
* Q.1990 BICC bearer control tunnelling protocol
*
* (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* $Id: $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.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.
*
* Ref ITU-T Rec. Q.1990 (07/2001)
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <glib.h>
#include <epan/packet.h>
#define PNAME "BCTP Q.1990"
#define PSNAME "BCTP"
#define PFNAME "bctp"
static int proto_bctp = -1;
static int hf_bctp_bvei = -1;
static int hf_bctp_bvi = -1;
static int hf_bctp_tpei = -1;
static int hf_bctp_tpi = -1;
static gint ett_bctp = -1;
static dissector_table_t bctp_dissector_table;
static dissector_handle_t data_handle;
static dissector_handle_t text_handle;
/*
static const range_string tpi_vals[] = {
{0x00,0x17,"spare (binary encoded protocols)"},
{0x18,0x1f,"reserved for national use (binary encoded protocols)"},
{0x20,0x20,"IPBCP (text encoded)"},
{0x21,0x21,"spare (text encoded protocol)"},
{0x22,0x22,"not used"},
{0x23,0x37,"spare (text encoded protocols)"},
{0x38,0x3f,"reserved for national use (text encoded protocols)"},
{0,0,NULL}
};
*/
static const value_string bvei_vals[] = {
{0,"No indication"},
{0,"Version Error Indication, BCTP version not supported"},
{0,NULL}
};
static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
proto_item* pi = proto_tree_add_item(tree, proto_bctp, tvb,0,2, FALSE);
proto_tree* pt = proto_item_add_subtree(pi,ett_bctp);
tvbuff_t* sub_tvb = tvb_new_subset(tvb, 2, -1, -1);
guint8 tpi = tvb_get_guint8(tvb,1) & 0x3f;
proto_tree_add_item(pt, hf_bctp_bvei, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_bvi, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_tpei, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_tpi, tvb,0,2, FALSE);
if ( dissector_try_port(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) {
return;
} else if (tpi <= 0x22) {
call_dissector(data_handle,sub_tvb, pinfo, tree);
} else {
/* tpi > 0x22 */
call_dissector(text_handle,sub_tvb, pinfo, tree);
}
}
void
proto_register_bctp (void)
{
static hf_register_info hf[] = {
{&hf_bctp_bvei, {"BVEI", "bctp.bvei", FT_UINT16, BASE_HEX, VALS(bvei_vals), 0x4000, "BCTP Version Error Indicator", HFILL }},
{&hf_bctp_bvi, {"BVI", "bctp.bvi", FT_UINT16, BASE_HEX, NULL, 0x1F00, "BCTP Version Indicator", HFILL }},
{&hf_bctp_tpei, {"TPEI", "bctp.tpei", FT_UINT16, BASE_HEX, NULL, 0x0040, "Tunnelled Protocol Error Indicator", HFILL }},
{&hf_bctp_tpi, {"TPI", "bctp.tpi", FT_UINT16, BASE_HEX, NULL, 0x003F, "Tunnelled Protocol Indicator", HFILL }},
};
static gint *ett[] = {
&ett_bctp
};
proto_bctp = proto_register_protocol(PNAME, PSNAME, PFNAME);
proto_register_field_array(proto_bctp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("bctp", dissect_bctp, proto_bctp);
bctp_dissector_table = register_dissector_table("bctp.tpi", "BCTP Tunnelled Protocol Indicator", FT_UINT32, BASE_DEC);
}
void
proto_reg_handoff_bctp(void)
{
data_handle = find_dissector("data");
text_handle = find_dissector("data-text-lines");
}

View File

@ -258,7 +258,7 @@ static h248_package_t h248_pkg_GB = {
/* A.7 Bearer control tunnelling package */
static dissector_handle_t sdp_dissector = NULL;
static dissector_handle_t bctp_dissector = NULL;
static int hf_h248_pkg_bt = -1;
static int hf_h248_pkg_bt_tind = -1;
@ -270,7 +270,7 @@ static gint ett_h248_pkg_bt_tind = -1;
static gint ett_h248_pkg_bt_bit= -1;
static void dissect_bt_tunneled_proto(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int hfid, h248_curr_info_t* i _U_, void* d _U_) {
tvbuff_t* sdp_tvb = NULL;
tvbuff_t* bctp_tvb = NULL;
gint8 class;
gboolean pc;
gint32 tag;
@ -279,11 +279,10 @@ static void dissect_bt_tunneled_proto(proto_tree* tree, tvbuff_t* tvb, packet_in
/* XXX: is this enough to guess it? */
if ((tag==BER_UNI_TAG_OCTETSTRING)) {
dissect_ber_octet_string(FALSE, pinfo, tree, tvb, 0, hfid, &sdp_tvb);
dissect_ber_octet_string(FALSE, pinfo, tree, tvb, 0, hfid, &bctp_tvb);
if (sdp_tvb) {
/* XXX: are we sure it is always sdp? */
call_dissector(sdp_dissector,sdp_tvb,pinfo,tree);
if (bctp_tvb) {
call_dissector(bctp_dissector,bctp_tvb,pinfo,tree);
}
} else {
proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
@ -417,7 +416,7 @@ static h248_package_t h248_pkg_bcg = {
void proto_reg_handoff_q1950(void) {
sdp_dissector = find_dissector("sdp");
bctp_dissector = find_dissector("bctp");
}

View File

@ -303,13 +303,6 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
in_media_description = FALSE;
/*
* in order to avoid an invalid line when used to dissect a q1950 parameter
* we will find the first useful character and start parsing from there
*/
offset = tvb_pbrk_guint8(tvb, offset, -1,"abcdefghijklmnopqrstuvwxyz");
if (offset < 0) offset = 0;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
/*
* Find the end of the line.
@ -1835,4 +1828,5 @@ proto_reg_handoff_sdp(void)
sdp_handle = find_dissector("sdp");
dissector_add_string("media_type", "application/sdp", sdp_handle);
dissector_add("bctp.tpi", 0x20, sdp_handle);
}