Revert "Fixup: tvb_* -> tvb_captured"
[metze/wireshark/wip.git] / epan / dissectors / packet-gmr1_bcch.c
1 /* packet-gmr1_bcch.c
2  *
3  * Routines for GMR-1 BCCH dissection in wireshark.
4  * Copyright (c) 2011 Sylvain Munaut <tnt@246tNt.com>
5  *
6  * References:
7  *  [1] ETSI TS 101 376-4-8 V1.3.1 - GMR-1 04.008
8  *  [2] ETSI TS 101 376-4-8 V2.2.1 - GMPRS-1 04.008
9  *  [3] ETSI TS 101 376-4-8 V3.1.1 - GMR-1 3G 44.008
10  *
11  * Wireshark - Network traffic analyzer
12  * By Gerald Combs <gerald@wireshark.org>
13  * Copyright 1998 Gerald Combs
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28  */
29
30 #include "config.h"
31
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include <epan/wmem/wmem.h>
35
36 #include "packet-csn1.h"
37
38 void proto_register_gmr1_bcch(void);
39
40 /* GMR-1 BCCH proto */
41 static int proto_gmr1_bcch = -1;
42
43 /* GMR-1 BCCH sub tree */
44 static gint ett_gmr1_bcch = -1;
45
46
47 /* ------------------------------------------------------------------------ */
48 /* CSN1 fields                                                              */
49 /* ------------------------------------------------------------------------ */
50
51 /* Segment 1A fields - [3] 11.5.2.66 */
52 static int hf_seg1a_class_2_version = -1;
53 static int hf_seg1a_class_3_version = -1;
54
55 static int hf_seg1a_syncinfo_sb_frame_ts_offset = -1;
56 static int hf_seg1a_syncinfo_sb_symbol_offset = -1;
57 static int hf_seg1a_syncinfo_sa_freq_offset = -1;
58
59 static int hf_seg1a_rachctrl_max_retrans = -1;
60 static int hf_seg1a_rachctrl_acc[16] = { -1, -1, -1, -1, -1, -1, -1, -1,
61                                          -1, -1, -1, -1, -1, -1, -1, -1 };
62 static int hf_seg1a_rachctrl_cell_bar_access = -1;
63
64 static int hf_seg1a_miscinfo_sb_reselection_hysteresis = -1;
65 static int hf_seg1a_miscinfo_spare = -1;
66 static int hf_seg1a_miscinfo_priority_access_ind = -1;
67
68 static int hf_seg1a_gbch_present = -1;
69 static int hf_seg1a_test_gs = -1;
70 static int hf_seg1a_test_gs2 = -1;
71 static int hf_seg1a_spare1 = -1;
72 static int hf_seg1a_cell_bar_access_extension2 = -1;
73 static int hf_seg1a_spare2 = -1;
74 static int hf_seg1a_cell_bar_access_extension = -1;
75
76 /* Segment 2A & 2Abis fields - [3] 11.5.2.67 / 11.5.2.68 */
77 static int hf_seg2a_class_4_version = -1;
78
79 static int hf_seg2a_syncinfo_sa_sirfn_delay = -1;
80 static int hf_seg2a_syncinfo_sa_bcch_stn = -1;
81 static int hf_seg2a_syncinfo_superframe_num = -1;
82 static int hf_seg2a_syncinfo_multiframe_num = -1;
83 static int hf_seg2a_syncinfo_mffn_high_bit = -1;
84
85 static int hf_seg2a_selcrit_rxlev_select_min = -1;
86
87 static int hf_seg2a_miscinfo_sb_selection_power = -1;
88
89 static int hf_seg2a_lainfo_sa_pch_config = -1;
90 static int hf_seg2a_lainfo_sa_bach_config = -1;
91 static int hf_seg2a_lainfo_rach_ts_offset = -1;
92 static int hf_seg2a_lainfo_n_page_occurrences = -1;
93 static int hf_seg2a_lainfo_imsi_attach_detach_ind = -1;
94 static int hf_seg2a_lainfo_ecsc_indication = -1;
95 static int hf_seg2a_lainfo_si_update_ind = -1;
96
97 /* Segment 2B fields */
98 /* Segment 2Bbis fields */
99
100 /* Segment 3A fields - [1] 11.5.2.71 */
101 static int hf_seg3a_lai_mcc = -1;
102 static int hf_seg3a_lai_mnc = -1;
103 static int hf_seg3a_lai_lac = -1;
104 static int hf_seg3a_lai_msc_id = -1;
105 static int hf_seg3a_lai_spot_beam_id = -1;
106
107 static int hf_seg3a_system_sat_id = -1;
108 static int hf_seg3a_system_sys_id = -1;
109
110 static int hf_seg3a_satpos_latitude = -1;
111 static int hf_seg3a_satpos_longitude = -1;
112 static int hf_seg3a_satpos_radius = -1;
113
114 static int hf_seg3a_beam_latitude = -1;
115 static int hf_seg3a_beam_longitude = -1;
116
117 static int hf_seg3a_miscinfo_sb_reselection_timer = -1;
118
119 static int hf_seg3a_spare = -1;
120
121 /* Segment 3B fields */
122 /* Segment 3Bbis fields */
123 /* Segment 3C fields */
124 /* Segment 3D fields */
125 /* Segment 3E fields */
126 /* Segment 3Ebis fields */
127 /* Segment 3F fields */
128 /* Segment 3G fields */
129 /* Segment 3Gbis fields */
130 /* Segment 3H fields */
131 /* Segment 3I fields */
132 /* Segment 3J fields */
133 /* Segment 3Jbis fields */
134 /* Segment 3Kbis fields */
135 /* Segment 3L fields */
136 /* Segment 3M fields */
137 /* Segment 4A fields */
138 /* Segment 4B fields */
139 /* Segment 4C fields */
140 /* Segment 4D fields */
141 /* Segment 4E fields */
142 /* Segment 4F fields */
143 /* Segment 4G fields */
144 /* Segment 4H fields */
145 /* Segment 4I fields */
146 /* Segment 4J fields */
147 /* Segment 4K fields */
148
149 /* System Information fields [1] 10.1.31 & 10.1.32 */
150 static int hf_si_protocol_version = -1;
151 static int hf_si_block_type = -1;
152 static int hf_si_spare = -1;
153
154 static int hf_si1_randomization_period = -1;
155
156
157 /* ------------------------------------------------------------------------ */
158 /* CSN1 parsing structure                                                   */
159 /* ------------------------------------------------------------------------ */
160
161 /* Segments structures */
162
163         /* Segment 1A - [3] 11.5.2.66 */
164 typedef struct {
165         guint8  SB_FRAME_TS_OFFSET;
166         gint8   SB_SYMBOL_OFFSET;
167         gint8   SA_FREQ_OFFSET;
168 } Seg1A_SyncInfo_t;
169
170 typedef struct {
171         guint8  AC15;
172         guint8  AC14;
173         guint8  AC13;
174         guint8  AC12;
175         guint8  AC11;
176         guint8  EC10;
177         guint8  AC9;
178         guint8  AC8;
179         guint8  AC7;
180         guint8  AC6;
181         guint8  AC5;
182         guint8  AC4;
183         guint8  AC3;
184         guint8  AC2;
185         guint8  AC1;
186         guint8  AC0;
187 } Seg1A_AccessClasses_t;
188
189 typedef struct {
190         guint8  Max_Retrans;
191         Seg1A_AccessClasses_t AccessClasses;
192         guint8  CELL_BAR_ACCESS;
193 } Seg1A_RACHCtrlParams_t;
194
195 typedef struct {
196         guint8  SB_RESELECTION_HYSTERESIS;
197         guint8  Spare;
198         guint8  PriorityAccessInd;
199 } Seg1A_MiscInfo_t;
200
201 typedef struct {
202         guint8  Class_2_version;
203         guint8  Class_3_version;
204         Seg1A_SyncInfo_t SyncInfo;
205         Seg1A_RACHCtrlParams_t RACHCtrlParams;
206         Seg1A_MiscInfo_t MiscInfo;
207         guint8  GBCH_Present;
208         guint8  Test_GS;
209         guint8  Test_GS2;
210         guint8  Spare1;
211         guint8  CELL_BAR_ACCESS_EXTENSION2;
212         guint8  Spare2;
213         guint8  CELL_BAR_ACCESS_EXTENSION;
214 } Segment1A_t;
215
216         /* Segment 2A & 2Abis - [3] 11.5.2.67 / 11.5.2.68 */
217 typedef struct {
218         guint8  SA_SIRFN_DELAY;
219         guint8  SA_BCCH_STN;
220         guint16 SuperframeNum;
221         guint8  MultiframeNum;
222         guint8  MFFN_HighBit;
223 } Seg2A_SyncInfo_t;
224
225 typedef struct {
226         guint8  RXLEV_SELECT_MIN;
227 } Seg2A_SelectionCriterion_t;
228
229 typedef struct {
230         guint8  SB_SELECTION_POWER;
231 } Seg2A_MiscInfo_t;
232
233 typedef struct {
234         guint8  SA_PCH_CONFIG;
235         guint8  SA_BACH_CONFIG;
236         guint8  RACH_TS_OFFSET;
237         guint8  N_Page_Occurrences;
238         guint8  IMSI_attach_detach_ind;
239         guint8  ECSC_ind;
240         guint8  SI_update_ind;
241 } Seg2A_LAInfo_t;
242
243 typedef struct {
244         guint8  Class_4_version;
245         Seg2A_SyncInfo_t SyncInfo;
246         Seg2A_SelectionCriterion_t SelectionCriterion;
247         Seg2A_MiscInfo_t MiscInfo;
248         Seg2A_LAInfo_t LAInfo;
249 } Segment2A_t;
250
251 typedef struct {
252         guint8  Class_4_version;
253         Seg2A_SyncInfo_t SyncInfo;
254         Seg2A_SelectionCriterion_t SelectionCriterion;
255         Seg2A_MiscInfo_t MiscInfo;
256         Seg2A_LAInfo_t LAInfo;
257 } Segment2Abis_t;
258
259 typedef struct {
260         guint8 _dummy; /* Remove when dissection is written */
261 } Segment2B_t;
262
263 typedef struct {
264         guint8 _dummy; /* Remove when dissection is written */
265 } Segment2Bbis_t;
266
267         /* Segment 3A - [1] 11.5.2.71 */
268 typedef struct {
269         guint16 MCC;
270         guint16 MNC;
271         guint16 LAC;
272         guint8 MSC_ID;          /* splitted version of LAC */
273         guint16 Spot_Beam_ID;   /* splitted version of LAC */
274 } Seg3A_LAI_t;
275
276 typedef struct {
277         guint8 Satellite_ID;
278         guint8 System_ID;
279 } Seg3A_System_t;
280
281 typedef struct {
282         gint8   Latitude;
283         guint16 Longitude;
284         gint16  Radius;
285 } Seg3A_SatellitePosition_t;
286
287 typedef struct {
288         gint16  Latitude;
289         guint16 Longitude;
290 } Seg3A_BeamPosition_t;
291
292 typedef struct {
293         guint8 SB_RESELECTION_TIMER;
294 } Seg3A_MiscInfo_t;
295
296 typedef struct {
297         Seg3A_LAI_t LAI;
298         Seg3A_System_t System;
299         Seg3A_SatellitePosition_t SatellitePosition;
300         Seg3A_BeamPosition_t BeamPosition;
301         Seg3A_MiscInfo_t MiscInfo;
302         guint8 Spare;
303 } Segment3A_t;
304
305 typedef struct {
306         guint8 _dummy; /* Remove when dissection is written */
307 } Segment3B_t;
308
309 typedef struct {
310         guint8 _dummy; /* Remove when dissection is written */
311 } Segment3Bbis_t;
312
313 typedef struct {
314         guint8 _dummy; /* Remove when dissection is written */
315 } Segment3C_t;
316
317 typedef struct {
318         guint8 _dummy; /* Remove when dissection is written */
319 } Segment3D_t;
320
321 typedef struct {
322         guint8 _dummy; /* Remove when dissection is written */
323 } Segment3E_t;
324
325 typedef struct {
326         guint8 _dummy; /* Remove when dissection is written */
327 } Segment3Ebis_t;
328
329 typedef struct {
330         guint8 _dummy; /* Remove when dissection is written */
331 } Segment3F_t;
332
333 typedef struct {
334         guint8 _dummy; /* Remove when dissection is written */
335 } Segment3G_t;
336
337 typedef struct {
338         guint8 _dummy; /* Remove when dissection is written */
339 } Segment3Gbis_t;
340
341 typedef struct {
342         guint8 _dummy; /* Remove when dissection is written */
343 } Segment3H_t;
344
345 typedef struct {
346         guint8 _dummy; /* Remove when dissection is written */
347 } Segment3I_t;
348
349 typedef struct {
350         guint8 _dummy; /* Remove when dissection is written */
351 } Segment3J_t;
352
353 typedef struct {
354         guint8 _dummy; /* Remove when dissection is written */
355 } Segment3Jbis_t;
356
357 typedef struct {
358         guint8 _dummy; /* Remove when dissection is written */
359 } Segment3Kbis_t;
360
361 typedef struct {
362         guint8 _dummy; /* Remove when dissection is written */
363 } Segment3L_t;
364
365 typedef struct {
366         guint8 _dummy; /* Remove when dissection is written */
367 } Segment3M_t;
368
369 typedef struct {
370         guint8 _dummy; /* Remove when dissection is written */
371 } Segment4A_t;
372
373 typedef struct {
374         guint8 _dummy; /* Remove when dissection is written */
375 } Segment4B_t;
376
377 typedef struct {
378         guint8 _dummy; /* Remove when dissection is written */
379 } Segment4C_t;
380
381 typedef struct {
382         guint8 _dummy; /* Remove when dissection is written */
383 } Segment4D_t;
384
385 typedef struct {
386         guint8 _dummy; /* Remove when dissection is written */
387 } Segment4E_t;
388
389 typedef struct {
390         guint8 _dummy; /* Remove when dissection is written */
391 } Segment4F_t;
392
393 typedef struct {
394         guint8 _dummy; /* Remove when dissection is written */
395 } Segment4G_t;
396
397 typedef struct {
398         guint8 _dummy; /* Remove when dissection is written */
399 } Segment4H_t;
400
401 typedef struct {
402         guint8 _dummy; /* Remove when dissection is written */
403 } Segment4I_t;
404
405 typedef struct {
406         guint8 _dummy; /* Remove when dissection is written */
407 } Segment4J_t;
408
409 typedef struct {
410         guint8 _dummy; /* Remove when dissection is written */
411 } Segment4K_t;
412
413 /* System informations structures */
414
415         /* System Information type 1 - [1] 10.1.31 */
416 typedef struct {
417         guint8          Protocol_Version;
418         guint8          Block_Type;
419         guint8          Randomization_Period;
420         guint8          Spare;
421 } SI1_Block_Header_t;
422
423 typedef struct {
424         SI1_Block_Header_t      Block_Header;
425         Segment1A_t             Segment1A;
426         guint8                  SegmentType;
427         union {
428                 Segment2Abis_t          Segment2Abis;
429                 Segment2Bbis_t          Segment2Bbis;
430                 Segment3A_t             Segment3A;
431                 Segment3Bbis_t          Segment3Bbis;
432                 Segment3C_t             Segment3C;
433                 Segment3D_t             Segment3D;
434                 Segment3Ebis_t          Segment3Ebis;
435                 Segment3F_t             Segment3F;
436                 Segment3Gbis_t          Segment3Gbis;
437                 Segment3H_t             Segment3H;
438                 Segment3I_t             Segment3I;
439                 Segment3Jbis_t          Segment3Jbis;
440                 Segment3Kbis_t          Segment3Kbis;
441                 Segment4A_t             Segment4A;
442                 Segment4B_t             Segment4B;
443                 Segment4C_t             Segment4C;
444                 Segment4D_t             Segment4D;
445                 Segment4E_t             Segment4E;
446                 Segment4F_t             Segment4F;
447                 Segment4G_t             Segment4G;
448                 Segment4H_t             Segment4H;
449                 Segment4I_t             Segment4I;
450                 Segment4J_t             Segment4J;
451                 Segment4K_t             Segment4K;
452         } u;
453 } SystemInformation1_t;
454
455         /* System Information type 2 - [1] 10.1.32 */
456 typedef struct {
457         guint8          Protocol_Version;
458         guint8          Block_Type;
459         guint8          Spare;
460 } SI2_Block_Header_t;
461
462 typedef struct {
463         SI2_Block_Header_t      Block_Header;
464         guint8                  SegmentType;
465         union {
466                 Segment2A_t             Segment2A;
467                 Segment2B_t             Segment2B;
468                 Segment3B_t             Segment3B;
469                 Segment3E_t             Segment3E;
470                 Segment3G_t             Segment3G;
471                 Segment3J_t             Segment3J;
472         } u;
473 } SystemInformation2_t;
474
475
476 /* ------------------------------------------------------------------------ */
477 /* CSN1 parsing definitions                                                 */
478 /* ------------------------------------------------------------------------ */
479
480 /* Segments */
481
482         /* Segment 1A - [3] 11.5.2.66 */
483 static const
484 CSN_DESCR_BEGIN(Seg1A_SyncInfo_t)
485   M_UINT       (Seg1A_SyncInfo_t, SB_FRAME_TS_OFFSET, 5, &hf_seg1a_syncinfo_sb_frame_ts_offset),
486   M_UINT       (Seg1A_SyncInfo_t, SB_SYMBOL_OFFSET, 6, &hf_seg1a_syncinfo_sb_symbol_offset),
487   M_UINT       (Seg1A_SyncInfo_t, SA_FREQ_OFFSET, 8, &hf_seg1a_syncinfo_sa_freq_offset),
488 CSN_DESCR_END  (Seg1A_SyncInfo_t)
489
490 static const
491 CSN_DESCR_BEGIN(Seg1A_AccessClasses_t)
492  M_UINT        (Seg1A_AccessClasses_t, AC15, 1, &hf_seg1a_rachctrl_acc[15]),
493  M_UINT        (Seg1A_AccessClasses_t, AC14, 1, &hf_seg1a_rachctrl_acc[14]),
494  M_UINT        (Seg1A_AccessClasses_t, AC13, 1, &hf_seg1a_rachctrl_acc[13]),
495  M_UINT        (Seg1A_AccessClasses_t, AC12, 1, &hf_seg1a_rachctrl_acc[12]),
496  M_UINT        (Seg1A_AccessClasses_t, AC11, 1, &hf_seg1a_rachctrl_acc[11]),
497  M_UINT        (Seg1A_AccessClasses_t, EC10, 1, &hf_seg1a_rachctrl_acc[10]),
498  M_UINT        (Seg1A_AccessClasses_t, AC9,  1, &hf_seg1a_rachctrl_acc[9]),
499  M_UINT        (Seg1A_AccessClasses_t, AC8,  1, &hf_seg1a_rachctrl_acc[8]),
500  M_UINT        (Seg1A_AccessClasses_t, AC7,  1, &hf_seg1a_rachctrl_acc[7]),
501  M_UINT        (Seg1A_AccessClasses_t, AC6,  1, &hf_seg1a_rachctrl_acc[6]),
502  M_UINT        (Seg1A_AccessClasses_t, AC5,  1, &hf_seg1a_rachctrl_acc[5]),
503  M_UINT        (Seg1A_AccessClasses_t, AC4,  1, &hf_seg1a_rachctrl_acc[4]),
504  M_UINT        (Seg1A_AccessClasses_t, AC3,  1, &hf_seg1a_rachctrl_acc[3]),
505  M_UINT        (Seg1A_AccessClasses_t, AC2,  1, &hf_seg1a_rachctrl_acc[2]),
506  M_UINT        (Seg1A_AccessClasses_t, AC1,  1, &hf_seg1a_rachctrl_acc[1]),
507  M_UINT        (Seg1A_AccessClasses_t, AC0,  1, &hf_seg1a_rachctrl_acc[0]),
508 CSN_DESCR_END  (Seg1A_AccessClasses_t)
509
510 static const
511 CSN_DESCR_BEGIN(Seg1A_RACHCtrlParams_t)
512  M_UINT        (Seg1A_RACHCtrlParams_t, Max_Retrans, 2, &hf_seg1a_rachctrl_max_retrans),
513  M_TYPE_LABEL  (Seg1A_RACHCtrlParams_t, AccessClasses, Seg1A_AccessClasses_t, "Access Classes"),
514  M_UINT        (Seg1A_RACHCtrlParams_t, CELL_BAR_ACCESS, 1, &hf_seg1a_rachctrl_cell_bar_access),
515 CSN_DESCR_END  (Seg1A_RACHCtrlParams_t)
516
517 static const
518 CSN_DESCR_BEGIN(Seg1A_MiscInfo_t)
519   M_UINT       (Seg1A_MiscInfo_t, SB_RESELECTION_HYSTERESIS, 4, &hf_seg1a_miscinfo_sb_reselection_hysteresis),
520   M_UINT       (Seg1A_MiscInfo_t, Spare, 1, &hf_seg1a_miscinfo_spare),
521   M_UINT       (Seg1A_MiscInfo_t, PriorityAccessInd, 1, &hf_seg1a_miscinfo_priority_access_ind),
522 CSN_DESCR_END  (Seg1A_MiscInfo_t)
523
524 static const
525 CSN_DESCR_BEGIN(Segment1A_t)
526   M_UINT       (Segment1A_t, Class_2_version, 3, &hf_seg1a_class_2_version),
527   M_UINT       (Segment1A_t, Class_3_version, 4, &hf_seg1a_class_3_version),
528   M_TYPE_LABEL (Segment1A_t, SyncInfo, Seg1A_SyncInfo_t, "Synchronization Info Class 1"),
529   M_TYPE_LABEL (Segment1A_t, RACHCtrlParams, Seg1A_RACHCtrlParams_t, "RACH Control Parameters"),
530   M_TYPE_LABEL (Segment1A_t, MiscInfo, Seg1A_MiscInfo_t, "Misc Info Class 1"),
531   M_UINT       (Segment1A_t, GBCH_Present, 1, &hf_seg1a_gbch_present),
532   M_UINT       (Segment1A_t, Test_GS, 1, &hf_seg1a_test_gs),
533   M_UINT       (Segment1A_t, Test_GS2, 1, &hf_seg1a_test_gs2),
534   M_UINT       (Segment1A_t, Spare1, 3, &hf_seg1a_spare1),
535   M_UINT       (Segment1A_t, CELL_BAR_ACCESS_EXTENSION2, 1, &hf_seg1a_cell_bar_access_extension2),
536   M_UINT       (Segment1A_t, Spare2, 5, &hf_seg1a_spare2),
537   M_UINT       (Segment1A_t, CELL_BAR_ACCESS_EXTENSION, 1, &hf_seg1a_cell_bar_access_extension),
538 CSN_DESCR_END  (Segment1A_t)
539
540         /* Segment 2A & 2Abis - [1] 11.5.2.67 / 11.5.2.68 */
541 static const
542 CSN_DESCR_BEGIN(Seg2A_SyncInfo_t)
543   M_UINT       (Seg2A_SyncInfo_t, SA_SIRFN_DELAY, 4, &hf_seg2a_syncinfo_sa_sirfn_delay),
544   M_UINT       (Seg2A_SyncInfo_t, SA_BCCH_STN, 5, &hf_seg2a_syncinfo_sa_bcch_stn),
545   M_UINT       (Seg2A_SyncInfo_t, SuperframeNum, 13, &hf_seg2a_syncinfo_superframe_num),
546   M_UINT       (Seg2A_SyncInfo_t, MultiframeNum, 2, &hf_seg2a_syncinfo_multiframe_num),
547   M_UINT       (Seg2A_SyncInfo_t, MFFN_HighBit, 1, &hf_seg2a_syncinfo_mffn_high_bit),
548 CSN_DESCR_END  (Seg2A_SyncInfo_t)
549
550 static const
551 CSN_DESCR_BEGIN(Seg2A_SelectionCriterion_t)
552   M_UINT       (Seg2A_SelectionCriterion_t, RXLEV_SELECT_MIN, 5, &hf_seg2a_selcrit_rxlev_select_min),
553 CSN_DESCR_END  (Seg2A_SelectionCriterion_t)
554
555 static const
556 CSN_DESCR_BEGIN(Seg2A_MiscInfo_t)
557   M_UINT       (Seg2A_MiscInfo_t, SB_SELECTION_POWER, 4, &hf_seg2a_miscinfo_sb_selection_power),
558 CSN_DESCR_END  (Seg2A_MiscInfo_t)
559
560 static const
561 CSN_DESCR_BEGIN(Seg2A_LAInfo_t)
562   M_UINT       (Seg2A_LAInfo_t, SA_PCH_CONFIG, 2, &hf_seg2a_lainfo_sa_pch_config),
563   M_UINT       (Seg2A_LAInfo_t, SA_BACH_CONFIG, 8, &hf_seg2a_lainfo_sa_bach_config),
564   M_UINT       (Seg2A_LAInfo_t, RACH_TS_OFFSET, 5, &hf_seg2a_lainfo_rach_ts_offset),
565   M_UINT       (Seg2A_LAInfo_t, N_Page_Occurrences, 2, &hf_seg2a_lainfo_n_page_occurrences),
566   M_UINT       (Seg2A_LAInfo_t, IMSI_attach_detach_ind, 1, &hf_seg2a_lainfo_imsi_attach_detach_ind),
567   M_UINT       (Seg2A_LAInfo_t, ECSC_ind, 1, &hf_seg2a_lainfo_ecsc_indication),
568   M_UINT       (Seg2A_LAInfo_t, SI_update_ind, 1, &hf_seg2a_lainfo_si_update_ind),
569 CSN_DESCR_END  (Seg2A_LAInfo_t)
570
571 static const
572 CSN_DESCR_BEGIN(Segment2A_t)
573   M_FIXED_LABEL(Segment2A_t, 2, 0x2, "= Class type: 2"),
574   M_FIXED_LABEL(Segment2A_t, 4, 0x0, "= Segment type: A"),
575   M_UINT       (Segment2A_t, Class_4_version, 3, &hf_seg2a_class_4_version),
576   M_TYPE_LABEL (Segment2A_t, SyncInfo, Seg2A_SyncInfo_t, "Synchronization Info Class 2"),
577   M_TYPE_LABEL (Segment2A_t, SelectionCriterion, Seg2A_SelectionCriterion_t, "Selection Criterion"),
578   M_TYPE_LABEL (Segment2A_t, MiscInfo, Seg2A_MiscInfo_t, "Misc Info Class 2"),
579   M_TYPE_LABEL (Segment2A_t, LAInfo, Seg2A_LAInfo_t, "LA Info Class 2"),
580 CSN_DESCR_END  (Segment2A_t)
581
582 static const
583 CSN_DESCR_BEGIN(Segment2Abis_t)
584   M_FIXED_LABEL(Segment2Abis_t, 2, 0x2, "= Class type: 2"),
585   M_FIXED_LABEL(Segment2Abis_t, 4, 0x0, "= Segment type: Abis"),
586   M_UINT       (Segment2Abis_t, Class_4_version, 3, &hf_seg2a_class_4_version),
587   M_TYPE_LABEL (Segment2Abis_t, SyncInfo, Seg2A_SyncInfo_t, "Synchronization Info Class 2"),
588   M_TYPE_LABEL (Segment2Abis_t, SelectionCriterion, Seg2A_SelectionCriterion_t, "Selection Criterion"),
589   M_TYPE_LABEL (Segment2Abis_t, MiscInfo, Seg2A_MiscInfo_t, "Misc Info Class 2"),
590   M_TYPE_LABEL (Segment2Abis_t, LAInfo, Seg2A_LAInfo_t, "LA Info Class 2"),
591 CSN_DESCR_END  (Segment2Abis_t)
592
593 static const
594 CSN_DESCR_BEGIN(Segment2B_t)
595   M_FIXED_LABEL(Segment2B_t, 2, 0x2, "= Class type: 2"),
596   M_FIXED_LABEL(Segment2B_t, 4, 0x1, "= Segment type: B"),
597 CSN_DESCR_END  (Segment2B_t)
598
599 static const
600 CSN_DESCR_BEGIN(Segment2Bbis_t)
601   M_FIXED_LABEL(Segment2Bbis_t, 2, 0x2, "= Class type: 2"),
602   M_FIXED_LABEL(Segment2Bbis_t, 4, 0x1, "= Segment type: B bis"),
603 CSN_DESCR_END  (Segment2Bbis_t)
604
605         /* Segment 3A - [1] 11.5.2.71 */
606 static gint16
607 Seg3A_LAI_Dissector(proto_tree *tree _U_, csnStream_t* ar, tvbuff_t *tvb, void* data, int ett_csn1)
608 {
609         Seg3A_LAI_t *LAI = (Seg3A_LAI_t *)data;
610         proto_item *lac_item;
611         proto_tree *lac_tree;
612         guint8 c[5];
613         int i;
614
615         if (ar->remaining_bits_len < 5*8)
616                 return -1;
617
618         for (i=0; i<5; i++)
619                 c[i] = tvb_get_bits8(tvb, ar->bit_offset + (i<<3), 8);
620
621         LAI->MCC = (c[0] & 0xf) * 100 + ((c[0] & 0xf0) >> 4) * 10 + (c[1] & 0xf);
622         LAI->MNC = (c[2] & 0xf) *  10 + ((c[2] & 0xf0) >> 4);
623
624         LAI->LAC = (c[3] << 8) | c[4];
625         LAI->MSC_ID = (LAI->LAC >> 10) & 0x3f;
626         LAI->Spot_Beam_ID = LAI->LAC & 0x03ff;
627
628         proto_tree_add_uint_bits_format_value(tree, hf_seg3a_lai_mcc, tvb, ar->bit_offset, 16, (guint32)LAI->MCC, "%d", LAI->MCC);
629         proto_tree_add_uint_bits_format_value(tree, hf_seg3a_lai_mnc, tvb, ar->bit_offset+16, 8, (guint32)LAI->MNC, "%d", LAI->MNC);
630
631         lac_item = proto_tree_add_uint_bits_format_value(tree, hf_seg3a_lai_lac, tvb, ar->bit_offset+24, 16, (guint32)LAI->LAC, "0x%04x", LAI->LAC);
632         lac_tree = proto_item_add_subtree(lac_item, ett_csn1);
633
634         proto_tree_add_uint_bits_format_value(lac_tree, hf_seg3a_lai_msc_id, tvb, ar->bit_offset+24, 6, (guint32)LAI->MSC_ID, "%d", LAI->MSC_ID);
635         proto_tree_add_uint_bits_format_value(lac_tree, hf_seg3a_lai_spot_beam_id, tvb, ar->bit_offset+30, 10, (guint32)LAI->Spot_Beam_ID, "%d", LAI->Spot_Beam_ID);
636
637         ar->remaining_bits_len -= 5*8;
638         ar->bit_offset += 5*8;
639
640         return 0;
641 }
642
643 static const
644 CSN_DESCR_BEGIN(Seg3A_System_t)
645   M_UINT       (Seg3A_System_t, Satellite_ID, 2, &hf_seg3a_system_sat_id),
646   M_UINT       (Seg3A_System_t, System_ID, 4, &hf_seg3a_system_sys_id),
647 CSN_DESCR_END  (Seg3A_System_t)
648
649 static const
650 CSN_DESCR_BEGIN(Seg3A_SatellitePosition_t)
651   M_UINT       (Seg3A_SatellitePosition_t, Latitude, 8, &hf_seg3a_satpos_latitude),
652   M_UINT       (Seg3A_SatellitePosition_t, Longitude, 12, &hf_seg3a_satpos_longitude),
653   M_UINT       (Seg3A_SatellitePosition_t, Radius, 16, &hf_seg3a_satpos_radius),
654 CSN_DESCR_END  (Seg3A_SatellitePosition_t)
655
656 static const
657 CSN_DESCR_BEGIN(Seg3A_BeamPosition_t)
658   M_UINT       (Seg3A_BeamPosition_t, Latitude, 11, &hf_seg3a_beam_latitude),
659   M_UINT       (Seg3A_BeamPosition_t, Longitude, 12, &hf_seg3a_beam_longitude),
660 CSN_DESCR_END  (Seg3A_BeamPosition_t)
661
662 static const
663 CSN_DESCR_BEGIN(Seg3A_MiscInfo_t)
664   M_UINT       (Seg3A_MiscInfo_t, SB_RESELECTION_TIMER, 6, &hf_seg3a_miscinfo_sb_reselection_timer),
665 CSN_DESCR_END  (Seg3A_MiscInfo_t)
666
667 static const
668 CSN_DESCR_BEGIN(Segment3A_t)
669   M_FIXED_LABEL(Segment3A_t, 1, 0x0, "= Class type: 3"),
670   M_FIXED_LABEL(Segment3A_t, 4, 0x0, "= Segment type: A"),
671   M_SERIALIZE  (Segment3A_t, LAI, 0, Seg3A_LAI_Dissector),
672   M_TYPE_LABEL (Segment3A_t, System, Seg3A_System_t, "System"),
673   M_TYPE_LABEL (Segment3A_t, SatellitePosition, Seg3A_SatellitePosition_t, "Satellite Position"),
674   M_TYPE_LABEL (Segment3A_t, BeamPosition, Seg3A_BeamPosition_t, "Beam Center Position"),
675   M_TYPE_LABEL (Segment3A_t, MiscInfo, Seg3A_MiscInfo_t, "Misc Info Class 3"),
676   M_UINT       (Segment3A_t, Spare, 4, &hf_seg3a_spare),
677 CSN_DESCR_END  (Segment3A_t)
678
679 static const
680 CSN_DESCR_BEGIN(Segment3B_t)
681   M_FIXED_LABEL(Segment3B_t, 1, 0x0, "= Class type: 3"),
682   M_FIXED_LABEL(Segment3B_t, 4, 0x1, "= Segment type: B"),
683 CSN_DESCR_END  (Segment3B_t)
684
685 static const
686 CSN_DESCR_BEGIN(Segment3Bbis_t)
687   M_FIXED_LABEL(Segment3Bbis_t, 1, 0x0, "= Class type: 3"),
688   M_FIXED_LABEL(Segment3Bbis_t, 4, 0x1, "= Segment type: B bis"),
689 CSN_DESCR_END  (Segment3Bbis_t)
690
691 static const
692 CSN_DESCR_BEGIN(Segment3C_t)
693   M_FIXED_LABEL(Segment3C_t, 1, 0x0, "= Class type: 3"),
694   M_FIXED_LABEL(Segment3C_t, 4, 0x2, "= Segment type: C"),
695 CSN_DESCR_END  (Segment3C_t)
696
697 static const
698 CSN_DESCR_BEGIN(Segment3D_t)
699   M_FIXED_LABEL(Segment3D_t, 1, 0x0, "= Class type: 3"),
700   M_FIXED_LABEL(Segment3D_t, 4, 0x3, "= Segment type: D"),
701 CSN_DESCR_END  (Segment3D_t)
702
703 static const
704 CSN_DESCR_BEGIN(Segment3E_t)
705   M_FIXED_LABEL(Segment3E_t, 1, 0x0, "= Class type: 3"),
706   M_FIXED_LABEL(Segment3E_t, 4, 0x4, "= Segment type: E"),
707 CSN_DESCR_END  (Segment3E_t)
708
709 static const
710 CSN_DESCR_BEGIN(Segment3Ebis_t)
711   M_FIXED_LABEL(Segment3Ebis_t, 1, 0x0, "= Class type: 3"),
712   M_FIXED_LABEL(Segment3Ebis_t, 4, 0x4, "= Segment type: E bis"),
713 CSN_DESCR_END  (Segment3Ebis_t)
714
715 static const
716 CSN_DESCR_BEGIN(Segment3F_t)
717   M_FIXED_LABEL(Segment3F_t, 1, 0x0, "= Class type: 3"),
718   M_FIXED_LABEL(Segment3F_t, 4, 0x5, "= Segment type: F"),
719 CSN_DESCR_END  (Segment3F_t)
720
721 static const
722 CSN_DESCR_BEGIN(Segment3G_t)
723   M_FIXED_LABEL(Segment3G_t, 1, 0x0, "= Class type: 3"),
724   M_FIXED_LABEL(Segment3G_t, 4, 0x6, "= Segment type: G"),
725 CSN_DESCR_END  (Segment3G_t)
726
727 static const
728 CSN_DESCR_BEGIN(Segment3Gbis_t)
729   M_FIXED_LABEL(Segment3Gbis_t, 1, 0x0, "= Class type: 3"),
730   M_FIXED_LABEL(Segment3Gbis_t, 4, 0x6, "= Segment type: G bis"),
731 CSN_DESCR_END  (Segment3Gbis_t)
732
733 static const
734 CSN_DESCR_BEGIN(Segment3H_t)
735   M_FIXED_LABEL(Segment3H_t, 1, 0x0, "= Class type: 3"),
736   M_FIXED_LABEL(Segment3H_t, 4, 0x7, "= Segment type: H"),
737 CSN_DESCR_END  (Segment3H_t)
738
739 static const
740 CSN_DESCR_BEGIN(Segment3I_t)
741   M_FIXED_LABEL(Segment3I_t, 1, 0x0, "= Class type: 3"),
742   M_FIXED_LABEL(Segment3I_t, 4, 0x9, "= Segment type: I"),
743 CSN_DESCR_END  (Segment3I_t)
744
745 static const
746 CSN_DESCR_BEGIN(Segment3J_t)
747   M_FIXED_LABEL(Segment3J_t, 1, 0x0, "= Class type: 3"),
748   M_FIXED_LABEL(Segment3J_t, 4, 0xa, "= Segment type: J"),
749 CSN_DESCR_END  (Segment3J_t)
750
751 static const
752 CSN_DESCR_BEGIN(Segment3Jbis_t)
753   M_FIXED_LABEL(Segment3Jbis_t, 1, 0x0, "= Class type: 3"),
754   M_FIXED_LABEL(Segment3Jbis_t, 4, 0xa, "= Segment type: J bis"),
755 CSN_DESCR_END  (Segment3Jbis_t)
756
757 static const
758 CSN_DESCR_BEGIN(Segment3Kbis_t)
759   M_FIXED_LABEL(Segment3Kbis_t, 1, 0x0, "= Class type: 3"),
760   M_FIXED_LABEL(Segment3Kbis_t, 4, 0xb, "= Segment type: K bis"),
761 CSN_DESCR_END  (Segment3Kbis_t)
762
763 #if 0
764 static const
765 CSN_DESCR_BEGIN(Segment3L_t)
766   M_FIXED_LABEL(Segment3L_t, 1, 0x0, "= Class type: 3"),
767   M_FIXED_LABEL(Segment3L_t, 4, 0xc, "= Segment type: L"),
768 CSN_DESCR_END  (Segment3L_t)
769 #endif
770
771 #if 0
772 static const
773 CSN_DESCR_BEGIN(Segment3M_t)
774   M_FIXED_LABEL(Segment3M_t, 1, 0x0, "= Class type: 3"),
775   M_FIXED_LABEL(Segment3M_t, 4, 0xd, "= Segment type: M"),
776 CSN_DESCR_END  (Segment3M_t)
777 #endif
778
779 static const
780 CSN_DESCR_BEGIN(Segment4A_t)
781   M_FIXED_LABEL(Segment4A_t, 3, 0x6, "= Class type: 4"),
782   M_FIXED_LABEL(Segment4A_t, 4, 0x0, "= Segment type: A"),
783 CSN_DESCR_END  (Segment4A_t)
784
785 static const
786 CSN_DESCR_BEGIN(Segment4B_t)
787   M_FIXED_LABEL(Segment4B_t, 3, 0x6, "= Class type: 4"),
788   M_FIXED_LABEL(Segment4B_t, 4, 0x1, "= Segment type: B"),
789 CSN_DESCR_END  (Segment4B_t)
790
791 static const
792 CSN_DESCR_BEGIN(Segment4C_t)
793   M_FIXED_LABEL(Segment4C_t, 3, 0x6, "= Class type: 4"),
794   M_FIXED_LABEL(Segment4C_t, 4, 0x2, "= Segment type: C"),
795 CSN_DESCR_END  (Segment4C_t)
796
797 static const
798 CSN_DESCR_BEGIN(Segment4D_t)
799   M_FIXED_LABEL(Segment4D_t, 3, 0x6, "= Class type: 4"),
800   M_FIXED_LABEL(Segment4D_t, 4, 0x3, "= Segment type: D"),
801 CSN_DESCR_END  (Segment4D_t)
802
803 static const
804 CSN_DESCR_BEGIN(Segment4E_t)
805   M_FIXED_LABEL(Segment4E_t, 3, 0x6, "= Class type: 4"),
806   M_FIXED_LABEL(Segment4E_t, 4, 0x4, "= Segment type: E"),
807 CSN_DESCR_END  (Segment4E_t)
808
809 static const
810 CSN_DESCR_BEGIN(Segment4F_t)
811   M_FIXED_LABEL(Segment4F_t, 3, 0x6, "= Class type: 4"),
812   M_FIXED_LABEL(Segment4F_t, 4, 0x5, "= Segment type: F"),
813 CSN_DESCR_END  (Segment4F_t)
814
815 static const
816 CSN_DESCR_BEGIN(Segment4G_t)
817   M_FIXED_LABEL(Segment4G_t, 3, 0x6, "= Class type: 4"),
818   M_FIXED_LABEL(Segment4G_t, 4, 0x6, "= Segment type: G"),
819 CSN_DESCR_END  (Segment4G_t)
820
821 static const
822 CSN_DESCR_BEGIN(Segment4H_t)
823   M_FIXED_LABEL(Segment4H_t, 3, 0x6, "= Class type: 4"),
824   M_FIXED_LABEL(Segment4H_t, 4, 0x7, "= Segment type: H"),
825 CSN_DESCR_END  (Segment4H_t)
826
827 static const
828 CSN_DESCR_BEGIN(Segment4I_t)
829   M_FIXED_LABEL(Segment4I_t, 3, 0x6, "= Class type: 4"),
830   M_FIXED_LABEL(Segment4I_t, 4, 0x8, "= Segment type: I"),
831 CSN_DESCR_END  (Segment4I_t)
832
833 static const
834 CSN_DESCR_BEGIN(Segment4J_t)
835   M_FIXED_LABEL(Segment4J_t, 3, 0x6, "= Class type: 4"),
836   M_FIXED_LABEL(Segment4J_t, 4, 0x9, "= Segment type: J"),
837 CSN_DESCR_END  (Segment4J_t)
838
839 static const
840 CSN_DESCR_BEGIN(Segment4K_t)
841   M_FIXED_LABEL(Segment4K_t, 3, 0x6, "= Class type: 4"),
842   M_FIXED_LABEL(Segment4K_t, 4, 0xa, "= Segment type: K"),
843 CSN_DESCR_END  (Segment4K_t)
844
845
846 /* System information */
847
848         /* System Information type 1 - [1] 10.1.31 */
849
850 static const
851 CSN_DESCR_BEGIN(SI1_Block_Header_t)
852   M_UINT       (SI1_Block_Header_t, Protocol_Version, 4, &hf_si_protocol_version),
853   M_UINT       (SI1_Block_Header_t, Block_Type, 1, &hf_si_block_type),
854   M_UINT       (SI1_Block_Header_t, Randomization_Period, 2, &hf_si1_randomization_period),
855   M_UINT       (SI1_Block_Header_t, Spare, 1, &hf_si_spare),
856 CSN_DESCR_END  (SI1_Block_Header_t)
857
858 static const
859 CSN_ChoiceElement_t SI1_SegmentChoice[] =
860 {
861   {6, 0x20, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment2Abis, Segment2Abis_t, "Segment 2A bis")},
862   {6, 0x21, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment2Bbis, Segment2Bbis_t, "Segment 2B bis")},
863   {5, 0x00, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3A,    Segment3A_t,    "Segment 3A")},
864   {5, 0x01, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3Bbis, Segment3Bbis_t, "Segment 3B bis")},
865   {5, 0x02, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3C,    Segment3C_t,    "Segment 3C")},
866   {5, 0x03, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3D,    Segment3D_t,    "Segment 3D")},
867   {5, 0x04, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3Ebis, Segment3Ebis_t, "Segment 3E bis")},
868   {5, 0x05, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3F,    Segment3F_t,    "Segment 3F")},
869   {5, 0x06, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3Gbis, Segment3Gbis_t, "Segment 3G bis")},
870   {5, 0x07, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3H,    Segment3H_t,    "Segment 3H")},
871   {5, 0x09, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3I,    Segment3I_t,    "Segment 3I")},
872   {5, 0x0a, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3Jbis, Segment3Jbis_t, "Segment 3J bis")},
873   {5, 0x0b, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment3Kbis, Segment3Kbis_t, "Segment 3K bis")},
874   {7, 0x60, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4A,    Segment4A_t,    "Segment 4A")},
875   {7, 0x61, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4B,    Segment4B_t,    "Segment 4B")},
876   {7, 0x62, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4C,    Segment4C_t,    "Segment 4C")},
877   {7, 0x63, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4D,    Segment4D_t,    "Segment 4D")},
878   {7, 0x64, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4E,    Segment4E_t,    "Segment 4E")},
879   {7, 0x65, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4F,    Segment4F_t,    "Segment 4F")},
880   {7, 0x66, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4G,    Segment4G_t,    "Segment 4G")},
881   {7, 0x67, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4H,    Segment4H_t,    "Segment 4H")},
882   {7, 0x68, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4I,    Segment4I_t,    "Segment 4I")},
883   {7, 0x69, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4J,    Segment4J_t,    "Segment 4J")},
884   {7, 0x6a, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4K,    Segment4K_t,    "Segment 4K")},
885   {0, 0x00, 1, CSN_ERROR(SystemInformation1_t, "Unknown segment !", -1)},
886 };
887
888 static const
889 CSN_DESCR_BEGIN(SystemInformation1_t)
890   M_TYPE_LABEL (SystemInformation1_t, Block_Header, SI1_Block_Header_t, "Block Header"),
891   M_TYPE_LABEL (SystemInformation1_t, Segment1A, Segment1A_t, "Segment 1A"),
892   M_CHOICE_IL  (SystemInformation1_t, SegmentType, SI1_SegmentChoice, ElementsOf(SI1_SegmentChoice)),
893 CSN_DESCR_END  (SystemInformation1_t)
894
895         /* System Information type 2 - [1] 10.1.32 */
896
897 CSN_DESCR_BEGIN(SI2_Block_Header_t)
898   M_UINT       (SI2_Block_Header_t, Protocol_Version, 4, &hf_si_protocol_version),
899   M_UINT       (SI2_Block_Header_t, Block_Type, 1, &hf_si_block_type),
900   M_UINT       (SI2_Block_Header_t, Spare, 3, &hf_si_spare),
901 CSN_DESCR_END  (SI2_Block_Header_t)
902
903 static const
904 CSN_ChoiceElement_t SI2_SegmentChoice[] =
905 {
906   {6, 0x20, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment2A, Segment2A_t, "Segment 2A")},
907   {6, 0x21, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment2B, Segment2B_t, "Segment 2B")},
908   {5, 0x01, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3B, Segment3B_t, "Segment 3B")},
909   {5, 0x04, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3E, Segment3E_t, "Segment 3E")},
910   {5, 0x06, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3G, Segment3G_t, "Segment 3G")},
911   {5, 0x0a, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3J, Segment3J_t, "Segment 3J")},
912   {0, 0x00, 1, CSN_ERROR(SystemInformation2_t, "Unknown segment !", -1)},
913 };
914
915 static const
916 CSN_DESCR_BEGIN(SystemInformation2_t)
917   M_TYPE_LABEL (SystemInformation2_t, Block_Header, SI2_Block_Header_t, "Block Header"),
918   M_CHOICE_IL  (SystemInformation2_t, SegmentType, SI2_SegmentChoice, ElementsOf(SI2_SegmentChoice)),
919 CSN_DESCR_END  (SystemInformation2_t)
920
921
922 /* ------------------------------------------------------------------------ */
923 /* Fields values                                                            */
924 /* ------------------------------------------------------------------------ */
925
926 /* Common stuff */
927 static void
928 segx_half_db_value_fmt(gchar *s, guint32 v)
929 {
930         g_snprintf(s, ITEM_LABEL_LENGTH, "%2.1f dB (%u)", v * 0.5f, v);
931 }
932
933 /* Segment 1A - [3] 11.5.2.66 */
934 static void
935 seg1a_syncinfo_sa_freq_offset_fmt(gchar *s, guint32 v)
936 {
937         gint32 sv = (gint32)v;
938         g_snprintf(s, ITEM_LABEL_LENGTH, "%d Hz (%d)", sv * 5, sv);
939 }
940
941 static const value_string seg1a_rachctrl_acc_vals[] = {
942         {  0, "not barred (allowed)"},
943         {  1, "barred (not allowed)"},
944         {  0, NULL }
945 };
946
947 static const value_string seg1a_rachctrl_cell_bar_access_vals[] = {
948         {  0, "The cell is not barred"},
949         {  1, "The cell is barred"},
950         {  0, NULL }
951 };
952
953 /* Segment 2A & 2Abis - [1] 11.5.2.67 & 11.5.2.68 */
954 static const value_string seg2a_lainfo_imsi_attach_detach_ind_vals[] = {
955         {  0, "MESs shall NOT apply IMSI attach and detach procedure for this LA"},
956         {  1, "MESs shall apply IMSI attach and detach procedure for this LA"},
957         {  0, NULL }
958 };
959
960 static const value_string seg2a_lainfo_ecsc_indication_vals[] = {
961         {  0, "Early sending is explicitly prohibited"},
962         {  1, "Early sending is explicitly accepted"},
963         {  0, NULL }
964 };
965
966 /* Segment 3A - [1] 11.5.2.71 */
967 static void
968 seg3a_latitude_fmt(gchar *s, guint32 v)
969 {
970         gint32 sv = (gint32)v;
971         char c;
972
973         if (sv < 0) {
974                 c = 'S';
975                 sv = -sv;
976         } else
977                 c = 'N';
978
979         g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f %c (%d)", sv / 10.0f, c, sv);
980 }
981
982 static void
983 seg3a_longitude_fmt(gchar *s, guint32 v)
984 {
985         gint32 sv;
986         char c;
987
988         if (v < 1800) {
989                 c = 'W';
990                 sv = v;
991         } else {
992                 c = 'E';
993                 sv = 3600 - v;
994         }
995
996         g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f %c (%u)", sv / 10.0f, c, v);
997 }
998
999 static void
1000 seg3a_satpos_radius_fmt(gchar *s, guint32 v)
1001 {
1002         gint32 sv = (gint32)v;
1003         gint32 a = (42162 * 1000) + (sv * 5);
1004         g_snprintf(s, ITEM_LABEL_LENGTH, "%.3lf km (%u)", a / 1000.0, sv);
1005 }
1006
1007 static void
1008 seg3a_miscinfo_sb_reselection_timer_fmt(gchar *s, guint32 v)
1009 {
1010         g_snprintf(s, ITEM_LABEL_LENGTH, "%d minutes (%u)", v*4, v);
1011 }
1012
1013 /* System Information 1 - [1] 10.3.31 */
1014 static const value_string si1_randomization_period_vals[] = {
1015         { 0, "7 frames after this SI block" },
1016         { 1, "15 frames after this SI block" },
1017         { 2, "23 frames after this SI block" },
1018         { 3, "31 frames after this SI block" },
1019         { 0, NULL }
1020 };
1021
1022
1023 /* ------------------------------------------------------------------------ */
1024 /* Dissector code                                                           */
1025 /* ------------------------------------------------------------------------ */
1026
1027 static void
1028 dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1029 {
1030         proto_item  *bcch_item = NULL;
1031         proto_tree  *bcch_tree = NULL;
1032         csnStream_t  ar;
1033         gboolean     is_si1;
1034
1035         col_append_str(pinfo->cinfo, COL_INFO, "(BCCH) ");
1036
1037         is_si1 = tvb_get_bits8(tvb, 0, 5) & 1;
1038
1039         bcch_item =  proto_tree_add_protocol_format(
1040                 tree, proto_gmr1_bcch, tvb, 0, -1,
1041                 "GMR-1 BCCH - System Information type %d", is_si1 ? 1 : 2
1042         );
1043         bcch_tree = proto_item_add_subtree(bcch_item, ett_gmr1_bcch);
1044
1045         csnStreamInit(&ar, 0, tvb_length(tvb)*8);
1046
1047         /* SI1 or SI2 */
1048         if (is_si1) {
1049                 SystemInformation1_t *data;
1050                 data = wmem_new(wmem_packet_scope(), SystemInformation1_t);
1051                 /* Initialize the type to the last element, which is an
1052                  * "Unknown", in case the dissector bails before getting this
1053                  * far. */
1054                 data->SegmentType = array_length(SI1_SegmentChoice) - 1;
1055                 csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation1_t), tvb, data, ett_gmr1_bcch);
1056                 col_append_fstr(
1057                         pinfo->cinfo, COL_INFO,
1058                         "System Information 1: Segment 1A, %s",
1059                         SI1_SegmentChoice[data->SegmentType].descr.sz
1060                 );
1061         } else {
1062                 SystemInformation2_t *data;
1063                 data = wmem_new(wmem_packet_scope(), SystemInformation2_t);
1064                 /* Initialize the type to the last element, which is an
1065                  * "Unknown", in case the dissector bails before getting this
1066                  * far. */
1067                 data->SegmentType = array_length(SI2_SegmentChoice) - 1;
1068                 csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation2_t), tvb, data, ett_gmr1_bcch);
1069                 col_append_fstr(
1070                         pinfo->cinfo, COL_INFO,
1071                         "System Information 2: %s",
1072                         SI2_SegmentChoice[data->SegmentType].descr.sz
1073                 );
1074         }
1075 }
1076
1077 void
1078 proto_register_gmr1_bcch(void)
1079 {
1080         static hf_register_info hf[] = {
1081                 /* Segment 1A - [3] 11.5.2.66 */
1082                 { &hf_seg1a_class_2_version,
1083                   { "Class 2 version", "gmr1.bcch.seg1a.class_2_version",
1084                     FT_UINT8, BASE_DEC, NULL, 0x00,
1085                     "Version number for current Class 2 information", HFILL }
1086                 },
1087                 { &hf_seg1a_class_3_version,
1088                   { "Class 3 version", "gmr1.bcch.seg1a.class_3_version",
1089                     FT_UINT8, BASE_DEC, NULL, 0x00,
1090                     "Version number for current Class 3 information", HFILL }
1091                 },
1092                 { &hf_seg1a_syncinfo_sb_frame_ts_offset,
1093                   { "SB_FRAME_TS_OFFSET", "gmr1.bcch.seg1a.syncinfo.sb_frame_ts_offset",
1094                     FT_UINT8, BASE_DEC, NULL, 0x00,
1095                     NULL, HFILL }
1096                 },
1097                 { &hf_seg1a_syncinfo_sb_symbol_offset,
1098                   { "SB_SYMBOL_OFFSET", "gmr1.bcch.seg1a.syncinfo.sb_symbol_offset",
1099                     FT_INT8, BASE_DEC, NULL, 0x00,
1100                     NULL, HFILL }
1101                 },
1102                 { &hf_seg1a_syncinfo_sa_freq_offset,
1103                   { "SA_FREQ_OFFSET", "gmr1.bcch.seg1a.syncinfo.sa_freq_offset",
1104                     FT_UINT8, BASE_CUSTOM, seg1a_syncinfo_sa_freq_offset_fmt, 0x00,
1105                     NULL, HFILL }
1106                 },
1107                 { &hf_seg1a_rachctrl_max_retrans,
1108                   { "Max Retrans", "gmr1.bcch.seg1a.rachctrl.max_retrans",
1109                     FT_UINT8, BASE_DEC, NULL, 0x00,
1110                     NULL, HFILL }
1111                 },
1112                 { &hf_seg1a_rachctrl_acc[15],
1113                   { "AC15", "gmr1.bcch.seg1a.rachctrl.ac15",
1114                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1115                     "Access Class 15 barred", HFILL }
1116                 },
1117                 { &hf_seg1a_rachctrl_acc[14],
1118                   { "AC14", "gmr1.bcch.seg1a.rachctrl.ac14",
1119                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1120                     "Access Class 14 barred", HFILL }
1121                 },
1122                 { &hf_seg1a_rachctrl_acc[13],
1123                   { "AC13", "gmr1.bcch.seg1a.rachctrl.ac13",
1124                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1125                     "Access Class 13 barred", HFILL }
1126                 },
1127                 { &hf_seg1a_rachctrl_acc[12],
1128                   { "AC12", "gmr1.bcch.seg1a.rachctrl.ac12",
1129                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1130                     "Access Class 12 barred", HFILL }
1131                 },
1132                 { &hf_seg1a_rachctrl_acc[11],
1133                   { "AC11", "gmr1.bcch.seg1a.rachctrl.ac11",
1134                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1135                     "Access Class 11 barred", HFILL }
1136                 },
1137                 { &hf_seg1a_rachctrl_acc[10],
1138                   { "EC10", "gmr1.bcch.seg1a.rachctrl.ac10",
1139                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1140                     "Emergency Class 10 barred", HFILL }
1141                 },
1142                 { &hf_seg1a_rachctrl_acc[9],
1143                   { "AC9", "gmr1.bcch.seg1a.rachctrl.ac9",
1144                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1145                     "Access Class 9 barred", HFILL }
1146                 },
1147                 { &hf_seg1a_rachctrl_acc[8],
1148                   { "AC8", "gmr1.bcch.seg1a.rachctrl.ac8",
1149                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1150                     "Access Class 8 barred", HFILL }
1151                 },
1152                 { &hf_seg1a_rachctrl_acc[7],
1153                   { "AC7", "gmr1.bcch.seg1a.rachctrl.ac7",
1154                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1155                     "Access Class 7 barred", HFILL }
1156                 },
1157                 { &hf_seg1a_rachctrl_acc[6],
1158                   { "AC6", "gmr1.bcch.seg1a.rachctrl.ac6",
1159                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1160                     "Access Class 6 barred", HFILL }
1161                 },
1162                 { &hf_seg1a_rachctrl_acc[5],
1163                   { "AC5", "gmr1.bcch.seg1a.rachctrl.ac5",
1164                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1165                     "Access Class 5 barred", HFILL }
1166                 },
1167                 { &hf_seg1a_rachctrl_acc[4],
1168                   { "AC4", "gmr1.bcch.seg1a.rachctrl.ac4",
1169                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1170                     "Access Class 4 barred", HFILL }
1171                 },
1172                 { &hf_seg1a_rachctrl_acc[3],
1173                   { "AC3", "gmr1.bcch.seg1a.rachctrl.ac3",
1174                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1175                     "Access Class 3 barred", HFILL }
1176                 },
1177                 { &hf_seg1a_rachctrl_acc[2],
1178                   { "AC2", "gmr1.bcch.seg1a.rachctrl.ac2",
1179                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1180                     "Access Class 2 barred", HFILL }
1181                 },
1182                 { &hf_seg1a_rachctrl_acc[1],
1183                   { "AC1", "gmr1.bcch.seg1a.rachctrl.ac1",
1184                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1185                     "Access Class 1 barred", HFILL }
1186                 },
1187                 { &hf_seg1a_rachctrl_acc[0],
1188                   { "AC0", "gmr1.bcch.seg1a.rachctrl.ac0",
1189                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_acc_vals), 0x00,
1190                     "Access Class 0 barred", HFILL }
1191                 },
1192                 { &hf_seg1a_rachctrl_cell_bar_access,
1193                   { "CELL_BAR_ACCESS", "gmr1.bcch.seg1a.rachctrl.cell_bar_access",
1194                     FT_UINT8, BASE_DEC, VALS(seg1a_rachctrl_cell_bar_access_vals), 0x00,
1195                     NULL, HFILL }
1196                 },
1197                 { &hf_seg1a_miscinfo_sb_reselection_hysteresis,
1198                   { "SB_RESELECTION_HYSTERESIS", "gmr1.bcch.seg1a.miscinfo.sb_reselection_hysteresis",
1199                     FT_UINT8, BASE_CUSTOM, segx_half_db_value_fmt, 0x00,
1200                     NULL, HFILL }
1201                 },
1202                 { &hf_seg1a_miscinfo_spare,
1203                   { "Spare", "gmr1.bcch.seg1a.miscinfo.spare",
1204                     FT_UINT8, BASE_DEC, NULL, 0x00,
1205                     NULL, HFILL }
1206                 },
1207                 { &hf_seg1a_miscinfo_priority_access_ind,
1208                   { "Priority Access Ind", "gmr1.bcch.seg1a.miscinfo.priority_access_ind",
1209                     FT_UINT8, BASE_DEC, NULL, 0x00,
1210                     "Reserved for future use", HFILL }
1211                 },
1212                 { &hf_seg1a_gbch_present,
1213                   { "GBCH Present", "gmr1.bcch.seg1a.gbch_present",
1214                     FT_UINT8, BASE_DEC, NULL, 0x00,
1215                     NULL, HFILL }
1216                 },
1217                 { &hf_seg1a_test_gs,
1218                   { "Test GS", "gmr1.bcch.seg1a.test_gs",
1219                     FT_UINT8, BASE_DEC, NULL, 0x00,
1220                     NULL, HFILL }
1221                 },
1222                 { &hf_seg1a_test_gs2,
1223                   { "Test GS2", "gmr1.bcch.seg1a.test_gs2",
1224                     FT_UINT8, BASE_DEC, NULL, 0x00,
1225                     NULL, HFILL }
1226                 },
1227                 { &hf_seg1a_spare1,
1228                   { "Spare", "gmr1.bcch.seg1a.spare1",
1229                     FT_UINT8, BASE_DEC, NULL, 0x00,
1230                     NULL, HFILL }
1231                 },
1232                 { &hf_seg1a_cell_bar_access_extension2,
1233                   { "CELL_BAR_ACCESS_EXTENSION2", "gmr1.bcch.seg1a.cell_bar_access_extension2",
1234                     FT_UINT8, BASE_DEC, NULL, 0x00,
1235                     NULL, HFILL }
1236                 },
1237                 { &hf_seg1a_spare2,
1238                   { "Spare", "gmr1.bcch.seg1a.spare2",
1239                     FT_UINT8, BASE_DEC, NULL, 0x00,
1240                     NULL, HFILL }
1241                 },
1242                 { &hf_seg1a_cell_bar_access_extension,
1243                   { "CELL_BAR_ACCESS_EXTENSION", "gmr1.bcch.seg1a.cell_bar_access_extension",
1244                     FT_UINT8, BASE_DEC, NULL, 0x00,
1245                     NULL, HFILL }
1246                 },
1247
1248                 /* Segment 2A - [1] 11.5.2.67 */
1249                 { &hf_seg2a_class_4_version,
1250                   { "Class 4 version", "gmr1.bcch.seg2a.class_4_version",
1251                     FT_UINT8, BASE_DEC, NULL, 0x00,
1252                     "Version number for current Class 4 information", HFILL }
1253                 },
1254                 { &hf_seg2a_syncinfo_sa_sirfn_delay,
1255                   { "SA_SIRFN_DELAY", "gmr1.bcch.seg2a.syncinfo.sa_sirfn_delay",
1256                     FT_UINT8, BASE_DEC, NULL, 0x00,
1257                     "Delay of system information relative to superframe", HFILL }
1258                 },
1259                 { &hf_seg2a_syncinfo_sa_bcch_stn,
1260                   { "SA_BCCH_STN", "gmr1.bcch.seg2a.syncinfo.sa_bcch_stn",
1261                     FT_UINT8, BASE_DEC, NULL, 0x00,
1262                     "Starting timeslot number", HFILL }
1263                 },
1264                 { &hf_seg2a_syncinfo_superframe_num,
1265                   { "Superframe Number", "gmr1.bcch.seg2a.syncinfo.superframe_num",
1266                     FT_UINT16, BASE_DEC, NULL, 0x00,
1267                     NULL, HFILL }
1268                 },
1269                 { &hf_seg2a_syncinfo_multiframe_num,
1270                   { "Multiframe Number", "gmr1.bcch.seg2a.syncinfo.multiframe_num",
1271                     FT_UINT8, BASE_DEC, NULL, 0x00,
1272                     "Multiframe number in a superframe", HFILL }
1273                 },
1274                 { &hf_seg2a_syncinfo_mffn_high_bit,
1275                   { "MFFN high bit", "gmr1.bcch.seg2a.syncinfo.mffn_high_bit",
1276                     FT_UINT8, BASE_DEC, NULL, 0x00,
1277                     "High bit of the TDMA FN in a multiframe", HFILL }
1278                 },
1279                 { &hf_seg2a_selcrit_rxlev_select_min,
1280                   { "RXLEV_SELECT_MIN", "gmr1.bcch.seg2a.selcrit.rxlev_select_min",
1281                     FT_UINT8, BASE_CUSTOM, segx_half_db_value_fmt, 0x00,
1282                     "Adjustment to threshold to camp-on system", HFILL }
1283                 },
1284                 { &hf_seg2a_miscinfo_sb_selection_power,
1285                   { "SB_SELECTION_POWER", "gmr1.bcch.seg2a.miscinfo.sb_selection_power",
1286                     FT_UINT8, BASE_CUSTOM, segx_half_db_value_fmt, 0x00,
1287                     NULL, HFILL }
1288                 },
1289                 { &hf_seg2a_lainfo_sa_pch_config,
1290                   { "SA_PCH_CONFIG", "gmr1.bcch.seg2a.lainfo.sa_pch_config",
1291                     FT_UINT8, BASE_DEC, NULL, 0x00,
1292                     "Paging group configuration information", HFILL }
1293                 },
1294                 { &hf_seg2a_lainfo_sa_bach_config,
1295                   { "SA_BACH_CONFIG", "gmr1.bcch.seg2a.lainfo.sa_bach_config",
1296                     FT_UINT8, BASE_DEC, NULL, 0x00,
1297                     "Alerting group configuration information", HFILL }
1298                 },
1299                 { &hf_seg2a_lainfo_rach_ts_offset,
1300                   { "RACH_TS_OFFSET", "gmr1.bcch.seg2a.lainfo.rach_ts_offset",
1301                     FT_UINT8, BASE_DEC, NULL, 0x00,
1302                     "Start of RACH window with respect to BCCH", HFILL }
1303                 },
1304                 { &hf_seg2a_lainfo_n_page_occurrences,
1305                   { "N Page Occurrences", "gmr1.bcch.seg2a.lainfo.n_page_occurrences",
1306                     FT_UINT8, BASE_DEC, NULL, 0x00,
1307                     "Number of times a page shall be retransmitted after the initial transmission", HFILL }
1308                 },
1309                 { &hf_seg2a_lainfo_imsi_attach_detach_ind,
1310                   { "IMSI attach-detach ind", "gmr1.bcch.seg2a.lainfo.imsi_attach_detach_ind",
1311                     FT_UINT8, BASE_DEC, VALS(seg2a_lainfo_imsi_attach_detach_ind_vals), 0x00,
1312                     "Should MESs apply IMSI attach and detach procedure for this LA", HFILL }
1313                 },
1314                 { &hf_seg2a_lainfo_ecsc_indication,
1315                   { "ECSC indication", "gmr1.bcch.seg2a.lainfo.ecsc_indication",
1316                     FT_UINT8, BASE_DEC, VALS(seg2a_lainfo_ecsc_indication_vals), 0x00,
1317                     "Early Classmark Sending Control", HFILL }
1318                 },
1319                 { &hf_seg2a_lainfo_si_update_ind,
1320                   { "SI update ind", "gmr1.bcch.seg2a.lainfo.si_update_ind",
1321                     FT_UINT8, BASE_DEC, NULL, 0x00,
1322                     "Flag for BACH reorganization. Value changes after each reorganization", HFILL }
1323                 },
1324
1325                 /* Segment 3A - [1] 11.5.2.71 */
1326                 { &hf_seg3a_lai_mcc,
1327                   { "Mobile Country Code (MCC)", "gmr1.bcch.seg3a.lai.mcc",
1328                     FT_UINT16, BASE_DEC, NULL, 0x00,
1329                     NULL, HFILL }
1330                 },
1331                 { &hf_seg3a_lai_mnc,
1332                   { "Mobile Network Code (MNC)", "gmr1.bcch.seg3a.lai.mnc",
1333                     FT_UINT16, BASE_DEC, NULL, 0x00,
1334                     NULL, HFILL }
1335                 },
1336                 { &hf_seg3a_lai_lac,
1337                   { "Location Area Code (LAC)", "gmr1.bcch.seg3a.lai.lac",
1338                     FT_UINT16, BASE_HEX, NULL, 0x00,
1339                     NULL, HFILL }
1340                 },
1341                 { &hf_seg3a_lai_msc_id,
1342                   { "MSC ID", "gmr1.bcch.seg3a.lai.msc_id",
1343                     FT_UINT8, BASE_DEC, NULL, 0x00,
1344                     NULL, HFILL }
1345                 },
1346                 { &hf_seg3a_lai_spot_beam_id,
1347                   { "Spot Beam ID", "gmr1.bcch.seg3a.lai.spot_beam_id",
1348                     FT_UINT16, BASE_DEC, NULL, 0x00,
1349                     NULL, HFILL }
1350                 },
1351                 { &hf_seg3a_system_sat_id,
1352                   { "Satellite ID", "gmr1.bcch.seg3a.system.sat_id",
1353                     FT_UINT8, BASE_DEC, NULL, 0x00,
1354                     NULL, HFILL }
1355                 },
1356                 { &hf_seg3a_system_sys_id,
1357                   { "System ID", "gmr1.bcch.seg3a.system.sys_id",
1358                     FT_UINT8, BASE_DEC, NULL, 0x00,
1359                     NULL, HFILL }
1360                 },
1361                 { &hf_seg3a_satpos_latitude,
1362                   { "Latitude", "gmr1.bcch.seg3a.satpos.latitude",
1363                     FT_INT8, BASE_CUSTOM, seg3a_latitude_fmt, 0x00,
1364                     NULL, HFILL }
1365                 },
1366                 { &hf_seg3a_satpos_longitude,
1367                   { "Longitude", "gmr1.bcch.seg3a.satpos.longitude",
1368                     FT_UINT16, BASE_CUSTOM, seg3a_longitude_fmt, 0x00,
1369                     NULL, HFILL }
1370                 },
1371                 { &hf_seg3a_satpos_radius,
1372                   { "Radius", "gmr1.bcch.seg3a.satpos.radius",
1373                     FT_INT16, BASE_CUSTOM, seg3a_satpos_radius_fmt, 0x00,
1374                     NULL, HFILL }
1375                 },
1376                 { &hf_seg3a_beam_latitude,
1377                   { "Latitude", "gmr1.bcch.seg3a.beam.latitude",
1378                     FT_INT16, BASE_CUSTOM, seg3a_latitude_fmt, 0x00,
1379                     NULL, HFILL }
1380                 },
1381                 { &hf_seg3a_beam_longitude,
1382                   { "Longitude", "gmr1.bcch.seg3a.beam.longitude",
1383                     FT_UINT16, BASE_CUSTOM, seg3a_longitude_fmt, 0x00,
1384                     NULL, HFILL }
1385                 },
1386                 { &hf_seg3a_miscinfo_sb_reselection_timer,
1387                   { "SB_RESELECTION_TIMER", "gmr1.bcch.seg3a.sb_reselection_timer",
1388                     FT_UINT8, BASE_CUSTOM, seg3a_miscinfo_sb_reselection_timer_fmt, 0x00,
1389                     NULL, HFILL }
1390                 },
1391                 { &hf_seg3a_spare,
1392                   { "Spare", "gmr1.bcch.seg3a.spare",
1393                     FT_UINT8, BASE_DEC, NULL, 0x00,
1394                     NULL, HFILL }
1395                 },
1396
1397                 /* System Information fields - [1] 10.1.31 & 10.1.32 */
1398                 { &hf_si_protocol_version,
1399                   { "Protocol version", "gmr1.bcch.si.protocol_version",
1400                     FT_UINT8, BASE_DEC, NULL, 0x00,
1401                     NULL, HFILL }
1402                 },
1403                 { &hf_si_block_type,
1404                   { "Block Type", "gmr1.bcch.si.block_type",
1405                     FT_UINT8, BASE_DEC, NULL, 0x00,
1406                     NULL, HFILL }
1407                 },
1408                 { &hf_si_spare,
1409                   { "Spare", "gmr1.bcch.si.spare",
1410                     FT_UINT8, BASE_DEC, NULL, 0x00,
1411                     NULL, HFILL }
1412                 },
1413                 { &hf_si1_randomization_period,
1414                   { "Randomization Period", "gmr1.bcch.si.randomization_period",
1415                     FT_UINT8, BASE_DEC, VALS(si1_randomization_period_vals), 0x00,
1416                     NULL, HFILL }
1417                 },
1418         };
1419
1420         static gint *ett[] = {
1421                 &ett_gmr1_bcch,
1422         };
1423
1424         proto_gmr1_bcch = proto_register_protocol("GEO-Mobile Radio (1) BCCH", "GMR-1 BCCH", "gmr1.bcch");
1425
1426         proto_register_field_array(proto_gmr1_bcch, hf, array_length(hf));
1427         proto_register_subtree_array(ett, array_length(ett));
1428
1429         register_dissector("gmr1_bcch", dissect_gmr1_bcch, proto_gmr1_bcch);
1430 }
1431
1432 /*
1433  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
1434  *
1435  * Local variables:
1436  * c-basic-offset: 8
1437  * tab-width: 8
1438  * indent-tabs-mode: t
1439  * End:
1440  *
1441  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1442  * :indentSize=8:tabSize=8:noTabs=false:
1443  */