blob: 4957db71dd9a18e7a2c9bb9f6ea61a0400cec4f6 [file] [log] [blame]
Holger Hans Peter Freyther9b5f1d72011-01-11 16:33:52 +01001From 48f2a191de62686c2ffdb97e46b5cc6bb61a868d Mon Sep 17 00:00:00 2001
2From: Holger Hans Peter Freyther <zecke@selfish.org>
3Date: Tue, 11 Jan 2011 15:16:19 +0100
4Subject: [PATCH 3/4] lucent-hnb
5
6Add lucent hnb patch from OpenBSC
7---
8 epan/CMakeLists.txt | 1 +
9 epan/dissectors/Makefile.common | 1 +
10 epan/dissectors/packet-lucent_hnb.c | 103 +++++++++++++++++++++++++++++++++++
11 3 files changed, 105 insertions(+), 0 deletions(-)
12 create mode 100644 epan/dissectors/packet-lucent_hnb.c
13
14diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
15index 9217ec0..ac76ab9 100644
16--- a/epan/CMakeLists.txt
17+++ b/epan/CMakeLists.txt
18@@ -728,6 +728,7 @@ set(DISSECTOR_SRC
19 dissectors/packet-lpd.c
20 dissectors/packet-lsc.c
21 dissectors/packet-ltp.c
22+ dissectors/packet-lucent_hnb.c
23 dissectors/packet-lwapp.c
24 dissectors/packet-lwres.c
25 dissectors/packet-m2pa.c
26diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
27index 4c7094b..9931f28 100644
28--- a/epan/dissectors/Makefile.common
29+++ b/epan/dissectors/Makefile.common
30@@ -638,6 +638,7 @@ DISSECTOR_SRC = \
31 packet-lpd.c \
32 packet-lsc.c \
33 packet-ltp.c \
34+ packet-lucent_hnb.c \
35 packet-lwapp.c \
36 packet-lwres.c \
37 packet-m2pa.c \
38diff --git a/epan/dissectors/packet-lucent_hnb.c b/epan/dissectors/packet-lucent_hnb.c
39new file mode 100644
40index 0000000..296f98b
Harald Weltec25b3692009-08-27 21:59:22 +090041--- /dev/null
Holger Hans Peter Freyther9b5f1d72011-01-11 16:33:52 +010042+++ b/epan/dissectors/packet-lucent_hnb.c
Harald Weltec25b3692009-08-27 21:59:22 +090043@@ -0,0 +1,103 @@
44+/* packet-lucent_hnb.c
45+ * Routines for packet dissection of Alcatel/Lucent HomeNodeB
46+ * Copyright 2009 by Harald Welte <laforge@gnumonks.org>
47+ *
48+ * This protocol decoder is based entirely on reverse engineering, i.e.
49+ * on educated guesses.
50+ *
51+ * $Id: packet-lucent_hnb.c 29254 2009-07-31 19:19:25Z gerald $
52+ *
53+ * Wireshark - Network traffic analyzer
54+ * By Gerald Combs <gerald@wireshark.org>
55+ * Copyright 1998 Gerald Combs
56+ *
57+ * This program is free software; you can redistribute it and/or
58+ * modify it under the terms of the GNU General Public License
59+ * as published by the Free Software Foundation; either version 2
60+ * of the License, or (at your option) any later version.
61+ *
62+ * This program is distributed in the hope that it will be useful,
63+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
64+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65+ * GNU General Public License for more details.
66+ *
67+ * You should have received a copy of the GNU General Public License
68+ * along with this program; if not, write to the Free Software
69+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
70+ */
71+
72+#ifdef HAVE_CONFIG_H
73+# include "config.h"
74+#endif
75+
76+#define LHNB_SCTP_PPI_MM 1
77+#define LHNB_SCTP_PPI_GMM 6
78+
79+#define LHNB_SCTP_PORT 6005
80+
81+#include <glib.h>
82+
83+#include <epan/packet.h>
84+
85+/* Initialize the protocol and registered fields */
86+static int proto_lhnb = -1;
87+
88+static int hf_lhnb_length = -1;
89+
90+/* Initialize the subtree pointers */
91+static gint ett_lhnb = -1;
92+
93+static dissector_handle_t ranap_handle;
94+
95+/* Code to actually dissect the packets */
96+static void
97+dissect_lhnb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
98+{
99+
100+ int offset = 0;
101+ u_int16_t len;
102+ tvbuff_t *next_tvb;
103+
104+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "LHNB");
105+ col_clear(pinfo->cinfo, COL_INFO);
106+
107+ proto_tree_add_item(tree, hf_lhnb_length, tvb, offset+2, 2, FALSE);
108+ len = tvb_get_ntohs(tvb, offset+2);
109+ next_tvb = tvb_new_subset(tvb, offset+2+6, len-4, -1);
110+
111+ call_dissector(ranap_handle, next_tvb, pinfo, tree);
112+}
113+
114+void proto_register_lucent_hnb(void)
115+{
116+ static hf_register_info hf[] = {
117+ {&hf_lhnb_length,
118+ {"Length", "lhnb.len",
119+ FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
120+ },
121+ };
122+
123+ static gint *ett[] = {
124+ &ett_lhnb,
125+ };
126+
127+ proto_lhnb =
128+ proto_register_protocol("Alcatel/Lucent HomeNodeB",
129+ "Lucent HNB", "lhnb");
130+
131+ proto_register_field_array(proto_lhnb, hf, array_length(hf));
132+ proto_register_subtree_array(ett, array_length(ett));
133+}
134+
135+void proto_reg_handoff_lucent_hnb(void)
136+{
137+ dissector_handle_t lhnb_handle;
138+
139+ ranap_handle = find_dissector("ranap");
140+
141+ lhnb_handle = create_dissector_handle(dissect_lhnb, proto_lhnb);
142+
143+ dissector_add("sctp.ppi", LHNB_SCTP_PPI_MM, lhnb_handle);
144+ dissector_add("sctp.ppi", LHNB_SCTP_PPI_GMM, lhnb_handle);
145+ dissector_add("sctp.port", LHNB_SCTP_PORT, lhnb_handle);
146+}
Holger Hans Peter Freyther9b5f1d72011-01-11 16:33:52 +0100147--
1481.7.3.4
149