summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cell_broadcast.c
blob: a4ca519fcdf75e53f56e996caa9f8fc220add4ca (plain)
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
/* packet-gsm_cell_broadcast.c
 * Routines for GSM Cell Broadcast Service dissection - A.K.A. 3GPP 23.041 (GSM 03.41) section 9.4
 *
 * Copyright 2011, Mike Morrin <mike.morrin [AT] ipaccess.com>
 *
 * 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 <epan/packet.h>

#include <epan/asn1.h>

#include <epan/expert.h>
#include <epan/reassemble.h>

#include "packet-gsm_map.h"

#include "packet-cell_broadcast.h"

void proto_register_cbs(void);

#define GSM_CBS_PAGE_SIZE 88

static const value_string message_id_values[] = {
   { 0, "Index"},
   { 10, "Flashes"},
   { 20, "Hospitals"},
   { 22, "Doctors"},
   { 24, "Pharmacy"},
   { 30, "Long Distance Road Reports"},
   { 32, "Local Road Reports"},
   { 34, "Taxis"},
   { 40, "Weather"},
   { 50, "Regional Services (local phone prefixes) / District (Base Station Identity)"},
   { 52, "Network Information"},
   { 54, "Operator Service"},
   { 56, "Directory Enquiries (national)"},
   { 57, "Directory Enquiries (international)"},
   { 58, "Customer Care (national)"},
   { 59, "Customer Care (international)"},
   { 60, "Local Date/Time Group incl. Time Zone"},
   { 100, "Regional Services (local phone prefixes)"},
   { 101, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 102, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 103, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 104, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 105, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 106, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 107, "planned for news, events, whether, traffic, TV station and News of the day"},
   { 123, "Mobile Auction"},
   { 140, "Handelsblatt (latest info from stock exchange)"},
   { 666, "PASSO Traffic Alert (brief teaser information for IVR)"},
   { 1000, "LCS CBS Message Identifier for E-OTD Assistance Data message"},
   { 1001, "LCS CBS Message Identifier for DGPS Correction Data message"},
   { 1002, "LCS CBS Message Identifier for GPS Ephemeris and Clock Correction Data message"},
   { 1003, "LCS CBS Message Identifier for GPS Almanac and Other Data message"},
   { 4352, "ETWS CBS Message Identifier for earthquake warning message"},
   { 4353, "ETWS CBS Message Identifier for tsunami warning message"},
   { 4354, "ETWS CBS Message Identifier for earthquake and tsunami combined warning message"},
   { 4355, "ETWS CBS Message Identifier for test message"},
   { 4356, "ETWS CBS Message Identifier for messages related to other emergency types"},
   { 4370, "CMAS CBS Message Identifier for CMAS Presidential Level Alerts"},
   { 4371, "CMAS CBS Message Identifier for CMAS Extreme Alerts with Severity of Extreme, Urgency of Immediate, and Certainty of Observed"},
   { 4372, "CMAS CBS Message Identifier for CMAS Extreme Alerts with Severity of Extreme, Urgency of Immediate, and Certainty of Likely"},
   { 4373, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Extreme, Urgency of Expected, and Certainty of Observed"},
   { 4374, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Extreme, Urgency of Expected, and Certainty of Likely"},
   { 4375, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Severe, Urgency of Immediate, and Certainty of Observed"},
   { 4376, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Severe, Urgency of Immediate, and Certainty of Likely"},
   { 4377, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Severe, Urgency of Expected, and Certainty of Observed"},
   { 4378, "CMAS CBS Message Identifier for CMAS Severe Alerts with Severity of Severe, Urgency of Expected, and Certainty of Likely"},
   { 4379, "CMAS CBS Message Identifier for Child Abduction Emergency (or Amber Alert)"},
   { 4380, "CMAS CBS Message Identifier for the Required Monthly Test"},
   { 4381, "CMAS CBS Message Identifier for CMAS Exercise"},
   { 4382, "CMAS CBS Message Identifier for operator defined use"},
   { 65535, "Message Identifier Reserved, and should not be used for new services"},
   {    0, NULL }
};

static const value_string geographic_scope_values[] = {
   { 0x00, "Cell-wide (immediate display)" },
   { 0x01, "PLMN-wide" },
   { 0x02, "Location Area-wide (GSM) or Service Area-wide (UMTS)" },
   { 0x03, "Cell-wide (normal display)" },
   {    0, NULL }
};

/* Initialize the protocol and registered fields */
static int proto_cell_broadcast;

static int hf_gsm_cbs_serial_number;
static int hf_gsm_cbs_geographic_scope;
static int hf_gsm_cbs_message_code;
static int hf_gsm_cbs_update_number;
static int hf_gsm_cbs_message_identifier;
static int hf_gsm_cbs_total_pages;
static int hf_gsm_cbs_current_page;

/* These fields are used when reassembling multi-page gsm cbs messages */
static int hf_gsm_cbs_pages;
static int hf_gsm_cbs_page_num;
static int hf_gsm_cbs_page_overlap;
static int hf_gsm_cbs_page_overlap_conflict;
static int hf_gsm_cbs_page_multiple_tails;
static int hf_gsm_cbs_page_too_long_fragment;
static int hf_gsm_cbs_page_error;
static int hf_gsm_cbs_page_count;
static int hf_gsm_cbs_message_reassembled_in;
static int hf_gsm_cbs_message_reassembled_length;
static int hf_gsm_cbs_page_content;
static int hf_gsm_cbs_page_content_padding;
static int hf_gsm_cbs_message_content;

/* Initialize the subtree pointers */
static int ett_cbs_msg;
static int ett_cbs_serial_no;
static int ett_cbs_coding;
static int ett_gsm_cbs_page;
static int ett_gsm_cbs_page_content;
static int ett_gsm_cbs_pages;

static expert_field ei_gsm_cbs_unhandled_encoding;

/* reassembly of GSM multi-page messages */
static reassembly_table gsm_cbs_reassembly_table;

/* Structure needed for the fragmentation routines in reassemble.c */
static const fragment_items gsm_page_items = {
   &ett_gsm_cbs_page,
   &ett_gsm_cbs_pages,
   &hf_gsm_cbs_pages,
   &hf_gsm_cbs_page_num,
   &hf_gsm_cbs_page_overlap,
   &hf_gsm_cbs_page_overlap_conflict,
   &hf_gsm_cbs_page_multiple_tails,
   &hf_gsm_cbs_page_too_long_fragment,
   &hf_gsm_cbs_page_error,
   &hf_gsm_cbs_page_count,
   &hf_gsm_cbs_message_reassembled_in,
   &hf_gsm_cbs_message_reassembled_length,
   /* Reassembled data field */
   NULL,
   "pages"
};

unsigned dissect_cbs_serial_number(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
{
   uint16_t serial_number = tvb_get_ntohs(tvb, offset) ;
   proto_item *item;
   proto_tree *subtree;

   item = proto_tree_add_item(tree, hf_gsm_cbs_serial_number, tvb, offset, 2, ENC_BIG_ENDIAN);
   proto_item_append_text(item, ", Message Code: %d, Update Number: %d", (serial_number & 0x3FF) >> 4, serial_number & 0x0F);
   subtree = proto_item_add_subtree(item, ett_cbs_serial_no);
   proto_tree_add_item(subtree, hf_gsm_cbs_geographic_scope, tvb, offset, 2, ENC_BIG_ENDIAN);
   proto_tree_add_item(subtree, hf_gsm_cbs_message_code, tvb, offset, 2, ENC_BIG_ENDIAN);
   proto_tree_add_item(subtree, hf_gsm_cbs_update_number, tvb, offset, 2, ENC_BIG_ENDIAN);
   offset += 2;
   return offset;
}

unsigned dissect_cbs_message_identifier(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
{
   uint16_t msg_id;
   const char *msg_id_string = NULL;

   msg_id = tvb_get_ntohs(tvb, offset);
   msg_id_string = try_val_to_str(msg_id, message_id_values);
   if (msg_id_string == NULL)
   {
      if (msg_id < 1000)
      {
         msg_id_string = "Message ID to be allocated by GSMA";
      }
      else if (msg_id < 4096)
      {
         msg_id_string = "Message ID intended for standardization in future versions of 3GPP TS 23.041";
      }
      else if (msg_id < 4224)
      {
         msg_id_string = "Message ID reserved for Cell Broadcast Data Download (unsecured) to the SIM ";
      }
      else if (msg_id < 4352)
      {
         msg_id_string = "Message ID reserved for Cell Broadcast Data Download (secured) to the SIM ";
      }
      else if (msg_id < 4360)
      {
         msg_id_string = "ETWS CBS Message Identifier for future extension";
      }
      else if (msg_id < 4400)
      {
         msg_id_string = "CMAS CBS Message Identifier for future extension";
      }
      else if (msg_id < 6400)
      {
         msg_id_string = "CBS Message Identifier for future PWS use";
      }
      else if (msg_id < 40960)
      {
         msg_id_string = "Intended for standardization in future versions of 3GPP TS 23.041";
      }
      else if (msg_id < 43500)
      {
         msg_id_string = "Message ID in PLMN operator specific range";
      }
      else if (msg_id < 43530)
      {
         msg_id_string = "Traffic Information Traffic Master UK";
      }
      else if (msg_id < 43585)
      {
         msg_id_string = "Traffic information Mannesmann Telecommerce";
      }
      else if (msg_id < 45056)
      {
         msg_id_string = "Message ID in PLMN operator specific range";
      }
      else
      {
         msg_id_string = "Message ID intended as PLMN operator specific range in future versions of 3GPP TS 23.041";
      }
   }
   proto_tree_add_uint_format_value(tree, hf_gsm_cbs_message_identifier, tvb, offset, 2, msg_id, "%s (%d)", msg_id_string, msg_id);
   offset += 2;
   return offset;
}

tvbuff_t * dissect_cbs_data(uint8_t sms_encoding, tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, unsigned offset )
{
   tvbuff_t * tvb_out = NULL;
   int length = tvb_reported_length(tvb) - offset;
   char *text;

   switch(sms_encoding){
   case SMS_ENCODING_7BIT:
   case SMS_ENCODING_7BIT_LANG:
      text = tvb_get_ts_23_038_7bits_string_packed(pinfo->pool, tvb, offset<<3, (length*8)/7);
      tvb_out = tvb_new_child_real_data(tvb, text, (unsigned)strlen(text), (unsigned)strlen(text));
      add_new_data_source(pinfo, tvb_out, "unpacked 7 bit data");
      break;

   case SMS_ENCODING_8BIT:
      /*
       * XXX - encoding is "user-defined".  Have a preference?
       */
      text = tvb_get_string_enc(pinfo->pool, tvb, offset, length, ENC_ASCII|ENC_NA);
      tvb_out = tvb_new_child_real_data(tvb, text, (unsigned)strlen(text), (unsigned)strlen(text));
      add_new_data_source(pinfo, tvb_out, "8 bit data");
      break;

   case SMS_ENCODING_UCS2:
   case SMS_ENCODING_UCS2_LANG:
      text = tvb_get_string_enc(pinfo->pool, tvb, offset, length, ENC_UCS_2|ENC_BIG_ENDIAN);
      tvb_out = tvb_new_child_real_data(tvb, text, (unsigned)strlen(text), (unsigned)strlen(text));
      add_new_data_source(pinfo, tvb_out, "UCS-2 data");
      break;

   default:
      proto_tree_add_expert_format(tree, pinfo, &ei_gsm_cbs_unhandled_encoding, tvb, offset, length,
                                    "Unhandled encoding %d of CBS String", sms_encoding);
      break;
   }
   return tvb_out;
}

static int
dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
   uint8_t sms_encoding, total_pages, current_page;
   uint32_t      offset = 0;
   unsigned      len, text_len;
   uint32_t      msg_key;
   proto_item    *cbs_page_item = NULL;
   proto_tree    *cbs_page_tree = NULL;
   uint16_t      serial_number, message_id;
   tvbuff_t      *cbs_page_tvb = NULL;
   tvbuff_t      *cbs_msg_tvb = NULL;
   fragment_head * frag_data = NULL;

   len = tvb_reported_length(tvb);

   col_append_str(pinfo->cinfo, COL_PROTOCOL, " Cell Broadcast");
   col_append_str(pinfo->cinfo, COL_INFO, " (CBS Page)");

   cbs_page_item = proto_tree_add_protocol_format(proto_tree_get_root(tree), proto_cell_broadcast, tvb, 0, len, "GSM Cell Broadcast");
   cbs_page_tree = proto_item_add_subtree(cbs_page_item, ett_gsm_cbs_page);

   serial_number = tvb_get_ntohs(tvb, offset);
   offset = dissect_cbs_serial_number(tvb, cbs_page_tree, offset);
   message_id = tvb_get_ntohs(tvb, offset);
   offset = dissect_cbs_message_identifier(tvb, cbs_page_tree, offset);
   sms_encoding = dissect_cbs_data_coding_scheme(tvb, pinfo, cbs_page_tree, offset++);
   total_pages = tvb_get_uint8(tvb, offset);
   current_page = (total_pages & 0xF0) >> 4;
   total_pages &= 0x0F;
   proto_tree_add_item(cbs_page_tree, hf_gsm_cbs_current_page, tvb, offset, 1, ENC_BIG_ENDIAN);
   proto_tree_add_item(cbs_page_tree, hf_gsm_cbs_total_pages, tvb, offset++, 1, ENC_BIG_ENDIAN);
   cbs_page_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_page_tree, pinfo, offset );

   if (cbs_page_tvb != NULL)
   {
      text_len = tvb_reported_length(cbs_page_tvb);
      while (text_len && (tvb_get_uint8(cbs_page_tvb, text_len-1) == '\r')) {
         text_len--;
      }
      if (tree != NULL)
      {
         proto_tree *cbs_page_subtree = proto_tree_add_subtree(cbs_page_tree, tvb, offset, -1,
                                        ett_gsm_cbs_page_content, NULL, "Cell Broadcast Page Contents");
         len = tvb_reported_length(cbs_page_tvb);
         proto_tree_add_item(cbs_page_subtree, hf_gsm_cbs_page_content, cbs_page_tvb, 0, text_len, ENC_UTF_8);
         len -= text_len;
         if (len)
         {
            proto_tree_add_item(cbs_page_subtree, hf_gsm_cbs_page_content_padding, cbs_page_tvb, text_len, len, ENC_UTF_8);
         }
      }
      if (text_len)
      {
         cbs_page_tvb = tvb_new_subset_length(cbs_page_tvb, 0, text_len);
         if (total_pages == 1)
         {
            /* no need for reassembly */
            cbs_msg_tvb = cbs_page_tvb;
         }
         else
         {
             /* now we have a complete page, try to concatenate the full message */
            /* we can use the serial number and message ID as keys, as they are the same for all pages of a message */
            msg_key = (serial_number << 16) + message_id;
            frag_data = fragment_add_seq_check(&gsm_cbs_reassembly_table,
                                               cbs_page_tvb, 0, pinfo, msg_key, NULL,
                                               (current_page -1), text_len,
                                               (current_page!=total_pages));
            cbs_msg_tvb = process_reassembled_data(cbs_page_tvb, 0, pinfo, "Reassembled Cell Broadcast message",
                                                frag_data, &gsm_page_items, NULL, cbs_page_tree);
         }
      }
   }
   if (cbs_msg_tvb != NULL)
   {
      proto_item     *cbs_msg_item = NULL;
      proto_tree    *cbs_msg_tree = NULL;

      len = tvb_reported_length(cbs_msg_tvb);
      col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)");

      cbs_msg_item = proto_tree_add_protocol_format(proto_tree_get_root(tree), proto_cell_broadcast, cbs_msg_tvb, 0, len, "GSM Cell Broadcast Message");
      cbs_msg_tree = proto_item_add_subtree(cbs_msg_item, ett_cbs_msg);

      proto_tree_add_item(cbs_msg_tree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, len, ENC_UTF_8);
   }

   return tvb_captured_length(tvb);
}

int dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
   uint8_t sms_encoding;
   uint32_t      offset = 0;
   uint32_t      len;
   proto_item    *cbs_item;
   proto_tree    *cbs_tree, *cbs_subtree;
   unsigned      msg_len;
   uint8_t       *msg;
   tvbuff_t * cbs_msg_tvb = NULL;

   len = tvb_reported_length(tvb);

   col_append_str(pinfo->cinfo, COL_PROTOCOL, " Cell Broadcast");
   col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)");

   cbs_item = proto_tree_add_protocol_format(proto_tree_get_root(tree), proto_cell_broadcast, tvb, 0, len, "Cell Broadcast");
   cbs_tree = proto_item_add_subtree(cbs_item, ett_cbs_msg);

   sms_encoding = dissect_cbs_data_coding_scheme(tvb, pinfo, cbs_tree, 0);
   offset++;
   cbs_msg_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_tree, pinfo, offset );

   msg_len = tvb_reported_length(cbs_msg_tvb);
   cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1,
                    ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len);
   msg = tvb_get_string_enc(pinfo->pool, cbs_msg_tvb, 0, msg_len, ENC_UTF_8|ENC_NA);
   proto_tree_add_string_format(cbs_subtree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, -1, msg, "%s", msg);
   return tvb_captured_length(tvb);
}

