aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nbifom.c
blob: c5ebae779b9c57adbd6d61bcdc74da68f6a13343 (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
/* packet-nbifom.c
 * Routines for Network-Based IP Flow Mobility (NBIFOM) dissection
 * 3GPP TS 24.161 V13.3.0 (2016-12) Release 13
 * Copyright 2016, Pascal Quantin <pascal@wireshark.org>
 *
 * 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>

void proto_register_nbifom(void);

static int proto_nbifom = -1;
static int hf_nbifom_param_id_ul = -1;
static int hf_nbifom_param_id_dl = -1;
static int hf_nbifom_param_contents_len = -1;
static int hf_nbifom_param_contents_dflt_access = -1;
static int hf_nbifom_param_contents_status = -1;
static int hf_nbifom_param_contents_ran_rules_handling = -1;
static int hf_nbifom_param_contents_ran_rules_status = -1;
static int hf_nbifom_param_contents_access_use_ind_spare = -1;
static int hf_nbifom_param_contents_access_use_ind_wlan_access_usable_val = -1;
static int hf_nbifom_param_contents_access_use_ind_3gpp_access_usable_val = -1;
static int hf_nbifom_param_contents_mode = -1;
static int hf_nbifom_param_contents_rem_bytes = -1;
static int hf_nbifom_routing_rule_len = -1;
static int hf_nbifom_routing_rule_id = -1;
static int hf_nbifom_routing_rule_routing_access = -1;
static int hf_nbifom_routing_rule_spare = -1;
static int hf_nbifom_routing_rule_op_code = -1;
static int hf_nbifom_routing_rule_prio = -1;
static int hf_nbifom_routing_rule_flags = -1;
static int hf_nbifom_routing_rule_flags_prot_type_nxt_hdr = -1;
static int hf_nbifom_routing_rule_flags_ipsec_spi = -1;
static int hf_nbifom_routing_rule_flags_dst_addr_prefix_len = -1;
static int hf_nbifom_routing_rule_flags_src_addr_prefix_len = -1;
static int hf_nbifom_routing_rule_flags_dst_ipv6_addr = -1;
static int hf_nbifom_routing_rule_flags_src_ipv6_addr = -1;
static int hf_nbifom_routing_rule_flags_dst_ipv4_addr = -1;
static int hf_nbifom_routing_rule_flags_src_ipv4_addr = -1;
static int hf_nbifom_routing_rule_flags_spare_bits0xc0 = -1;
static int hf_nbifom_routing_rule_flags_flow_label = -1;
static int hf_nbifom_routing_rule_flags_tos = -1;
static int hf_nbifom_routing_rule_flags_end_dst_port_range = -1;
static int hf_nbifom_routing_rule_flags_start_dst_port_range = -1;
static int hf_nbifom_routing_rule_flags_end_src_port_range = -1;
static int hf_nbifom_routing_rule_flags_start_src_port_range = -1;
static int hf_nbifom_routing_rule_flags_spare_bits0xffff = -1;
static int hf_nbifom_routing_rule_src_ipv4_addr = -1;
static int hf_nbifom_routing_rule_dst_ipv4_addr = -1;
static int hf_nbifom_routing_rule_src_ipv6_addr = -1;
static int hf_nbifom_routing_rule_dst_ipv6_addr = -1;
static int hf_nbifom_routing_rule_src_addr_prefix_len = -1;
static int hf_nbifom_routing_rule_dst_addr_prefix_len = -1;
static int hf_nbifom_routing_rule_ipsec_spi = -1;
static int hf_nbifom_routing_rule_prot_type_nxt_hdr = -1;
static int hf_nbifom_routing_rule_start_src_port_range = -1;
static int hf_nbifom_routing_rule_end_src_port_range = -1;
static int hf_nbifom_routing_rule_start_dst_port_range = -1;
static int hf_nbifom_routing_rule_end_dst_port_range = -1;
static int hf_nbifom_routing_rule_tos = -1;
static int hf_nbifom_routing_rule_flow_label = -1;

static gint ett_nbifom = -1;
static gint ett_nbifom_param_contents = -1;
static gint ett_nbifom_routing_rule = -1;
static gint ett_nbifom_routing_rule_flags = -1;

static const value_string nbifom_param_id_ue_to_nw_vals[] = {
    { 0x00, "Not assigned" },
    { 0x01, "NBIFOM mode" },
    { 0x02, "NBIFOM default access" },
    { 0x03, "NBIFOM status" },
    { 0x04, "NBIFOM routing rules" },
    { 0x05, "NBIFOM IP flow mapping" },
    { 0x06, "Not assigned" },
    { 0x07, "NBIFOM access stratum status" },
    { 0x08, "NBIFOM access usability indication" },
    { 0, NULL }
};

static const value_string nbifom_param_id_nw_to_ue_vals[] = {
    { 0x00, "Not assigned" },
    { 0x01, "NBIFOM mode" },
    { 0x02, "NBIFOM default access" },
    { 0x03, "NBIFOM status" },
    { 0x04, "NBIFOM routing rules" },
    { 0x05, "Not assigned" },
    { 0x06, "NBIFOM RAN rules handling" },
    { 0x07, "Not assigned" },
    { 0x08, "Not assigned" },
    { 0, NULL }
};

static const value_string nbifom_dflt_access_vals[] = {
    { 0x01, "3GPP access" },
    { 0x02, "Non-3GPP access" },
    { 0, NULL },
};

static const value_string nbifom_status_vals[] = {
    { 0x00, "Accepted" },
    { 0x1a, "Insufficient resources" },
    { 0x22, "Service option temporarily out of order" },
    { 0x25, "Requested service option not subscribed" },
    { 0x39, "Incorrect indication in the routing rule operation" },
    { 0x3a, "Unknown information in IP flow filter(s)" },
    { 0x3f, "Request rejected, unspecified" },
    { 0x6f, "Protocol error, unspecified" },
    { 0x82, "Unknown routing access information" },
    { 0, NULL },
};

static const value_string nbifom_ran_rules_handling_vals[] = {
    { 0x01, "RAN rules handling parameter is not set" },
    { 0x02, "RAN rules handling parameter is set" },
    { 0, NULL }
};

static const value_string nbifom_ran_rules_status_vals[] = {
    { 0x01, "No indication" },
    { 0x02, "Move-traffic-from-WLAN indication" },
    { 0x03, "Move-traffic-to-WLAN indication" },
    { 0, NULL }
};

static const value_string nbifom_wlan_access_usable_vals[] = {
    { 0x00, "No change in usability of WLAN access" },
    { 0x01, "WLAN access becomes usable" },
    { 0x02, "WLAN access becomes unusable" },
    { 0x03, "Reserved" },
    { 0, NULL }
};

static const value_string nbifom_3gpp_access_usable_vals[] = {
    { 0x00, "No change in usability of 3GPP access" },
    { 0x01, "3GPP access becomes usable" },
    { 0x02, "3GPP access becomes unusable" },
    { 0x03, "Reserved" },
    { 0, NULL }
};

static const value_string nbifom_mode_vals[] = {
    { 0x01, "UE-initiated NBIFOM mode" },
    { 0x02, "Network-initiated NBIFOM mode" },
    { 0, NULL }
};

static const value_string nbifom_routing_access_vals[] = {
    { 0x01, "3GPP access" },
    { 0x02, "Non-3GPP access" },
    { 0, NULL }
};

static const value_string nbifom_op_code_vals[] = {
    { 0x00, "Spare" },
    { 0x01, "Create routing rule" },
    { 0x02, "Delete routing rule" },
    { 0x03, "Replace existing routing rule" },
    { 0x04, "Reserved" },
    { 0, NULL }
};

static void
dissect_nbifom_routing_rules(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset, guint32 params_content_len)
{
    gint curr_offset = offset;
    guint32 i = 0, routing_rule_len;
    proto_item *item;
    proto_tree *subtree;
    guint64 flags;

    while ((curr_offset - offset) < (gint)params_content_len) {
        static int * const flags1[] = {
            &hf_nbifom_routing_rule_routing_access,
            &hf_nbifom_routing_rule_spare,
            &hf_nbifom_routing_rule_op_code,
            NULL
        };
        static int * const flags2[] = {
            &hf_nbifom_routing_rule_flags_prot_type_nxt_hdr,
            &hf_nbifom_routing_rule_flags_ipsec_spi,
            &hf_nbifom_routing_rule_flags_dst_addr_prefix_len,
            &hf_nbifom_routing_rule_flags_src_addr_prefix_len,
            &hf_nbifom_routing_rule_flags_dst_ipv6_addr,
            &hf_nbifom_routing_rule_flags_src_ipv6_addr,
            &hf_nbifom_routing_rule_flags_dst_ipv4_addr,
            &hf_nbifom_routing_rule_flags_src_ipv4_addr,
            &hf_nbifom_routing_rule_flags_spare_bits0xc0,
            &hf_nbifom_routing_rule_flags_flow_label,
            &hf_nbifom_routing_rule_flags_tos,
            &hf_nbifom_routing_rule_flags_end_dst_port_range,
            &hf_nbifom_routing_rule_flags_start_dst_port_range,
            &hf_nbifom_routing_rule_flags_end_src_port_range,
            &hf_nbifom_routing_rule_flags_start_src_port_range,
            &hf_nbifom_routing_rule_flags_spare_bits0xffff,
            NULL
        };

        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, -1, ett_nbifom_routing_rule, &item, "Routing Rule %u", ++i);
        proto_tree_add_item_ret_uint(subtree, hf_nbifom_routing_rule_len, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &routing_rule_len);
        proto_item_set_len(item, routing_rule_len+1);
        curr_offset++;
        proto_tree_add_item(subtree, hf_nbifom_routing_rule_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
        curr_offset++;
        proto_tree_add_bitmask_list(subtree, tvb, curr_offset, 1, flags1, ENC_BIG_ENDIAN);
        curr_offset++;
        proto_tree_add_item(subtree, hf_nbifom_routing_rule_prio, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
        curr_offset++;
        proto_tree_add_bitmask_ret_uint64(subtree, tvb, curr_offset, hf_nbifom_routing_rule_flags,
                                          ett_nbifom_routing_rule_flags, flags2, ENC_BIG_ENDIAN, &flags);
        curr_offset += 4;
        if (flags & 0x01000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_src_ipv4_addr, tvb, curr_offset, 4, ENC_NA);
            curr_offset += 4;
        }
        if (flags & 0x02000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_dst_ipv4_addr, tvb, curr_offset, 4, ENC_NA);
            curr_offset += 4;
        }
        if (flags & 0x04000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_src_ipv6_addr, tvb, curr_offset, 16, ENC_NA);
            curr_offset += 16;
        }
        if (flags & 0x08000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_dst_ipv6_addr, tvb, curr_offset, 16, ENC_NA);
            curr_offset += 16;
        }
        if (flags & 0x10000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_src_addr_prefix_len, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
            curr_offset++;
        }
        if (flags & 0x20000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_dst_addr_prefix_len, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
            curr_offset++;
        }
        if (flags & 0x40000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_ipsec_spi, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
            curr_offset += 4;
        }
        if (flags & 0x80000000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_prot_type_nxt_hdr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
            curr_offset++;
        }
        if (flags & 0x00010000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_start_src_port_range, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
            curr_offset += 4;
        }
        if (flags & 0x00020000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_end_src_port_range, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
            curr_offset += 4;
        }
        if (flags & 0x00040000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_start_dst_port_range, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
            curr_offset += 4;
        }
        if (flags & 0x00080000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_end_dst_port_range, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
            curr_offset += 4;
        }
        if (flags & 0x00100000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_tos, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
            curr_offset++;
        }
        if (flags & 0x00200000) {
            proto_tree_add_item(subtree, hf_nbifom_routing_rule_flow_label, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
            curr_offset += 3;
        }
    }
}

static int
dissect_nbifom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    proto_item *item;
    proto_tree *nbifom_tree, *subtree;
    gint reported_len = tvb_reported_length(tvb);
    gint offset = 0, saved_offset;
    guint32 param_id, param_contents_len;
    int hf_nbifom_param_id = pinfo->link_dir == P2P_DIR_UL ? hf_nbifom_param_id_ul : hf_nbifom_param_id_dl;

    col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, "/", "NBIFOM");

    item = proto_tree_add_item(tree, proto_nbifom, tvb, 0, -1, ENC_NA);
    nbifom_tree = proto_item_add_subtree(item, ett_nbifom);

    while (offset < reported_len) {
        item = proto_tree_add_item_ret_uint(nbifom_tree, hf_nbifom_param_id, tvb, offset, 1, ENC_BIG_ENDIAN, &param_id);
        offset++;
        subtree = proto_item_add_subtree(item, ett_nbifom_param_contents);
        proto_tree_add_item_ret_uint(subtree, hf_nbifom_param_contents_len, tvb, offset, 1, ENC_BIG_ENDIAN, &param_contents_len);
        offset++;
        saved_offset = offset;
        switch (param_id) {
        case 1:
            proto_tree_add_item(subtree, hf_nbifom_param_contents_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;
        case 2:
            proto_tree_add_item(subtree, hf_nbifom_param_contents_dflt_access, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;
        case 3:
            proto_tree_add_item(subtree, hf_nbifom_param_contents_status, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;
        case 5:
            if (pinfo->link_dir == P2P_DIR_DL) {
                break;
            } /* else fall through case 4 */
            /* FALL THROUGH */
        case 4:
            dissect_nbifom_routing_rules(tvb, pinfo, subtree, offset, param_contents_len);
            offset += param_contents_len;
            break;
        case 6:
            if (pinfo->link_dir == P2P_DIR_DL) {
                proto_tree_add_item(subtree, hf_nbifom_param_contents_ran_rules_handling, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
            }
            break;
        case 7:
            if (pinfo->link_dir == P2P_DIR_UL) {
                proto_tree_add_item(subtree, hf_nbifom_param_contents_ran_rules_status, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
            }
            break;
        case 8:
            if (pinfo->link_dir == P2P_DIR_UL) {
                static int * const flags[] = {
                    &hf_nbifom_param_contents_access_use_ind_spare,
                    &hf_nbifom_param_contents_access_use_ind_wlan_access_usable_val,
                    &hf_nbifom_param_contents_access_use_ind_3gpp_access_usable_val,
                    NULL
                };

                proto_tree_add_bitmask_list(subtree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
                offset++;
            }
            break;
        default:
            break;
        }
        if ((offset - saved_offset) < (gint)param_contents_len) {
            proto_tree_add_item(subtree, hf_nbifom_param_contents_rem_bytes, tvb, offset, param_contents_len - (offset - saved_offset), ENC_NA);
        }
        offset = saved_offset + param_contents_len;
    }

    return tvb_captured_length(tvb);
}

void
proto_register_nbifom(void)
{
    static hf_register_info hf[] = {
        { &hf_nbifom_param_id_ul,
            { "Parameter identifier", "nbifom.param_id", FT_UINT8, BASE_HEX,
              VALS(nbifom_param_id_ue_to_nw_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_id_dl,
            { "Parameter identifier", "nbifom.param_id", FT_UINT8, BASE_HEX,
              VALS(nbifom_param_id_nw_to_ue_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_len,
            { "Length of parameter contents", "nbifom.param_contents.len", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_dflt_access,
            { "NBIFOM default access", "nbifom.param_contents.dflt_access", FT_UINT8, BASE_HEX,
              VALS(nbifom_dflt_access_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_status,
            { "NBIFOM status", "nbifom.param_contents.status", FT_UINT8, BASE_HEX,
              VALS(nbifom_status_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_ran_rules_handling,
            { "NBIFOM RAN rules handling", "nbifom.param_contents.ran_rules_handling", FT_UINT8, BASE_HEX,
              VALS(nbifom_ran_rules_handling_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_ran_rules_status,
            { "NBIFOM RAN rules status", "nbifom.param_contents.ran_rules_status", FT_UINT8, BASE_HEX,
              VALS(nbifom_ran_rules_status_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_access_use_ind_spare,
            { "Spare", "nbifom.param_contents.access_use_ind.spare", FT_UINT8, BASE_HEX,
              NULL, 0xf0, NULL, HFILL }},
        { &hf_nbifom_param_contents_access_use_ind_wlan_access_usable_val,
            { "WLAN access usable value", "nbifom.param_contents.access_use_ind.wlan_access_usable_val", FT_UINT8, BASE_HEX,
              VALS(nbifom_wlan_access_usable_vals), 0x0c, NULL, HFILL }},
        { &hf_nbifom_param_contents_access_use_ind_3gpp_access_usable_val,
            { "3GPP access usable value", "nbifom.param_contents.access_use_ind.3gpp_access_usable_val", FT_UINT8, BASE_HEX,
              VALS(nbifom_3gpp_access_usable_vals), 0x03, NULL, HFILL }},
        { &hf_nbifom_param_contents_mode,
            { "NBIFOM mode", "nbifom.param_contents.mode", FT_UINT8, BASE_HEX,
              VALS(nbifom_mode_vals), 0, NULL, HFILL }},
        { &hf_nbifom_param_contents_rem_bytes,
            { "Remaining parameter contents", "nbifom.param_contents.rem_bytes", FT_BYTES, BASE_NONE,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_len,
            { "Length of routing rule", "nbifom.routing_rule.len", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_id,
            { "Routing rule identifier", "nbifom.routing_rule.id", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_routing_access,
            { "Routing access", "nbifom.routing_rule.routing_access", FT_UINT8, BASE_DEC,
              VALS(nbifom_routing_access_vals), 0xc0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_spare,
            { "Spare", "nbifom.routing_rule.spare", FT_UINT8, BASE_HEX,
              NULL, 0x38, NULL, HFILL }},
        { &hf_nbifom_routing_rule_op_code,
            { "Operation code", "nbifom.routing_rule.op_code", FT_UINT8, BASE_HEX,
              VALS(nbifom_op_code_vals), 0x07, NULL, HFILL }},
        { &hf_nbifom_routing_rule_prio,
            { "Routing rule priority", "nbifom.routing_rule.prio", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags,
            { "Flags", "nbifom.routing_rule.flags", FT_UINT32, BASE_HEX,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_prot_type_nxt_hdr,
            { "Protocol type / next header", "nbifom.routing_rule.flags.prot_type_nxt_hdr", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x80000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_ipsec_spi,
            { "IPSec SPI", "nbifom.routing_rule.flags.ipsec_spi", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x40000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_dst_addr_prefix_len,
            { "Destination address prefix length", "nbifom.routing_rule.flags.dst_addr_prefix_len", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x20000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_src_addr_prefix_len,
            { "Source address prefix length", "nbifom.routing_rule.flags.src_addr_prefix_len", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x10000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_dst_ipv6_addr,
            { "Destination IPv6 address", "nbifom.routing_rule.flags.dst_ipv6_addr", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x08000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_src_ipv6_addr,
            { "Source IPv6 address", "nbifom.routing_rule.flags.src_ipv6_addr", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x04000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_dst_ipv4_addr,
            { "Destination IPv4 address", "nbifom.routing_rule.flags.dst_ipv4_addr", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x02000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_src_ipv4_addr,
            { "Source IPv4 address", "nbifom.routing_rule.flags.src_ipv4_addr", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x01000000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_spare_bits0xc0,
            { "Spare", "nbifom.routing_rule.flags.spare", FT_UINT32, BASE_HEX,
              NULL, 0x00c00000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_flow_label,
            { "Flow label", "nbifom.routing_rule.flags.flow_label", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00200000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_tos,
            { "Type of service", "nbifom.routing_rule.flags.tos", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00100000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_end_dst_port_range,
            { "End destination port range", "nbifom.routing_rule.flags.end_dst_port_range", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00080000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_start_dst_port_range,
            { "Start destination port range", "nbifom.routing_rule.flags.start_dst_port_range", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00040000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_end_src_port_range,
            { "End source port range", "nbifom.routing_rule.flags.end_src_port_range", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00020000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_start_src_port_range,
            { "Start source port range", "nbifom.routing_rule.flags.start_src_port_range", FT_BOOLEAN, 32,
              TFS(&tfs_present_not_present), 0x00010000, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flags_spare_bits0xffff,
            { "Spare", "nbifom.routing_rule.flags.spare", FT_UINT32, BASE_HEX,
              NULL, 0x0000ffff, NULL, HFILL }},
        { &hf_nbifom_routing_rule_src_ipv4_addr,
            { "Source IPv4 address", "nbifom.routing_rule.src_ipv4_addr", FT_IPv4, BASE_NONE,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_dst_ipv4_addr,
            { "Destination IPv4 address", "nbifom.routing_rule.dst_ipv4_addr", FT_IPv4, BASE_NONE,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_src_ipv6_addr,
            { "Source IPv6 address", "nbifom.routing_rule.src_ipv6_addr", FT_IPv6, BASE_NONE,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_dst_ipv6_addr,
            { "Destination IPv6 address", "nbifom.routing_rule.dst_ipv6_addr", FT_IPv6, BASE_NONE,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_src_addr_prefix_len,
            { "Source address prefix length", "nbifom.routing_rule.src_addr_prefix_len", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_dst_addr_prefix_len,
            { "Destination address prefix length", "nbifom.routing_rule.dst_addr_prefix_len", FT_UINT8, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_ipsec_spi,
            { "IPSec SPI", "nbifom.routing_rule.ipsec_spi", FT_UINT32, BASE_HEX,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_prot_type_nxt_hdr,
            { "Protocol type / next header", "nbifom.routing_rule.prot_type_nxt_hdr", FT_UINT8, BASE_HEX,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_start_src_port_range,
            { "Start source port range", "nbifom.routing_rule.start_src_port_range", FT_UINT32, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_end_src_port_range,
            { "End source port range", "nbifom.routing_rule.end_src_port_range", FT_UINT32, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_start_dst_port_range,
            { "Start destination port range", "nbifom.routing_rule.start_dst_port_range", FT_UINT32, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_end_dst_port_range,
            { "End destination port range", "nbifom.routing_rule.end_dst_port_range", FT_UINT32, BASE_DEC,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_tos,
            { "Type of service", "nbifom.routing_rule.tos", FT_UINT8, BASE_HEX,
              NULL, 0, NULL, HFILL }},
        { &hf_nbifom_routing_rule_flow_label,
            { "Flow label", "nbifom.routing_rule.flow_label", FT_UINT24, BASE_HEX,
              NULL, 0x0fffff, NULL, HFILL }}
    };

    static gint *nbifom_subtrees[] = {
        &ett_nbifom,
        &ett_nbifom_param_contents,
        &ett_nbifom_routing_rule,
        &ett_nbifom_routing_rule_flags
    };

    proto_nbifom = proto_register_protocol("Network-Based IP Flow Mobility", "NBIFOM", "nbifom");
    proto_register_field_array(proto_nbifom, hf, array_length(hf));
    proto_register_subtree_array(nbifom_subtrees, array_length(nbifom_subtrees));

    register_dissector("nbifom", dissect_nbifom, proto_nbifom);
}

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