summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-itdm.c
blob: 96375874dae9e29873aa721b0289a83e9bbd2d75 (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
/* packet-itdm.c
 * Routines for I-TDM (Internal TDM) dissection
 * Compliant to PICMG SFP.0 and SFP.1 March 24, 2005
 *
 * Copyright 2008, Dan Gora <dg [AT] adax.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/prefs.h>

void proto_register_itdm(void);
void proto_reg_handoff_itdm(void);

/* Initialize the protocol and registered fields */
static int proto_itdm        = -1;
static int hf_itdm_timestamp = -1;
static int hf_itdm_seqnum    = -1;
static int hf_itdm_sop_eop   = -1;
static int hf_itdm_last_pack = -1;
static int hf_itdm_pktlen    = -1;
static int hf_itdm_chksum    = -1;
static int hf_itdm_uid       = -1;
static int hf_itdm_ack       = -1;
static int hf_itdm_act       = -1;
static int hf_itdm_chcmd     = -1;
static int hf_itdm_chid      = -1;
static int hf_itdm_chloc1    = -1;
static int hf_itdm_chloc2    = -1;
static int hf_itdm_pktrate   = -1;
static int hf_itdm_cxnsize   = -1;

/* I-TDM control protocol fields */
static int hf_itdm_ctl_transid   = -1;
static int hf_itdm_ctl_command   = -1;
static int hf_itdm_ctl_flowid    = -1;
static int hf_itdm_ctl_dm        = -1;
static int hf_itdm_ctl_emts      = -1;
static int hf_itdm_ctl_pktrate   = -1;
static int hf_itdm_ctl_ptid      = -1;
static int hf_itdm_ctl_cksum     = -1;


/* Initialize the subtree pointers */
static gint ett_itdm       = -1;
static gint ett_itdm_ctl   = -1;

static dissector_handle_t itdm_handle;

/* ZZZZ some magic number.. */
static guint gbl_ItdmMPLSLabel = 0x99887;
static guint gbl_ItdmCTLFlowNo = 0;

/* I-TDM 125usec mode commands for data flows */
#define ITDM_CMD_NEW_CHAN     1
#define ITDM_CMD_CLOSE_CHAN   2
#define ITDM_CMD_RELOC_CHAN   3
#define ITDM_CMD_CYCLIC_REAF  4
#define ITDM_CMD_PACKET_RATE  5

#define ITDM_FLOWID_OFFSET    7
#define ITDM_CHCMD_OFFSET    10
#define ITDM_CHANID_OFFSET   11
#define ITDM_CHLOC1_OFFSET   14
#define ITDM_CHLOC2_OFFSET   16

/* I-TDM commands for I-TDM control flows */
#define ITDM_CTL_TRANSID_OFFSET    10
#define ITDM_CTL_CMD_OFFSET        14
#define ITDM_CTL_FLOWID_OFFSET     15
#define ITDM_CTL_ITDM_MODE_OFFSET  18
#define ITDM_CTL_EMTS_OFFSET       20
#define ITDM_CTL_PKTRATE_OFFSET    22
#define ITDM_CTL_PAIRED_TRANSID_OFFSET    26
#define ITDM_CTL_CRC_OFFSET        30

#define ITDM_CTL_CMD_AFI_REQ  1

static const value_string sop_eop_vals[] = {
  { 0x0, "Middle of Packet" },
  { 0x1, "End of Packet" },
  { 0x2, "Start of Packet" },
  { 0x3, "Complete Packet" },
  { 0, NULL }
};

static const true_false_string ack_tfs = {
  "Acknowledging a command from remote node",
  "Normal Command"
};

static const value_string chcmd_vals[] = {
  { 0x0, "Reserved" },
  { 0x1, "New Channel ID" },
  { 0x2, "Close Channel ID" },
  { 0x3, "Relocate Channel ID" },
  { 0x4, "Cyclic Reaffirmation" },
  { 0x5, "Packet Rate Integrity Check" },
  { 0x6, "Reserved" },
  { 0x7, "Reserved" },
  { 0x8, "Reserved" },
  { 0x9, "Reserved" },
  { 0xa, "Reserved" },
  { 0xb, "Reserved" },
  { 0xc, "Reserved" },
  { 0xd, "Reserved" },
  { 0xe, "Reserved" },
  { 0xf, "Reserved" },
  { 0, NULL }
};

static const value_string itdm_ctl_command_vals[] = {
  { 0x0, "Not Used" },
  { 0x1, "AFI_REQ: Alloc Flow ID Req" },
  { 0x2, "AFI_RSP: Alloc Flow ID Rsp - Req Accepted." },
  { 0x3, "DFI_REQ: Dealloc Flow ID Req" },
  { 0x4, "DFI_RSP: Dealloc Flow ID Rsp - Req Accepted." },

  { 0x10, "AFI_RSP: Reject: Data Mode Field value Not Supported." },
  { 0x11, "AFI_RSP: Reject: Explicit Multi-timeslot value Not Supported." },
  { 0x12, "AFI_RSP: Reject: Packet Rate value Not Supported." },
  { 0x13, "AFI_RSP: Reject: Checksum Invalid." },
  { 0x14, "AFI_RSP: Reject: No more flows available." },

  { 0x20, "DFI_RSP: Reject: Data Mode Field value does not match Flow ID." },
  { 0x21, "DFI_RSP: Reject: Explicit Multi-timeslots value does not match." },
  { 0x22, "DFI_RSP: Reject: Packet Rate value does not match." },
  { 0x23, "DFI_RSP: Reject: Checksum Invalid." },
  { 0x24, "DFI_RSP: Reject: Flow ID invalid (out of range)." },
  { 0x25, "DFI_RSP: Reject: Flow ID not currently allocated." },
  { 0x26, "DFI_RSP: Reject: Other Flow ID in pair has active connections." },
  { 0, NULL }
};

static const value_string itdm_ctl_data_mode_vals[] = {
  { 0, "Not Used." },
  { 1, "I-TDM 1ms Data Mode." },
  { 2, "I-TDM 125usec Data Mode." },
  { 3, "I-TDM Explicit Multi-timeslot Data Mode." },
  { 4, "I-TDM CAS Signaling Data Mode." },
  { 0, NULL }
};

static const value_string itdm_ctl_pktrate_vals[] = {
  { 0x447A0000, "I-TDM 1ms Data Mode." },
  { 0x45FA0000, "I-TDM 125usec/EMTS Data Mode." },
  { 0x43A6AAAB, "I-TDM T1 CAS Mode." },
  { 0x43FA0000, "I-TDM E1 CAS Mode." },
  { 0, NULL }
};

static void
dissect_itdm_125usec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  tvbuff_t  *next_tvb;
  proto_item *itdm_item = NULL;
  proto_tree *itdm_tree = NULL;
  int offset;
  guint32 flowid;
  guint32 chanid;
  guint16 chloc1;
  guint16 chloc2;
  guint8 chcmd;
  guint8 actbit;
  guint8 ackbit;


  col_set_str(pinfo->cinfo, COL_PROTOCOL, "ITDM");

  flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET);
  chanid = tvb_get_ntoh24(tvb, ITDM_CHANID_OFFSET);
  chcmd  = tvb_get_guint8(tvb, ITDM_CHCMD_OFFSET);
  chloc1 = tvb_get_ntohs(tvb, ITDM_CHLOC1_OFFSET);
  actbit = (chcmd & 0x10) ? 1 : 0;
  ackbit = (chcmd & 0x20) ? 1 : 0;
  chcmd  = chcmd & 0x0f;

  col_add_fstr(pinfo->cinfo, COL_INFO,
      "Flow %d Chan %d ACT %d ACK %d %s",
      flowid, chanid, actbit, ackbit,
      val_to_str_const(chcmd, chcmd_vals, "Reserved"));
  if (chcmd == ITDM_CMD_NEW_CHAN ||
      chcmd == ITDM_CMD_CLOSE_CHAN ||
      chcmd == ITDM_CMD_CYCLIC_REAF)
  {
    col_append_fstr(pinfo->cinfo, COL_INFO,
        " Loc1 %d", chloc1);
  }
  else if (chcmd == ITDM_CMD_RELOC_CHAN)
  {
    chloc2 = tvb_get_ntohs(tvb, ITDM_CHLOC2_OFFSET);
    col_append_fstr(pinfo->cinfo, COL_INFO,
      " Loc1 %d Loc2 %d", chloc1, chloc2);
  }

  offset = 0;

  if (tree)
  {
  itdm_item = proto_tree_add_item(tree, proto_itdm, tvb, 0, -1, ENC_NA);
  itdm_tree = proto_item_add_subtree(itdm_item, ett_itdm);

  proto_tree_add_item(itdm_tree, hf_itdm_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  proto_tree_add_item(itdm_tree, hf_itdm_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset += 1;
  proto_tree_add_item(itdm_tree, hf_itdm_sop_eop, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  proto_tree_add_checksum(itdm_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
  offset += 2;
  proto_tree_add_item(itdm_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN);
  offset += 3;
  proto_tree_add_item(itdm_tree, hf_itdm_ack, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_tree, hf_itdm_act, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_tree, hf_itdm_chcmd, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset += 1;
  proto_tree_add_item(itdm_tree, hf_itdm_chid, tvb, offset, 3, ENC_BIG_ENDIAN);
  offset += 3;
  if (chcmd == ITDM_CMD_PACKET_RATE)
  {
    proto_tree_add_item(itdm_tree, hf_itdm_pktrate, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
  }
  else
  {
    proto_tree_add_item(itdm_tree, hf_itdm_chloc1, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    if (chcmd == ITDM_CMD_CYCLIC_REAF ||
        chcmd == ITDM_CMD_NEW_CHAN ||
        chcmd == ITDM_CMD_CLOSE_CHAN)
    {
      proto_tree_add_item(itdm_tree, hf_itdm_cxnsize, tvb, offset, 2, ENC_BIG_ENDIAN);
      offset += 2;
    }
    else
    {
      proto_tree_add_item(itdm_tree, hf_itdm_chloc2, tvb, offset, 2, ENC_BIG_ENDIAN);
      offset += 2;
    }
  }
  }

  next_tvb = tvb_new_subset_remaining(tvb, offset);
  call_data_dissector(next_tvb, pinfo, tree);
}

static void
dissect_itdm_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  tvbuff_t  *next_tvb;
  proto_item *itdm_ctl_item = NULL;
  proto_tree *itdm_ctl_tree = NULL;
  int offset;
  guint32 flowid;
  guint8 command;
  guint32 trans_id;
  guint32 paired_trans_id;
  guint32 allocd_flowid;

  col_set_str(pinfo->cinfo, COL_PROTOCOL, "ITDM-Control");

  flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET);
  command = tvb_get_guint8(tvb, ITDM_CTL_CMD_OFFSET);
  allocd_flowid = tvb_get_ntoh24(tvb, ITDM_CTL_FLOWID_OFFSET);
  trans_id = tvb_get_ntohl(tvb, ITDM_CTL_TRANSID_OFFSET);
  paired_trans_id = tvb_get_ntohl(tvb, ITDM_CTL_PAIRED_TRANSID_OFFSET);

  col_add_fstr(pinfo->cinfo, COL_INFO,
      "Flow %d Command %s ",
      flowid, val_to_str_const(command, itdm_ctl_command_vals, "Reserved"));

  if (command != ITDM_CTL_CMD_AFI_REQ )
  {
    col_append_fstr(pinfo->cinfo, COL_INFO,
        " Alloc'd FlowID %d", allocd_flowid);
  }

  col_append_fstr(pinfo->cinfo, COL_INFO, " TransID 0x%x ", trans_id);

  if (command != ITDM_CTL_CMD_AFI_REQ )
  {
    col_append_fstr(pinfo->cinfo, COL_INFO,
        " Paired TransID 0x%x", paired_trans_id);
  }

  offset = 0;

  if (tree)
  {
  itdm_ctl_item = proto_tree_add_item(tree, proto_itdm, tvb, 0, -1, ENC_NA);
  itdm_ctl_tree = proto_item_add_subtree(itdm_ctl_item, ett_itdm_ctl);

  /* These eventually should go into a SFP.0 dissector... */
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset += 1;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_sop_eop, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  proto_tree_add_checksum(itdm_ctl_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
  offset += 2;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN);
  offset += 3;

  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_transid, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;

  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_command, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset += 1;
  if (command != ITDM_CTL_CMD_AFI_REQ) {
    proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_flowid, tvb, offset, 3, ENC_BIG_ENDIAN);
  }
  offset += 3;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_dm, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset += 1;
  /* rsvd.. */
  offset += 1;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_emts, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_pktrate, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;
  if (command != ITDM_CTL_CMD_AFI_REQ) {
    proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_ptid, tvb, offset, 4, ENC_BIG_ENDIAN);
  }
  offset += 4;
  /* rsvd.. */
  offset += 2;
  proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_cksum, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;
  }

  next_tvb = tvb_new_subset_remaining(tvb, offset);
  call_data_dissector(next_tvb, pinfo, tree);
}

static int
dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
  guint32 flowid;

  /* ZZZ for now, 125 usec mode and I-TDM control protocol
   * need to add 1ms mode */
  if (tvb_captured_length(tvb) < 18)
    return 0;

  /* See if this packet is a data flow or the I-TDM control flow. */
  flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET);

  /* gbl_ItdmCTLFlowNo is the configurable flow number where
   * the control protocol resides... Usually 0.
   */
  if (flowid == gbl_ItdmCTLFlowNo)
    dissect_itdm_control(tvb, pinfo, tree);
  else
    dissect_itdm_125usec(tvb, pinfo, tree);
  return tvb_captured_length(tvb);
}

void
proto_register_itdm(void)
{

  static hf_register_info hf[] = {
    { &hf_itdm_timestamp,{ "Timestamp", "itdm.timestamp",
      FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_seqnum,{ "Sequence Number", "itdm.seqnum",
      FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_sop_eop,{ "Start/End of Packet", "itdm.sop_eop",
      FT_UINT8, BASE_DEC, VALS(sop_eop_vals), 0xc0, NULL, HFILL } },
    { &hf_itdm_last_pack,{ "Last Packet", "itdm.last_pack",
      FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } },
    { &hf_itdm_pktlen,{ "Packet Length", "itdm.pktlen",
      FT_UINT16, BASE_DEC, NULL, 0x07ff, NULL, HFILL } },
    { &hf_itdm_chksum,{ "Checksum", "itdm.chksum",
      FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_uid,{ "Flow ID", "itdm.uid",
      FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_ack,{ "ACK", "itdm.ack",
      FT_BOOLEAN, 8, TFS(&ack_tfs), 0x20, NULL, HFILL } },
    { &hf_itdm_act,{ "Activate", "itdm.act",
      FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } },
    { &hf_itdm_chcmd,{ "Channel Command", "itdm.chcmd",
      FT_UINT8, BASE_DEC, VALS(chcmd_vals), 0x0f, NULL, HFILL } },
    { &hf_itdm_chid,{ "Channel ID", "itdm.chid",
      FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_chloc1,{ "Channel Location 1", "itdm.chloc1",
      FT_UINT16, BASE_DEC, NULL, 0x01ff, NULL, HFILL } },
    { &hf_itdm_chloc2,{ "Channel Location 2", "itdm.chloc2",
      FT_UINT16, BASE_DEC, NULL, 0x01ff, NULL, HFILL } },
    { &hf_itdm_pktrate,{ "IEEE 754 Packet Rate", "itdm.pktrate",
       FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_cxnsize, { "Connection Size", "itdm.cxnsize",
       FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },

    { &hf_itdm_ctl_transid, { "Transaction ID", "itdm.ctl_transid",
       FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_command, { "Control Command", "itdm.ctl_cmd",
       FT_UINT8, BASE_DEC, VALS(itdm_ctl_command_vals), 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_flowid, { "Allocated Flow ID", "itdm.ctl_flowid",
       FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_dm, { "I-TDM Data Mode", "itdm.ctl_dm",
       FT_UINT8, BASE_DEC, VALS(itdm_ctl_data_mode_vals), 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_emts, { "I-TDM Explicit Multi-timeslot Size", "itdm.ctlemts",
       FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_pktrate, { "I-TDM Packet Rate", "itdm.ctl_pktrate",
       FT_UINT32, BASE_HEX, VALS(itdm_ctl_pktrate_vals), 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_ptid, { "Paired Transaction ID", "itdm.ctl_ptid",
       FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
    { &hf_itdm_ctl_cksum, { "ITDM Control Message Checksum", "itdm.ctl_cksum",
       FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }
  };

  static gint *ett[] = {
    &ett_itdm,
    &ett_itdm_ctl
  };

  module_t *itdm_module;

  proto_itdm = proto_register_protocol("Internal TDM", "ITDM", "itdm");
  itdm_handle = register_dissector("itdm", dissect_itdm, proto_itdm);

  proto_register_field_array(proto_itdm, hf, array_length(hf));
  proto_register_subtree_array(ett, array_length(ett));

  itdm_module = prefs_register_protocol(proto_itdm, proto_reg_handoff_itdm);

  prefs_register_uint_preference(itdm_module, "mpls_label",
    "ITDM MPLS label (Flow Bundle ID in hex)",
    "The MPLS label (aka Flow Bundle ID) used by ITDM traffic.",
    16, &gbl_ItdmMPLSLabel);

  prefs_register_uint_preference(itdm_module, "ctl_flowno",
    "I-TDM Control Protocol Flow Number",
    "Flow Number used by I-TDM Control Protocol traffic.",
    10, &gbl_ItdmCTLFlowNo);
}

void
proto_reg_handoff_itdm(void)
{
  static gboolean Initialized=FALSE;
  static guint ItdmMPLSLabel;

  if (!Initialized) {
    Initialized=TRUE;
  } else {
    dissector_delete_uint("mpls.label", ItdmMPLSLabel, itdm_handle);
  }

  ItdmMPLSLabel = gbl_ItdmMPLSLabel;
  dissector_add_uint("mpls.label", gbl_ItdmMPLSLabel, itdm_handle);
}

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