3 * Q.1990 BICC bearer control tunnelling protocol
5 * (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 * Ref ITU-T Rec. Q.1990 (07/2001)
18 #include <epan/packet.h>
20 #define PNAME "BCTP Q.1990"
24 void proto_register_bctp(void);
25 void proto_reg_handoff_bctp(void);
27 static int proto_bctp
;
28 static int hf_bctp_bvei
;
29 static int hf_bctp_bvi
;
30 static int hf_bctp_tpei
;
31 static int hf_bctp_tpi
;
34 static dissector_table_t bctp_dissector_table
;
35 static dissector_handle_t text_handle
;
38 static const range_string tpi_vals[] = {
39 {0x00,0x17,"spare (binary encoded protocols)"},
40 {0x18,0x1f,"reserved for national use (binary encoded protocols)"},
41 {0x20,0x20,"IPBCP (text encoded)"},
42 {0x21,0x21,"spare (text encoded protocol)"},
43 {0x22,0x22,"not used"},
44 {0x23,0x37,"spare (text encoded protocols)"},
45 {0x38,0x3f,"reserved for national use (text encoded protocols)"},
50 static const value_string bvei_vals
[] = {
52 {1,"Version Error Indication, BCTP version not supported"},
57 static int dissect_bctp(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
58 proto_item
* pi
= proto_tree_add_item(tree
, proto_bctp
, tvb
,0,2, ENC_NA
);
59 proto_tree
* pt
= proto_item_add_subtree(pi
,ett_bctp
);
60 tvbuff_t
* sub_tvb
= tvb_new_subset_remaining(tvb
, 2);
61 uint8_t tpi
= tvb_get_uint8(tvb
,1) & 0x3f;
63 proto_tree_add_item(pt
, hf_bctp_bvei
, tvb
,0,2, ENC_BIG_ENDIAN
);
64 proto_tree_add_item(pt
, hf_bctp_bvi
, tvb
,0,2, ENC_BIG_ENDIAN
);
65 proto_tree_add_item(pt
, hf_bctp_tpei
, tvb
,0,2, ENC_BIG_ENDIAN
);
66 proto_tree_add_item(pt
, hf_bctp_tpi
, tvb
,0,2, ENC_BIG_ENDIAN
);
68 if (!dissector_try_uint(bctp_dissector_table
, tpi
, sub_tvb
, pinfo
, tree
) ) {
70 call_data_dissector(sub_tvb
, pinfo
, tree
);
73 call_dissector(text_handle
,sub_tvb
, pinfo
, tree
);
76 return tvb_captured_length(tvb
);
80 proto_register_bctp (void)
82 static hf_register_info hf
[] = {
83 {&hf_bctp_bvei
, {"BVEI", "bctp.bvei", FT_UINT16
, BASE_HEX
, VALS(bvei_vals
), 0x4000, "BCTP Version Error Indicator", HFILL
}},
84 {&hf_bctp_bvi
, {"BVI", "bctp.bvi", FT_UINT16
, BASE_HEX
, NULL
, 0x1F00, "BCTP Version Indicator", HFILL
}},
85 {&hf_bctp_tpei
, {"TPEI", "bctp.tpei", FT_UINT16
, BASE_HEX
, NULL
, 0x0040, "Tunneled Protocol Error Indicator", HFILL
}},
86 {&hf_bctp_tpi
, {"TPI", "bctp.tpi", FT_UINT16
, BASE_HEX
, NULL
, 0x003F, "Tunneled Protocol Indicator", HFILL
}},
92 proto_bctp
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
93 proto_register_field_array(proto_bctp
, hf
, array_length(hf
));
94 proto_register_subtree_array(ett
, array_length(ett
));
96 register_dissector("bctp", dissect_bctp
, proto_bctp
);
98 bctp_dissector_table
= register_dissector_table("bctp.tpi", "BCTP Tunneled Protocol Indicator", proto_bctp
, FT_UINT32
, BASE_DEC
);
102 proto_reg_handoff_bctp(void)
104 text_handle
= find_dissector_add_dependency("data-text-lines", proto_bctp
);
108 * Editor modelines - https://www.wireshark.org/tools/modelines.html
113 * indent-tabs-mode: t
116 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
117 * :indentSize=8:tabSize=8:noTabs=false: