summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-msnlb.c
blob: f691ef1e23ddf8ef5f90c6fec8cb7b5b36457c15 (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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/* packet-msnlb.c
 * Routines for MS NLB dissection
 *
 * 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/etypes.h>
#include <epan/to_str.h>
#include "packet-smb-common.h"

void proto_register_msnlb(void);
void proto_reg_handoff_msnlb(void);

static dissector_handle_t msnlb_handle;

/* Initialize the protocol and registered fields */
static int proto_msnlb = -1;

static int hf_msnlb_signature = -1;
static int hf_msnlb_version = -1;
static int hf_msnlb_uniquehostid = -1;
static int hf_msnlb_clusterip = -1;
static int hf_msnlb_dedicatedip = -1;
static int hf_msnlb_signature_data = -1;

static int hf_msnlb_myhostid = -1;
static int hf_msnlb_defaulthostid = -1;
static int hf_msnlb_convergencestate = -1;
static int hf_msnlb_numberofportrules = -1;
static int hf_msnlb_uniquehostcode = -1;
static int hf_msnlb_packetshandled = -1;
static int hf_msnlb_teamingcfg = -1;
static int hf_msnlb_teamingcfg_reserved = -1;
static int hf_msnlb_teamingcfg_xorclusterip = -1;
static int hf_msnlb_teamingcfg_numberofparticipants = -1;
static int hf_msnlb_teamingcfg_hashing = -1;
static int hf_msnlb_teamingcfg_master = -1;
static int hf_msnlb_teamingcfg_active = -1;
static int hf_msnlb_reserved = -1;
static int hf_msnlb_portruleconfiguration = -1;
static int hf_msnlb_portruleconfiguration_data = -1;
static int hf_msnlb_currentmap = -1;
static int hf_msnlb_currentmap_data = -1;
static int hf_msnlb_newmap = -1;
static int hf_msnlb_newmap_data = -1;
static int hf_msnlb_idlemap = -1;
static int hf_msnlb_idlemap_data = -1;
static int hf_msnlb_readymap = -1;
static int hf_msnlb_readymap_data = -1;
static int hf_msnlb_loadweights = -1;
static int hf_msnlb_loadweights_data = -1;
static int hf_msnlb_reserved2 = -1;
static int hf_msnlb_reserved2_data = -1;

static int hf_msnlb_extended_hb = -1;
static int hf_msnlb_extended_hb_type = -1;
static int hf_msnlb_length = -1;
static int hf_msnlb_address_family = -1;
static int hf_msnlb_host_name = -1;
static int hf_msnlb_host_ipv4 = -1;
static int hf_msnlb_host_ipv6 = -1;
static int hf_msnlb_host_unknown = -1;
static int hf_msnlb_padding = -1;
static int hf_msnlb_extended_hb_unknown = -1;

static gint ett_msnlb = -1;
static gint ett_msnlb_signature = -1;
static gint ett_msnlb_teamingcfg = -1;
static gint ett_msnlb_portruleconfiguration = -1;
static gint ett_msnlb_currentmap = -1;
static gint ett_msnlb_newmap = -1;
static gint ett_msnlb_idlemap = -1;
static gint ett_msnlb_readymap = -1;
static gint ett_msnlb_loadweights = -1;
static gint ett_msnlb_reserved = -1;
static gint ett_msnlb_extended_hb = -1;

#define NLB_CLUSTER_MEMBERSHIP_HB 0xC0DE01BF
#define NLB_EXTENDED_HB 0xC0DE01C0
#define NLB_RELIABLE_PROTOCOL 0xC0DE01DE

static const value_string nlb_signature_vals[] = {
  { NLB_CLUSTER_MEMBERSHIP_HB, "NLB Cluster Membership HeartBeat" },
  { NLB_EXTENDED_HB, "NLB Extended HeartBeat" },
  { NLB_RELIABLE_PROTOCOL, "NLB Reliable Protocol" },
  { 0, NULL }
};

static const value_string nlb_extended_hb_type_vals[] = {
  { 1, "Host name" },
  { 2, "IP Address" },
  { 0, NULL }
};

static const value_string nlb_address_family_vals[] = {
  { 0x2, "IPv4" },
  { 0x17, "IPv6" },
  { 0, NULL }
};

static true_false_string tfs_reverse_normal = { "Reverse", "Normal" };

static void
version_base_custom(gchar *result, guint32 version)
{
  snprintf(result, ITEM_LABEL_LENGTH, "%d.%d", (version  >> 8) & 0xFF, (version & 0xFF));
}

static int
dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
  proto_item  *ti;
  proto_tree  *msnlb_tree = NULL, *msnlb_subtree;
  guint16     offset = 0;
  guint32     signature;

  col_set_str(pinfo->cinfo, COL_PROTOCOL, "MS NLB");

  col_set_str(pinfo->cinfo, COL_INFO, "MS NLB heartbeat");

  if (tree) {
    ti = proto_tree_add_item(tree, proto_msnlb, tvb, 0, -1, ENC_NA);
    msnlb_tree = proto_item_add_subtree(ti, ett_msnlb);
  }

  proto_tree_add_item(msnlb_tree, hf_msnlb_signature, tvb, offset, 4, ENC_LITTLE_ENDIAN);
  signature = tvb_get_letohl(tvb, offset);
  offset += 4;

  proto_tree_add_item(msnlb_tree, hf_msnlb_version, tvb, offset, 4, ENC_LITTLE_ENDIAN);
  offset += 4;

  proto_tree_add_item(msnlb_tree, hf_msnlb_uniquehostid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
  offset += 4;

  proto_tree_add_item(msnlb_tree, hf_msnlb_clusterip, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;

  proto_tree_add_item(msnlb_tree, hf_msnlb_dedicatedip, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;

  ti = proto_tree_add_item(msnlb_tree, hf_msnlb_signature_data, tvb, offset, -1, ENC_NA);
  proto_item_append_text(ti, " - %s", val_to_str(signature, nlb_signature_vals, "Unknown (%u)"));
  col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", val_to_str(signature, nlb_signature_vals, "Unknown (%u)"));
  msnlb_subtree = proto_item_add_subtree(ti, ett_msnlb_signature);

  switch(signature){
    case NLB_CLUSTER_MEMBERSHIP_HB:{
      guint32 i;
      proto_tree *teamingcfg_tree, *subtree;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_myhostid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
      offset += 2;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_defaulthostid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
      offset += 2;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_convergencestate, tvb, offset, 2, ENC_LITTLE_ENDIAN);
      offset += 2;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_numberofportrules, tvb, offset, 2, ENC_LITTLE_ENDIAN);
      offset += 2;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_uniquehostcode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      offset += 4;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_packetshandled, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      offset += 4;

      /* Teaming configuration/state code, which is of the form:

         -------------------------------------
         |XXXXXXXX|PPPPPPPP|PPPPPPPP|NNNNNHMA|
         -------------------------------------

         X: Reserved
         P: XOR of the least significant 16 bits of each participant's cluster IP address
         N: Number of participants
         H: Hashing (Reverse=1, Normal=0)
         M: Master (Yes=1, No=0)
         A: Teaming active (Yes=1, No=0)
      */

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_teamingcfg, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      teamingcfg_tree = proto_item_add_subtree(ti, ett_msnlb_teamingcfg);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_xorclusterip, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_numberofparticipants, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_hashing, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_master, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      proto_tree_add_item(teamingcfg_tree, hf_msnlb_teamingcfg_active, tvb, offset, 4, ENC_LITTLE_ENDIAN);
      offset += 4;

      proto_tree_add_item(msnlb_subtree, hf_msnlb_reserved, tvb, offset, 4, ENC_NA);
      offset += 4;

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_portruleconfiguration, tvb, offset, 4*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_portruleconfiguration);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_portruleconfiguration_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_currentmap, tvb, offset, 8*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_currentmap);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_currentmap_data, tvb, offset, 8, ENC_LITTLE_ENDIAN);
        offset += 8;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_newmap, tvb, offset, 8*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_newmap);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_newmap_data, tvb, offset, 8, ENC_LITTLE_ENDIAN);
        offset += 8;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_idlemap, tvb, offset, 8*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_idlemap);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_idlemap_data, tvb, offset, 8, ENC_LITTLE_ENDIAN);
        offset += 8;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_readymap, tvb, offset, 8*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_readymap);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_readymap_data, tvb, offset, 8, ENC_LITTLE_ENDIAN);
        offset += 8;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_loadweights, tvb, offset, 4*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_loadweights);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_loadweights_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
      }

      ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_reserved2, tvb, offset, 4*33, ENC_NA);
      subtree = proto_item_add_subtree(ti, ett_msnlb_reserved);
      for(i = 1; i <= 33; i++){
        proto_tree_add_item(subtree, hf_msnlb_reserved2_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
      }
    }
    break;
    case NLB_EXTENDED_HB:{
      guint8 hb_type;
      proto_tree *hb_tree;
      while (tvb_reported_length_remaining(tvb, offset) > 0) {
        ti = proto_tree_add_item(msnlb_subtree, hf_msnlb_extended_hb, tvb, offset, -1, ENC_NA);
        hb_tree = proto_item_add_subtree(ti, ett_msnlb_extended_hb);

        proto_tree_add_item(hb_tree, hf_msnlb_extended_hb_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
        hb_type = tvb_get_guint8(tvb, offset);
        proto_item_append_text(ti, " - %s", val_to_str(hb_type, nlb_extended_hb_type_vals, "Unknown (%u)"));
        offset += 1;

        switch(hb_type){
          case 1:{ /* FQDN */
            char *fqdn = NULL;
            proto_tree_add_item(hb_tree, hf_msnlb_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
            offset += 1;
            proto_tree_add_item(hb_tree, hf_msnlb_reserved, tvb, offset, 2, ENC_NA);
            offset += 2;
            proto_tree_add_item(hb_tree, hf_msnlb_reserved, tvb, offset, 4, ENC_NA);
            offset += 4;
            offset = display_unicode_string(tvb, pinfo, hb_tree, offset, hf_msnlb_host_name, &fqdn);
            offset += 6;
            proto_item_append_text(ti, ": %s", fqdn);
            }
          break;
          case 2:{ /* IP */
            guint16 address_family;
            proto_tree_add_item(hb_tree, hf_msnlb_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
            offset += 1;
            proto_tree_add_item(hb_tree, hf_msnlb_reserved, tvb, offset, 2, ENC_NA);
            offset += 2;
            proto_tree_add_item(hb_tree, hf_msnlb_reserved, tvb, offset, 4, ENC_NA);
            offset += 4;
            proto_tree_add_item(hb_tree, hf_msnlb_address_family, tvb, offset, 2, ENC_LITTLE_ENDIAN);
            address_family = tvb_get_letohs(tvb, offset);
            offset += 2;
            switch(address_family){
              case 0x2: /* IPv4 */
                proto_tree_add_item(hb_tree, hf_msnlb_host_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
                proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb, offset));
                offset += 4;
                break;
              case 0x17: /* IPv6 */
                proto_tree_add_item(hb_tree, hf_msnlb_host_ipv6, tvb, offset, 16, ENC_NA);
                proto_item_append_text(ti, ": %s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
                offset += 16;
                break;
              default: /* Unknown */
                proto_tree_add_item(hb_tree, hf_msnlb_host_unknown, tvb, offset, -1, ENC_NA);
                offset += tvb_reported_length_remaining(tvb, offset);
              break;
            }
            proto_tree_add_item(hb_tree, hf_msnlb_padding, tvb, offset, -1, ENC_NA);
            offset += tvb_reported_length_remaining(tvb, offset);
          }
          break;
          default: /* default ?! */
            proto_tree_add_item(hb_tree, hf_msnlb_extended_hb_unknown, tvb, offset, -1, ENC_NA);
            offset += tvb_reported_length_remaining(tvb, offset);
          break;
        }
      }


    }
    break;

    default:
    break;
  }

  return tvb_captured_length(tvb);
}

void
proto_register_msnlb(void)
{
  static hf_register_info hf[] = {
    { &hf_msnlb_signature,
      { "Signature", "msnlb.signature",
        FT_UINT32, BASE_HEX,
        VALS(nlb_signature_vals), 0,
        NULL, HFILL }
    },
    { &hf_msnlb_version,
      { "Version", "msnlb.version",
        FT_UINT32, BASE_CUSTOM,
        CF_FUNC(version_base_custom), 0,
        NULL, HFILL }
    },
    { &hf_msnlb_uniquehostid,
      { "Unique Host ID", "msnlb.unique_host_id",
        FT_UINT32, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_clusterip,
      { "Cluster IP", "msnlb.cluster_ip",
        FT_IPv4, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_dedicatedip,
      { "Host IP", "msnlb.host_ip",
        FT_IPv4, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_signature_data,
      { "Signature Data", "msnlb.signature_data",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_myhostid,
      { "My Host id", "msnlb.my_host_ip",
        FT_UINT16, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_defaulthostid,
      { "Default Host id", "msnlb.default_host_ip",
        FT_UINT16, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_convergencestate,
      { "Convergence State", "msnlb.convergence_state",
        FT_UINT16, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_numberofportrules,
      { "Number of Port Rules", "msnlb.number_of_port_rules",
        FT_UINT16, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_uniquehostcode,
      { "Unique Host Code", "msnlb.unique_host_code",
        FT_UINT32, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_packetshandled,
      { "Packets Handled", "msnlb.packets_handled",
        FT_UINT32, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg,
      { "Teaming Configuration", "msnlb.teamincfg",
        FT_UINT32, BASE_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg_reserved,
      { "Reserved", "msnlb.teamincfg.reserved",
        FT_UINT32, BASE_HEX,
        NULL, 0xFF000000,
        "Must be zero", HFILL }
    },
    { &hf_msnlb_teamingcfg_xorclusterip,
      { "XOR of the least significant 16 bits of each participant's cluster IP address", "msnlb.teamingcfg.xorclusterip",
        FT_UINT32, BASE_HEX,
        NULL, 0x00FFFF00,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg_numberofparticipants,
      { "Number of Participants", "msnlb.teamingcfg.number_of_participants",
        FT_UINT32, BASE_HEX,
        NULL, 0x000000F8,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg_hashing,
      { "Hashing", "msnlb.teamingcfg.hashing",
        FT_BOOLEAN, 32,
        TFS(&tfs_reverse_normal), 0x00000004,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg_master,
      { "Master", "msnlb.teamingcfg.master",
        FT_BOOLEAN, 32,
        NULL, 0x00000002,
        NULL, HFILL }
    },
    { &hf_msnlb_teamingcfg_active,
      { "Active", "msnlb.teamingcfg.active",
        FT_BOOLEAN, 32,
        NULL, 0x00000001,
        NULL, HFILL }
    },
    { &hf_msnlb_reserved,
      { "Reserved", "msnlb.reserved",
        FT_BYTES, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_portruleconfiguration,
      { "Port Rule Configuration", "msnlb.portruleconfiguration",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_portruleconfiguration_data,
      { "Port Rule Configuration Data", "msnlb.portruleconfiguration.data",
        FT_UINT32, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_currentmap,
      { "Current Map", "msnlb.currentmap",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_currentmap_data,
      { "Current Map Data", "msnlb.currentmap.data",
        FT_UINT64, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_newmap,
      { "New Map", "msnlb.newmap",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_newmap_data,
      { "New Map Data", "msnlb.newmap.data",
        FT_UINT64, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_idlemap,
      { "Idle Map", "msnlb.idlemap",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_idlemap_data,
      { "Idle Map Data", "msnlb.idlemap.data",
        FT_UINT64, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_readymap,
      { "Ready Map", "msnlb.readymap",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_readymap_data,
      { "Ready Map Data", "msnlb.readymap.data",
        FT_UINT64, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_loadweights,
      { "Load Weights", "msnlb.loadweights",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_loadweights_data,
      { "Load Weights Data", "msnlb.loadweights.data",
        FT_UINT32, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_reserved2,
      { "Reserved", "msnlb.reserved2",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_reserved2_data,
      { "Reserved Data", "msnlb.reserved2.data",
        FT_UINT32, BASE_DEC_HEX,
        NULL, 0,
        NULL, HFILL }
    },

    { &hf_msnlb_extended_hb,
      { "Extended HB", "msnlb.extended_hb",
        FT_NONE, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },

    { &hf_msnlb_extended_hb_type,
      { "Type", "msnlb.extended_hb.type",
        FT_UINT8, BASE_DEC,
        VALS(nlb_extended_hb_type_vals), 0,
        NULL, HFILL }
    },
    { &hf_msnlb_length,
      { "Length", "msnlb.length",
        FT_UINT8, BASE_DEC,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_address_family,
      { "Address Family", "msnlb.address_family",
        FT_UINT16, BASE_HEX_DEC,
        VALS(nlb_address_family_vals), 0,
        NULL, HFILL }
    },
    { &hf_msnlb_host_name,
      { "Host name", "msnlb.host_name",
        FT_STRING, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_host_ipv4,
      { "Host IPv4", "msnlb.host_ipv4",
        FT_IPv4, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_host_ipv6,
      { "Host IPv6", "msnlb.host_ipv6",
        FT_IPv6, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_host_unknown,
      { "Host Unknown", "msnlb.host_unknown",
        FT_BYTES, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_padding,
      { "Padding", "msnlb.padding",
        FT_BYTES, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    },
    { &hf_msnlb_extended_hb_unknown,
      { "Unknown HB Data", "msnlb.extended_hb.unknown",
        FT_BYTES, BASE_NONE,
        NULL, 0,
        NULL, HFILL }
    }
  };

  static gint *ett[] = {
    &ett_msnlb,
    &ett_msnlb_signature,
    &ett_msnlb_teamingcfg,
    &ett_msnlb_portruleconfiguration,
    &ett_msnlb_currentmap,
    &ett_msnlb_newmap,
    &ett_msnlb_idlemap,
    &ett_msnlb_readymap,
    &ett_msnlb_loadweights,
    &ett_msnlb_reserved,
    &ett_msnlb_extended_hb
  };

  proto_msnlb = proto_register_protocol("MS Network Load Balancing", "MS NLB", "msnlb");
  proto_register_field_array(proto_msnlb, hf, array_length(hf));
  proto_register_subtree_array(ett, array_length(ett));

  msnlb_handle = register_dissector("msnlb", dissect_msnlb, proto_msnlb);
}

void
proto_reg_handoff_msnlb(void)
{
  dissector_add_uint("ethertype", ETHERTYPE_MS_NLB_HEARTBEAT, msnlb_handle);
}

/*
 * Editor modelines
 *
 * 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:
 */