aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ecp.c
blob: 87c951103e9c288592d7b6a85042781c8afe7983 (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
/* packet-ecp.c
 * Routines for Solaris ECP/VDP dissection based on IEEE 802.1Qbg Draft 2.1
 *
 * 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 <epan/expert.h>
#include <epan/oui.h>

void proto_register_ecp(void);
void proto_register_vdp(void);
void proto_reg_handoff_ecp_21(void);
void proto_reg_handoff_vdp(void);

static dissector_handle_t ecp_handle;
static dissector_handle_t vdp_handle;

static int proto_ecp;
static int hf_ecp_version;
static int hf_ecp_op;
static int hf_ecp_subtype;
static int hf_ecp_seqno;

static int proto_vdp;
static int hf_vdp_tlv_type;
static int hf_vdp_tlv_len;
static int hf_vdp_tlv_assoc_reason;
static int hf_vdp_vidstr_ps;
static int hf_vdp_vidstr_pcp;
static int hf_vdp_vidstr_vid;
static int hf_vdp_vsitypeid;
static int hf_vdp_vsiversion;
static int hf_vdp_vsiid_format;
static int hf_vdp_vsiid;
static int hf_vdp_filter_format;
static int hf_vdp_assoc_mac_id;
static int hf_vdp_manager_id;
static int hf_vdp_data;
static int hf_vdp_tlv_org_oui;
static int hf_vdp_tlv_oracle_subtype;
static int hf_vdp_tlv_assoc_flag_mbit;
static int hf_vdp_tlv_assoc_flag_sbit;
static int hf_vdp_tlv_assoc_flag_req_rsp;
static int hf_vdp_tlv_assoc_request_flags;
static int hf_vdp_tlv_assoc_flag_hard_error;
static int hf_vdp_tlv_assoc_flag_keep;
static int hf_vdp_tlv_assoc_error;
static int hf_vdp_tlv_assoc_response_flags;

static int hf_oui_oracle_encoding;

static gint ett_ecp;
static gint ett_vdp_tlv;
static gint ett_vdp_tlv_assoc;
static gint ett_vdp_tlv_org;
static gint ett_vdp_assoc_flags;

static expert_field ei_vdp_tlvlen_bad;

static dissector_table_t   ecp_subdissector_table;

#define	ECP_OP_REQ		0x0
#define	ECP_OP_ACK		0x1

#define	ECP_SUBTYPE_VDP		0x0001
#define	ECP_SUBTYPE_PECSP	0x0002

#define VDP_TLV_PREASSOC	0x01
#define VDP_TLV_PREASSOCRR	0x02
#define VDP_TLV_ASSOC		0x03
#define VDP_TLV_DEASSOC		0x04
#define VDP_TLV_MGRID		0x05
#define	VDP_TLV_ORG		0x7F

#define	VSI_FMT_IPv4		0x01
#define	VSI_FMT_IPv6		0x02
#define	VSI_FMT_MAC		0x03
#define	VSI_FMT_LOCAL		0x04
#define	VSI_FMT_UUID		0x05

#define	VDP_FILTER_VID		0x01
#define	VDP_FILTER_MACVID	0x02
#define	VDP_FILTER_GRPVID	0x03
#define	VDP_FILTER_GRPMACVID	0x04

/* Masks - from packet-lldp.c */
#define TLV_TYPE_MASK		0xFE00
#define TLV_TYPE(value)		(((value) & TLV_TYPE_MASK) >> 9)
#define TLV_INFO_LEN_MASK	0x01FF
#define TLV_INFO_LEN(value)	((value) & TLV_INFO_LEN_MASK)

#define	ECP_VERSION_MASK	0xF000
#define	ECP_OP_MASK		0x0C00
#define	ECP_SUBTYPE_MASK	0x03FF

#define	ECP_VERSION(value)	(((value) & ECP_VERSION_MASK) >> 12)
#define	ECP_OP(value)		(((value) & ECP_OP_MASK) >> 10)
#define	ECP_SUBTYPE(value)	(((value) & ECP_SUBTYPE_MASK))

#define	OUI_ORACLE_VSIMGR_SUBTYPE	0x01

static const value_string ecp_op_vals[] = {
	{ ECP_OP_REQ,	"ECP request" },
	{ ECP_OP_ACK,	"ECP acknowledgement" },
	{ 0,	NULL }
};

static const value_string ecp_subtype_vals[] = {
	{ ECP_SUBTYPE_VDP,	"VDP" },
	{ 0,			NULL }
};

static const value_string vdp_tlv_type_vals[] = {
	{ VDP_TLV_PREASSOC,		"PreAssociate" },
	{ VDP_TLV_PREASSOCRR,		"PreAssociate with RR" },
	{ VDP_TLV_ASSOC,		"Associate" },
	{ VDP_TLV_DEASSOC,		"DeAssociate" },
	{ VDP_TLV_MGRID,		"VSI Manager ID" },
	{ VDP_TLV_ORG,			"Organizationally defined TLV" },
	{ 0x0,				NULL }
};

static const value_string oui_oracle_subtype_vals[] = {
	{ OUI_ORACLE_VSIMGR_SUBTYPE,		"VSI Manager Subtype" },
	{ 0x0,					NULL }
};

static const value_string oui_oracle_encoding_vals[] = {
	{ 0x1,		"oracle_vsi_v1" },
	{ 0x0,		NULL }
};

static const value_string vdp_response_error_type_vals[] = {
	{ 0x0,	"Success" },
	{ 0x1,	"Invalid Format" },
	{ 0x2,	"Insufficient Resource" },
	{ 0x3,	"Unable to Contact VSI Manager" },
	{ 0x4,	"Other Failure" },
	{ 0x5,	"Invalid VID, GroupID, or Mac address" },
	{ 0x0,	NULL }
};

static const value_string vdp_vsiid_format_vals[] = {
	{ VSI_FMT_IPv4,		"IPv4" },
	{ VSI_FMT_IPv6,		"IPv6" },
	{ VSI_FMT_MAC,		"MAC" },
	{ VSI_FMT_LOCAL,	"Local" },
	{ VSI_FMT_UUID,		"UUID" },
	{ 0x0,	NULL }
};

static const value_string vdp_filter_format_vals[] = {
	{ VDP_FILTER_VID,		"VID" },
	{ VDP_FILTER_MACVID,		"MAC/VID" },
	{ VDP_FILTER_GRPVID,		"GroupID/VID" },
	{ VDP_FILTER_GRPMACVID,		"GroupID/MAC/VID" },
	{ 0x0,				NULL }
};

static void
vdp_add_vidstr(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
{
	if (tree) {
		proto_tree_add_item(tree, hf_vdp_vidstr_ps, tvb, offset, 2, ENC_BIG_ENDIAN);
		proto_tree_add_item(tree, hf_vdp_vidstr_pcp, tvb, offset, 2, ENC_BIG_ENDIAN);
		proto_tree_add_item(tree, hf_vdp_vidstr_vid, tvb, offset, 2, ENC_BIG_ENDIAN);
	}
}

static void
dissect_vdp_tlv_assoc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item* length_item _U_, int offset, guint8 tlvtype, int tlvlen _U_)
{
	proto_tree *vdp_tlv_assoc_tree;
	proto_item *associate_item;
	guint8 reason, filter_format;
	int start_offset = offset;

	if (tlvtype == VDP_TLV_ASSOC)
		vdp_tlv_assoc_tree = proto_tree_add_subtree(tree, tvb, offset, 0,
			ett_vdp_tlv_assoc, &associate_item, "VDP Associate");
	else
		vdp_tlv_assoc_tree = proto_tree_add_subtree(tree, tvb, offset, 0,
			ett_vdp_tlv_assoc, &associate_item, "VDP DeAssociate");

	/* Reason */
	reason = tvb_get_guint8(tvb, offset);
	if (reason & 0x40) {
		static int * const response_flags[] = {
			&hf_vdp_tlv_assoc_flag_hard_error,
			&hf_vdp_tlv_assoc_flag_keep,
			&hf_vdp_tlv_assoc_flag_req_rsp,
			NULL
		};

		proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_tlv_assoc_error, tvb, offset, 1, ENC_BIG_ENDIAN);
		proto_tree_add_bitmask(vdp_tlv_assoc_tree, tvb, offset, hf_vdp_tlv_assoc_response_flags, ett_vdp_assoc_flags, response_flags, ENC_BIG_ENDIAN);
	} else {
		static int * const request_flags[] = {
			&hf_vdp_tlv_assoc_flag_mbit,
			&hf_vdp_tlv_assoc_flag_sbit,
			&hf_vdp_tlv_assoc_flag_req_rsp,
			NULL
		};

		proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_tlv_assoc_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
		proto_tree_add_bitmask(vdp_tlv_assoc_tree, tvb, offset, hf_vdp_tlv_assoc_request_flags, ett_vdp_assoc_flags, request_flags, ENC_BIG_ENDIAN);
	}
	offset++;

	/* VSITYPEID/VERSION */
	proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_vsitypeid, tvb, offset, 3, ENC_BIG_ENDIAN);
	offset += 3;
	proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_vsiversion, tvb, offset, 1, ENC_BIG_ENDIAN);
	offset++;

	/* VSIID Format */
	proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_vsiid_format, tvb, offset, 1, ENC_BIG_ENDIAN);
	offset++;

	/* VSIID */
	proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_vsiid, tvb, offset, 16, ENC_NA);
	offset += 16;

	/* Filter Format */
	proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_filter_format, tvb, offset, 1, ENC_BIG_ENDIAN);
	filter_format = tvb_get_guint8(tvb, offset);
	offset++;

	switch (filter_format) {
	case VDP_FILTER_VID:
		vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset);
		offset += 2;
		break;
	case VDP_FILTER_MACVID:
		proto_tree_add_item(vdp_tlv_assoc_tree, hf_vdp_assoc_mac_id, tvb, offset, 6, ENC_NA);
		offset += 6;
		vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset);
		offset += 2;
		break;
	}

	proto_item_set_len(associate_item, offset-start_offset);
}

static void
dissect_vdp_tlv_mgrid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item* length_item, int offset, int tlvlen)
{
	if (tlvlen != 16) {
		expert_add_info(pinfo, length_item, &ei_vdp_tlvlen_bad);
	} else {
		proto_tree_add_item(tree, hf_vdp_manager_id, tvb, offset, 16, ENC_NA);
	}
}

static void
dissect_oracle_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset)
{
	proto_tree_add_item(tree, hf_oui_oracle_encoding, tvb, offset, 1, ENC_BIG_ENDIAN);
}

static void
dissect_vdp_tlv_org(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item* length_item, int offset, int tlvlen)
{
	guint32 oui;
	guint8 subtype;

	if (tlvlen < 3) {
		expert_add_info(pinfo, length_item, &ei_vdp_tlvlen_bad);
        return;
	}

	proto_tree_add_item_ret_uint(tree, hf_vdp_tlv_org_oui, tvb, offset, 3, ENC_BIG_ENDIAN, &oui);
	offset += 3;

	/* XXX only support Oracle OUI for now */
	if (oui != OUI_ORACLE)
		return;

	proto_tree_add_item(tree, hf_vdp_tlv_oracle_subtype, tvb, offset, 1, ENC_NA);
	subtype = tvb_get_guint8(tvb, offset);
	offset++;

	switch (subtype) {
	case OUI_ORACLE_VSIMGR_SUBTYPE:
		dissect_oracle_tlv(tvb, pinfo, tree, offset);
		break;
	}
}

