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