1 /* packet-teimanagement.c
2 * Routines for LAPD TEI Management frame disassembly
3 * Rolf Fiedler <rolf.fiedler@innoventif.com>
4 * based on code by Gilbert Ramirez <gram@alumni.rice.edu>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
10 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/lapd_sapi.h>
18 /* ISDN/LAPD references:
20 * http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/isdn.htm
21 * http://www.ece.wpi.edu/courses/ee535/hwk11cd95/agrebe/agrebe.html
22 * http://www.acacia-net.com/Clarinet/Protocol/q9213o84.htm
25 void proto_reg_handoff_teimanagement(void);
26 void proto_register_teimanagement(void);
28 static dissector_handle_t teimanagement_handle
;
32 static int hf_tei_management_entity_id
;
33 static int hf_tei_management_reference
;
34 static int hf_tei_management_message
;
35 static int hf_tei_management_action
;
36 static int hf_tei_management_extend
;
38 static int ett_tei_management_subtree
;
40 #define TEI_ID_REQUEST 0x01
41 #define TEI_ID_ASSIGNED 0x02
42 #define TEI_ID_DENIED 0x03
43 #define TEI_ID_CHECK_REQ 0x04
44 #define TEI_ID_CHECK_RESP 0x05
45 #define TEI_ID_REMOVE 0x06
46 #define TEI_ID_VERIFY 0x07
48 static const value_string tei_msg_vals
[]={
49 { TEI_ID_REQUEST
, "Identity Request"},
50 { TEI_ID_ASSIGNED
, "Identity Assigned"},
51 { TEI_ID_DENIED
, "Identity Denied"},
52 { TEI_ID_CHECK_REQ
, "Identity Check Request"},
53 { TEI_ID_CHECK_RESP
, "Identity Check Response"},
54 { TEI_ID_REMOVE
, "Identity Remove"},
55 { TEI_ID_VERIFY
, "Identity Verify"},
60 dissect_teimanagement(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
62 proto_tree
*tei_tree
= NULL
;
66 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TEI");
67 col_clear(pinfo
->cinfo
, COL_INFO
);
70 tei_ti
= proto_tree_add_item(tree
, proto_tei
, tvb
, 0, 5, ENC_NA
);
71 tei_tree
= proto_item_add_subtree(tei_ti
, ett_tei_management_subtree
);
73 proto_tree_add_item(tei_tree
, hf_tei_management_entity_id
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
74 proto_tree_add_item(tei_tree
, hf_tei_management_reference
, tvb
, 1, 2, ENC_BIG_ENDIAN
);
77 message
= tvb_get_uint8(tvb
, 3);
78 col_add_str(pinfo
->cinfo
, COL_INFO
,
79 val_to_str(message
, tei_msg_vals
, "Unknown message type (0x%04x)"));
81 proto_tree_add_uint(tei_tree
, hf_tei_management_message
, tvb
, 3, 1, message
);
82 proto_tree_add_item(tei_tree
, hf_tei_management_action
, tvb
, 4, 1, ENC_BIG_ENDIAN
);
83 proto_tree_add_item(tei_tree
, hf_tei_management_extend
, tvb
, 4, 1, ENC_BIG_ENDIAN
);
85 return tvb_captured_length(tvb
);
89 proto_register_teimanagement(void)
92 &ett_tei_management_subtree
95 static hf_register_info hf
[] = {
96 { &hf_tei_management_entity_id
,
97 { "Entity", "tei_management.entity", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
98 "Layer Management Entity Identifier", HFILL
}},
100 { &hf_tei_management_reference
,
101 { "Reference", "tei_management.reference", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
102 "Reference Number", HFILL
}},
104 { &hf_tei_management_message
,
105 { "Msg", "tei_management.msg", FT_UINT8
, BASE_DEC
, VALS(tei_msg_vals
), 0x0,
106 "Message Type", HFILL
}},
108 { &hf_tei_management_action
,
109 { "Action", "tei_management.action", FT_UINT8
, BASE_DEC
, NULL
, 0xfe,
110 "Action Indicator", HFILL
}},
112 { &hf_tei_management_extend
,
113 { "Extend", "tei_management.extend", FT_UINT8
, BASE_DEC
, NULL
, 0x01,
114 "Extension Indicator", HFILL
}}
117 proto_tei
= proto_register_protocol("TEI Management Procedure, Channel D (LAPD)",
118 "TEI_MANAGEMENT", "tei_management");
119 proto_register_field_array (proto_tei
, hf
, array_length(hf
));
120 proto_register_subtree_array(ett
, array_length(ett
));
122 teimanagement_handle
= register_dissector("tei_management", dissect_teimanagement
, proto_tei
);
126 proto_reg_handoff_teimanagement(void)
128 dissector_add_uint("lapd.sapi", LAPD_SAPI_L2
, teimanagement_handle
);
132 * Editor modelines - https://www.wireshark.org/tools/modelines.html
137 * indent-tabs-mode: nil
140 * vi: set shiftwidth=4 tabstop=8 expandtab:
141 * :indentSize=4:tabSize=8:noTabs=true: