2001-03-23 19:22:02 +00:00
|
|
|
/* packet-lmi.c
|
|
|
|
* Routines for Frame Relay Local Management Interface (LMI) disassembly
|
|
|
|
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-03-23 19:22:02 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-03-23 19:22:02 +00:00
|
|
|
* Copyright 1998
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-03-23 19:22:02 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-03-23 19:22:02 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-03-23 19:22:02 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-03-23 19:22:02 +00:00
|
|
|
*
|
|
|
|
* ToDo:
|
|
|
|
*
|
|
|
|
* References:
|
|
|
|
*
|
|
|
|
* http://www.techfest.com/networking/wan/frrel.htm
|
2003-10-06 07:26:10 +00:00
|
|
|
* http://www.frforum.com/5000/Approved/FRF.1.2/frf1_2.pdf
|
2003-10-17 23:44:06 +00:00
|
|
|
* http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/frame.htm#xtocid18
|
2001-03-23 19:22:02 +00:00
|
|
|
* http://www.net.aapt.com.au/techref/lmimess.htm
|
|
|
|
* http://www.raleigh.ibm.com:80/cgi-bin/bookmgr/BOOKS/EZ305800/1.2.4.4
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/nlpid.h>
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
static int proto_lmi = -1;
|
|
|
|
static int hf_lmi_call_ref = -1;
|
|
|
|
static int hf_lmi_msg_type = -1;
|
|
|
|
static int hf_lmi_inf_ele = -1;
|
|
|
|
static int hf_lmi_inf_len = -1;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2001-03-23 19:22:02 +00:00
|
|
|
static int hf_lmi_rcd_type = -1;
|
|
|
|
static int hf_lmi_send_seq = -1;
|
|
|
|
static int hf_lmi_recv_seq = -1;
|
|
|
|
static int hf_lmi_dlci_high = -1;
|
|
|
|
static int hf_lmi_dlci_low = -1;
|
|
|
|
static int hf_lmi_new = -1;
|
|
|
|
static int hf_lmi_act = -1;
|
|
|
|
|
|
|
|
static gint ett_lmi = -1;
|
|
|
|
static gint ett_lmi_ele = -1;
|
|
|
|
|
|
|
|
#ifdef _OLD_
|
|
|
|
/*
|
|
|
|
* Bits in the address field.
|
|
|
|
*/
|
|
|
|
#define LMI_CMD 0xf000 /* LMI Command */
|
|
|
|
#define LMI_SEQ 0x0fff /* LMI Sequence number */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const value_string msg_type_str[] = {
|
|
|
|
{0x75, "Status Enquiry"},
|
|
|
|
{0x7D, "Status"},
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string element_type_str[] = {
|
|
|
|
|
|
|
|
/*** These are the ANSI values ***/
|
|
|
|
{0x01, "Report"},
|
|
|
|
{0x03, "Keep Alive"},
|
|
|
|
{0x07, "PVC Status"},
|
|
|
|
|
|
|
|
/*** These are the ITU values ***/
|
|
|
|
{0x51, "Report"},
|
|
|
|
{0x53, "Keep Alive"},
|
|
|
|
{0x07, "PVC Status"},
|
|
|
|
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string record_type_str[] = {
|
|
|
|
{0x00, "Full Status"},
|
|
|
|
{0x01, "Link Integrity Verification Only"},
|
|
|
|
{0x02, "Single PVC"},
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string pvc_status_new_str[] = {
|
|
|
|
{0x00, "PVC already present"},
|
|
|
|
{0x01, "PVC is new"},
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string pvc_status_act_str[] = {
|
|
|
|
{0x00, "PVC is Inactive"},
|
2001-03-29 07:46:08 +00:00
|
|
|
{0x01, "PVC is Active"},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_lmi_report_type(tvbuff_t *tvb, int offset, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_rcd_type, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_lmi_link_int(tvbuff_t *tvb, int offset, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_send_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
++offset;
|
2001-03-30 11:03:29 +00:00
|
|
|
proto_tree_add_uint(tree, hf_lmi_recv_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_lmi_pvc_status(tvbuff_t *tvb, int offset, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_dlci_high, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
++offset;
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_dlci_low, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
++offset;
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_new, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
proto_tree_add_uint(tree, hf_lmi_act, tvb, offset, 1, tvb_get_guint8( tvb, offset));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2003-01-11 07:01:59 +00:00
|
|
|
proto_tree *lmi_tree = NULL, *lmi_subtree;
|
2001-03-23 19:22:02 +00:00
|
|
|
proto_item *ti;
|
|
|
|
int offset = 2, len;
|
2003-01-11 07:01:59 +00:00
|
|
|
guint8 msg_type;
|
2001-03-23 19:22:02 +00:00
|
|
|
guint8 ele_id;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LMI");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_lmi, tvb, 0, 3, ENC_NA);
|
2001-03-23 19:22:02 +00:00
|
|
|
lmi_tree = proto_item_add_subtree(ti, ett_lmi_ele);
|
|
|
|
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(lmi_tree, hf_lmi_call_ref, tvb, 0, 1, ENC_BIG_ENDIAN);
|
2003-01-11 07:01:59 +00:00
|
|
|
}
|
|
|
|
msg_type = tvb_get_guint8( tvb, 1);
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
|
|
|
val_to_str(msg_type, msg_type_str, "Unknown message type (0x%02x)"));
|
|
|
|
}
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(lmi_tree, hf_lmi_msg_type, tvb, 1, 1, msg_type);
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
/* Display the LMI elements */
|
2001-09-14 07:10:13 +00:00
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
2001-03-23 19:22:02 +00:00
|
|
|
ele_id = tvb_get_guint8( tvb, offset);
|
|
|
|
len = tvb_get_guint8( tvb, offset + 1);
|
|
|
|
|
2003-10-06 20:46:52 +00:00
|
|
|
ti = proto_tree_add_text(lmi_tree, tvb, offset, len + 2,
|
|
|
|
"Information Element: %s",
|
|
|
|
val_to_str(ele_id, element_type_str, "Unknown (%u)"));
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
lmi_subtree = proto_item_add_subtree(ti, ett_lmi_ele);
|
|
|
|
|
|
|
|
proto_tree_add_uint(lmi_subtree, hf_lmi_inf_ele, tvb, offset, 1,
|
2003-10-06 20:46:52 +00:00
|
|
|
ele_id);
|
2001-03-23 19:22:02 +00:00
|
|
|
++offset;
|
|
|
|
proto_tree_add_uint(lmi_subtree, hf_lmi_inf_len, tvb, offset, 1, len);
|
|
|
|
++offset;
|
2002-08-28 21:04:11 +00:00
|
|
|
if (( ele_id == 1) || (ele_id == 51))
|
2001-03-23 19:22:02 +00:00
|
|
|
dissect_lmi_report_type( tvb, offset, lmi_subtree);
|
2002-08-28 21:04:11 +00:00
|
|
|
else if (( ele_id == 3) || (ele_id == 53))
|
2001-03-23 19:22:02 +00:00
|
|
|
dissect_lmi_link_int( tvb, offset, lmi_subtree);
|
2002-08-28 21:04:11 +00:00
|
|
|
else if (( ele_id == 7) || (ele_id == 57))
|
2001-03-23 19:22:02 +00:00
|
|
|
dissect_lmi_pvc_status( tvb, offset, lmi_subtree);
|
|
|
|
offset += len;
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2001-03-23 19:22:02 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
lmi_tree = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_lmi(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_lmi_call_ref,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "Call reference", "lmi.cmd", FT_UINT8, BASE_HEX, NULL, 0,
|
2010-09-23 21:46:31 +00:00
|
|
|
NULL, HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
{ &hf_lmi_msg_type,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "Message Type", "lmi.msg_type", FT_UINT8, BASE_HEX, VALS(msg_type_str), 0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
{ &hf_lmi_inf_ele,
|
|
|
|
{ "Type", "lmi.inf_ele_type", FT_UINT8, BASE_DEC, VALS(element_type_str), 0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Information Element Type", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_inf_len,
|
|
|
|
{ "Length", "lmi.inf_ele_len", FT_UINT8, BASE_DEC, NULL, 0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Information Element Length", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
|
|
|
|
{ &hf_lmi_rcd_type,
|
|
|
|
{ "Record Type", "lmi.ele_rcd_type", FT_UINT8, BASE_DEC, VALS(record_type_str), 0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_send_seq,
|
|
|
|
{ "Send Seq", "lmi.send_seq", FT_UINT8, BASE_DEC, NULL, 0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Send Sequence", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_recv_seq,
|
|
|
|
{ "Recv Seq", "lmi.recv_seq", FT_UINT8, BASE_DEC, NULL, 0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Receive Sequence", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_dlci_high,
|
|
|
|
{ "DLCI High", "lmi.dlci_hi", FT_UINT8, BASE_DEC, NULL, 0x3f,
|
2001-06-18 02:18:27 +00:00
|
|
|
"DLCI High bits", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_dlci_low,
|
|
|
|
{ "DLCI Low", "lmi.dlci_low", FT_UINT8, BASE_DEC, NULL, 0x78,
|
2001-06-18 02:18:27 +00:00
|
|
|
"DLCI Low bits", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_new,
|
|
|
|
{ "DLCI New", "lmi.dlci_new", FT_UINT8, BASE_DEC, VALS(pvc_status_new_str), 0x08,
|
2001-06-18 02:18:27 +00:00
|
|
|
"DLCI New Flag", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
{ &hf_lmi_act,
|
|
|
|
{ "DLCI Active","lmi.dlci_act", FT_UINT8, BASE_DEC, VALS(pvc_status_act_str), 0x02,
|
2001-06-18 02:18:27 +00:00
|
|
|
"DLCI Active Flag", HFILL }},
|
2001-03-23 19:22:02 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_lmi,
|
|
|
|
&ett_lmi_ele,
|
|
|
|
};
|
|
|
|
proto_lmi = proto_register_protocol ("Local Management Interface", "LMI", "lmi");
|
|
|
|
proto_register_field_array (proto_lmi, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_lmi(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t lmi_handle;
|
|
|
|
|
|
|
|
lmi_handle = create_dissector_handle(dissect_lmi, proto_lmi);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("fr.ietf", NLPID_LMI, lmi_handle);
|
2001-03-23 19:22:02 +00:00
|
|
|
}
|