aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-04-04 07:33:39 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-04-04 07:33:39 +0000
commit77b67c7456a174439d61c09038f82d1ad113ae15 (patch)
treed587f816085435b66d698c33f7dccb15298702b8 /epan
parent16a4af2d6755d2ca5af2bb8bd24442b4dd40e933 (diff)
From Rolf Fiedler:
Patch to add V5.2 tracing capability on E1 links using EyeSDN probes. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7027 Removed preference related stufff as it's not needed. svn path=/trunk/; revision=41915
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt2
-rw-r--r--epan/dissectors/Makefile.common2
-rw-r--r--epan/dissectors/packet-frame.c4
-rw-r--r--epan/dissectors/packet-v5dl.c381
-rw-r--r--epan/dissectors/packet-v5ef.c212
5 files changed, 601 insertions, 0 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 17a432e2b9..2f39e85d2b 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -1136,6 +1136,8 @@ set(DISSECTOR_SRC
dissectors/packet-uts.c
dissectors/packet-v120.c
dissectors/packet-v52.c
+ dissectors/packet-v5dl.c
+ dissectors/packet-v5ef.c
dissectors/packet-v5ua.c
dissectors/packet-vcdu.c
dissectors/packet-vicp.c
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index d8d0bca79d..9946c99344 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -1056,6 +1056,8 @@ DISSECTOR_SRC = \
packet-v120.c \
packet-v52.c \
packet-v5ua.c \
+ packet-v5ef.c \
+ packet-v5dl.c \
packet-vcdu.c \
packet-vicp.c \
packet-vines.c \
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 6c15ebf474..d12c9f7bc8 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -157,6 +157,9 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
break;
case WTAP_ENCAP_ISDN:
+ case WTAP_ENCAP_V5_EF:
+ case WTAP_ENCAP_DPNSS:
+ case WTAP_ENCAP_BACNET_MS_TP:
pinfo->p2p_dir = pinfo->pseudo_header->isdn.uton ?
P2P_DIR_SENT : P2P_DIR_RECV;
break;
@@ -168,6 +171,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
break;
case WTAP_ENCAP_MTP2_WITH_PHDR:
+ case WTAP_ENCAP_MTP2:
pinfo->p2p_dir = pinfo->pseudo_header->mtp2.sent ?
P2P_DIR_SENT : P2P_DIR_RECV;
pinfo->link_number = pinfo->pseudo_header->mtp2.link_number;
diff --git a/epan/dissectors/packet-v5dl.c b/epan/dissectors/packet-v5dl.c
new file mode 100644
index 0000000000..7115e48b35
--- /dev/null
+++ b/epan/dissectors/packet-v5dl.c
@@ -0,0 +1,381 @@
+/* packet-v5dl.c
+ * Routines for V5 data link frame disassembly
+ * Rolf Fiedler <rolf.fiedler@innoventif.de> using the LAPD code of
+ * Gilbert Ramirez <gram@alumni.rice.edu>
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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.
+ */
+/*
+ * V5 Data Link Layer
+ *
+ * V5 references:
+ * ETS 300 324-1
+ * ETS 300 347-1
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <string.h>
+#include <epan/packet.h>
+#include <epan/conversation.h>
+#include <epan/xdlc.h>
+#include <epan/crc16-tvb.h>
+
+static int proto_v5dl = -1;
+static int hf_v5dl_direction = -1;
+static int hf_v5dl_address = -1;
+static int hf_v5dl_ef = -1;
+static int hf_v5dl_eah = -1;
+static int hf_v5dl_cr = -1;
+static int hf_v5dl_ea1 = -1;
+static int hf_v5dl_eal = -1;
+static int hf_v5dl_ea2 = -1;
+static int hf_v5dl_control = -1;
+static int hf_v5dl_n_r = -1;
+static int hf_v5dl_n_s = -1;
+static int hf_v5dl_p = -1;
+static int hf_v5dl_p_ext = -1;
+static int hf_v5dl_f = -1;
+static int hf_v5dl_f_ext = -1;
+static int hf_v5dl_s_ftype = -1;
+static int hf_v5dl_u_modifier_cmd = -1;
+static int hf_v5dl_u_modifier_resp = -1;
+static int hf_v5dl_ftype_i = -1;
+static int hf_v5dl_ftype_s_u = -1;
+static int hf_v5dl_ftype_s_u_ext = -1;
+static int hf_v5dl_checksum = -1;
+static int hf_v5dl_checksum_good = -1;
+static int hf_v5dl_checksum_bad = -1;
+
+static gint ett_v5dl = -1;
+static gint ett_v5dl_address = -1;
+static gint ett_v5dl_control = -1;
+static gint ett_v5dl_checksum = -1;
+
+static dissector_handle_t data_handle;
+
+/*
+ * Bits in the address field.
+ */
+#define V5DL_EAH 0xfc00 /* Service Access Point Identifier */
+#define V5DL_EAH_SHIFT 10
+#define V5DL_CR 0x0200 /* Command/Response bit */
+#define V5DL_EA1 0x0100 /* First Address Extension bit */
+#define V5DL_EAL 0x00fe /* Terminal Endpoint Identifier */
+#define V5DL_EAL_SHIFT 1
+#define V5DL_EA2 0x0001 /* Second Address Extension bit */
+
+static const value_string v5dl_direction_vals[] = {
+ { P2P_DIR_RECV, "Network->User"},
+ { P2P_DIR_SENT, "User->Network"},
+ { 0, NULL }
+};
+
+static const value_string v5dl_addr_vals[] = {
+ { 8175, "ISDN Protocol" },
+ { 8176, "PSTN Protocol" },
+ { 8177, "CONTROL Protocol" },
+ { 8178, "BCC Protocol" },
+ { 8179, "PROT Protocol" },
+ { 8180, "Link Control Protocol" },
+ { 8191, "VALUE RESERVED" },
+ { 0, NULL } };
+
+/* Used only for U frames */
+static const xdlc_cf_items v5dl_cf_items = {
+ NULL,
+ NULL,
+ &hf_v5dl_p,
+ &hf_v5dl_f,
+ NULL,
+ &hf_v5dl_u_modifier_cmd,
+ &hf_v5dl_u_modifier_resp,
+ NULL,
+ &hf_v5dl_ftype_s_u
+};
+
+/* Used only for I and S frames */
+static const xdlc_cf_items v5dl_cf_items_ext = {
+ &hf_v5dl_n_r,
+ &hf_v5dl_n_s,
+ &hf_v5dl_p_ext,
+ &hf_v5dl_f_ext,
+ &hf_v5dl_s_ftype,
+ NULL,
+ NULL,
+ &hf_v5dl_ftype_i,
+ &hf_v5dl_ftype_s_u_ext
+};
+
+
+#define MAX_V5DL_PACKET_LEN 1024
+
+static void
+dissect_v5dl(tvbuff_t*, packet_info*, proto_tree*);
+
+static void
+dissect_v5dl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_tree *v5dl_tree, *addr_tree, *checksum_tree;
+ proto_item *v5dl_ti, *addr_ti, *checksum_ti;
+ int direction;
+ guint16 control, checksum, checksum_calculated;
+ int v5dl_header_len, checksum_offset;
+ guint16 addr, cr, eah, eal, v5addr;
+ gboolean is_response = 0;
+ tvbuff_t *next_tvb;
+ const char *srcname = "?";
+ const char *dstname = "?";
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "V5DL");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ addr = tvb_get_ntohs(tvb, 0);
+ cr = addr & V5DL_CR;
+ eal = (addr & V5DL_EAL) >> V5DL_EAL_SHIFT;
+ eah = (addr & V5DL_EAH) >> V5DL_EAH_SHIFT;
+ v5addr = (eah << 7) + eal;
+ v5dl_header_len = 2; /* addr */
+
+ direction = pinfo->p2p_dir;
+ if (pinfo->p2p_dir == P2P_DIR_RECV) {
+ is_response = cr ? FALSE : TRUE;
+ srcname = "Network";
+ dstname = "User";
+ }
+ else if (pinfo->p2p_dir == P2P_DIR_SENT) {
+ is_response = cr ? TRUE : FALSE;
+ srcname = "User";
+ dstname = "Network";
+ }
+
+ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, srcname);
+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, dstname);
+
+ if (tree) {
+ proto_item *direction_ti;
+
+ v5dl_ti = proto_tree_add_item(tree, proto_v5dl, tvb, 0, -1,
+ ENC_NA);
+ v5dl_tree = proto_item_add_subtree(v5dl_ti, ett_v5dl);
+
+ /*
+ * Don't show the direction if we don't know it.
+ */
+ if (direction != P2P_DIR_UNKNOWN) {
+ direction_ti = proto_tree_add_uint(v5dl_tree, hf_v5dl_direction,
+ tvb, 0, 0, pinfo->p2p_dir);
+ PROTO_ITEM_SET_GENERATED(direction_ti);
+ }
+
+ addr_ti = proto_tree_add_uint(v5dl_tree, hf_v5dl_ef, tvb,
+ 0, 2, v5addr);
+ addr_tree = proto_item_add_subtree(addr_ti, ett_v5dl_address);
+ proto_tree_add_uint(addr_tree, hf_v5dl_eah, tvb, 0, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5dl_cr, tvb, 0, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5dl_ea1, tvb, 0, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5dl_eal, tvb, 1, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5dl_ea2, tvb, 1, 1, addr);
+ }
+ else {
+ v5dl_ti = NULL;
+ v5dl_tree = NULL;
+ }
+
+ control = dissect_xdlc_control(tvb, 2, pinfo, v5dl_tree, hf_v5dl_control,
+ ett_v5dl_control, &v5dl_cf_items, &v5dl_cf_items_ext, NULL, NULL,
+ is_response, TRUE, FALSE);
+ v5dl_header_len += XDLC_CONTROL_LEN(control, TRUE);
+
+ if (tree)
+ proto_item_set_len(v5dl_ti, v5dl_header_len);
+
+ if (NULL != p_get_proto_data(pinfo->fd, proto_v5dl)) {
+ /* check checksum */
+ checksum_offset = tvb_length(tvb) - 2;
+ checksum = tvb_get_guint8(tvb, checksum_offset); /* high byte */
+ checksum <<= 8;
+ checksum |= tvb_get_guint8(tvb, checksum_offset+1) & 0x00FF; /* low byte */
+ checksum_calculated = crc16_ccitt_tvb(tvb, tvb_length(tvb) - 2);
+ checksum_calculated = g_htons(checksum_calculated); /* Note: g_htons() macro may eval arg multiple times */
+
+ if (checksum == checksum_calculated) {
+ checksum_ti = proto_tree_add_uint_format(v5dl_tree, hf_v5dl_checksum, tvb, checksum_offset, 2, 0,"Checksum: 0x%04x [correct]", checksum);
+ checksum_tree = proto_item_add_subtree(checksum_ti, ett_v5dl_checksum);
+ proto_tree_add_boolean(checksum_tree, hf_v5dl_checksum_good, tvb, checksum_offset, 2, TRUE);
+ proto_tree_add_boolean(checksum_tree, hf_v5dl_checksum_bad, tvb, checksum_offset, 2, FALSE);
+ } else {
+ checksum_ti = proto_tree_add_uint_format(v5dl_tree, hf_v5dl_checksum, tvb, checksum_offset, 2, 0,"Checksum: 0x%04x [incorrect, should be 0x%04x]", checksum, checksum_calculated);
+ checksum_tree = proto_item_add_subtree(checksum_ti, ett_v5dl_checksum);
+ proto_tree_add_boolean(checksum_tree, hf_v5dl_checksum_good, tvb, checksum_offset, 2, FALSE);
+ proto_tree_add_boolean(checksum_tree, hf_v5dl_checksum_bad, tvb, checksum_offset, 2, TRUE);
+ }
+
+ next_tvb = tvb_new_subset(tvb, v5dl_header_len, tvb_length_remaining(tvb,v5dl_header_len) - 2, -1);
+
+ } else
+ next_tvb = tvb_new_subset_remaining(tvb, v5dl_header_len);
+
+ if (XDLC_IS_INFORMATION(control)) {
+ /* call next protocol */
+ call_dissector(data_handle,next_tvb, pinfo, tree);
+ }
+}
+
+void
+proto_reg_handoff_v5dl(void);
+
+void
+proto_register_v5dl(void)
+{
+ static hf_register_info hf[] = {
+
+ { &hf_v5dl_direction,
+ { "Direction", "v5dl.direction", FT_UINT8, BASE_DEC, VALS(v5dl_direction_vals), 0x0,
+ NULL, HFILL }},
+
+ { &hf_v5dl_address,
+ { "Address Field", "v5dl.address", FT_UINT16, BASE_HEX, NULL, 0x0,
+ "Address", HFILL }},
+
+ { &hf_v5dl_ef,
+ { "EF", "v5dl.ef", FT_UINT16, BASE_DEC, VALS(v5dl_addr_vals), 0x0,
+ "Envelope Function Address", HFILL }},
+
+ { &hf_v5dl_eah,
+ { "EAH", "v5dl.eah", FT_UINT16, BASE_DEC, NULL, V5DL_EAH,
+ "Envelope Address High", HFILL }},
+
+ { &hf_v5dl_cr,
+ { "C/R", "v5dl.cr", FT_UINT16, BASE_DEC, NULL, V5DL_CR,
+ "Command/Response bit", HFILL }},
+
+ { &hf_v5dl_ea1,
+ { "EA1", "v5dl.ea1", FT_UINT16, BASE_DEC, NULL, V5DL_EA1,
+ "First Address Extension bit", HFILL }},
+
+ { &hf_v5dl_eal,
+ { "EAL", "v5dl.eal", FT_UINT16, BASE_DEC, NULL, V5DL_EAL,
+ "Envelope Address Low", HFILL }},
+
+ { &hf_v5dl_ea2,
+ { "EA2", "v5dl.ea2", FT_UINT16, BASE_DEC, NULL, V5DL_EA2,
+ "Second Address Extension bit", HFILL }},
+
+ { &hf_v5dl_control,
+ { "Control Field", "v5dl.control", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_v5dl_n_r,
+ { "N(R)", "v5dl.control.n_r", FT_UINT16, BASE_DEC,
+ NULL, XDLC_N_R_EXT_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_n_s,
+ { "N(S)", "v5dl.control.n_s", FT_UINT16, BASE_DEC,
+ NULL, XDLC_N_S_EXT_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_p,
+ { "Poll", "v5dl.control.p", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), XDLC_P_F, NULL, HFILL }},
+
+ { &hf_v5dl_p_ext,
+ { "Poll", "v5dl.control.p", FT_BOOLEAN, 16,
+ TFS(&tfs_set_notset), XDLC_P_F_EXT, NULL, HFILL }},
+
+ { &hf_v5dl_f,
+ { "Final", "v5dl.control.f", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), XDLC_P_F, NULL, HFILL }},
+
+ { &hf_v5dl_f_ext,
+ { "Final", "v5dl.control.f", FT_BOOLEAN, 16,
+ TFS(&tfs_set_notset), XDLC_P_F_EXT, NULL, HFILL }},
+
+ { &hf_v5dl_s_ftype,
+ { "Supervisory frame type", "v5dl.control.s_ftype", FT_UINT16, BASE_HEX,
+ VALS(stype_vals), XDLC_S_FTYPE_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_u_modifier_cmd,
+ { "Command", "v5dl.control.u_modifier_cmd", FT_UINT8, BASE_HEX,
+ VALS(modifier_vals_cmd), XDLC_U_MODIFIER_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_u_modifier_resp,
+ { "Response", "v5dl.control.u_modifier_resp", FT_UINT8, BASE_HEX,
+ VALS(modifier_vals_resp), XDLC_U_MODIFIER_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_ftype_i,
+ { "Frame type", "v5dl.control.ftype", FT_UINT16, BASE_HEX,
+ VALS(ftype_vals), XDLC_I_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_ftype_s_u,
+ { "Frame type", "v5dl.control.ftype", FT_UINT8, BASE_HEX,
+ VALS(ftype_vals), XDLC_S_U_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_ftype_s_u_ext,
+ { "Frame type", "v5dl.control.ftype", FT_UINT16, BASE_HEX,
+ VALS(ftype_vals), XDLC_S_U_MASK, NULL, HFILL }},
+
+ { &hf_v5dl_checksum,
+ { "Checksum", "v5dl.checksum", FT_UINT16, BASE_HEX,
+ NULL, 0x0, "Details at: http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html", HFILL }},
+
+ { &hf_v5dl_checksum_good,
+ { "Good Checksum", "v5dl.checksum_good", FT_BOOLEAN, BASE_NONE,
+ NULL, 0x0, "True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
+
+ { &hf_v5dl_checksum_bad,
+ { "Bad Checksum", "v5dl.checksum_bad", FT_BOOLEAN, BASE_NONE,
+ NULL, 0x0, "True: checksum doesn't match packet content; False: matches content or not checked", HFILL }}
+ };
+
+ static gint *ett[] = {
+ &ett_v5dl,
+ &ett_v5dl_address,
+ &ett_v5dl_control,
+ &ett_v5dl_checksum
+ };
+
+ proto_v5dl = proto_register_protocol("V5 Data Link Layer",
+ "V5DL", "v5dl");
+ proto_register_field_array (proto_v5dl, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ register_dissector("v5dl", dissect_v5dl, proto_v5dl);
+
+}
+
+void
+proto_reg_handoff_v5dl(void)
+{
+ static gboolean init = FALSE;
+
+ if (!init) {
+ dissector_handle_t v5dl_handle;
+
+ v5dl_handle = find_dissector("v5dl");
+ data_handle = find_dissector("v52");
+
+ init = TRUE;
+ }
+}
diff --git a/epan/dissectors/packet-v5ef.c b/epan/dissectors/packet-v5ef.c
new file mode 100644
index 0000000000..7c0c645540
--- /dev/null
+++ b/epan/dissectors/packet-v5ef.c
@@ -0,0 +1,212 @@
+/* packet-lapd.c
+ * Routines for V5 envelope function frame disassembly
+ * Rolf Fiedler <rolf.fiedler@innoventif.de>
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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.
+ */
+/*
+ * V5 bitstream over HDLC handling
+ *
+ * V5 references:
+ *
+ * ETS 300 324-1
+ * ETS 300 347-1
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <string.h>
+#include <epan/packet.h>
+#include <epan/conversation.h>
+#include <epan/xdlc.h>
+#include <epan/crc16-tvb.h>
+
+static int proto_v5ef = -1;
+static int hf_v5ef_direction = -1;
+static int hf_v5ef_address = -1;
+static int hf_v5ef_eah = -1;
+static int hf_v5ef_ea1 = -1;
+static int hf_v5ef_eal = -1;
+static int hf_v5ef_ea2 = -1;
+
+static gint ett_v5ef = -1;
+static gint ett_v5ef_address = -1;
+
+static dissector_handle_t v52_handle, lapd_handle;
+
+/*
+ * Bits in the address field.
+ */
+#define V5EF_EAH 0xfc00 /* Service Access Point Identifier */
+#define V5EF_EAH_SHIFT 10
+#define V5EF_EA1 0x0100 /* First Address Extension bit */
+#define V5EF_EAL 0x00fe /* Terminal Endpoint Identifier */
+#define V5EF_EAL_SHIFT 1
+#define V5EF_EA2 0x0001 /* Second Address Extension bit */
+
+static const value_string v5ef_direction_vals[] = {
+ { 0, "AN->LE"},
+ { 1, "LE->AN"},
+ { 0, NULL }
+};
+
+#define MAX_V5EF_PACKET_LEN 1024
+
+static void
+dissect_v5ef(tvbuff_t*, packet_info*, proto_tree*);
+
+static void
+dissect_v5ef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_tree *v5ef_tree, *addr_tree;
+ proto_item *v5ef_ti, *addr_ti;
+ int direction;
+ int v5ef_header_len;
+ guint16 addr, eah, eal, efaddr;
+ tvbuff_t *next_tvb;
+ const char *srcname = "src";
+ const char *dstname = "dst";
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "V5-EF");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ addr = tvb_get_ntohs(tvb, 0);
+ eah = (addr & V5EF_EAH) >> V5EF_EAH_SHIFT;
+ eal = (addr & V5EF_EAL) >> V5EF_EAL_SHIFT;
+ efaddr = (eah << 7) + eal;
+ v5ef_header_len = 2; /* addr */
+
+ direction = pinfo->pseudo_header->isdn.uton;
+ if (direction==0) {
+ srcname = "LE";
+ dstname = "AN";
+ } else if (direction > 0) {
+ srcname = "AN";
+ dstname = "LE";
+ }
+ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, srcname);
+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, dstname);
+
+ if (tree) {
+ proto_item *direction_ti;
+
+ v5ef_ti = proto_tree_add_item(tree, proto_v5ef, tvb, 0, -1,
+ ENC_NA);
+ v5ef_tree = proto_item_add_subtree(v5ef_ti, ett_v5ef);
+
+ /*
+ * Don't show the direction if we don't know it.
+ */
+ if (direction != P2P_DIR_UNKNOWN) {
+ direction_ti = proto_tree_add_uint(v5ef_tree, hf_v5ef_direction,
+ tvb, 0, 0, direction);
+ PROTO_ITEM_SET_GENERATED(direction_ti);
+ }
+
+ addr_ti = proto_tree_add_uint(v5ef_tree, hf_v5ef_address, tvb,
+ 0, 2, addr);
+ addr_tree = proto_item_add_subtree(addr_ti, ett_v5ef_address);
+
+ proto_tree_add_uint(addr_tree, hf_v5ef_eah, tvb, 0, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5ef_ea1, tvb, 0, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5ef_eal, tvb, 1, 1, addr);
+ proto_tree_add_uint(addr_tree, hf_v5ef_ea2, tvb, 1, 1, addr);
+ }
+ else {
+ v5ef_ti = NULL;
+ v5ef_tree = NULL;
+ }
+
+ if (tree)
+ proto_item_set_len(v5ef_ti, v5ef_header_len);
+
+ next_tvb = tvb_new_subset_remaining(tvb, v5ef_header_len);
+
+ if(efaddr>8175) call_dissector(v52_handle,next_tvb, pinfo, tree);
+ else call_dissector(lapd_handle,next_tvb, pinfo, tree);
+}
+
+void
+proto_reg_handoff_v5ef(void);
+
+void
+proto_register_v5ef(void)
+{
+ static hf_register_info hf[] = {
+
+ { &hf_v5ef_direction,
+ { "Direction", "v5ef.direction", FT_UINT8, BASE_DEC, VALS(v5ef_direction_vals), 0x0,
+ NULL, HFILL }},
+
+ { &hf_v5ef_address,
+ { "Address Field", "v5ef.address", FT_UINT16, BASE_HEX, NULL, 0x0,
+ "Address", HFILL }},
+
+ { &hf_v5ef_eah,
+ { "EAH", "v5ef.eah", FT_UINT16, BASE_DEC, NULL, V5EF_EAH,
+ "Envelope Address High Part", HFILL }},
+
+ { &hf_v5ef_ea1,
+ { "EA1", "v5ef.ea1", FT_UINT16, BASE_DEC, NULL, V5EF_EA1,
+ "First Address Extension bit", HFILL }},
+
+ { &hf_v5ef_eal,
+ { "EAL", "v5ef.eal", FT_UINT16, BASE_DEC, NULL, V5EF_EAL,
+ "Envelope Address Low Part", HFILL }},
+
+ { &hf_v5ef_ea2,
+ { "EA2", "v5ef.ea2", FT_UINT16, BASE_DEC, NULL, V5EF_EA2,
+ "Second Address Extension bit", HFILL }},
+ };
+
+ static gint *ett[] = {
+ &ett_v5ef,
+ &ett_v5ef_address,
+ };
+
+ proto_v5ef = proto_register_protocol("V5 Envelope Function (v5ef)",
+ "v5ef", "v5ef");
+ proto_register_field_array (proto_v5ef, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ register_dissector("v5ef", dissect_v5ef, proto_v5ef);
+
+}
+
+void
+proto_reg_handoff_v5ef(void)
+{
+ static gboolean init = FALSE;
+
+ if (!init) {
+ dissector_handle_t v5ef_handle;
+
+ v5ef_handle = find_dissector("v5ef");
+ dissector_add_uint("wtap_encap", WTAP_ENCAP_V5_EF, v5ef_handle);
+
+ lapd_handle = find_dissector("lapd");
+ v52_handle = find_dissector("v5dl");
+ init = TRUE;
+ }
+}