2 * Routines for GSM-R UUS1 dissection
4 * Copyright 2018, Michail Koreshkov <michail.koreshkov [at] bk.ru
7 * Railways Telecommunications (RT);
8 * Global System for Mobile communications (GSM);
9 * Usage of the User-to-User Information Element
10 * for GSM Operation on Railways
11 * (ETSI TS 102 610 V1.2.0 (2012-08))
14 * EIRENE SRS: "UIC Project EIRENE System Requirements Specification".
17 * MORANE F 10 T 6003 4: "FFFS for Presentation of Functional Numbers
18 * to Called and Calling Parties".
21 * eLDA IRS (V5.0): "Interface Requirements Specification
22 * enhanced Location Dependent Addressing".
24 * SPDX-License-Identifier: GPL-2.0-or-later
29 #include <epan/packet.h>
30 #include <epan/expert.h>
32 #include <epan/prefs.h>
34 /* forward reference */
35 void proto_register_gsm_r_uus1(void);
36 void proto_reg_handoff_gsm_r_uus1(void);
39 /* Initialize the protocol and registered fields */
40 static int proto_gsm_r_uus1
;
42 static int hf_gsm_r_uus1_elem_tag
;
43 static int hf_gsm_r_uus1_elem_len
;
44 static int hf_gsm_r_uus1_pfn
;
45 static int hf_gsm_r_uus1_pfn_digits
;
48 static int hf_gsm_r_uus1_chpc
;
49 static int hf_gsm_r_uus1_chpc_t_dur
;
50 static int hf_gsm_r_uus1_chpc_t_rel
;
51 static int hf_gsm_r_uus1_chpc_pl_call
;
52 static int hf_gsm_r_uus1_chpc_cause
;
53 static int hf_gsm_r_uus1_chpc_cause_power
;
54 static int hf_gsm_r_uus1_chpc_cause_radio
;
55 static int hf_gsm_r_uus1_chpc_cause_reserved3
;
56 static int hf_gsm_r_uus1_chpc_cause_reserved4
;
57 static int hf_gsm_r_uus1_chpc_cause_user_command
;
58 static int hf_gsm_r_uus1_chpc_cause_reserved6
;
59 static int hf_gsm_r_uus1_chpc_cause_reserved7
;
60 static int hf_gsm_r_uus1_chpc_cause_reserved8
;
61 static int hf_gsm_r_uus1_chpc_gref
;
62 static int hf_gsm_r_uus1_chpc_ack_cause
;
65 static int hf_gsm_r_uus1_epfn
;
68 static int hf_gsm_r_uus1_present_text_str
;
71 static int hf_gsm_r_uus1_elda
;
72 static int hf_gsm_r_uus1_elda_lat
;
73 static int hf_gsm_r_uus1_elda_lat_deg
;
74 static int hf_gsm_r_uus1_elda_lat_min
;
75 static int hf_gsm_r_uus1_elda_lat_sec
;
76 static int hf_gsm_r_uus1_elda_lat_hem
;
77 static int hf_gsm_r_uus1_elda_long
;
78 static int hf_gsm_r_uus1_elda_long_deg
;
79 static int hf_gsm_r_uus1_elda_long_min
;
80 static int hf_gsm_r_uus1_elda_long_sec
;
81 static int hf_gsm_r_uus1_elda_long_hem
;
82 static int hf_gsm_r_uus1_elda_height
;
83 static int hf_gsm_r_uus1_elda_speed
;
84 static int hf_gsm_r_uus1_elda_heading
;
85 static int hf_gsm_r_uus1_elda_e_time
;
86 static int hf_gsm_r_uus1_elda_distance
;
87 static int hf_gsm_r_uus1_elda_scale
;
88 static int hf_gsm_r_uus1_elda_spare
;
91 static int hf_gsm_r_uus1_present_dsd_alarm
;
92 static int hf_gsm_r_uus1_present_dsd_alarm_loco_number
;
95 static int hf_gsm_r_uus1_alert_controller
;
96 static int hf_gsm_r_uus1_alert_controller_gref
;
98 /* Initialize the subtree pointers */
99 static int ett_gsm_r_uus1
;
100 static int ett_gsm_r_uus1_pfn
;
101 static int ett_gsm_r_uus1_chpc
;
102 static int ett_gsm_r_uus1_chpc_cause
;
103 static int ett_gsm_r_uus1_epfn
;
104 static int ett_gsm_r_uus1_present_text_str
;
105 static int ett_gsm_r_uus1_elda
;
106 static int ett_gsm_r_uus1_elda_lat
;
107 static int ett_gsm_r_uus1_elda_long
;
108 static int ett_gsm_r_uus1_present_dsd_alarm
;
109 static int ett_gsm_r_uus1_alert_controller
;
113 static bool q931_u2u
;
114 static bool gsm_a_u2u
= true;
117 static expert_field ei_gsm_r_uus1_not_implemented_yet
;
119 static const value_string gsm_r_uus1_tags
[] = {
120 { 2, "Acknowledgement by Receiver of a HPC and response from device accepting the acknowledgement" },
121 { 3, "Acknowledgement by Initiator of a HPC" },
122 { 5, "Presentation of Functional Number" },
123 { 6, "enhanced Location Dependent Addressing" },
124 { 7, "enhanced Location Dependent Addressing (Reserved for future use)" },
125 { 8, "enhanced Location Dependent Addressing (Reserved for future use)" },
126 { 9, "ePFN Information" },
127 { 10, "User specific plain text according to alphabet indicator" },
128 { 11, "DSD Alarm Notification" },
129 { 12, "Alerting of a Controller Notification and Response" },
135 * 5.1 Presentation of functional number
139 de_gsm_r_uus1_pfn(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint32_t offset
)
141 uint32_t curr_offset
;
145 proto_tree
*sub_tree
;
147 curr_offset
= offset
;
149 len
= tvb_get_uint8(tvb
, offset
+1);
151 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_pfn
, tvb
, curr_offset
, len
+2, ENC_NA
);
152 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_pfn
);
154 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
155 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
159 proto_item_append_text(item
, ": No FN Available");
161 fn_str
= tvb_bcd_dig_to_str(pinfo
->pool
, tvb
, offset
+2, len
, NULL
, false);
162 proto_tree_add_string(sub_tree
, hf_gsm_r_uus1_pfn_digits
, tvb
, curr_offset
, len
, fn_str
);
163 proto_item_append_text(item
, ": %s", fn_str
);
168 return (curr_offset
- offset
);
173 * 5.2 Confirmation of High Priority Calls
176 static const range_string gsm_r_uus1_chpc_priority_vals
[] = {
177 { 0x00, 0x00, "no priority specified in call"},
178 { 0x01, 0x01, "eMLPP priority of 4 (Railway Information)"},
179 { 0x02, 0x02, "eMLPP priority of 3 (Railway Operation)"},
180 { 0x03, 0x03, "eMLPP priority of 2 (Public Emergency/Group Calls)"},
181 { 0x04, 0x04, "eMLPP priority of 1 (Command and Control)"},
182 { 0x05, 0x05, "eMLPP priority of 0 (Railway Emergency)"},
183 { 0x06, 0x07, "unknown" },
188 de_gsm_r_uus1_chpc_forward(tvbuff_t
*tvb
, proto_tree
*tree
, uint32_t offset
)
190 uint32_t curr_offset
;
195 proto_tree
*sub_tree
;
197 curr_offset
= offset
;
199 len
= tvb_get_uint8(tvb
, offset
+1);
201 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_chpc
, tvb
, curr_offset
, len
+2, ENC_NA
);
202 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_chpc
);
204 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
205 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
208 t_dur
= tvb_get_uint24(tvb
, curr_offset
, ENC_LITTLE_ENDIAN
);
209 proto_tree_add_uint_format_value(sub_tree
, hf_gsm_r_uus1_chpc_t_dur
, tvb
, curr_offset
, 3, t_dur
, "%d ms", t_dur
*100);
212 t_rel
= tvb_get_uint32(tvb
, curr_offset
, ENC_LITTLE_ENDIAN
);
213 proto_tree_add_uint_format_value(sub_tree
, hf_gsm_r_uus1_chpc_t_rel
, tvb
, curr_offset
, 4, t_rel
, "%d ms", t_rel
*100);
216 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_chpc_pl_call
, tvb
, curr_offset
, 1, ENC_NA
);
219 static int * const cause_flags
[] = {
220 &hf_gsm_r_uus1_chpc_cause_power
,
221 &hf_gsm_r_uus1_chpc_cause_radio
,
222 &hf_gsm_r_uus1_chpc_cause_reserved3
,
223 &hf_gsm_r_uus1_chpc_cause_reserved4
,
224 &hf_gsm_r_uus1_chpc_cause_user_command
,
225 &hf_gsm_r_uus1_chpc_cause_reserved6
,
226 &hf_gsm_r_uus1_chpc_cause_reserved7
,
227 &hf_gsm_r_uus1_chpc_cause_reserved8
,
231 proto_tree_add_bitmask(sub_tree
, tvb
, curr_offset
, hf_gsm_r_uus1_chpc_cause
, ett_gsm_r_uus1_chpc_cause
, cause_flags
, ENC_NA
);
234 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_chpc_gref
, tvb
, curr_offset
, 4, ENC_BCD_DIGITS_0_9
|ENC_LITTLE_ENDIAN
);
237 return (curr_offset
- offset
);
241 * 5.3 CHPC tag definition for collecting network device
243 * The tag is included in a RELEASE_COMPLETE message
244 * which shall have the release cause value of "Normal Call Clearing".
246 * gsm_a.dtap.msg_cc_type == 0x2a
248 static const range_string gsm_r_uus1_chpc_ack_cause_vals
[] = {
249 { 0x00, 0x00, "ACK (no error)" },
250 { 0x01, 0x01, "NACK-1 (error, repetition should take place)" },
251 { 0x02, 0x7f, "Reserved for internal use" },
252 { 0x80, 0x80, "NACK-2 (fatal error, NO repetition to take place)" },
253 { 0x81, 0xff, "Reserved" },
258 de_gsm_r_uus1_chpc_collect(tvbuff_t
*tvb
, proto_tree
*tree
, uint32_t offset
)
261 proto_tree
*sub_tree
;
263 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_chpc
, tvb
, offset
, 2, ENC_NA
);
264 proto_item_set_text(item
, "CHPC for collecting network device");
265 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_chpc
);
267 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, offset
, 1, ENC_NA
);
268 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_chpc_ack_cause
, tvb
, offset
+1, 1, ENC_NA
);
274 * Type of field depends on BSSAP message type. SETUP or RELEASE_COMPLETE
275 * But I don't know how to verify message type.
276 * That is why use length variable to find type of field
279 de_gsm_r_uus1_chpc(tvbuff_t
*tvb
, proto_tree
*tree
, uint32_t offset
)
281 uint8_t field_length
;
282 field_length
= tvb_get_uint8(tvb
, offset
+1);
283 if(field_length
== 13)
284 return de_gsm_r_uus1_chpc_forward(tvb
, tree
, offset
);
286 return de_gsm_r_uus1_chpc_collect(tvb
, tree
, offset
);
290 * 5.4 Enhanced presentation of functional number
291 * (not implemented now)
294 de_gsm_r_uus1_epfn(tvbuff_t
*tvb
, proto_tree
*tree
, packet_info
*pinfo
, uint32_t offset
)
296 uint32_t curr_offset
;
299 proto_tree
*sub_tree
;
301 curr_offset
= offset
;
303 len
= tvb_get_uint8(tvb
, offset
+1);
305 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_epfn
, tvb
, curr_offset
, len
+2, ENC_NA
);
306 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_epfn
);
308 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
309 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
312 proto_tree_add_expert(sub_tree
, pinfo
, &ei_gsm_r_uus1_not_implemented_yet
, tvb
, curr_offset
, len
);
315 return (curr_offset
- offset
);
319 * 5.5 Presentation of text strings
320 * (not implemented now)
323 de_gsm_r_uus1_text_str(tvbuff_t
*tvb
, proto_tree
*tree
, packet_info
*pinfo
, uint32_t offset
)
325 uint32_t curr_offset
;
328 proto_tree
*sub_tree
;
330 curr_offset
= offset
;
332 len
= tvb_get_uint8(tvb
, offset
+1);
334 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_present_text_str
, tvb
, curr_offset
, len
+2, ENC_NA
);
335 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_present_text_str
);
337 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
338 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
341 proto_tree_add_expert(sub_tree
, pinfo
, &ei_gsm_r_uus1_not_implemented_yet
, tvb
, curr_offset
, len
);
344 return (curr_offset
- offset
);
348 * 5.6 Transfer of train position (eLDA)
351 static const true_false_string gsm_r_uus1_elda_lat_hem
= {
356 static const true_false_string gsm_r_uus1_elda_long_hem
= {
361 static const value_string gsm_r_uus1_elda_scale_vals
[] = {
362 { 0, "10 cm resolution" },
363 { 1, "1 metre resolution" },
364 { 2, "10 metre resolution" },
365 { 3, "Odometry information not valid" },
371 de_gsm_r_uus1_elda(tvbuff_t
*tvb
, proto_tree
*tree
, packet_info
*pinfo _U_
, uint32_t offset
)
373 uint32_t curr_offset
;
377 uint32_t lat_deg_val
;
378 uint32_t lat_min_val
;
379 uint32_t lat_sec_val
;
380 uint32_t lat_hem_val
;
382 uint32_t long_deg_val
;
383 uint32_t long_min_val
;
384 uint32_t long_sec_val
;
385 uint32_t long_hem_val
;
390 proto_tree
*sub_tree
;
392 proto_item
*lat_item
;
393 proto_item
*long_item
;
394 proto_tree
*lat_tree
;
395 proto_tree
*long_tree
;
397 curr_offset
= offset
;
399 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_elda
, tvb
, curr_offset
, 16, ENC_NA
);
400 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_elda
);
401 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
402 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
405 bit_offset
= curr_offset
* 8;
408 lat_item
= proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elda_lat
, tvb
, curr_offset
, 4, ENC_NA
);
409 lat_tree
= proto_item_add_subtree(lat_item
, ett_gsm_r_uus1_elda_lat
);
411 val
= tvb_get_uint32(tvb
, curr_offset
, ENC_NA
);
412 lat_deg_val
= tvb_get_bits(tvb
, bit_offset
, 7, ENC_NA
);
414 lat_min_val
= tvb_get_bits(tvb
, bit_offset
, 6, ENC_NA
);
416 lat_sec_val
= tvb_get_bits(tvb
, bit_offset
, 13, ENC_NA
);
418 lat_hem_val
= tvb_get_bits(tvb
, bit_offset
, 1, ENC_NA
);
421 proto_tree_add_uint(lat_tree
, hf_gsm_r_uus1_elda_lat_deg
, tvb
, curr_offset
, 4, val
);
422 proto_tree_add_uint(lat_tree
, hf_gsm_r_uus1_elda_lat_min
, tvb
, curr_offset
, 4, val
);
423 proto_tree_add_uint_format_value(lat_tree
, hf_gsm_r_uus1_elda_lat_sec
, tvb
, curr_offset
, 4, val
, "%.2f", (float)(lat_sec_val
)/100);
424 proto_tree_add_boolean(lat_tree
, hf_gsm_r_uus1_elda_lat_hem
, tvb
, curr_offset
, 4, val
);
426 proto_item_set_text(lat_item
, "Latitude: %d %d\'%.2f\"%s", lat_deg_val
, lat_min_val
, (float)(lat_sec_val
)/100,
427 lat_hem_val
? "N" : "S");
432 long_item
= proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elda_long
, tvb
, curr_offset
, 4, ENC_NA
);
433 long_tree
= proto_item_add_subtree(long_item
, ett_gsm_r_uus1_elda_long
);
435 val
= tvb_get_uint32(tvb
, curr_offset
, ENC_NA
);
436 long_deg_val
= tvb_get_bits(tvb
, bit_offset
, 8, ENC_NA
);
438 long_min_val
= tvb_get_bits(tvb
, bit_offset
, 6, ENC_NA
);
440 long_sec_val
= tvb_get_bits(tvb
, bit_offset
, 13, ENC_NA
);
442 long_hem_val
= tvb_get_bits(tvb
, bit_offset
, 1, ENC_NA
);
445 proto_tree_add_uint(long_tree
, hf_gsm_r_uus1_elda_long_deg
, tvb
, curr_offset
, 4, val
);
446 proto_tree_add_uint(long_tree
, hf_gsm_r_uus1_elda_long_min
, tvb
, curr_offset
, 4, val
);
447 proto_tree_add_uint_format_value(long_tree
, hf_gsm_r_uus1_elda_long_sec
, tvb
, curr_offset
, 4, val
, "%.2f", (float)(long_sec_val
)/100);
448 proto_tree_add_boolean(long_tree
, hf_gsm_r_uus1_elda_long_hem
, tvb
, curr_offset
, 4, val
);
450 proto_item_set_text(long_item
, "Longitude: %d %d\'%.2f\"%s", long_deg_val
, long_min_val
, (float)(long_sec_val
)/100,
451 long_hem_val
? "W" : "E");
455 /* Height, Speed, Heading */
457 // height step 1m. Range: -100m...+4500m
458 t_val
= tvb_get_bits(tvb
, bit_offset
, 13, ENC_NA
) - 100;
459 proto_tree_add_int(sub_tree
, hf_gsm_r_uus1_elda_height
, tvb
, curr_offset
, 4, t_val
);
462 // speed step 10 km/h
463 t_val
= tvb_get_bits(tvb
, bit_offset
, 6, ENC_NA
) * 10;
464 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_speed
, tvb
, curr_offset
, 4, t_val
);
467 // heading step 10 deg
468 t_val
= tvb_get_bits(tvb
, bit_offset
, 6, ENC_NA
) * 10;
469 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_heading
, tvb
, curr_offset
, 4, t_val
);
474 /* Elapsed Time, Distance, Scale, Spare */
476 // time step 1 second. Range: 0...2047
477 t_val
= tvb_get_bits(tvb
, bit_offset
, 11, ENC_NA
);
478 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_e_time
, tvb
, curr_offset
, 4, t_val
);
481 // distance step = 10 cm, 1 m or 10 m depending on the parameter Scale
482 t_val
= tvb_get_bits(tvb
, bit_offset
, 14, ENC_NA
);
483 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_distance
, tvb
, curr_offset
, 4, t_val
);
487 t_val
= tvb_get_bits(tvb
, bit_offset
, 2, ENC_NA
);
488 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_scale
, tvb
, curr_offset
, 4, t_val
);
492 t_val
= tvb_get_bits(tvb
, bit_offset
, 5, ENC_NA
);
493 proto_tree_add_uint(sub_tree
, hf_gsm_r_uus1_elda_spare
, tvb
, curr_offset
, 4, t_val
);
499 * 5.7 Notification DSD alarm condition
503 de_gsm_r_uus1_dsd_alarm(tvbuff_t
*tvb
, proto_tree
*tree
, packet_info
*pinfo _U_
, uint32_t offset
)
505 uint32_t curr_offset
;
507 const char *loco_engine_number
;
509 proto_tree
*sub_tree
;
511 curr_offset
= offset
;
513 len
= tvb_get_uint8(tvb
, offset
+1);
515 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_present_dsd_alarm
, tvb
, curr_offset
, len
+2, ENC_NA
);
516 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_present_dsd_alarm
);
518 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
519 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
522 loco_engine_number
= tvb_bcd_dig_to_str(pinfo
->pool
, tvb
, offset
+2, len
, NULL
, false);
523 proto_tree_add_string(sub_tree
, hf_gsm_r_uus1_present_dsd_alarm_loco_number
, tvb
, curr_offset
, len
, loco_engine_number
);
524 proto_item_append_text(item
, ": %s", loco_engine_number
);
527 return (curr_offset
- offset
);
532 * 5.8 Notification of a request to alert a controller
536 de_gsm_r_uus1_alert_controller(tvbuff_t
*tvb
, proto_tree
*tree
, packet_info
*pinfo _U_
, uint32_t offset
)
538 uint32_t curr_offset
;
541 proto_tree
*sub_tree
;
544 curr_offset
= offset
;
546 len
= tvb_get_uint8(tvb
, offset
+1);
548 item
= proto_tree_add_item(tree
, hf_gsm_r_uus1_alert_controller
, tvb
, curr_offset
+2, len
, ENC_NA
);
549 sub_tree
= proto_item_add_subtree(item
, ett_gsm_r_uus1_alert_controller
);
551 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_tag
, tvb
, curr_offset
, 1, ENC_NA
);
552 proto_tree_add_item(sub_tree
, hf_gsm_r_uus1_elem_len
, tvb
, curr_offset
+1, 1, ENC_NA
);
555 proto_tree_add_item_ret_display_string(sub_tree
, hf_gsm_r_uus1_alert_controller_gref
, tvb
, curr_offset
, 4, ENC_BCD_DIGITS_0_9
|ENC_LITTLE_ENDIAN
, pinfo
->pool
, &gref_str
);
556 proto_item_append_text(item
, ": %s", gref_str
);
559 return (curr_offset
- offset
);
564 dissect_gsm_r_uus1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
569 proto_item
*gsm_r_uus1_item
= NULL
;
570 proto_tree
*gsm_r_uus1_tree
= NULL
;
573 len
= tvb_captured_length(tvb
);
576 proto_tree_add_protocol_format(tree
, proto_gsm_r_uus1
, tvb
, 0, len
, "GSM-R User-to-User Signaling");
578 gsm_r_uus1_tree
= proto_item_add_subtree(gsm_r_uus1_item
, ett_gsm_r_uus1
);
580 while (offset
< len
){
581 elem_tag
= tvb_get_uint8(tvb
, offset
);
585 offset
+= de_gsm_r_uus1_chpc(tvb
, gsm_r_uus1_tree
, offset
);
588 offset
+= de_gsm_r_uus1_pfn(tvb
, pinfo
, gsm_r_uus1_tree
, offset
);
593 offset
+= de_gsm_r_uus1_elda(tvb
, gsm_r_uus1_tree
, pinfo
, offset
);
596 offset
+= de_gsm_r_uus1_epfn(tvb
, gsm_r_uus1_tree
, pinfo
, offset
);
599 offset
+= de_gsm_r_uus1_text_str(tvb
, gsm_r_uus1_tree
, pinfo
, offset
);
602 offset
+= de_gsm_r_uus1_dsd_alarm(tvb
, gsm_r_uus1_tree
, pinfo
, offset
);
605 offset
+= de_gsm_r_uus1_alert_controller(tvb
, gsm_r_uus1_tree
, pinfo
, offset
);
615 /* heuristic dissector */
617 dissect_gsm_r_uus1_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
619 if (dissect_gsm_r_uus1(tvb
, pinfo
, tree
, data
) > 0)
626 /* Register the protocol with Wireshark */
628 proto_register_gsm_r_uus1(void)
630 /* Setup list of header fields */
632 static hf_register_info hf
[] = {
633 { &hf_gsm_r_uus1_elem_tag
,
634 { "Element tag", "gsm-r-uus1.elem_tag",
635 FT_UINT8
, BASE_DEC
, VALS(gsm_r_uus1_tags
), 0x0,
638 { &hf_gsm_r_uus1_elem_len
,
639 { "Length", "gsm-r-uus1.elem_len",
640 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
643 { &hf_gsm_r_uus1_pfn
,
644 { "Presentation of Functional Number (PFN)", "gsm-r-uus1.pfn",
645 FT_NONE
, BASE_NONE
, NULL
, 0x0,
648 { &hf_gsm_r_uus1_pfn_digits
,
649 { "Digits", "gsm-r-uus1.pfn.digits",
650 FT_STRING
, BASE_NONE
, NULL
, 0x0,
653 { &hf_gsm_r_uus1_chpc
,
654 { "Confirmation of High Priority Calls (CHPC)", "gsm-r-uus1.chpc",
655 FT_NONE
, BASE_NONE
, NULL
, 0x0,
658 { &hf_gsm_r_uus1_chpc_t_dur
,
659 { "Duration of the call", "gsm-r-uus1.chpc.t_dur",
660 FT_UINT24
, BASE_DEC
, NULL
, 0x0,
663 { &hf_gsm_r_uus1_chpc_t_rel
,
664 { "Interval between the end of the call and the transmission of the confirmation message", "gsm-r-uus1.chpc.t_rel",
665 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
668 { &hf_gsm_r_uus1_chpc_pl_call
,
669 { "Priority level of the call", "gsm-r-uus1.chpc.pl_call",
670 FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gsm_r_uus1_chpc_priority_vals
), 0x0,
673 { &hf_gsm_r_uus1_chpc_cause
,
674 { "Reason for termination of the call", "gsm-r-uus1.chpc.cause",
675 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
678 { &hf_gsm_r_uus1_chpc_cause_power
,
679 { "Mobile was powered off when receiving (power fail)", "gsm-r-uus1.chpc.cause.power",
680 FT_BOOLEAN
, 8, NULL
, 0x01,
683 { &hf_gsm_r_uus1_chpc_cause_radio
,
684 { "Call was interrupted due to radio link error", "gsm-r-uus1.chpc.cause.radio",
685 FT_BOOLEAN
, 8, NULL
, 0x02,
688 { &hf_gsm_r_uus1_chpc_cause_reserved3
,
689 { "Reserved", "gsm-r-uus1.chpc.cause.reserved3",
690 FT_BOOLEAN
, 8, NULL
, 0x04,
693 { &hf_gsm_r_uus1_chpc_cause_reserved4
,
694 { "Reserved", "gsm-r-uus1.chpc.cause.reserved4",
695 FT_BOOLEAN
, 8, NULL
, 0x08,
698 { &hf_gsm_r_uus1_chpc_cause_user_command
,
699 { "Call was left on user command", "gsm-r-uus1.chpc.cause.user_command",
700 FT_BOOLEAN
, 8, NULL
, 0x10,
703 { &hf_gsm_r_uus1_chpc_cause_reserved6
,
704 { "Reserved", "gsm-r-uus1.chpc.cause.reserved6",
705 FT_BOOLEAN
, 8, NULL
, 0x20,
708 { &hf_gsm_r_uus1_chpc_cause_reserved7
,
709 { "Reserved", "gsm-r-uus1.chpc.cause.reserved7",
710 FT_BOOLEAN
, 8, NULL
, 0x40,
713 { &hf_gsm_r_uus1_chpc_cause_reserved8
,
714 { "Reserved", "gsm-r-uus1.chpc.cause.reserved8",
715 FT_BOOLEAN
, 8, NULL
, 0x80,
718 { &hf_gsm_r_uus1_chpc_gref
,
719 { "Group call reference", "gsm-r-uus1.chpc.gref",
720 FT_STRING
, BASE_NONE
, NULL
, 0x0,
723 { &hf_gsm_r_uus1_chpc_ack_cause
,
724 { "ACK/CAUSE", "gsm-r-uus1.chpc.ack_cause",
725 FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gsm_r_uus1_chpc_ack_cause_vals
), 0x0,
728 { &hf_gsm_r_uus1_epfn
,
729 { "Enhanced presentation of functional number (ePFN)", "gsm-r-uus1.epfn",
730 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
733 { &hf_gsm_r_uus1_present_text_str
,
734 { "Presentation of text strings", "gsm-r-uus1.present_text_str",
735 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
738 { &hf_gsm_r_uus1_elda
,
739 { "Train position (eLDA)", "gsm-r-uus1.elda",
740 FT_NONE
, BASE_NONE
, NULL
, 0x0,
743 { &hf_gsm_r_uus1_elda_lat
,
744 { "Latitude", "gsm-r-uus1.elda.lat",
745 FT_NONE
, BASE_NONE
, NULL
, 0x0,
748 { &hf_gsm_r_uus1_elda_lat_deg
,
749 { "Degrees", "gsm-r-uus1.elda.lat.deg",
750 FT_UINT32
, BASE_DEC
, NULL
, 0xFE000000,
753 { &hf_gsm_r_uus1_elda_lat_min
,
754 { "Minutes", "gsm-r-uus1.elda.lat.min",
755 FT_UINT32
, BASE_DEC
, NULL
, 0x01F80000,
758 { &hf_gsm_r_uus1_elda_lat_sec
,
759 { "Seconds", "gsm-r-uus1.elda.lat.sec",
760 FT_UINT32
, BASE_DEC
, NULL
, 0x0007FFC0,
763 { &hf_gsm_r_uus1_elda_lat_hem
,
764 { "Hemisphere", "gsm-r-uus1.elda.lat.hem",
765 FT_BOOLEAN
, 32, TFS(&gsm_r_uus1_elda_lat_hem
), 0x00000020,
768 { &hf_gsm_r_uus1_elda_long
,
769 { "Latitude", "gsm-r-uus1.elda.long",
770 FT_NONE
, BASE_NONE
, NULL
, 0x0,
773 { &hf_gsm_r_uus1_elda_long_deg
,
774 { "Degrees", "gsm-r-uus1.elda.long.deg",
775 FT_UINT32
, BASE_DEC
, NULL
, 0x1FE00000,
778 { &hf_gsm_r_uus1_elda_long_min
,
779 { "Minutes", "gsm-r-uus1.elda.long.min",
780 FT_UINT32
, BASE_DEC
, NULL
, 0x001F8000,
783 { &hf_gsm_r_uus1_elda_long_sec
,
784 { "Seconds", "gsm-r-uus1.elda_long.sec",
785 FT_UINT32
, BASE_DEC
, NULL
, 0x00007FFC,
788 { &hf_gsm_r_uus1_elda_long_hem
,
789 { "Hemisphere", "gsm-r-uus1.elda_long.hem",
790 FT_BOOLEAN
, 32, TFS(&gsm_r_uus1_elda_long_hem
), 0x00000002,
793 { &hf_gsm_r_uus1_elda_height
,
794 { "Height (m)", "gsm-r-uus1.elda.height",
795 FT_INT32
, BASE_DEC
, NULL
, 0x0,
798 { &hf_gsm_r_uus1_elda_speed
,
799 { "Speed (km/h)", "gsm-r-uus1.elda.speed",
800 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
803 { &hf_gsm_r_uus1_elda_heading
,
804 { "Heading (deg)", "gsm-r-uus1.elda.heading",
805 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
808 { &hf_gsm_r_uus1_elda_e_time
,
809 { "Elapsed Time (sec)", "gsm-r-uus1.elda.e_time",
810 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
813 { &hf_gsm_r_uus1_elda_distance
,
814 { "Distance", "gsm-r-uus1.elda.distance",
815 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
818 { &hf_gsm_r_uus1_elda_scale
,
819 { "Scale", "gsm-r-uus1.elda.scale",
820 FT_UINT32
, BASE_DEC
, VALS(gsm_r_uus1_elda_scale_vals
), 0x00,
823 { &hf_gsm_r_uus1_elda_spare
,
824 { "Spare", "gsm-r-uus1.elda.spare",
825 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
828 { &hf_gsm_r_uus1_present_dsd_alarm
,
829 { "Notification DSD alarm condition", "gsm-r-uus1.present_dsd_alarm",
830 FT_NONE
, BASE_NONE
, NULL
, 0x0,
833 { &hf_gsm_r_uus1_present_dsd_alarm_loco_number
,
834 { "Locomotive engine number", "gsm-r-uus1.present_dsd_alarm.loco_number",
835 FT_STRING
, BASE_NONE
, NULL
, 0x0,
838 { &hf_gsm_r_uus1_alert_controller
,
839 { "Notification of a request to alert a controller", "gsm-r-uus1.alert_controller",
840 FT_NONE
, BASE_NONE
, NULL
, 0x0,
843 { &hf_gsm_r_uus1_alert_controller_gref
,
844 { "Group call reference", "gsm-r-uus1.alert_controller.gref",
845 FT_STRING
, BASE_NONE
, NULL
, 0x0,
850 static ei_register_info ei
[] = {
851 { &ei_gsm_r_uus1_not_implemented_yet
, { "gsm-r-uus1.not_implemented_yet", PI_UNDECODED
, PI_NOTE
, "Not implemented yet", EXPFILL
}},
854 expert_module_t
* expert_gsm_r_uus1
;
856 static int *ett
[] = {
859 &ett_gsm_r_uus1_chpc
,
860 &ett_gsm_r_uus1_chpc_cause
,
861 &ett_gsm_r_uus1_epfn
,
862 &ett_gsm_r_uus1_present_text_str
,
863 &ett_gsm_r_uus1_elda
,
864 &ett_gsm_r_uus1_elda_lat
,
865 &ett_gsm_r_uus1_elda_long
,
866 &ett_gsm_r_uus1_present_dsd_alarm
,
867 &ett_gsm_r_uus1_alert_controller
870 module_t
*gsm_r_uus1_module
;
872 /* Register the protocol name and description */
874 proto_register_protocol("GSM-R User-to-User Signaling", "GSM-R", "gsm-r-uus1");
876 proto_register_field_array(proto_gsm_r_uus1
, hf
, array_length(hf
));
878 proto_register_subtree_array(ett
, array_length(ett
));
880 expert_gsm_r_uus1
= expert_register_protocol(proto_gsm_r_uus1
);
881 expert_register_field_array(expert_gsm_r_uus1
, ei
, array_length(ei
));
883 /* subdissector code */
884 register_dissector("gsm-r-uus1", dissect_gsm_r_uus1
, proto_gsm_r_uus1
);
886 gsm_r_uus1_module
= prefs_register_protocol(proto_gsm_r_uus1
, proto_reg_handoff_gsm_r_uus1
);
887 prefs_register_bool_preference(gsm_r_uus1_module
, "dissect_q931_u2u",
888 "Dissect Q.931 User-To-User information",
889 "Dissect Q.931 User-To-User information",
891 prefs_register_bool_preference(gsm_r_uus1_module
, "dissect_gsm_a_u2u",
892 "Dissect GSM-A User-To-User information",
893 "Dissect GSM-A User-To-User information",
898 proto_reg_handoff_gsm_r_uus1(void)
900 dissector_handle_t gsm_r_uus1_handle
;
902 gsm_r_uus1_handle
= find_dissector("gsm-r-uus1");
905 heur_dissector_add("q931_user", dissect_gsm_r_uus1_heur
, "GSM-R over UUS1", "gsm_r_uus1", proto_gsm_r_uus1
, HEURISTIC_ENABLE
);
907 heur_dissector_delete("q931_user", dissect_gsm_r_uus1_heur
, proto_gsm_r_uus1
);
912 dissector_add_uint("gsm_a.dtap.u2u_prot_discr", 0, gsm_r_uus1_handle
);
914 dissector_delete_uint("gsm_a.dtap.u2u_prot_discr", 0, gsm_r_uus1_handle
);
919 * Editor modelines - https://www.wireshark.org/tools/modelines.html
924 * indent-tabs-mode: nil
927 * vi: set shiftwidth=4 tabstop=8 expandtab:
928 * :indentSize=4:tabSize=8:noTabs=true: