1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
|
/* packet-gmr1_rach.c
*
* Routines for GMR-1 RACH dissection in wireshark.
* Copyright (c) 2012 Sylvain Munaut <tnt@246tNt.com>
*
* References:
* [1] ETSI TS 101 376-4-8 V1.3.1 - GMR-1 04.008
* [2] ETSI TS 101 376-4-8 V2.2.1 - GMPRS-1 04.008
* [3] ETSI TS 101 376-4-8 V3.1.1 - GMR-1 3G 44.008
*
* Especially [1] 10.1.8
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <stdlib.h>
#include <epan/packet.h>
#include <epan/tfs.h>
void proto_register_gmr1_rach(void);
/* GMR-1 RACH proto */
static int proto_gmr1_rach;
/* GMR-1 RACH subtrees */
static int ett_rach_msg;
static int ett_rach_kls1;
static int ett_rach_kls2;
static int ett_rach_gmprs_type1_kls2;
static int ett_rach_gmprs_type2_kls2;
static int ett_rach_est_cause;
static int ett_rach_dialed_num;
static int ett_rach_gps_pos;
static int ett_rach_gmprs_req_type;
/* Fields */
static int hf_rach_prio;
static int hf_rach_est_cause;
static int hf_rach_est_cause_moc;
static int hf_rach_est_cause_pag_resp;
static int hf_rach_num_plan;
static int hf_rach_chan_needed;
static int hf_rach_retry_cnt;
static int hf_rach_precorr;
static int hf_rach_rand_ref;
static int hf_rach_gps_pos_cpi;
static int hf_rach_gps_pos_lat;
static int hf_rach_gps_pos_long;
static int hf_rach_mes_pwr_class;
static int hf_rach_sp_hplmn_id;
static int hf_rach_pd;
static int hf_rach_number;
static int hf_rach_number_grp1;
static int hf_rach_number_grp2;
static int hf_rach_number_grp3;
static int hf_rach_number_grp4;
static int hf_rach_number_grp5;
static int hf_rach_msc_id;
static int hf_rach_gps_timestamp;
static int hf_rach_software_version;
static int hf_rach_spare;
static int hf_rach_gci;
static int hf_rach_r;
static int hf_rach_o;
static int hf_rach_number_type;
static int hf_rach_gmprs_term_type;
static int hf_rach_gmprs_radio_prio;
static int hf_rach_gmprs_tlli;
static int hf_rach_gmprs_num_rlc_blks;
static int hf_rach_gmprs_peak_tput;
static int hf_rach_gmprs_dl_peak_tput;
static int hf_rach_gmprs_ul_peak_tput;
static int hf_rach_gmprs_rlc_mode;
static int hf_rach_gmprs_llc_mode;
static int hf_rach_gmprs_spare1;
static int hf_rach_gmprs_spare2;
static int hf_rach_gmprs_spare3;
static int hf_rach_gmprs_reserved1;
static int hf_rach_gmprs_req_type;
static int hf_rach_gmprs_req_type_pag_resp;
static int hf_rach_gmprs_chan_needed;
static const true_false_string rach_prio_tfs = {
"Priority Call",
"Normal Call"
};
static const value_string rach_est_cause_vals[] = {
{ 4, "In response to alerting" },
{ 7, "(GmPRS) Channel Request Type 2" },
{ 8, "Location update" },
{ 9, "IMSI Detach" },
{ 10, "Supplementary Services" },
{ 11, "Short Message Services" },
{ 12, "Position Verification" },
{ 13, "(GmPRS) Attach/RA Update" },
{ 14, "(GmPRS) Packet Data Transfer" },
{ 15, "Emergency Call" },
{ 0, NULL }
};
static const value_string rach_est_cause_moc_vals[] = {
{ 1, "Mobile Originated Call" },
{ 0, NULL }
};
static const value_string rach_est_cause_pag_resp_vals[] = {
{ 0, "In response to paging" },
{ 0, NULL }
};
static const value_string rach_num_plan_vals[] = {
{ 0, "Unknown" },
{ 1, "ISDN E.164/E.163" },
{ 2, "Not Used" },
{ 3, "X.121" },
{ 4, "Telex F.69" },
{ 8, "National Numbering Plan" },
{ 9, "Private Numbering Plan" },
{ 15, "Reserved for Extension" },
{ 0, NULL }
};
static const value_string rach_chan_needed_vals[] = {
{ 0, "any" },
{ 1, "SDCCH" },
{ 2, "TCH3" },
{ 3, "spare" },
{ 0, NULL }
};
static const value_string rach_precorr_vals[] = {
{ 0, "Reserved" },
{ 1, "-47 symbols correction" },
{ 2, "-94 symbols correction" },
{ 3, "-141 symbols correction" },
{ 4, "+141 symbols correction" },
{ 5, "+94 symbols correction" },
{ 6, "+47 symbols correction" },
{ 7, "No precorrection" },
{ 0, NULL }
};
static void
dissect_gmr1_rach_kls1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *root_tree,
int *is_moc, int *is_pdt)
{
proto_tree *tree = NULL;
proto_item *ec_item = NULL;
proto_tree *ec_tree = NULL;
uint8_t ec;
/* Tree */
tree = proto_tree_add_subtree(
root_tree, tvb, 0, 2,
ett_rach_kls1, NULL, "Class-1 informations");
/* Priority */
proto_tree_add_item(tree, hf_rach_prio,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* Establishment Cause */
ec = (tvb_get_uint8(tvb, offset) >> 1) & 0x1f;
*is_moc = !!(ec & 0x10);
*is_pdt = (ec == 14);
if (ec & 0x10)
{
/* MOC */
ec_item = proto_tree_add_item(tree, hf_rach_est_cause_moc,
tvb, offset, 1, ENC_BIG_ENDIAN);
ec_tree = proto_item_add_subtree(ec_item, ett_rach_est_cause);
col_append_str(pinfo->cinfo, COL_INFO, "Mobile Originated Call ");
/* Numbering plan */
proto_tree_add_item(ec_tree, hf_rach_num_plan,
tvb, offset, 1, ENC_BIG_ENDIAN);
}
else if ((ec & 0x1c) == 0x00)
{
/* Paging response */
ec_item = proto_tree_add_item(tree, hf_rach_est_cause_pag_resp,
tvb, offset, 1, ENC_BIG_ENDIAN);
ec_tree = proto_item_add_subtree(ec_item, ett_rach_est_cause);
col_append_str(pinfo->cinfo, COL_INFO, "Paging response ");
/* Channel Needed */
proto_tree_add_item(ec_tree, hf_rach_chan_needed,
tvb, offset, 1, ENC_BIG_ENDIAN);
}
else if (ec == 7)
{
/* Channel Request Type 2 */
proto_tree_add_item(tree, hf_rach_est_cause,
tvb, offset, 1, ENC_BIG_ENDIAN);
}
else
{
/* Other */
proto_tree_add_item(tree, hf_rach_est_cause,
tvb, offset, 1, ENC_BIG_ENDIAN);
col_append_str(pinfo->cinfo, COL_INFO,
val_to_str(ec, rach_est_cause_vals, "Unknown (%u)"));
}
/* Retry counter */
proto_tree_add_item(tree, hf_rach_retry_cnt,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* Precorrection Indication */
proto_tree_add_item(tree, hf_rach_precorr,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
/* Random Reference */
proto_tree_add_item(tree, hf_rach_rand_ref,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
}
static const true_false_string rach_gps_pos_cpi_tfs = {
"GPS position is current position",
"GPS position is old position"
};
static void
rach_gps_pos_lat_fmt(char *s, uint32_t v)
{
int32_t sv = v;
snprintf(s, ITEM_LABEL_LENGTH, "%.5f %s (%d)",
abs(sv) / 2912.7f, sv < 0 ? "S" : "N", sv);
}
static void
rach_gps_pos_long_fmt(char *s, uint32_t v)
{
int32_t sv = v;
snprintf(s, ITEM_LABEL_LENGTH, "%.5f %s (%d)",
abs(sv) / 2912.70555f, sv < 0 ? "W" : "E", sv);
/* FIXME: The specs says >0 is West ... but it doesn't seem to
* match real world captures !
*/
}
static void
dissect_gmr1_rach_gps_pos(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
uint32_t lat, lng;
/* Check for NULL */
/* Spec says that NULL is latitude == 0x40000 and longitude
* is random. But from real capture it seems that
* longitude == 0x80000 and latitude random is also NULL pos */
lat = (tvb_get_ntohl(tvb, offset) >> 12) & 0x7ffff;
lng = tvb_get_ntohl(tvb, offset + 1) & 0xfffff;
if (lat == 0x40000) {
proto_tree_add_int_format(tree, hf_rach_gps_pos_lat, tvb, offset, 5, lat,
"NULL GPS Position (latitude == 0x40000)");
return;
} else if (lng == 0x80000) {
proto_tree_add_int_format(tree, hf_rach_gps_pos_long, tvb, offset, 5, lng,
"NULL GPS Position (longitude == 0x80000)");
return;
}
/* CPI */
proto_tree_add_item(tree, hf_rach_gps_pos_cpi,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* Latitude */
proto_tree_add_item(tree, hf_rach_gps_pos_lat,
tvb, offset, 3, ENC_BIG_ENDIAN);
/* Longitude */
proto_tree_add_item(tree, hf_rach_gps_pos_long,
tvb, offset + 2, 3, ENC_BIG_ENDIAN);
}
static void
rach_sp_hplmn_id_fmt(char *s, uint32_t v)
{
if (v == 0xfffff) {
snprintf(s, ITEM_LABEL_LENGTH, "%05x (Null)", v);
} else if ((v & 0xf8000) == 0xf8000) {
snprintf(s, ITEM_LABEL_LENGTH, "%05x (SP ID %4d)", v, v & 0x7fff);
} else {
snprintf(s, ITEM_LABEL_LENGTH, "%05x (HPLMN ID)", v);
}
}
static const value_string rach_pd_vals[] = {
{ 0, "Fixed to 00 for this version of the protocol" },
{ 1, "Reserved" },
{ 2, "Reserved" },
{ 3, "Reserved" },
{ 0, NULL }
};
static void
rach_dialed_num_grp1234_fmt(char *s, uint32_t v)
{
if (v <= 999) {
snprintf(s, ITEM_LABEL_LENGTH, "%03d", v);
} else if (v == 1023) {
snprintf(s, ITEM_LABEL_LENGTH,
"All digits in the preceding group are valid (%d)", v);
} else if (v == 1022) {
snprintf(s, ITEM_LABEL_LENGTH,
"First two digits in the preceding group are valid, "
"and the third digit (i.e. 0) is padding (%d)", v);
} else if (v == 1021) {
snprintf(s, ITEM_LABEL_LENGTH,
"First digit in the preceding group is valid, and "
"the second and third 0s are padding (%d)", v);
} else {
snprintf(s, ITEM_LABEL_LENGTH, "Invalid (%d)", v);
}
}
static void
rach_dialed_num_grp5_fmt(char *s, uint32_t v)
{
if (v >= 1100 && v <= 1199) {
snprintf(s, ITEM_LABEL_LENGTH, "%02d (%d)", v - 1100, v);
} else if (v >= 1200 && v <= 1209) {
snprintf(s, ITEM_LABEL_LENGTH, "%01d (%d)", v - 1200, v);
} else {
rach_dialed_num_grp1234_fmt(s, v);
}
}
static void
rach_gps_timestamp_fmt(char *s, uint32_t v)
{
if (v == 0xffff) {
snprintf(s, ITEM_LABEL_LENGTH, ">= 65535 minutes or N/A (%04x)", v);
} else {
snprintf(s, ITEM_LABEL_LENGTH, "%d minutes (%04x)", v, v);
}
}
static const true_false_string rach_gci_tfs = {
"MES is GPS capable",
"MES is not GPS capable"
};
static const true_false_string rach_r_tfs = {
"Normal case",
"Retry (see specs for details)"
};
static const true_false_string rach_o_tfs = {
"Retry after failed optimal routing attempt",
"Normal case"
};
static const value_string rach_number_type_vals[] = {
{ 0, "Unknown" },
{ 1, "International Number" },
{ 2, "National Number" },
{ 3, "Network-specific Number (operator access)" },
{ 4, "Dedicated Access short code" },
{ 5, "Reserved" },
{ 6, "Reserved" },
{ 7, "(N/A - Not MO Call)" },
{ 0, NULL }
};
static const value_string rach_gmprs_term_type_vals[] = {
{ 0x09, "Multislot class 2, Power class 1 (type C), Half Duplex, Handheld, Internal antenna, A/Gb interface, L-band" },
{ 0x0a, "Multislot class 3, Power class 1 (type C), Half Duplex, Handheld, Internal antenna, A/Gb interface, L-band" },
{ 0x0b, "Multislot class 4, Power class 1 (type C), Half Duplex, Handheld, Internal antenna, A/Gb interface, L-band" },
{ 0x0c, "Multislot class 1, Power class 1 (type C), Full Duplex, Handheld, Internal antenna, A/Gb interface, L-band" },
{ 0x0d, "Multislot class 1, Power class 9 (type D), Full Duplex, Fixed, Internal antenna, Gb interface, L-band" },
{ 0x0e, "Multislot class 1, Power class 9 (type D), Full Duplex, Fixed, Passive external antenna, Gb interface, L-band" },
{ 0x0f, "Multislot class 1, Power class 9 (type D), Full Duplex, Fixed, Active external antenna, Gb interface, L-band" },
{ 0x10, "Multislot class 4, Power class 1 (type E), Half Duplex, Handheld, Internal antenna, Iu-PS interface, S-band" },
{ 0x11, "Multislot class 5, Power class 1 (type E), Half Duplex, Handheld, Internal antenna, Iu-PS interface, S-band" },
{ 0x12, "Multislot class 5, Power class 1 (type E), Half Duplex, Handheld, Internal antenna, Iu-PS interface, S-band" },
{ 0x15, "Multislot class 3, Power class 1 (type F), Half Duplex, Handheld, Internal antenna, Iu-PS interface, S-band" },
{ 0x1a, "Multislot class 3, Power class 1 (type G), Half Duplex, Handheld, Internal antenna, Iu-PS interface, S-band" },
{ 0x1f, "Multislot class 1, Power class 2 (type H), Full Duplex, Vehicular, Internal antenna, Iu-PS interface, S-band" },
{ 0x20, "Multislot class 5, Power class 2 (type H), Full Duplex, Vehicular, Internal antenna, Iu-PS interface, S-band" },
{ 0x24, "Multislot class 1, Power class 9 (type I), Full Duplex, Fixed, Internal antenna, Iu-PS interface, S-band" },
{ 0x25, "Multislot class 1, Power class 9 (type I), Full Duplex, Fixed, Internal antenna, Iu-PS interface, S-band" },
{ 0x29, "Multislot class 3, (type J), Half Duplex, Handheld, Internal antenna, Iu-PS interface, L-band" },
{ 0x2e, "Multislot class 3, (type K), Half Duplex, Handheld, Internal antenna, Iu-PS interface, L-band" },
{ 0x33, "Multislot class 1, (type L), Full Duplex, Handheld, Internal antenna, Iu-PS interface, L-band" },
{ 0x38, "Multislot class 1, (type M), Full Duplex, Fixed, External antenna, Iu-PS interface, L-band" },
{ 0x40, "Reserved" },
{ 0x48, "Multislot class 1, Power class 8 (type A), Full Duplex, Fixed, Internal antenna, Gb interface, L-band" },
{ 0, NULL }
};
static value_string_ext rach_gmprs_term_type_ext_vals = VALUE_STRING_EXT_INIT(rach_gmprs_term_type_vals);
static const value_string rach_gmprs_radio_prio_vals[] = {
{ 0, "Radio Priority 1 (1=highest, 4=lowest)" },
{ 1, "Radio Priority 2 (1=highest, 4=lowest)" },
{ 2, "Radio Priority 3 (1=highest, 4=lowest)" },
{ 3, "Radio Priority 4 (1=highest, 4=lowest)" },
{ 0, NULL }
};
static const true_false_string rach_gmprs_rlc_mode_tfs = {
"Unacknowledged",
"Acknowledged"
};
static const true_false_string rach_gmprs_llc_mode_tfs = {
"Data packets",
"SACK/ACK packets"
};
static const value_string rach_gmprs_req_type_vals[] = {
{ 0x04, "Suspend - In Response to Alerting for circuit switched services" },
{ 0x06, "Suspend - MO Call" },
{ 0x07, "Resume" },
{ 0x08, "Suspend - Location Update" },
{ 0x09, "Suspend - IMSI Detach" },
{ 0x0a, "Suspend - Supplementary Services" },
{ 0x0b, "Suspend - Short Message Services" },
{ 0x0f, "Suspend - Emergency Call" },
{ 0, NULL }
};
static const value_string rach_gmprs_req_type_pag_resp_vals[] = {
{ 0x00, "Suspend - Answer to Paging" },
{ 0, NULL }
};
static int
_parse_dialed_number(char *s, int slen, tvbuff_t *tvb, int offset)
{
uint16_t grp[5];
int rv, i, done;
grp[0] = ((tvb_get_uint8(tvb, offset+0) & 0x3f) << 4) |
((tvb_get_uint8(tvb, offset+1) & 0xf0) >> 4);
grp[1] = ((tvb_get_uint8(tvb, offset+1) & 0x0f) << 6) |
((tvb_get_uint8(tvb, offset+2) & 0xfc) >> 2);
grp[2] = ((tvb_get_uint8(tvb, offset+2) & 0x03) << 8) |
tvb_get_uint8(tvb, offset+3);
grp[3] = ((tvb_get_uint8(tvb, offset+4) & 0xff) << 2) |
((tvb_get_uint8(tvb, offset+5) & 0xc0) >> 6);
grp[4] = ((tvb_get_uint8(tvb, offset+5) & 0x3f) << 5) |
((tvb_get_uint8(tvb, offset+6) & 0xf8) >> 3);
rv = 0;
done = 0;
for (i=0; i<4; i++)
{
if (grp[i+1] <= 999)
{
/* All digits of group are valid */
rv += snprintf(s + rv, slen - rv, "%03d", grp[i]);
}
else if (grp[i+1] == 1023)
{
/* Last group and all digits are valid */
rv += snprintf(s + rv, slen - rv, "%03d", grp[i]);
done = 1;
break;
}
else if (grp[i+1] == 1022)
{
/* Last group and first two digits are valid */
rv += snprintf(s + rv, slen - rv, "%02d", grp[i] / 10);
done = 1;
break;
}
else if (grp[i+1] == 1021)
{
/* Last group and first digit is valid */
rv += snprintf(s + rv, slen - rv, "%01d", grp[i] / 100);
done = 1;
break;
}
else if ((i==3) && (grp[i+1] >= 1100) && (grp[i+1] <= 1209))
{
/* All digits of group are valid */
rv += snprintf(s + rv, slen - rv, "%03d", grp[i]);
}
else
{
/* Invalid */
return snprintf(s, slen, "(Invalid)");
}
}
if (!done) {
if (grp[4] <= 999)
{
/* All digits are valid */
rv += snprintf(s + rv, slen - rv, "%03d", grp[4]);
}
else if (grp[4] >= 1100 && grp[4] <= 1199)
{
/* Only two digits are valid */
rv += snprintf(s + rv, slen - rv, "%02d", grp[4] - 1100);
}
else if (grp[4] >= 1200 && grp[4] <= 1209)
{
/* Only one digit is valid */
rv += snprintf(s + rv, slen - rv, "%01d", grp[4] - 1200);
}
else
{
/* Invalid */
return snprintf(s, slen, "(Invalid)");
}
}
return rv;
}
static void
dissect_gmr1_rach_kls2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *root_tree,
int is_moc)
{
proto_tree *tree = NULL;
proto_item *dialed_num_item = NULL;
proto_tree *dialed_num_tree = NULL, *gps_pos_tree = NULL;
/* Tree */
tree = proto_tree_add_subtree(
root_tree, tvb, 2, 16,
ett_rach_kls2, NULL, "Class-2 informations");
/* MES Power Class */
proto_tree_add_item(tree, hf_rach_mes_pwr_class,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* SP/HPLMN ID */
proto_tree_add_item(tree, hf_rach_sp_hplmn_id,
tvb, offset, 3, ENC_BIG_ENDIAN);
/* PD */
proto_tree_add_item(tree, hf_rach_pd,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* Is it a MO call ? */
if (is_moc) {
char s[32];
/* Dialed number */
/* Parse number */
_parse_dialed_number(s, sizeof(s), tvb, offset + 3);
col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", s);
/* Base item */
dialed_num_item = proto_tree_add_string(
tree, hf_rach_number, tvb, offset + 3, 7, s);
dialed_num_tree = proto_item_add_subtree(
dialed_num_item, ett_rach_dialed_num);
/* Group 1 */
proto_tree_add_item(dialed_num_tree, hf_rach_number_grp1,
tvb, offset + 3, 2, ENC_BIG_ENDIAN);
/* Group 2 */
proto_tree_add_item(dialed_num_tree, hf_rach_number_grp2,
tvb, offset + 4, 2, ENC_BIG_ENDIAN);
/* Group 3 */
proto_tree_add_item(dialed_num_tree, hf_rach_number_grp3,
tvb, offset + 5, 2, ENC_BIG_ENDIAN);
/* Group 4 */
proto_tree_add_item(dialed_num_tree, hf_rach_number_grp4,
tvb, offset + 7, 2, ENC_BIG_ENDIAN);
/* Group 5 */
proto_tree_add_item(dialed_num_tree, hf_rach_number_grp5,
tvb, offset + 8, 2, ENC_BIG_ENDIAN);
} else {
/* MSC ID */
proto_tree_add_item(tree, hf_rach_msc_id,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* GPS timestamp */
proto_tree_add_item(tree, hf_rach_gps_timestamp,
tvb, offset + 4, 2, ENC_BIG_ENDIAN);
/* Software version number */
proto_tree_add_item(tree, hf_rach_software_version,
tvb, offset + 6, 1, ENC_BIG_ENDIAN);
/* Spare */
proto_tree_add_item(tree, hf_rach_spare,
tvb, offset + 6, 1, ENC_BIG_ENDIAN);
}
/* GCI */
proto_tree_add_item(tree, hf_rach_gci,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* R */
proto_tree_add_item(tree, hf_rach_r,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* O */
proto_tree_add_item(tree, hf_rach_o,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* GPS Position */
gps_pos_tree = proto_tree_add_subtree(
tree, tvb, offset + 10, 5,
ett_rach_gps_pos, NULL, "GPS Position");
dissect_gmr1_rach_gps_pos(tvb, offset + 10, pinfo, gps_pos_tree);
/* Number type */
proto_tree_add_item(tree, hf_rach_number_type,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
}
static const crumb_spec_t rach_gmprs_type1_term_type_crumbs[] = {
{ 0, 4 },
{ 29, 3 },
{ 0, 0 }
};
static const crumb_spec_t rach_gmprs_num_rlc_blks_crumbs[] = {
{ 0, 8 },
{ 14, 2 },
{ 0, 0 }
};
static void
dissect_gmprs_rach_type1_kls2(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *root_tree, int is_pdt)
{
proto_tree *tree = NULL;
proto_tree *gps_pos_tree = NULL;
uint8_t term_type;
int is_class_d;
/* Tree */
tree = proto_tree_add_subtree(
root_tree, tvb, 2, 16,
ett_rach_gmprs_type1_kls2, NULL, "GmPRS Type-1 Class-2 informations");
/* GmPRS Terminal Type */
proto_tree_add_split_bits_item_ret_val(
tree, hf_rach_gmprs_term_type,
tvb, offset << 3,
rach_gmprs_type1_term_type_crumbs,
NULL);
term_type = ((tvb_get_uint8(tvb, offset) >> 1) & 0x78 ) |
( tvb_get_uint8(tvb, offset + 3) & 0x07);
is_class_d = (term_type == 0x0d) ||
(term_type == 0x0e) ||
(term_type == 0x0f);
/* Class D terminal ? */
if (is_class_d) {
/* DL Peak Throughput */
proto_tree_add_item(tree, hf_rach_gmprs_dl_peak_tput,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* Reserved */
proto_tree_add_item(tree, hf_rach_gmprs_reserved1,
tvb, offset, 2, ENC_BIG_ENDIAN);
} else {
/* SP/HPLMN ID */
proto_tree_add_item(tree, hf_rach_sp_hplmn_id,
tvb, offset, 3, ENC_BIG_ENDIAN);
}
/* Radio Priority */
proto_tree_add_item(tree, hf_rach_gmprs_radio_prio,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* Spare */
proto_tree_add_item(tree, hf_rach_gmprs_spare1,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* PD */
proto_tree_add_item(tree, hf_rach_pd,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* TLLI */
proto_tree_add_item(tree, hf_rach_gmprs_tlli,
tvb, offset + 4, 4, ENC_BIG_ENDIAN);
/* Is it for Packet Data Transfer ? */
if (is_pdt) {
/* Number of RLC blocks */
proto_tree_add_split_bits_item_ret_val(
tree, hf_rach_gmprs_num_rlc_blks,
tvb, (offset + 8) << 3,
rach_gmprs_num_rlc_blks_crumbs,
NULL);
/* (UL) Peak Throughput */
proto_tree_add_item(tree, is_class_d ?
hf_rach_gmprs_ul_peak_tput :
hf_rach_gmprs_peak_tput,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* Spare */
proto_tree_add_item(tree, hf_rach_gmprs_spare2,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
} else {
/* GPS timestamp */
proto_tree_add_item(tree, hf_rach_gps_timestamp,
tvb, offset + 8, 2, ENC_BIG_ENDIAN);
}
/* GPS Position */
gps_pos_tree = proto_tree_add_subtree(
tree, tvb, offset + 10, 5,
ett_rach_gps_pos, NULL, "GPS Position");
dissect_gmr1_rach_gps_pos(tvb, offset + 10, pinfo, gps_pos_tree);
/* RLC mode */
/* Off-the-air data shows bit is sometimes set even
* when not a PDT ... */
proto_tree_add_item(tree, hf_rach_gmprs_rlc_mode,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
/* LLC mode */
/* Off-the-air data shows bit is sometimes set even
* when not a PDT ... */
proto_tree_add_item(tree, hf_rach_gmprs_llc_mode,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
/* Spare */
proto_tree_add_item(tree, hf_rach_gmprs_spare3,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
}
static const crumb_spec_t rach_gmprs_type2_term_type_crumbs[] = {
{ 0, 4 },
{ 64, 3 },
{ 0, 0 }
};
static void
dissect_gmprs_rach_type2_kls2(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *root_tree)
{
proto_tree *tree = NULL;
proto_tree *gps_pos_tree = NULL;
uint8_t req_type;
/* Tree */
tree = proto_tree_add_subtree(
root_tree, tvb, 2, 16,
ett_rach_gmprs_type2_kls2, NULL, "GmPRS Type-2 Class-2 informations");
/* GmPRS Terminal type */
proto_tree_add_split_bits_item_ret_val(
tree, hf_rach_gmprs_term_type,
tvb, offset << 3,
rach_gmprs_type2_term_type_crumbs,
NULL);
/* SP/HPLMN ID */
proto_tree_add_item(tree, hf_rach_sp_hplmn_id,
tvb, offset, 3, ENC_BIG_ENDIAN);
/* PD */
proto_tree_add_item(tree, hf_rach_pd,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* MSC ID */
proto_tree_add_item(tree, hf_rach_msc_id,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
/* TLLI */
proto_tree_add_item(tree, hf_rach_gmprs_tlli,
tvb, offset + 4, 4, ENC_BIG_ENDIAN);
/* Request type */
req_type = tvb_get_uint8(tvb, offset + 8) & 0x1f;
if ((req_type & 0x1c) == 0) {
/* Paging response */
proto_item *rt_item = proto_tree_add_item(
tree, hf_rach_gmprs_req_type_pag_resp,
tvb, offset + 8, 1, ENC_BIG_ENDIAN);
proto_tree *rt_tree = proto_item_add_subtree(rt_item, ett_rach_gmprs_req_type);
col_append_str(pinfo->cinfo, COL_INFO, "Paging response ");
/* Channel Needed */
proto_tree_add_item(rt_tree, hf_rach_gmprs_chan_needed,
tvb, offset + 8, 1, ENC_BIG_ENDIAN);
} else {
/* Other */
proto_tree_add_item(tree, hf_rach_gmprs_req_type,
tvb, offset + 8, 1, ENC_BIG_ENDIAN);
col_append_str(pinfo->cinfo, COL_INFO,
val_to_str(req_type, rach_gmprs_req_type_vals, "Unknown (%u)"));
}
/* Software version number */
proto_tree_add_item(tree, hf_rach_software_version,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* Spare */
proto_tree_add_item(tree, hf_rach_spare,
tvb, offset + 9, 1, ENC_BIG_ENDIAN);
/* GPS Position */
gps_pos_tree = proto_tree_add_subtree(
tree, tvb, offset + 10, 5,
ett_rach_gps_pos, NULL, "GPS Position");
dissect_gmr1_rach_gps_pos(tvb, offset + 10, pinfo, gps_pos_tree);
/* GCI */
proto_tree_add_item(tree, hf_rach_gci,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
/* R */
proto_tree_add_item(tree, hf_rach_r,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
/* O */
proto_tree_add_item(tree, hf_rach_o,
tvb, offset + 15, 1, ENC_BIG_ENDIAN);
}
static int
dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
const int RACH_IE_CLASS1 = (1 << 0);
const int RACH_IE_CLASS2_GMR1 = (1 << 1);
const int RACH_IE_CLASS2_GMPRS_TYPE1 = (1 << 2);
const int RACH_IE_CLASS2_GMPRS_TYPE2 = (1 << 3);
proto_item *rach_item;
proto_tree *rach_tree;
const char *desc;
int len, is_moc, is_pdt, ies;
is_moc = 0;
is_pdt = 0;
len = tvb_reported_length(tvb);
desc = "GMR-1 Channel Request (RACH)";
ies = 0;
if (len == 18) {
uint8_t ec = (tvb_get_uint8(tvb, 0) >> 1) & 0x1f;
ies |= RACH_IE_CLASS1;
if ((ec == 13) || (ec == 14)) {
desc = "GMR-1 GmPRS Channel Request Type 1 (RACH)";
ies |= RACH_IE_CLASS2_GMPRS_TYPE1;
} else if (ec == 7) {
desc = "GMR-1 GmPRS Channel Request Type 2 (RACH)";
ies |= RACH_IE_CLASS2_GMPRS_TYPE2;
#if 0 /* Fix -Wduplicated-branches */
} else if (ec == 12) {
/* Position verification exists in both GMR-1 and GmPRS-1
* I have no idea how to differentiate them ... but from
* off-the-air data, it seems it used the GMR-1 format */
ies |= RACH_IE_CLASS2_GMR1;
#endif
} else {
ies |= RACH_IE_CLASS2_GMR1;
}
}
rach_item = proto_tree_add_protocol_format(
tree, proto_gmr1_rach, tvb, 0, len, "%s", desc);
rach_tree = proto_item_add_subtree(rach_item, ett_rach_msg);
if (!ies) {
col_append_str(pinfo->cinfo, COL_INFO, "(Invalid)");
call_data_dissector(tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
col_append_str(pinfo->cinfo, COL_INFO, "(RACH) ");
if (ies & RACH_IE_CLASS1)
dissect_gmr1_rach_kls1(tvb, 0, pinfo, rach_tree, &is_moc, &is_pdt);
if (ies & RACH_IE_CLASS2_GMR1)
dissect_gmr1_rach_kls2(tvb, 2, pinfo, rach_tree, is_moc);
if (ies & RACH_IE_CLASS2_GMPRS_TYPE1)
dissect_gmprs_rach_type1_kls2(tvb, 2, pinfo, rach_tree, is_pdt);
if (ies & RACH_IE_CLASS2_GMPRS_TYPE2)
dissect_gmprs_rach_type2_kls2(tvb, 2, pinfo, rach_tree);
return tvb_captured_length(tvb);
}
void
proto_register_gmr1_rach(void)
{
static hf_register_info hf[] = {
{ &hf_rach_prio,
{ "Priority", "gmr1.rach.priority",
FT_BOOLEAN, 8, TFS(&rach_prio_tfs), 0x01,
NULL, HFILL }
},
{ &hf_rach_est_cause,
{ "Establishment Cause", "gmr1.rach.est_cause",
FT_UINT8, BASE_HEX, VALS(rach_est_cause_vals), 0x3e,
NULL, HFILL }
},
{ &hf_rach_est_cause_moc,
{ "Establishment Cause", "gmr1.rach.est_cause.moc",
FT_UINT8, BASE_HEX, VALS(rach_est_cause_moc_vals), 0x20,
NULL, HFILL }
},
{ &hf_rach_est_cause_pag_resp,
{ "Establishment Cause", "gmr1.rach.est_cause.pag_resp",
FT_UINT8, BASE_HEX, VALS(rach_est_cause_pag_resp_vals), 0x38,
NULL, HFILL }
},
{ &hf_rach_num_plan,
{ "Numbering Plan Identification", "gmr1.rach.numbering_plan",
FT_UINT8, BASE_DEC, VALS(rach_num_plan_vals), 0x1e,
NULL, HFILL }
},
{ &hf_rach_chan_needed,
{ "Channel Needed", "gmr1.rach.chan_needed",
FT_UINT8, BASE_DEC, VALS(rach_chan_needed_vals), 0x06,
"Echoed from Paging Request", HFILL }
},
{ &hf_rach_retry_cnt,
{ "Retry Counter", "gmr1.rach.retry_counter",
FT_UINT8, BASE_DEC, NULL, 0xc0,
"Retransmission count for current access attempt", HFILL }
},
{ &hf_rach_precorr,
{ "Precorrection Indication", "gmr1.rach.precorr_ind",
FT_UINT8, BASE_DEC, VALS(rach_precorr_vals), 0xe0,
"This is the timing correction applied to RACH while "
"sending this message. See GMR 05.010.", HFILL }
},
{ &hf_rach_rand_ref,
{ "Random Reference", "gmr1.rach.random_reference",
FT_UINT8, BASE_HEX, NULL, 0x1f,
"A random number of 5 bits", HFILL }
},
{ &hf_rach_gps_pos_cpi,
{ "CPI", "gmr1.rach.gps_pos.cpi",
FT_BOOLEAN, 8, TFS(&rach_gps_pos_cpi_tfs), 0x80,
"Current Position Indicator", HFILL }
},
{ &hf_rach_gps_pos_lat,
{ "Latitude", "gmr1.rach.gps_pos.latitude",
FT_INT24, BASE_CUSTOM, CF_FUNC(rach_gps_pos_lat_fmt), 0x7ffff0,
NULL, HFILL }
},
{ &hf_rach_gps_pos_long,
{ "Longitude", "gmr1.rach.gps_pos.longitude",
FT_INT24, BASE_CUSTOM, CF_FUNC(rach_gps_pos_long_fmt), 0x0fffff,
NULL, HFILL }
},
{ &hf_rach_mes_pwr_class,
{ "MES Power Class", "gmr1.rach.mes_power_class",
FT_UINT8, BASE_DEC, NULL, 0xf0,
"See GMR 05.005 for infos", HFILL }
},
{ &hf_rach_sp_hplmn_id,
{ "SP/HPLMN ID", "gmr1.rach.sp_hplmn_id",
FT_UINT24, BASE_CUSTOM, CF_FUNC(rach_sp_hplmn_id_fmt), 0x0fffff,
NULL, HFILL }
},
{ &hf_rach_pd,
{ "PD", "gmr1.rach.pd",
FT_UINT8, BASE_DEC, VALS(rach_pd_vals), 0xc0,
"Protocol Discriminator", HFILL }
},
{ &hf_rach_number,
{ "Dialed Number", "gmr1.rach.number",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL, HFILL }
},
{ &hf_rach_number_grp1,
{ "Group 1", "gmr1.rach.number.grp1",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_dialed_num_grp1234_fmt), 0x3ff0,
NULL, HFILL }
},
{ &hf_rach_number_grp2,
{ "Group 2", "gmr1.rach.number.grp2",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_dialed_num_grp1234_fmt), 0x0ffc,
NULL, HFILL }
},
{ &hf_rach_number_grp3,
{ "Group 3", "gmr1.rach.number.grp3",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_dialed_num_grp1234_fmt), 0x03ff,
NULL, HFILL }
},
{ &hf_rach_number_grp4,
{ "Group 4", "gmr1.rach.number.grp4",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_dialed_num_grp1234_fmt), 0xffc0,
NULL, HFILL }
},
{ &hf_rach_number_grp5,
{ "Group 5", "gmr1.rach.number.grp5",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_dialed_num_grp5_fmt), 0x3ff8,
NULL, HFILL }
},
{ &hf_rach_msc_id,
{ "MSC ID", "gmr1.rach.msc_id",
FT_UINT8, BASE_DEC, NULL, 0x3f,
NULL, HFILL }
},
{ &hf_rach_gps_timestamp,
{ "GPS Timestamp", "gmr1.rach.gps_timestamp",
FT_UINT16, BASE_CUSTOM, CF_FUNC(rach_gps_timestamp_fmt), 0xffff,
NULL, HFILL }
},
{ &hf_rach_software_version,
{ "Software Version", "gmr1.rach.software_version",
FT_UINT8, BASE_DEC, NULL, 0xfe,
NULL, HFILL }
},
{ &hf_rach_spare,
{ "Spare", "gmr1.rach.spare",
FT_UINT32, BASE_DEC, NULL, 0x01fffff8,
NULL, HFILL }
},
{ &hf_rach_gci,
{ "GCI", "gmr1.rach.gci",
FT_BOOLEAN, 8, TFS(&rach_gci_tfs), 0x01,
"GPS Capability Indicator", HFILL }
},
{ &hf_rach_r,
{ "R", "gmr1.rach.r",
FT_BOOLEAN, 8, TFS(&rach_r_tfs), 0x02,
"See GMR 04.008 10.1.8 for full description" , HFILL }
},
{ &hf_rach_o,
{ "O", "gmr1.rach.o",
FT_BOOLEAN, 8, TFS(&rach_o_tfs), 0x04,
"See GMR 04.008 10.1.8 for full description", HFILL }
},
{ &hf_rach_number_type,
{ "Number Type", "gmr1.rach.number_type",
FT_UINT8, BASE_DEC, VALS(rach_number_type_vals), 0x07,
"For MO Call only", HFILL }
},
{ &hf_rach_gmprs_term_type,
{ "GmPRS Terminal Type", "gmr1.rach.gmprs_term_type",
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &rach_gmprs_term_type_ext_vals, 0x00,
"See GMR-1 3G 45.002 Annex C for infos", HFILL }
},
{ &hf_rach_gmprs_radio_prio,
{ "Radio Priority", "gmr1.rach.gmprs_radio_prio",
FT_UINT8, BASE_DEC, VALS(rach_gmprs_radio_prio_vals), 0x18,
"See GMPRS-1 04.060 for infos", HFILL }
},
{ &hf_rach_gmprs_tlli,
{ "TLLI", "gmr1.rach.gmprs_tlli",
FT_UINT32, BASE_HEX, NULL, 0x00,
"See GMPRS-1 04.060 for infos", HFILL }
},
{ &hf_rach_gmprs_num_rlc_blks,
{ "Number of RLC blocks", "gmr1.rach.gmprs_num_rlc_blks",
FT_UINT16, BASE_DEC, NULL, 0x00,
"See GMPRS-1 04.060 12.31 for infos", HFILL }
},
{ &hf_rach_gmprs_peak_tput,
{ "Peak Throughput", "gmr1.rach.gmprs_peak_tput",
FT_UINT8, BASE_DEC, NULL, 0x3c,
"See GMPRS-1 04.060 for infos", HFILL }
},
{ &hf_rach_gmprs_dl_peak_tput,
{ "DL Peak Throughput", "gmr1.rach.gmprs_dl_peak_tput",
FT_UINT8, BASE_DEC, NULL, 0x0f,
"See 3GPP TS 23.060 for infos", HFILL }
},
{ &hf_rach_gmprs_ul_peak_tput,
{ "UL Peak Throughput", "gmr1.rach.gmprs_ul_peak_tput",
FT_UINT8, BASE_DEC, NULL, 0x3c,
"See 3GPP TS 23.060 for infos", HFILL }
},
{ &hf_rach_gmprs_rlc_mode,
{ "RLC mode", "gmr1.rach.gmprs_rlc_mode",
FT_BOOLEAN, 8, TFS(&rach_gmprs_rlc_mode_tfs), 0x01,
NULL, HFILL }
},
{ &hf_rach_gmprs_llc_mode,
{ "LLC mode", "gmr1.rach.gmprs_llc_mode",
FT_BOOLEAN, 8, TFS(&rach_gmprs_llc_mode_tfs), 0x02,
NULL, HFILL }
},
{ &hf_rach_gmprs_spare1,
{ "Spare", "gmr1.rach.gmprs_spare1",
FT_UINT8, BASE_DEC, NULL, 0x20,
NULL, HFILL }
},
{ &hf_rach_gmprs_spare2,
{ "Spare", "gmr1.rach.gmprs_spare2",
FT_UINT8, BASE_DEC, NULL, 0xc0,
NULL, HFILL }
},
{ &hf_rach_gmprs_spare3,
{ "Spare", "gmr1.rach.gmprs_spare3",
FT_UINT8, BASE_DEC, NULL, 0x04,
NULL, HFILL }
},
{ &hf_rach_gmprs_reserved1,
{ "Reserved", "gmr1.rach.gmprs_reserved1",
FT_UINT16, BASE_HEX, NULL, 0xffff,
NULL, HFILL }
},
{ &hf_rach_gmprs_req_type,
{ "Request Type", "gmr1.rach.gmprs_req_type",
FT_UINT8, BASE_DEC, VALS(rach_gmprs_req_type_vals), 0x1f,
NULL, HFILL }
},
{ &hf_rach_gmprs_req_type_pag_resp,
{ "Request Type", "gmr1.rach.gmprs_req_type.pag_resp",
FT_UINT8, BASE_DEC, VALS(rach_gmprs_req_type_pag_resp_vals), 0x1c,
NULL, HFILL }
},
{ &hf_rach_gmprs_chan_needed,
{ "Channel Needed", "gmr1.rach.gmprs_chan_needed",
FT_UINT8, BASE_DEC, VALS(rach_chan_needed_vals), 0x03,
"Echoed from Paging Request", HFILL }
},
};
static int *ett[] = {
&ett_rach_msg,
&ett_rach_kls1,
&ett_rach_kls2,
&ett_rach_gmprs_type1_kls2,
&ett_rach_gmprs_type2_kls2,
&ett_rach_est_cause,
&ett_rach_dialed_num,
&ett_rach_gps_pos,
&ett_rach_gmprs_req_type,
};
proto_gmr1_rach = proto_register_protocol("GEO-Mobile Radio (1) RACH", "GMR-1 RACH", "gmr1.rach");
proto_register_field_array(proto_gmr1_rach, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("gmr1_rach", dissect_gmr1_rach, proto_gmr1_rach);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
|