diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2004-07-18 18:06:47 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2004-07-18 18:06:47 +0000 |
commit | 669db206cb1f270046ad400fff7655e20c63e723 (patch) | |
tree | 4eff24a2e16c8963e497e1fc575f35e6af59bd26 /epan/dissectors/packet-teimanagement.c | |
parent | ae46c27a38700af669ef907491081f09df6f6b2c (diff) | |
download | wireshark-669db206cb1f270046ad400fff7655e20c63e723.tar.gz wireshark-669db206cb1f270046ad400fff7655e20c63e723.tar.bz2 wireshark-669db206cb1f270046ad400fff7655e20c63e723.zip |
Move dissectors to epan/dissectors directory.
Also move ncp222.py, x11-fields, process-x11-fields.pl,
make-reg-dotc, and make-reg-dotc.py.
Adjust #include lines in files that include packet-*.h
files.
svn path=/trunk/; revision=11410
Diffstat (limited to 'epan/dissectors/packet-teimanagement.c')
-rw-r--r-- | epan/dissectors/packet-teimanagement.c | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/epan/dissectors/packet-teimanagement.c b/epan/dissectors/packet-teimanagement.c new file mode 100644 index 0000000000..8d6dab4d41 --- /dev/null +++ b/epan/dissectors/packet-teimanagement.c @@ -0,0 +1,146 @@ +/* packet-teimanagement.c + * Routines for LAPD TEI Management frame disassembly + * Rolf Fiedler <rolf.fiedler@innoventif.com> + * based on code by Gilbert Ramirez <gram@alumni.rice.edu> + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> +#include <glib.h> +#include <string.h> +#include <epan/packet.h> +#include "lapd_sapi.h" + +/* ISDN/LAPD references: + * + * http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/isdn.htm + * http://www.ece.wpi.edu/courses/ee535/hwk11cd95/agrebe/agrebe.html + * http://www.acacia-net.com/Clarinet/Protocol/q9213o84.htm + */ + +static int proto_tei=-1; + +static int lm_entity_id=-1; +static int lm_reference=-1; +static int lm_message=-1; +static int lm_action=-1; +static int lm_extend =-1; +static gint lm_subtree=-1; + +#define TEI_ID_REQUEST 0x01 +#define TEI_ID_ASSIGNED 0x02 +#define TEI_ID_DENIED 0x03 +#define TEI_ID_CHECK_REQ 0x04 +#define TEI_ID_CHECK_RESP 0x05 +#define TEI_ID_REMOVE 0x06 +#define TEI_ID_VERIFY 0x07 + +static const value_string tei_msg_vals[]={ + { TEI_ID_REQUEST, "Identity Request"}, + { TEI_ID_ASSIGNED, "Identity Assigned"}, + { TEI_ID_DENIED, "Identity Denied"}, + { TEI_ID_CHECK_REQ, "Identity Check Request"}, + { TEI_ID_CHECK_RESP, "Identity Check Response"}, + { TEI_ID_REMOVE, "Identity Remove"}, + { TEI_ID_VERIFY, "Identity Verify"}, + { 0, NULL} +}; + +static void +dissect_teimanagement(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *tei_tree = NULL; + proto_item *tei_ti; + guint8 message; + + if(check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "TEI"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + if (tree) { + tei_ti = proto_tree_add_item(tree, proto_tei, tvb, 0, 5, FALSE); + tei_tree = proto_item_add_subtree(tei_ti, lm_subtree); + + proto_tree_add_item(tei_tree, lm_entity_id, tvb, 0, 1, FALSE); + proto_tree_add_item(tei_tree, lm_reference, tvb, 1, 2, FALSE); + } + + message = tvb_get_guint8(tvb, 3); + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, + val_to_str(message, tei_msg_vals, "Unknown message type (0x%04x)")); + if (tree) { + proto_tree_add_uint(tei_tree, lm_message, tvb, 3, 1, message); + proto_tree_add_item(tei_tree, lm_action, tvb, 4, 1, FALSE); + proto_tree_add_item(tei_tree, lm_extend, tvb, 4, 1, FALSE); + } +} + +void +proto_register_teimanagement(void) +{ + static gint *subtree[]={ + &lm_subtree + }; + + static hf_register_info hf[] = { + { &lm_entity_id, + { "Entity", "tei.entity", FT_UINT8, BASE_HEX, NULL, 0x0, + "Layer Management Entity Identifier", HFILL }}, + + { &lm_reference, + { "Reference", "tei.reference", FT_UINT16, BASE_DEC, NULL, 0x0, + "Reference Number", HFILL }}, + + { &lm_message, + { "Msg", "tei.msg", FT_UINT8, BASE_DEC, VALS(tei_msg_vals), 0x0, + "Message Type", HFILL }}, + + { &lm_action, + { "Action", "tei.action", FT_UINT8, BASE_DEC, NULL, 0xfe, + "Action Indicator", HFILL }}, + + { &lm_extend, + { "Extend", "tei.extend", FT_UINT8, BASE_DEC, NULL, 0x01, + "Extension Indicator", HFILL }} + }; + + proto_tei = proto_register_protocol("TEI Management Procedure, Channel D (LAPD)", + "TEI_MANAGEMENT", "tei_management"); + proto_register_field_array (proto_tei, hf, array_length(hf)); + proto_register_subtree_array(subtree, array_length(subtree)); +} + +void +proto_reg_handoff_teimanagement(void) +{ + dissector_handle_t teimanagement_handle; + + teimanagement_handle = create_dissector_handle(dissect_teimanagement, + proto_tei); + dissector_add("lapd.sapi", LAPD_SAPI_L2, teimanagement_handle); +} |