/* Register the protocol with Wireshark */
void
proto_register_cbs(void)
{
   /* Setup list of header fields */
   static hf_register_info hf_cbs[] =
      {
         { &hf_gsm_cbs_serial_number,
           { "GSM CBS Serial Number", "gsm_cbs.serial_number",
             FT_UINT16, BASE_HEX_DEC, NULL, 0x00,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_message_code,
           { "GSM CBS Message Code", "gsm_cbs.message_code",
             FT_UINT16, BASE_DEC_HEX, NULL, 0x3FF0,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_geographic_scope,
           { "GSM CBS Geographic Scope",     "gsm_cbs.geographic_scope",
             FT_UINT16, BASE_DEC, VALS(geographic_scope_values), 0xC000,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_update_number,
           { "GSM CBS Update Number",        "gsm_cbs.update_number",
             FT_UINT16, BASE_DEC, NULL, 0x000F,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_message_identifier,
           { "GSM CBS Message Identifier",   "gsm_cbs.message-identifier",
             FT_UINT16, BASE_DEC_HEX, NULL, 0x00,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_total_pages,
           { "GSM CBS Total Pages",  "gsm_cbs.total_pages",
             FT_UINT8, BASE_DEC, NULL, 0x0F,
             NULL, HFILL }
         },
         { &hf_gsm_cbs_current_page,
           { "GSM CBS Current Page", "gsm_cbs.current_page",
             FT_UINT8, BASE_DEC, NULL, 0xF0,
             NULL, HFILL }
         },
         /* Fragment fields
          */
         { &hf_gsm_cbs_page_overlap,
           { "page overlap",
             "gsm_cbs.page.overlap",
             FT_BOOLEAN, BASE_NONE, NULL, 0x0,
             "GSM CBS page overlaps with other fragments", HFILL
           }
         },
         { &hf_gsm_cbs_page_overlap_conflict,
           { "Conflicting data in page overlap",
             "gsm_cbs.page.overlap.conflict",
             FT_BOOLEAN, BASE_NONE, NULL, 0x0,
             "Overlapping pages contained conflicting data", HFILL
           }
         },
         { &hf_gsm_cbs_page_multiple_tails,
           { "Multiple final pages found",
             "gsm_cbs.page.multipletails",
             FT_BOOLEAN, BASE_NONE, NULL, 0x0,
             "Several copies of the final page were found when reassembling the message", HFILL
           }
         },
         { &hf_gsm_cbs_page_too_long_fragment,
           { "Page too long",
             "gsm_cbs.page.toolongfragment",
             FT_BOOLEAN, BASE_NONE, NULL, 0x0,
             "Page contained data past end of packet", HFILL
           }
         },
         { &hf_gsm_cbs_page_error,
           { "Reassembly error",
             "gsm_cbs.fragment.error",
             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
             "Reassembly error due to illegal fragments", HFILL
           }
         },
         { &hf_gsm_cbs_page_count,
           { "Fragment count",
             "gsm_cbs.fragment.count",
             FT_UINT32, BASE_DEC, NULL, 0x0,
             "Count of Page Fragment", HFILL
           }
         },
         { &hf_gsm_cbs_message_reassembled_in,
           { "Reassembled in",
             "gsm_cbs.reassembled.in",
             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
             "CBS pages are reassembled in the given packet", HFILL
           }
         },
         { &hf_gsm_cbs_message_reassembled_length,
           { "Reassembled message length",
             "gsm_cbs.reassembled.length",
             FT_UINT32, BASE_DEC, NULL, 0x0,
             "The total length of the reassembled message", HFILL
           }
         },
         { &hf_gsm_cbs_page_num,
           { "CBS Page Number",
             "gsm_cbs.page_number",
             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
             NULL, HFILL
           }
         },
         { &hf_gsm_cbs_pages,
           { "CBS Pages",
             "gsm_cbs.pages",
             FT_NONE, BASE_NONE, NULL, 0x0,
             NULL, HFILL
           }
         },
         { &hf_gsm_cbs_page_content,
           { "CBS Page Content",
             "gsm_cbs.page_content",
             FT_STRING, BASE_NONE, NULL, 0x0,
             NULL, HFILL
           }
         },
         { &hf_gsm_cbs_page_content_padding,
           { "CBS Page Content Padding",
             "gsm_cbs.page_content_padding",
             FT_STRING, BASE_NONE, NULL, 0x0,
             NULL, HFILL
           }
         },
         { &hf_gsm_cbs_message_content,
           { "CBS Message Content",
             "gsm_cbs.message_content",
             FT_STRING, BASE_NONE, NULL, 0x0,
             NULL, HFILL
           }
         }
      };

   /* Setup protocol subtree array */
   static int *ett[] = {
      &ett_cbs_msg,
      &ett_cbs_serial_no,
      &ett_cbs_coding,
      &ett_gsm_cbs_page,
      &ett_gsm_cbs_page_content,
      &ett_gsm_cbs_pages,
   };

   static ei_register_info ei[] = {
      { &ei_gsm_cbs_unhandled_encoding, { "gsm_cbs.unhandled_encoding", PI_PROTOCOL, PI_WARN, "Unhandled encoding", EXPFILL }},
   };
   expert_module_t* expert_cell_broadcast;

   /* Register the protocol name and description */
   proto_cell_broadcast = proto_register_protocol("GSM Cell Broadcast Service", "GSM Cell Broadcast Service", "gsm_cbs");

   proto_register_field_array(proto_cell_broadcast, hf_cbs, array_length(hf_cbs));

   reassembly_table_register(&gsm_cbs_reassembly_table,
                        &addresses_reassembly_table_functions);

   /* subdissector code */
   register_dissector("gsm_cbs", dissect_gsm_cell_broadcast, proto_cell_broadcast);
   register_dissector("umts_cell_broadcast", dissect_umts_cell_broadcast_message, proto_cell_broadcast);

   /* subtree array */
   proto_register_subtree_array(ett, array_length(ett));
   expert_cell_broadcast = expert_register_protocol(proto_cell_broadcast);
   expert_register_field_array(expert_cell_broadcast, ei, array_length(ei));
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local Variables:
 * c-basic-offset: 3
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * ex: set shiftwidth=3 tabstop=8 expandtab:
 * :indentSize=3:tabSize=8:noTabs=true:
 */