static int
dissect_vdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
	proto_tree *vdp_tlv_tree;
	proto_item *ti, *length_item;
	int offset = 0;
	guint8	tlvtype;
	guint16 tlvhdr;
	int tlvlen = 0;

	while (tvb_reported_length_remaining(tvb, offset) > 0) {
		tlvhdr = tvb_get_ntohs(tvb, offset);
		tlvtype = TLV_TYPE(tlvhdr);
		tlvlen = TLV_INFO_LEN(tlvhdr);

		if (tlvtype == 0) /* XXX most likely it's padding */
			break;

		vdp_tlv_tree = proto_tree_add_subtree(tree, tvb, offset,
			tlvlen + 2, ett_vdp_tlv, &ti, "VDP TLV");
		proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_type, tvb,
			offset, 2, ENC_BIG_ENDIAN);
		length_item = proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_len, tvb,
			offset, 2, ENC_BIG_ENDIAN);

		offset += 2;
		switch (tlvtype) {
		case VDP_TLV_PREASSOC:
			break;
		case VDP_TLV_PREASSOCRR:
			break;
		case VDP_TLV_ASSOC:
		case VDP_TLV_DEASSOC:
			dissect_vdp_tlv_assoc(tvb, pinfo, vdp_tlv_tree, length_item, offset, tlvtype, tlvlen);
			break;
		case VDP_TLV_MGRID:
			dissect_vdp_tlv_mgrid(tvb, pinfo, vdp_tlv_tree, length_item, offset, tlvlen);
			break;
		case VDP_TLV_ORG:
			dissect_vdp_tlv_org(tvb, pinfo, vdp_tlv_tree, length_item, offset, tlvlen);
			break;
		default:
			proto_tree_add_item(vdp_tlv_tree, hf_vdp_data, tvb, offset, tlvlen, ENC_NA);
			break;
		}

		offset += tlvlen;
	}

	return offset;
}

