blob: c9fc3dc47fcfa56977f0b957f4e4927ff8556574 [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
Harald Welte7c78c472011-09-06 21:09:05 +020014Index: wireshark/epan/CMakeLists.txt
15===================================================================
16--- wireshark.orig/epan/CMakeLists.txt 2011-09-06 12:30:50.000000000 +0200
17+++ wireshark/epan/CMakeLists.txt 2011-09-06 12:30:52.000000000 +0200
18@@ -738,6 +738,7 @@
Holger Hans Peter Freyther9b5f1d72011-01-11 16:33:52 +010019 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
Harald Welte7c78c472011-09-06 21:09:05 +020026Index: wireshark/epan/dissectors/Makefile.common
27===================================================================
28--- wireshark.orig/epan/dissectors/Makefile.common 2011-09-06 12:30:50.000000000 +0200
29+++ wireshark/epan/dissectors/Makefile.common 2011-09-06 12:30:52.000000000 +0200
30@@ -657,6 +657,7 @@
Holger Hans Peter Freyther9b5f1d72011-01-11 16:33:52 +010031 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 \
Harald Welte7c78c472011-09-06 21:09:05 +020038Index: wireshark/epan/dissectors/packet-lucent_hnb.c
39===================================================================
40--- /dev/null 1970-01-01 00:00:00.000000000 +0000
41+++ wireshark/epan/dissectors/packet-lucent_hnb.c 2011-09-06 12:30:52.000000000 +0200
Harald Weltec25b3692009-08-27 21:59:22 +090042@@ -0,0 +1,103 @@
43+/* packet-lucent_hnb.c
44+ * Routines for packet dissection of Alcatel/Lucent HomeNodeB
45+ * Copyright 2009 by Harald Welte <laforge@gnumonks.org>
46+ *
47+ * This protocol decoder is based entirely on reverse engineering, i.e.
48+ * on educated guesses.
49+ *
50+ * $Id: packet-lucent_hnb.c 29254 2009-07-31 19:19:25Z gerald $
51+ *
52+ * Wireshark - Network traffic analyzer
53+ * By Gerald Combs <gerald@wireshark.org>
54+ * Copyright 1998 Gerald Combs
55+ *
56+ * This program is free software; you can redistribute it and/or
57+ * modify it under the terms of the GNU General Public License
58+ * as published by the Free Software Foundation; either version 2
59+ * of the License, or (at your option) any later version.
60+ *
61+ * This program is distributed in the hope that it will be useful,
62+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
63+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64+ * GNU General Public License for more details.
65+ *
66+ * You should have received a copy of the GNU General Public License
67+ * along with this program; if not, write to the Free Software
68+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
69+ */
70+
71+#ifdef HAVE_CONFIG_H
72+# include "config.h"
73+#endif
74+
75+#define LHNB_SCTP_PPI_MM 1
76+#define LHNB_SCTP_PPI_GMM 6
77+
78+#define LHNB_SCTP_PORT 6005
79+
80+#include <glib.h>
81+
82+#include <epan/packet.h>
83+
84+/* Initialize the protocol and registered fields */
85+static int proto_lhnb = -1;
86+
87+static int hf_lhnb_length = -1;
88+
89+/* Initialize the subtree pointers */
90+static gint ett_lhnb = -1;
91+
92+static dissector_handle_t ranap_handle;
93+
94+/* Code to actually dissect the packets */
95+static void
96+dissect_lhnb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
97+{
98+
99+ int offset = 0;
100+ u_int16_t len;
101+ tvbuff_t *next_tvb;
102+
103+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "LHNB");
104+ col_clear(pinfo->cinfo, COL_INFO);
105+
106+ proto_tree_add_item(tree, hf_lhnb_length, tvb, offset+2, 2, FALSE);
107+ len = tvb_get_ntohs(tvb, offset+2);
108+ next_tvb = tvb_new_subset(tvb, offset+2+6, len-4, -1);
109+
110+ call_dissector(ranap_handle, next_tvb, pinfo, tree);
111+}
112+
113+void proto_register_lucent_hnb(void)
114+{
115+ static hf_register_info hf[] = {
116+ {&hf_lhnb_length,
117+ {"Length", "lhnb.len",
118+ FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
119+ },
120+ };
121+
122+ static gint *ett[] = {
123+ &ett_lhnb,
124+ };
125+
126+ proto_lhnb =
127+ proto_register_protocol("Alcatel/Lucent HomeNodeB",
128+ "Lucent HNB", "lhnb");
129+
130+ proto_register_field_array(proto_lhnb, hf, array_length(hf));
131+ proto_register_subtree_array(ett, array_length(ett));
132+}
133+
134+void proto_reg_handoff_lucent_hnb(void)
135+{
136+ dissector_handle_t lhnb_handle;
137+
138+ ranap_handle = find_dissector("ranap");
139+
140+ lhnb_handle = create_dissector_handle(dissect_lhnb, proto_lhnb);
141+
142+ dissector_add("sctp.ppi", LHNB_SCTP_PPI_MM, lhnb_handle);
143+ dissector_add("sctp.ppi", LHNB_SCTP_PPI_GMM, lhnb_handle);
144+ dissector_add("sctp.port", LHNB_SCTP_PORT, lhnb_handle);
145+}