From 985b7bae1198996299e18b7a6641a6414f8d35c4 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 26 Jan 2004 20:48:39 +0000 Subject: Add a dissector table for LAPD SAPIs, and move the #defines for them into "lapd_sapi.h". Use that to register the Q.931 dissector atop LAPD. From Rolf Fiedler: ISDN TEI management frame support. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9864 f5534014-38df-0310-8fa8-9805f1628bb7 --- AUTHORS | 4 ++ Makefile.am | 3 +- Makefile.common | 3 +- doc/ethereal.pod | 1 + lapd_sapi.h | 33 +++++++++++ packet-lapd.c | 38 +++++-------- packet-q931.c | 8 ++- packet-teimanagement.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 208 insertions(+), 28 deletions(-) create mode 100644 lapd_sapi.h create mode 100644 packet-teimanagement.c diff --git a/AUTHORS b/AUTHORS index c1a0a2819f..419fb0f321 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1998,6 +1998,10 @@ Chris Wilson { SMPP dissection of concatenated PDUs } +Rolf Fiedler { + ISDN TEI management frame support +} + And assorted fixes and enhancements by the people listed above and by: Pavel Roskin diff --git a/Makefile.am b/Makefile.am index 341824ca62..64caa4284c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.701 2004/01/25 17:51:53 gerald Exp $ +# $Id: Makefile.am,v 1.702 2004/01/26 20:48:38 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -417,6 +417,7 @@ DISSECTOR_SUPPORT_SRC = \ ip_opts.h \ ipproto.c \ ipproto.h \ + lapd_sapi.h \ llcsaps.h \ nlpid.h \ oui.h \ diff --git a/Makefile.common b/Makefile.common index 129aa8fb5a..388785ab44 100644 --- a/Makefile.common +++ b/Makefile.common @@ -3,7 +3,7 @@ # a) common to both files and # b) portable between both files # -# $Id: Makefile.common,v 1.3 2004/01/23 10:15:37 guy Exp $ +# $Id: Makefile.common,v 1.4 2004/01/26 20:48:38 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -385,6 +385,7 @@ DISSECTOR_SRC = \ packet-tcap.c \ packet-tcp.c \ packet-tds.c \ + packet-teimanagement.c \ packet-telnet.c \ packet-teredo.c \ packet-text-media.c \ diff --git a/doc/ethereal.pod b/doc/ethereal.pod index cbf41a60c8..6ee6aa96a4 100644 --- a/doc/ethereal.pod +++ b/doc/ethereal.pod @@ -2081,6 +2081,7 @@ B. Tadaaki Nagao Aaron Woo Chris Wilson + Rolf Fiedler Pavel Roskin Georgi Guninski Jason Copenhaver diff --git a/lapd_sapi.h b/lapd_sapi.h new file mode 100644 index 0000000000..7a401e5f57 --- /dev/null +++ b/lapd_sapi.h @@ -0,0 +1,33 @@ +/* lapd_sapi.h + * Declarations of LAPD SAPI values. + * + * $Id: lapd_sapi.h,v 1.1 2004/01/26 20:48:38 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 2004 Gerald Combs + * + * 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. + */ + +#ifndef __LAPD_SAPI_H__ +#define __LAPD_SAPI_H__ + +#define LAPD_SAPI_Q931 0 /* Q.931 call control procedure */ +#define LAPD_SAPI_PM_Q931 1 /* Packet mode Q.931 call control procedure */ +#define LAPD_SAPI_X25 16 /* X.25 Level 3 procedures */ +#define LAPD_SAPI_L2 63 /* Layer 2 management procedures */ + +#endif /* lapd_sapi.h */ diff --git a/packet-lapd.c b/packet-lapd.c index 22b399cce5..d8a6d053f6 100644 --- a/packet-lapd.c +++ b/packet-lapd.c @@ -2,7 +2,7 @@ * Routines for LAPD frame disassembly * Gilbert Ramirez * - * $Id: packet-lapd.c,v 1.37 2004/01/18 08:32:45 guy Exp $ + * $Id: packet-lapd.c,v 1.38 2004/01/26 20:48:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -33,6 +33,8 @@ #include #include "xdlc.h" +#include "lapd_sapi.h" + /* ISDN/LAPD references: * * http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/isdn.htm @@ -65,8 +67,10 @@ static gint ett_lapd = -1; static gint ett_lapd_address = -1; static gint ett_lapd_control = -1; -static dissector_handle_t q931_handle; +static dissector_table_t lapd_sapi_dissector_table; + static dissector_handle_t data_handle; +static dissector_handle_t tei_handle; /* * Bits in the address field. @@ -78,11 +82,6 @@ static dissector_handle_t data_handle; #define LAPD_TEI 0x00fe /* Terminal Endpoint Identifier */ #define LAPD_EA2 0x0001 /* Second Address Extension bit */ -#define LAPD_SAPI_Q931 0 /* Q.931 call control procedure */ -#define LAPD_SAPI_PM_Q931 1 /* Packet mode Q.931 call control procedure */ -#define LAPD_SAPI_X25 16 /* X.25 Level 3 procedures */ -#define LAPD_SAPI_L2 63 /* Layer 2 management procedures */ - static const value_string lapd_sapi_vals[] = { { LAPD_SAPI_Q931, "Q.931 Call control procedure" }, { LAPD_SAPI_PM_Q931, "Packet mode Q.931 Call control procedure" }, @@ -185,20 +184,9 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset(tvb, lapd_header_len, -1, -1); if (XDLC_IS_INFORMATION(control)) { /* call next protocol */ - switch (sapi) { - - case LAPD_SAPI_Q931: - call_dissector(q931_handle, next_tvb, pinfo, tree); - break; - - default: - /* - * XXX - handle some of the others, such as - * LAPD_SAPI_L2. - */ - call_dissector(data_handle, next_tvb, pinfo, tree); - break; - } + if (!dissector_try_port(lapd_sapi_dissector_table, sapi, + next_tvb, pinfo, tree)) + call_dissector(data_handle,next_tvb, pinfo, tree); } else call_dissector(data_handle,next_tvb, pinfo, tree); } @@ -295,14 +283,14 @@ proto_register_lapd(void) proto_register_subtree_array(ett, array_length(ett)); register_dissector("lapd", dissect_lapd, proto_lapd); + + lapd_sapi_dissector_table = register_dissector_table("lapd.sapi", + "LAPD SAPI", FT_UINT16, BASE_DEC); } void proto_reg_handoff_lapd(void) { - /* - * Get handle for the Q.931 dissector. - */ - q931_handle = find_dissector("q931"); data_handle = find_dissector("data"); + tei_handle = find_dissector("tei"); } diff --git a/packet-q931.c b/packet-q931.c index de6da18189..66583f1d1e 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris * - * $Id: packet-q931.c,v 1.65 2004/01/16 18:28:09 guy Exp $ + * $Id: packet-q931.c,v 1.66 2004/01/26 20:48:38 guy Exp $ * * Modified by Andreas Sikkema for possible use with H.323 * @@ -38,6 +38,7 @@ #include "packet-q931.h" #include "prefs.h" +#include "lapd_sapi.h" #include "packet-tpkt.h" /* Q.931 references: @@ -2935,6 +2936,11 @@ proto_register_q931(void) void proto_reg_handoff_q931(void) { + dissector_handle_t q931_handle; + + q931_handle = find_dissector("q931"); + dissector_add("lapd.sapi", LAPD_SAPI_Q931, q931_handle); + /* * Attempt to get a handle for the H.225 dissector. * If we can't, the handle we get is null, and we'll just diff --git a/packet-teimanagement.c b/packet-teimanagement.c new file mode 100644 index 0000000000..2af1a8a1ed --- /dev/null +++ b/packet-teimanagement.c @@ -0,0 +1,146 @@ +/* packet-teimanagement.c + * Routines for LAPD TEI Management frame disassembly + * Rolf Fiedler + * based on code by Gilbert Ramirez + * + * $Id: packet-teimanagement.c,v 1.1 2004/01/26 20:48:38 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include +#include +#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); +} -- cgit v1.2.3