static int
dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
	proto_item *ti;
	proto_tree *ecp_tree = NULL;
	int offset = 0;
	tvbuff_t *next_tvb;
	guint16 hdr, ver, op, subtype, seqno;

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECP");
	col_clear(pinfo->cinfo, COL_INFO);

	/* details */
	ti = proto_tree_add_item(tree, proto_ecp, tvb, 0, -1, ENC_NA);
	ecp_tree = proto_item_add_subtree(ti, ett_ecp);

	proto_tree_add_item(ecp_tree, hf_ecp_version, tvb, offset, 2,
		ENC_BIG_ENDIAN);
	proto_tree_add_item(ecp_tree, hf_ecp_op, tvb, offset, 2,
		ENC_BIG_ENDIAN);
	proto_tree_add_item(ecp_tree, hf_ecp_subtype, tvb, offset, 2,
		ENC_BIG_ENDIAN);

	/* Version/OP/Subtype */
	hdr = tvb_get_ntohs(tvb, offset);
	ver = ECP_VERSION(hdr);
	op = ECP_OP(hdr);
	subtype = ECP_SUBTYPE(hdr);
	col_add_fstr(pinfo->cinfo, COL_INFO,
	    "PDU Version = %x OP = %x Subtype = %x", ver, op, subtype);

	offset += 2;

	/* Seqno */
	if (tree) {
		proto_tree_add_item(ecp_tree, hf_ecp_seqno, tvb, offset, 2,
		    ENC_BIG_ENDIAN);
	}
	seqno = tvb_get_ntohs(tvb, offset);
	switch (op) {
	case ECP_OP_REQ:
		col_append_fstr(pinfo->cinfo, COL_INFO,
		    " SEQ = 0x%x", seqno);
		break;
	case ECP_OP_ACK:
		col_append_fstr(pinfo->cinfo, COL_INFO,
		    " ACK = 0x%x", seqno);
		break;
	}
	offset += 2;

	next_tvb = tvb_new_subset_remaining(tvb, offset);
	if (!dissector_try_uint(ecp_subdissector_table, subtype, next_tvb, pinfo, ecp_tree))
	{
		call_data_dissector(next_tvb, pinfo, tree);
	}

	return tvb_captured_length(tvb);
}

