3 * Q.1990 BICC bearer control tunnelling protocol
\r
5 * (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
\r
9 * Wireshark - Network traffic analyzer
\r
10 * By Gerald Combs <gerald@wireshark.org>
\r
11 * Copyright 1998 Gerald Combs
\r
13 * This program is free software; you can redistribute it and/or
\r
14 * modify it under the terms of the GNU General Public License
\r
15 * as published by the Free Software Foundation; either version 2
\r
16 * of the License, or (at your option) any later version.
\r
18 * This program is distributed in the hope that it will be useful,
\r
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 * GNU General Public License for more details.
\r
23 * You should have received a copy of the GNU General Public License
\r
24 * along with this program; if not, write to the Free Software
\r
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
27 * Ref ITU-T Rec. Q.1990 (07/2001)
\r
30 #ifdef HAVE_CONFIG_H
\r
31 # include "config.h"
\r
35 #include <epan/packet.h>
\r
37 #define PNAME "BCTP Q.1990"
\r
38 #define PSNAME "BCTP"
\r
39 #define PFNAME "bctp"
\r
41 static int proto_bctp = -1;
\r
42 static int hf_bctp_bvei = -1;
\r
43 static int hf_bctp_bvi = -1;
\r
44 static int hf_bctp_tpei = -1;
\r
45 static int hf_bctp_tpi = -1;
\r
47 static gint ett_bctp = -1;
\r
48 static dissector_table_t bctp_dissector_table;
\r
49 static dissector_handle_t data_handle;
\r
50 static dissector_handle_t text_handle;
\r
53 static const range_string tpi_vals[] = {
\r
54 {0x00,0x17,"spare (binary encoded protocols)"},
\r
55 {0x18,0x1f,"reserved for national use (binary encoded protocols)"},
\r
56 {0x20,0x20,"IPBCP (text encoded)"},
\r
57 {0x21,0x21,"spare (text encoded protocol)"},
\r
58 {0x22,0x22,"not used"},
\r
59 {0x23,0x37,"spare (text encoded protocols)"},
\r
60 {0x38,0x3f,"reserved for national use (text encoded protocols)"},
\r
65 static const value_string bvei_vals[] = {
\r
66 {0,"No indication"},
\r
67 {0,"Version Error Indication, BCTP version not supported"},
\r
72 static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
\r
73 proto_item* pi = proto_tree_add_item(tree, proto_bctp, tvb,0,2, FALSE);
\r
74 proto_tree* pt = proto_item_add_subtree(pi,ett_bctp);
\r
75 tvbuff_t* sub_tvb = tvb_new_subset(tvb, 2, -1, -1);
\r
76 guint8 tpi = tvb_get_guint8(tvb,1) & 0x3f;
\r
78 proto_tree_add_item(pt, hf_bctp_bvei, tvb,0,2, FALSE);
\r
79 proto_tree_add_item(pt, hf_bctp_bvi, tvb,0,2, FALSE);
\r
80 proto_tree_add_item(pt, hf_bctp_tpei, tvb,0,2, FALSE);
\r
81 proto_tree_add_item(pt, hf_bctp_tpi, tvb,0,2, FALSE);
\r
83 if ( dissector_try_port(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) {
\r
85 } else if (tpi <= 0x22) {
\r
86 call_dissector(data_handle,sub_tvb, pinfo, tree);
\r
89 call_dissector(text_handle,sub_tvb, pinfo, tree);
\r
94 proto_register_bctp (void)
\r
96 static hf_register_info hf[] = {
\r
97 {&hf_bctp_bvei, {"BVEI", "bctp.bvei", FT_UINT16, BASE_HEX, VALS(bvei_vals), 0x4000, "BCTP Version Error Indicator", HFILL }},
\r
98 {&hf_bctp_bvi, {"BVI", "bctp.bvi", FT_UINT16, BASE_HEX, NULL, 0x1F00, "BCTP Version Indicator", HFILL }},
\r
99 {&hf_bctp_tpei, {"TPEI", "bctp.tpei", FT_UINT16, BASE_HEX, NULL, 0x0040, "Tunnelled Protocol Error Indicator", HFILL }},
\r
100 {&hf_bctp_tpi, {"TPI", "bctp.tpi", FT_UINT16, BASE_HEX, NULL, 0x003F, "Tunnelled Protocol Indicator", HFILL }},
\r
102 static gint *ett[] = {
\r
106 proto_bctp = proto_register_protocol(PNAME, PSNAME, PFNAME);
\r
107 proto_register_field_array(proto_bctp, hf, array_length(hf));
\r
108 proto_register_subtree_array(ett, array_length(ett));
\r
110 register_dissector("bctp", dissect_bctp, proto_bctp);
\r
112 bctp_dissector_table = register_dissector_table("bctp.tpi", "BCTP Tunnelled Protocol Indicator", FT_UINT32, BASE_DEC);
\r
116 proto_reg_handoff_bctp(void)
\r
118 data_handle = find_dissector("data");
\r
119 text_handle = find_dissector("data-text-lines");
\r