blob: 030f07eef53eb0cfea693ea791612f3657a15962 [file] [log] [blame]
Harald Welte2d112ad2009-06-10 05:42:52 +08001Index: wireshark/epan/dissectors/packet-rsl.c
2===================================================================
3--- wireshark.orig/epan/dissectors/packet-rsl.c 2009-02-22 15:39:34.000000000 +0100
4+++ wireshark/epan/dissectors/packet-rsl.c 2009-02-22 17:27:51.000000000 +0100
5@@ -2,6 +2,7 @@
6 * Routines for Radio Signalling Link (RSL) dissection.
7 *
8 * Copyright 2007, Anders Broman <anders.broman@ericsson.com>
9+ * Copyright 2009, Harald Welte <laforge@gnumonks.org>
10 *
11 * $Id: packet-rsl.c 27065 2008-12-20 00:09:02Z wmeier $
12 *
13@@ -116,6 +117,14 @@
14 static int hf_rsl_rtd = -1;
15 static int hf_rsl_delay_ind = -1;
16 static int hf_rsl_tfo = -1;
17+static int hf_rsl_f4 = -1;
18+static int hf_rsl_f6 = -1;
19+static int hf_rsl_f8 = -1;
20+static int hf_rsl_fc = -1;
21+static int hf_rsl_local_port = -1;
22+static int hf_rsl_remote_port = -1;
23+static int hf_rsl_local_ip = -1;
24+static int hf_rsl_remote_ip = -1;
25
26 /* Initialize the subtree pointers */
27 static int ett_rsl = -1;
28@@ -173,6 +182,15 @@
29 static int ett_ie_meas_res_no = -1;
30 static int ett_ie_message_id = -1;
31 static int ett_ie_sys_info_type = -1;
32+static int ett_ie_f4 = -1;
33+static int ett_ie_f6 = -1;
34+static int ett_ie_f8 = -1;
35+static int ett_ie_remote_ip = -1;
36+static int ett_ie_remote_port = -1;
37+static int ett_ie_local_port = -1;
38+static int ett_ie_local_ip = -1;
39+static int ett_ie_fc = -1;
40+
41
42 proto_tree *top_tree;
43 dissector_handle_t gsm_a_ccch_handle;
44@@ -208,8 +226,11 @@
45 { 0x06, "Common Channel Management messages" },
46 { 0x08, "TRX Management messages" },
47 { 0x16, "Location Services messages" },
48+ { 0x3f, "ip.access Vendor Specific messages" },
49 { 0, NULL }
50 };
51+#define RSL_MSGDISC_IPACCESS 0x3f
52+
53 /*
54 * 9.2 MESSAGE TYPE
55 */
56@@ -338,6 +359,14 @@
57 { 0x3f, "TFO MODification REQuest" }, /* 8.4.31 */
58 /* 0 1 - - - - - - Location Services messages: */
59 { 0x41, "Location Information" }, /* 8.7.1 */
60+ /* ip.access */
61+ { 0x70, "ip.access BIND" },
62+ { 0x71, "ip.access BIND ACK" },
63+ { 0x72, "ip.access BIND NACK" },
64+ { 0x73, "ip.access CONNECT" },
65+ { 0x74, "ip.access CONNECT ACK" },
66+ { 0x75, "ip.access CONNECT NACK" },
67+ { 0x76, "ip.access DISCONNECT INDication" },
68 { 0, NULL }
69 };
70
71@@ -477,6 +506,10 @@
72 Not used
73
74 */
75+ { 0xf0, "Remote IP Address" },
76+ { 0xf1, "Remote RTP Port" },
77+ { 0xf3, "Local RTP Port" },
78+ { 0xf5, "Local IP Address" },
79 { 0, NULL }
80 };
81
82@@ -2043,7 +2076,6 @@
83 proto_item_set_len(ti, length+2);
84
85 proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
86- offset++;
87
88 /* Received Message */
89 offset = dissct_rsl_msg(tvb, pinfo, ie_tree, offset);
90@@ -2907,13 +2939,320 @@
91 return ie_offset + length;
92 }
93
94+/* Vendor-Specific messages of ip.access nanoBTS. There is no public documentation
95+ * about those extensions, all information in this dissector is based on lawful
96+ * protocol reverse enginering by Harald Welte <laforge@gnumonks.org> */
97+#define RSL_MSG_TYPE_IPAC_BIND 0x70
98+#define RSL_MSG_TYPE_IPAC_BIND_ACK 0x71
99+#define RSL_MSG_TYPE_IPAC_BIND_NACK 0x72
100+#define RSL_MSG_TYPE_IPAC_CONNECT 0x73
101+#define RSL_MSG_TYPE_IPAC_CONNECT_ACK 0x74
102+#define RSL_MSG_TYPE_IPAC_CONNECT_NACK 0x75
103+#define RSL_MSG_TYPE_IPAC_DISC_IND 0x76
104+#define RSL_IE_IPAC_REMOTE_IP 0xf0
105+#define RSL_IE_IPAC_REMOTE_PORT 0xf1
106+#define RSL_IE_IPAC_LOCAL_PORT 0xf3
107+#define RSL_IE_IPAC_LOCAL_IP 0xf5
108+
109+static int
110+dissect_rsl_ipac_ie_f8(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
111+{
112+ proto_item *ti;
113+ proto_tree *ie_tree;
114+ guint8 ie_id;
115+
116+ if (is_mandatory == FALSE) {
117+ ie_id = tvb_get_guint8(tvb, offset);
118+ if (ie_id != 0xf8)
119+ return offset;
120+ }
121+
122+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf8 IE");
123+ ie_tree = proto_item_add_subtree(ti, ett_ie_f8);
124+
125+ /* Element identifier */
126+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
127+ offset++;
128+ /* Fixed Length */
129+ proto_item_set_len(ti, 3);
130+
131+ proto_tree_add_item(ie_tree, hf_rsl_f8, tvb, offset, 2, FALSE);
132+ offset += 2;
133+
134+ return offset;
135+}
136+
137+static int
138+dissect_rsl_ipac_ie_local_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
139+{
140+ proto_item *ti;
141+ proto_tree *ie_tree;
142+ guint8 ie_id;
143+
144+ if (is_mandatory == FALSE) {
145+ ie_id = tvb_get_guint8(tvb, offset);
146+ if (ie_id != RSL_IE_IPAC_LOCAL_PORT)
147+ return offset;
148+ }
149+
150+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Local RTP Port IE");
151+ ie_tree = proto_item_add_subtree(ti, ett_ie_local_port);
152+
153+ /* Element identifier */
154+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
155+ offset++;
156+ /* Fixed Length */
157+ proto_item_set_len(ti, 3);
158+
159+ proto_tree_add_item(ie_tree, hf_rsl_local_port, tvb, offset, 2, FALSE);
160+ offset += 2;
161+
162+ return offset;
163+}
164+
165+static int
166+dissect_rsl_ipac_ie_remote_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
167+{
168+ proto_item *ti;
169+ proto_tree *ie_tree;
170+ guint8 ie_id;
171+
172+ if (is_mandatory == FALSE) {
173+ ie_id = tvb_get_guint8(tvb, offset);
174+ if (ie_id != RSL_IE_IPAC_REMOTE_PORT)
175+ return offset;
176+ }
177+
178+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Remote RTP Port IE");
179+ ie_tree = proto_item_add_subtree(ti, ett_ie_remote_port);
180+
181+ /* Element identifier */
182+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
183+ offset++;
184+ /* Fixed Length */
185+ proto_item_set_len(ti, 3);
186+
187+ proto_tree_add_uint(ie_tree, hf_rsl_remote_port, tvb, offset, 2, FALSE);
188+ offset += 2;
189+
190+ return offset;
191+}
192+
193+static int
194+dissect_rsl_ipac_ie_local_ip(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
195+{
196+ proto_item *ti;
197+ proto_tree *ie_tree;
198+ guint8 ie_id;
199+ guint32 ip;
200+
201+ if (is_mandatory == FALSE) {
202+ ie_id = tvb_get_guint8(tvb, offset);
203+ if (ie_id != RSL_IE_IPAC_LOCAL_IP)
204+ return offset;
205+ }
206+
207+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Local IP Address IE");
208+ ie_tree = proto_item_add_subtree(ti, ett_ie_local_ip);
209+
210+ /* Element identifier */
211+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
212+ offset++;
213+ /* Fixed Length */
214+ proto_item_set_len(ti, 5);
215+
216+ ip = tvb_get_ipv4(tvb, offset);
217+ proto_tree_add_ipv4(ie_tree, hf_rsl_local_ip, tvb, offset, 4, ip);
218+ offset += 4;
219+
220+ return offset;
221+}
222+
223+static int
224+dissect_rsl_ipac_ie_remote_ip(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
225+{
226+ proto_item *ti;
227+ proto_tree *ie_tree;
228+ guint8 ie_id;
229+ guint32 ip;
230+
231+ if (is_mandatory == FALSE) {
232+ ie_id = tvb_get_guint8(tvb, offset);
233+ if (ie_id != RSL_IE_IPAC_REMOTE_IP)
234+ return offset;
235+ }
236+
237+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Remote IP Address IE");
238+ ie_tree = proto_item_add_subtree(ti, ett_ie_remote_ip);
239+
240+ /* Element identifier */
241+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
242+ offset++;
243+ /* Fixed Length */
244+ proto_item_set_len(ti, 5);
245+
246+ ip = tvb_get_ipv4(tvb, offset);
247+ proto_tree_add_ipv4(ie_tree, hf_rsl_remote_ip, tvb, offset, 4, ip);
248+ offset += 4;
249+
250+ return offset;
251+}
252+
253+static int
254+dissect_rsl_ipac_ie_f6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
255+{
256+ proto_item *ti;
257+ proto_tree *ie_tree;
258+ guint8 length;
259+ guint8 ie_id;
260+
261+ if (is_mandatory == FALSE) {
262+ ie_id = tvb_get_guint8(tvb, offset);
263+ if (ie_id != 0xf6)
264+ return offset;
265+ }
266+
267+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf6 IE");
268+ ie_tree = proto_item_add_subtree(ti, ett_ie_f6);
269+
270+ /* Element identifier */
271+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
272+ offset++;
273+
274+ /* Length */
275+ length = tvb_get_guint8(tvb, offset);
276+ offset++;
277+ proto_item_set_len(ti, length+2);
278+
279+ proto_tree_add_bytes(ie_tree, hf_rsl_f6, tvb, offset, length,
280+ tvb_get_ptr(tvb, offset, length));
281+ offset += length;
282+
283+ return offset;
284+}
285+
286+static int
287+dissect_rsl_ipac_ie_f4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
288+{
289+ proto_item *ti;
290+ proto_tree *ie_tree;
291+ guint8 ie_id;
292+
293+ if (is_mandatory == FALSE) {
294+ ie_id = tvb_get_guint8(tvb, offset);
295+ if (ie_id != 0xf4)
296+ return offset;
297+ }
298+
299+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf4 IE");
300+ ie_tree = proto_item_add_subtree(ti, ett_ie_f4);
301+
302+ /* Element identifier */
303+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
304+ offset++;
305+ /* Fixed Length */
306+ proto_item_set_len(ti, 2);
307+ proto_tree_add_item(ie_tree, hf_rsl_f4, tvb, offset, 1, FALSE);
308+ offset++;
309+
310+ return offset;
311+}
312+
313+static int
314+dissect_rsl_ipac_ie_fc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
315+{
316+ proto_item *ti;
317+ proto_tree *ie_tree;
318+ guint8 ie_id;
319+
320+ if (is_mandatory == FALSE) {
321+ ie_id = tvb_get_guint8(tvb, offset);
322+ if (ie_id != 0xfc)
323+ return offset;
324+ }
325+
326+ ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xfc IE");
327+ ie_tree = proto_item_add_subtree(ti, ett_ie_fc);
328+
329+ /* Element identifier */
330+ proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
331+ offset++;
332+ /* Fixed Length */
333+ proto_item_set_len(ti, 2);
334+ proto_tree_add_item(ie_tree, hf_rsl_fc, tvb, offset, 1, FALSE);
335+ offset++;
336+
337+ return offset;
338+}
339+
340+static int
341+dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
342+{
343+ guint8 msg_type;
344+
345+ msg_type = tvb_get_guint8(tvb, offset)&0x7f;
346+ offset++;
347+
348+ switch (msg_type) {
349+ case RSL_MSG_TYPE_IPAC_BIND:
350+ /* Channel number 9.3.1 M TV 2 */
351+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
352+ break;
353+ case RSL_MSG_TYPE_IPAC_BIND_ACK:
354+ /* Channel number 9.3.1 M TV 2 */
355+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
356+ offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE);
357+ offset = dissect_rsl_ipac_ie_local_port(tvb, pinfo, tree, offset, TRUE);
358+ offset = dissect_rsl_ipac_ie_local_ip(tvb, pinfo, tree, offset, TRUE);
359+ offset = dissect_rsl_ipac_ie_fc(tvb, pinfo, tree, offset, TRUE);
360+ break;
361+ case RSL_MSG_TYPE_IPAC_BIND_NACK:
362+ /* Channel number 9.3.1 M TV 2 */
363+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
364+ break;
365+ case RSL_MSG_TYPE_IPAC_CONNECT:
366+ /* Channel number 9.3.1 M TV 2 */
367+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
368+ offset = dissect_rsl_ipac_ie_remote_ip(tvb, pinfo, tree, offset, TRUE);
369+ offset = dissect_rsl_ipac_ie_remote_port(tvb, pinfo, tree, offset, TRUE);
370+ offset = dissect_rsl_ipac_ie_f4(tvb, pinfo, tree, offset, TRUE);
371+ offset = dissect_rsl_ipac_ie_fc(tvb, pinfo, tree, offset, TRUE);
372+ break;
373+ case RSL_MSG_TYPE_IPAC_CONNECT_ACK:
374+ /* Channel number 9.3.1 M TV 2 */
375+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
376+ offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE);
377+ break;
378+ case RSL_MSG_TYPE_IPAC_CONNECT_NACK:
379+ /* Channel number 9.3.1 M TV 2 */
380+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
381+ break;
382+ case RSL_MSG_TYPE_IPAC_DISC_IND:
383+ /* Channel number 9.3.1 M TV 2 */
384+ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
385+ offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE);
386+ offset = dissect_rsl_ipac_ie_f6(tvb, pinfo, tree, offset, TRUE);
387+ /* Cause 9.3.26 M TLV >=3 */
388+ offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
389+ break;
390+ }
391+
392+ return offset;
393+}
394+
395 static int
396 dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
397 {
398- guint8 msg_type;
399+ guint8 msg_disc, msg_type;
400
401+ msg_disc = tvb_get_guint8(tvb, offset++) >> 1;
402 msg_type = tvb_get_guint8(tvb,offset)&0x7f;
403 proto_tree_add_item(tree, hf_rsl_msg_type, tvb, offset, 1, FALSE);
404+
405+ if (msg_disc == RSL_MSGDISC_IPACCESS) {
406+ offset = dissct_rsl_ipaccess_msg(tvb, pinfo, tree, offset);
407+ return offset;
408+ }
409 offset++;
410
411 switch (msg_type){
412@@ -3517,7 +3856,6 @@
413 /* 9.1 Message discriminator */
414 proto_tree_add_item(rsl_tree, hf_rsl_msg_dsc, tvb, offset, 1, FALSE);
415 proto_tree_add_item(rsl_tree, hf_rsl_T_bit, tvb, offset, 1, FALSE);
416- offset++;
417
418 offset = dissct_rsl_msg(tvb, pinfo, rsl_tree, offset);
419
420@@ -3883,6 +4221,46 @@
421 FT_UINT8, BASE_DEC, VALS(rsl_emlpp_prio_vals), 0x03,
422 "eMLPP Priority", HFILL }
423 },
424+ { &hf_rsl_f4,
425+ { "unknown F4 IE", "rsl.ipacc.f4",
426+ FT_UINT8, BASE_DEC, NULL, 0x0,
427+ "unknown F4 IE", HFILL }
428+ },
429+ { &hf_rsl_f6,
430+ { "unknown F6 IE", "rsl.ipacc.f6",
431+ FT_BYTES, BASE_HEX, NULL, 0x0,
432+ "unknown F6 IE", HFILL }
433+ },
434+ { &hf_rsl_f8,
435+ { "unknown F8 IE", "rsl.ipacc.f8",
436+ FT_UINT16, BASE_DEC, NULL, 0x0,
437+ "unknown F8 IE", HFILL }
438+ },
439+ { &hf_rsl_fc,
440+ { "unknown FC IE", "rsl.ipacc.fc",
441+ FT_UINT8, BASE_DEC, NULL, 0x0,
442+ "unknown FC IE", HFILL }
443+ },
444+ { &hf_rsl_local_port,
445+ { "ip.access Local RTP Port", "rsl.ipacc.local_port",
446+ FT_UINT16, BASE_DEC, NULL, 0x0,
447+ "ip.access Local RTP Port", HFILL },
448+ },
449+ { &hf_rsl_remote_port,
450+ { "ip.access Remote RTP Port", "rsl.ipacc.remote_port",
451+ FT_UINT16, BASE_DEC, NULL, 0x0,
452+ "ip.access Remote RTP Port", HFILL },
453+ },
454+ { &hf_rsl_local_ip,
455+ { "ip.access Local IP Address", "rsl.ipacc.local_ip",
456+ FT_IPv4, BASE_NONE, NULL, 0x0,
457+ "ip.access Local IP Address", HFILL },
458+ },
459+ { &hf_rsl_remote_ip,
460+ { "ip.access Remote IP Address", "rsl.ipacc.remote_ip",
461+ FT_IPv4, BASE_NONE, NULL, 0x0,
462+ "ip.access Remote IP Address", HFILL },
463+ },
464 };
465 static gint *ett[] = {
466 &ett_rsl,
467@@ -3941,6 +4319,14 @@
468 &ett_ie_meas_res_no,
469 &ett_ie_message_id,
470 &ett_ie_sys_info_type,
471+ &ett_ie_f4,
472+ &ett_ie_f6,
473+ &ett_ie_f8,
474+ &ett_ie_remote_ip,
475+ &ett_ie_remote_port,
476+ &ett_ie_local_port,
477+ &ett_ie_local_ip,
478+ &ett_ie_fc,
479 };
480
481 /* Register the protocol name and description */