void
proto_register_ecp(void)
{
	static hf_register_info hf[] = {
		{ &hf_ecp_version,
		{ "Version",	"ecp.ver", FT_UINT16, BASE_DEC,
		    NULL, ECP_VERSION_MASK, NULL, HFILL }},
		{ &hf_ecp_op,
		{ "Operation", "ecp.op", FT_UINT16, BASE_HEX,
		    VALS(ecp_op_vals), ECP_OP_MASK, NULL, HFILL }},
		{ &hf_ecp_subtype,
		{ "Subtype", "ecp.subtype", FT_UINT16, BASE_HEX,
		    VALS(ecp_subtype_vals), ECP_SUBTYPE_MASK, NULL, HFILL }},
		{ &hf_ecp_seqno,
		{ "Sequence number", "ecp.seqno", FT_UINT16, BASE_DEC,
		    NULL, 0x0, NULL, HFILL }},
	};

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

	proto_ecp = proto_register_protocol("Edge Control Protocol", "ECP21", "ecp21");
	proto_register_field_array(proto_ecp, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));

	ecp_handle = register_dissector("ecp21", dissect_ecp, proto_ecp);
	ecp_subdissector_table = register_dissector_table("ecp.subtype", "ECP Subtypes", proto_ecp, FT_UINT32, BASE_DEC);
}

