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>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/lapd_sapi.h>
33 /* ISDN/LAPD references:
35 * http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/isdn.htm
36 * http://www.ece.wpi.edu/courses/ee535/hwk11cd95/agrebe/agrebe.html
37 * http://www.acacia-net.com/Clarinet/Protocol/q9213o84.htm
40 static int proto_tei
=-1;
42 static int lm_entity_id
=-1;
43 static int lm_reference
=-1;
44 static int lm_message
=-1;
45 static int lm_action
=-1;
46 static int lm_extend
=-1;
47 static gint lm_subtree
=-1;
49 #define TEI_ID_REQUEST 0x01
50 #define TEI_ID_ASSIGNED 0x02
51 #define TEI_ID_DENIED 0x03
52 #define TEI_ID_CHECK_REQ 0x04
53 #define TEI_ID_CHECK_RESP 0x05
54 #define TEI_ID_REMOVE 0x06
55 #define TEI_ID_VERIFY 0x07
57 static const value_string tei_msg_vals
[]={
58 { TEI_ID_REQUEST
, "Identity Request"},
59 { TEI_ID_ASSIGNED
, "Identity Assigned"},
60 { TEI_ID_DENIED
, "Identity Denied"},
61 { TEI_ID_CHECK_REQ
, "Identity Check Request"},
62 { TEI_ID_CHECK_RESP
, "Identity Check Response"},
63 { TEI_ID_REMOVE
, "Identity Remove"},
64 { TEI_ID_VERIFY
, "Identity Verify"},
69 dissect_teimanagement(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
71 proto_tree
*tei_tree
= NULL
;
75 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TEI");
76 col_clear(pinfo
->cinfo
, COL_INFO
);
79 tei_ti
= proto_tree_add_item(tree
, proto_tei
, tvb
, 0, 5, ENC_NA
);
80 tei_tree
= proto_item_add_subtree(tei_ti
, lm_subtree
);
82 proto_tree_add_item(tei_tree
, lm_entity_id
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
83 proto_tree_add_item(tei_tree
, lm_reference
, tvb
, 1, 2, ENC_BIG_ENDIAN
);
86 message
= tvb_get_guint8(tvb
, 3);
87 col_add_str(pinfo
->cinfo
, COL_INFO
,
88 val_to_str(message
, tei_msg_vals
, "Unknown message type (0x%04x)"));
90 proto_tree_add_uint(tei_tree
, lm_message
, tvb
, 3, 1, message
);
91 proto_tree_add_item(tei_tree
, lm_action
, tvb
, 4, 1, ENC_BIG_ENDIAN
);
92 proto_tree_add_item(tei_tree
, lm_extend
, tvb
, 4, 1, ENC_BIG_ENDIAN
);
97 proto_register_teimanagement(void)
99 static gint
*subtree
[]={
103 static hf_register_info hf
[] = {
105 { "Entity", "tei.entity", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
106 "Layer Management Entity Identifier", HFILL
}},
109 { "Reference", "tei.reference", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
110 "Reference Number", HFILL
}},
113 { "Msg", "tei.msg", FT_UINT8
, BASE_DEC
, VALS(tei_msg_vals
), 0x0,
114 "Message Type", HFILL
}},
117 { "Action", "tei.action", FT_UINT8
, BASE_DEC
, NULL
, 0xfe,
118 "Action Indicator", HFILL
}},
121 { "Extend", "tei.extend", FT_UINT8
, BASE_DEC
, NULL
, 0x01,
122 "Extension Indicator", HFILL
}}
125 proto_tei
= proto_register_protocol("TEI Management Procedure, Channel D (LAPD)",
126 "TEI_MANAGEMENT", "tei_management");
127 proto_register_field_array (proto_tei
, hf
, array_length(hf
));
128 proto_register_subtree_array(subtree
, array_length(subtree
));
132 proto_reg_handoff_teimanagement(void)
134 dissector_handle_t teimanagement_handle
;
136 teimanagement_handle
= create_dissector_handle(dissect_teimanagement
,
138 dissector_add_uint("lapd.sapi", LAPD_SAPI_L2
, teimanagement_handle
);