void
proto_register_vdp(void)
{
	static hf_register_info hf[] = {
		{ &hf_vdp_tlv_type,
		{ "VDP TLV Type", "vdp21.tlvtype", FT_UINT16, BASE_DEC,
			VALS(vdp_tlv_type_vals), TLV_TYPE_MASK, NULL, HFILL }},
		{ &hf_vdp_tlv_len,
		{ "VDP TLV Length", "vdp21.tlvlen", FT_UINT16, BASE_DEC,
			NULL, TLV_INFO_LEN_MASK, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_reason,
		{ "Reason", "vdp21.assoc.reason", FT_UINT8, BASE_HEX,
			NULL, 0x0F, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_error,
		{ "Error", "vdp21.assoc.error", FT_UINT8, BASE_HEX,
			VALS(vdp_response_error_type_vals), 0x0F, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_request_flags,
		{ "Flags", "vdp21.assoc.request_flags", FT_UINT8, BASE_HEX,
			NULL, 0xF0, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_response_flags,
		{ "Flags", "vdp21.assoc.response_flags", FT_UINT8, BASE_HEX,
			NULL, 0xF0, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_flag_mbit,
		{ "M-Bit", "vdp21.assoc.flags.mbit", FT_BOOLEAN, 8,
			NULL, 0x10, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_flag_sbit,
		{ "S-Bit", "vdp21.assoc.flags.sbit", FT_BOOLEAN, 8,
			NULL, 0x20, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_flag_req_rsp,
		{ "Response", "vdp21.assoc.flags.req_rsp", FT_BOOLEAN, 8,
			NULL, 0x40, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_flag_hard_error,
		{ "Hard Error", "vdp21.assoc.flags.hard_error", FT_BOOLEAN, 8,
			NULL, 0x10, NULL, HFILL }},
		{ &hf_vdp_tlv_assoc_flag_keep,
		{ "Keep", "vdp21.assoc.flags.keep", FT_BOOLEAN, 8,
			NULL, 0x20, NULL, HFILL }},
		{ &hf_oui_oracle_encoding,
		{ "VSI Manager ID Encoding", "vdp21.oracle.encoding", FT_UINT8,
			BASE_HEX, VALS(oui_oracle_encoding_vals),
			0x0, NULL, HFILL}},
		{ &hf_vdp_vsitypeid,
		{ "VSI Type ID", "vdp21.vsitypeid", FT_UINT24,
			BASE_HEX, NULL, 0x0, NULL, HFILL}},
		{ &hf_vdp_vsiversion,
		{ "VSI Version", "vdp21.vsiversion", FT_UINT8,
			BASE_HEX, NULL, 0x0, NULL, HFILL}},
		{ &hf_vdp_vsiid_format,
		{ "VSIID Format", "vdp21.vsiidformat", FT_UINT8,
			BASE_HEX, VALS(vdp_vsiid_format_vals), 0x0,
			NULL, HFILL}},
		{ &hf_vdp_filter_format,
		{ "VDP Filter Format", "vdp21.filterformat", FT_UINT8,
			BASE_HEX, VALS(vdp_filter_format_vals), 0x0,
			NULL, HFILL}},
		{ &hf_vdp_assoc_mac_id,
		{ "MAC ID", "vdp21.assoc.mac_id", FT_ETHER, BASE_NONE,
			NULL, 0x0, NULL, HFILL }},
		{ &hf_vdp_vsiid,
		{ "VSIID", "vdp21.VSIID", FT_BYTES, SEP_COLON,
			NULL, 0x0, NULL, HFILL }},
		{ &hf_vdp_vidstr_ps,
		{ "VIDSTR PS", "vdp21.vidstr.ps", FT_UINT16, BASE_HEX,
			NULL, 0x0800, NULL, HFILL }},
		{ &hf_vdp_vidstr_pcp,
		{ "VIDSTR PCP", "vdp21.vidstr.pcp", FT_UINT16, BASE_HEX,
			NULL, 0x0700, NULL, HFILL }},
		{ &hf_vdp_vidstr_vid,
		{ "VIDSTR VID", "vdp21.vidstr.vid", FT_UINT16, BASE_HEX,
			NULL, 0x0FFF, NULL, HFILL }},
		{ &hf_vdp_manager_id,
		{ "VDP Manager ID", "vdp21.manager_id", FT_IPv6, BASE_NONE,
			NULL, 0x0, NULL, HFILL }},
		{ &hf_vdp_data,
		{ "Data", "vdp21.data", FT_BYTES, BASE_NONE,
			NULL, 0x0, NULL, HFILL }},
		{ &hf_vdp_tlv_org_oui,
		{ "VIDSTR VID", "vdp21.org_oui", FT_UINT24, BASE_OUI,
			NULL, 0x0, NULL, HFILL }},
		{ &hf_vdp_tlv_oracle_subtype,
		{ "Oracle Subtype", "vdp21.org.oracle.subtype", FT_UINT8, BASE_HEX,
			VALS(oui_oracle_subtype_vals), 0x0, NULL, HFILL }},
	};

	static gint *ett[] = {
		&ett_vdp_tlv,
		&ett_vdp_tlv_assoc,
		&ett_vdp_tlv_org,
		&ett_vdp_assoc_flags,
	};

	static ei_register_info ei[] = {
		{ &ei_vdp_tlvlen_bad, { "vdp21.tlvlen.bad", PI_MALFORMED, PI_ERROR, "VDP TLV Invalid Length", EXPFILL }},
	};

	expert_module_t* expert_vdp;

	proto_vdp = proto_register_protocol("VSI protocol", "VDP21", "vdp21");
	proto_register_field_array(proto_vdp, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
	expert_vdp = expert_register_protocol(proto_vdp);
	expert_register_field_array(expert_vdp, ei, array_length(ei));

	vdp_handle = register_dissector("vdp21", dissect_vdp, proto_vdp);
}

void
proto_reg_handoff_ecp_21(void)
{
	dissector_add_uint("ethertype", ETHERTYPE_ECP, ecp_handle);
}

void
proto_reg_handoff_vdp(void)
{
	dissector_add_uint("ecp.subtype", ECP_SUBTYPE_VDP, vdp_handle);
}

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