Create a header file for every packet-*.c file. Prune the packet.h file.
[obnox/wireshark/wip.git] / packet-vtp.c
1 /* packet-vtp.c
2  * Routines for the disassembly of Cisco's Virtual Trunking Protocol
3  *
4  * $Id: packet-vtp.c,v 1.1 2000/02/05 09:19:04 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  * 
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25  
26 #include "config.h"
27
28 #ifdef HAVE_SYS_TYPES_H
29 #include <sys/types.h>
30 #endif
31
32 #include <stdlib.h>
33 #include <string.h>
34
35 #include <glib.h>
36 #include "packet.h"
37
38 /*
39  * See
40  *
41  *      http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
42  *
43  * for some information on VTP.
44  *
45  * It's incomplete, and it appears to be inaccurate in a number of places,
46  * but it's all I could find....
47  */
48
49 static int proto_vtp = -1;
50 static int hf_vtp_version = -1;
51 static int hf_vtp_code = -1;
52 static int hf_vtp_followers = -1;
53 static int hf_vtp_md_len = -1;
54 static int hf_vtp_md = -1;
55 static int hf_vtp_conf_rev_num = -1;
56 static int hf_vtp_upd_id = -1;
57 static int hf_vtp_upd_ts = -1;
58 static int hf_vtp_md5_digest = -1;
59 static int hf_vtp_seq_num = -1;
60 static int hf_vtp_start_value = -1;
61 static int hf_vtp_vlan_info_len = -1;
62 static int hf_vtp_vlan_status_vlan_susp = -1;
63 static int hf_vtp_vlan_type = -1;
64 static int hf_vtp_vlan_name_len = -1;
65 static int hf_vtp_isl_vlan_id = -1;
66 static int hf_vtp_mtu_size = -1;
67 static int hf_vtp_802_10_index = -1;
68 static int hf_vtp_vlan_name = -1;
69 static int hf_vtp_vlan_tlvtype = -1;
70 static int hf_vtp_vlan_tlvlength = -1;
71
72 static gint ett_vtp = -1;
73 static gint ett_vtp_vlan_info = -1;
74 static gint ett_vtp_vlan_status = -1;
75 static gint ett_vtp_tlv = -1;
76
77 static int
78 dissect_vlan_info(const u_char *pd, int offset, proto_tree *tree);
79 static void
80 dissect_vlan_info_tlv(const u_char *pd, int offset, int length,
81     proto_tree *tree, proto_item *ti, guint8 type);
82
83 #define SUMMARY_ADVERT          0x01
84 #define SUBSET_ADVERT           0x02
85 #define ADVERT_REQUEST          0x03
86
87 static const value_string type_vals[] = {
88         { SUMMARY_ADVERT, "Summary-Advert" },
89         { SUBSET_ADVERT,  "Subset-Advert" },
90         { ADVERT_REQUEST, "Advert-Request" },
91         { 0,              NULL },
92 };
93         
94 void 
95 dissect_vtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
96 {
97         proto_item *ti; 
98         proto_tree *vtp_tree = NULL;
99         guint8 code;
100         guint8 md_len;
101         int vlan_info_len;
102
103         if (check_col(fd, COL_PROTOCOL))
104                 col_add_str(fd, COL_PROTOCOL, "VTP");
105         if (check_col(fd, COL_INFO))
106                 col_add_str(fd, COL_INFO, "Virtual Trunking Protocol"); 
107
108         if (tree) {
109                 ti = proto_tree_add_item(tree, proto_vtp, offset, END_OF_FRAME,
110                     NULL);
111                 vtp_tree = proto_item_add_subtree(ti, ett_vtp);
112
113                 proto_tree_add_item(vtp_tree, hf_vtp_version, offset, 1,
114                     pd[offset]);
115                 offset += 1;
116
117                 code = pd[offset];
118                 proto_tree_add_item(vtp_tree, hf_vtp_code, offset, 1,
119                     code);
120                 offset += 1;
121                 
122                 switch (code) {
123
124                 case SUMMARY_ADVERT:
125                         proto_tree_add_item(vtp_tree, hf_vtp_followers, offset,
126                             1, pd[offset]);
127                         offset += 1;
128
129                         md_len = pd[offset];
130                         proto_tree_add_item(vtp_tree, hf_vtp_md_len, offset,
131                             1, md_len);
132                         offset += 1;
133
134                         proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset,
135                             32, &pd[offset], "Management Domain: %.32s",
136                             &pd[offset]);
137                         offset += 32;
138
139                         proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num,
140                             offset, 4, pntohl(&pd[offset]));
141                         offset += 4;
142
143                         proto_tree_add_item(vtp_tree, hf_vtp_upd_id,
144                             offset, 4, &pd[offset]);
145                         offset += 4;
146
147                         proto_tree_add_item_format(vtp_tree, hf_vtp_upd_ts,
148                             offset, 12, &pd[offset],
149                             "Update Timestamp: %.2s-%.2s-%.2s %.2s:%.2s:%.2s",
150                             &pd[offset], &pd[offset+2], &pd[offset+4],
151                             &pd[offset+6], &pd[offset+8], &pd[offset+10]);
152                         offset += 12;
153
154                         proto_tree_add_item(vtp_tree, hf_vtp_md5_digest,
155                             offset, 16, &pd[offset]);
156                         break;
157
158                 case SUBSET_ADVERT:
159                         proto_tree_add_item(vtp_tree, hf_vtp_seq_num, offset,
160                             1, pd[offset]);
161                         offset += 1;
162
163                         md_len = pd[offset];
164                         proto_tree_add_item(vtp_tree, hf_vtp_md_len, offset,
165                             1, md_len);
166                         offset += 1;
167
168                         proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset,
169                             32, &pd[offset], "Management Domain: %.32s",
170                             &pd[offset]);
171                         offset += 32;
172
173                         proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num,
174                             offset, 4, pntohl(&pd[offset]));
175                         offset += 4;
176
177                         for (;;) {
178                                 vlan_info_len = 
179                                     dissect_vlan_info(pd, offset, vtp_tree);
180                                 if (vlan_info_len < 0)
181                                         break;
182                                 offset += vlan_info_len;
183                         }
184                         break;
185
186                 case ADVERT_REQUEST:
187                         offset += 1;    /* skip reserved field */
188
189                         md_len = pd[offset];
190                         proto_tree_add_item(vtp_tree, hf_vtp_md_len, offset,
191                             1, md_len);
192                         offset += 1;
193
194                         proto_tree_add_item(vtp_tree, hf_vtp_start_value,
195                             offset, 2, pntohs(&pd[offset]));
196                         break;
197
198                 case 0x04:
199                         /*
200                          * Mysterious type, seen a lot.
201                          * Is this some mutant variant of Advert-Request?
202                          */
203                         offset += 1;    /* skip unknown field */
204
205                         md_len = pd[offset];
206                         proto_tree_add_item(vtp_tree, hf_vtp_md_len, offset,
207                             1, md_len);
208                         offset += 1;
209
210                         proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset,
211                             32, &pd[offset], "Management Domain: %.32s",
212                             &pd[offset]);
213                         offset += 32;
214
215                         offset += 2;    /* skip unknown field */
216
217                         proto_tree_add_text(vtp_tree, offset, 2,
218                             "VLAN ID of some sort: 0x%04x",
219                             pntohs(&pd[offset]));
220                         offset += 2;
221                         break;
222                 }
223         }
224 }
225
226 #define VLAN_SUSPENDED  0x01
227
228 static const value_string vlan_type_vals[] = {
229         { 0x01, "Ethernet" },
230         { 0x02, "FDDI" },
231         { 0x03, "TrCRF" },
232         { 0x04, "FDDI-net" },
233         { 0x05, "TrBRF" },
234         { 0,    NULL },
235 };
236
237 #define SR_RING_NUM             0x01
238 #define SR_BRIDGE_NUM           0x02
239 #define STP_TYPE                0x03
240 #define PARENT_VLAN             0x04
241 #define TR_BRIDGED_VLANS        0x05
242 #define PRUNING                 0x06
243 #define BRIDGE_TYPE             0x07
244 #define MAX_ARE_HOP_CNT         0x08
245 #define MAX_STE_HOP_CNT         0x09
246 #define BACKUP_CRF_MODE         0x0A
247
248 static const value_string vlan_tlv_type_vals[] = {
249         { SR_RING_NUM,      "Source-Routing Ring Number" },
250         { SR_BRIDGE_NUM,    "Source-Routing Bridge Number" },
251         { STP_TYPE,         "Spanning-Tree Protocol Type" },
252         { PARENT_VLAN,      "Parent VLAN" },
253         { TR_BRIDGED_VLANS, "Translationally Bridged VLANs" },
254         { PRUNING,          "Pruning" },
255         { BRIDGE_TYPE,      "Bridge Type" },
256         { MAX_ARE_HOP_CNT,  "Max ARE Hop Count" },
257         { MAX_STE_HOP_CNT,  "Max STE Hop Count" },
258         { BACKUP_CRF_MODE,  "Backup CRF Mode" },
259         { 0,                NULL },
260 };
261
262 static int
263 dissect_vlan_info(const u_char *pd, int offset, proto_tree *tree)
264 {
265         proto_item *ti; 
266         proto_tree *vlan_info_tree;
267         proto_tree *status_tree;
268         guint8 vlan_info_len;
269         int vlan_info_left;
270         guint8 status;
271         guint8 vlan_name_len;
272         guint16 type;
273         int length;
274         char *type_str;
275         proto_tree *tlv_tree;
276
277         if (!BYTES_ARE_IN_FRAME(offset, 1))
278                 return -1;
279         vlan_info_len = pd[offset];
280         ti = proto_tree_add_text(tree, offset, vlan_info_len,
281             "VLAN Information");
282         vlan_info_tree = proto_item_add_subtree(ti, ett_vtp_vlan_info);
283         vlan_info_left = vlan_info_len;
284
285         proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_info_len, offset, 1,
286             vlan_info_len);
287         offset += 1;
288         vlan_info_left -= 1;
289
290         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
291                 return -1;
292         status = pd[offset];
293         ti = proto_tree_add_text(vlan_info_tree, offset, 1,
294             "Status: 0x%02x%s", status,
295             (status & VLAN_SUSPENDED) ? "(VLAN suspended)" : "");
296         status_tree = proto_item_add_subtree(ti, ett_vtp_vlan_status);
297         proto_tree_add_item(status_tree, hf_vtp_vlan_status_vlan_susp, offset, 1,
298             status);
299         offset += 1;
300         vlan_info_left -= 1;
301
302         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
303                 return -1;
304         proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_type, offset, 1,
305             pd[offset]);
306         offset += 1;
307         vlan_info_left -= 1;
308
309         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
310                 return -1;
311         vlan_name_len = pd[offset];
312         proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name_len, offset, 1,
313             vlan_name_len);
314         offset += 1;
315         vlan_info_left -= 1;
316
317         if (!BYTES_ARE_IN_FRAME(offset, 2) || vlan_info_left < 2)
318                 return -1;
319         proto_tree_add_item(vlan_info_tree, hf_vtp_isl_vlan_id, offset, 2,
320             pntohs(&pd[offset]));
321         offset += 2;
322         vlan_info_left -= 2;
323
324         if (!BYTES_ARE_IN_FRAME(offset, 2) || vlan_info_left < 2)
325                 return -1;
326         proto_tree_add_item(vlan_info_tree, hf_vtp_mtu_size, offset, 2,
327             pntohs(&pd[offset]));
328         offset += 2;
329         vlan_info_left -= 2;
330
331         if (!BYTES_ARE_IN_FRAME(offset, 4) || vlan_info_left < 4)
332                 return -1;
333         proto_tree_add_item(vlan_info_tree, hf_vtp_802_10_index, offset, 4,
334             pntohl(&pd[offset]));
335         offset += 4;
336         vlan_info_left -= 4;
337
338         /* VLAN name length appears to be rounded up to a multiple of
339            4. */
340         vlan_name_len = 4*((vlan_name_len + 3)/4);
341         if (!BYTES_ARE_IN_FRAME(offset, vlan_name_len)
342             || vlan_info_left < vlan_name_len)
343                 return -1;
344         proto_tree_add_item_format(vlan_info_tree, hf_vtp_vlan_name, offset,
345             vlan_name_len, &pd[offset], "VLAN Name: %.*s", vlan_name_len,
346             &pd[offset]);
347         offset += vlan_name_len;
348         vlan_info_left -= vlan_name_len;
349
350         while (IS_DATA_IN_FRAME(offset) && vlan_info_left > 0) {
351                 type = pd[offset + 0];
352                 length = pd[offset + 1];
353                 type_str = val_to_str(type, vlan_tlv_type_vals,
354                     "Unknown (0x%04x)");
355
356                 ti = proto_tree_add_notext(vlan_info_tree, offset,
357                     2 + length*2);
358                 tlv_tree = proto_item_add_subtree(ti, ett_vtp_tlv);
359                 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvtype, offset,
360                     1, type);
361                 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvlength, offset+1,
362                     1, length);
363                 offset += 2;
364                 vlan_info_left -= 2;
365                 if (length > 0) {
366                         dissect_vlan_info_tlv(pd, offset, length*2, tlv_tree,
367                             ti, type);
368                 }
369                 offset += length*2;
370                 vlan_info_left -= length*2;
371         }
372
373         return vlan_info_len;
374 }
375
376 static const value_string stp_type_vals[] = {
377         { 1, "SRT" },
378         { 2, "SRB" },
379         { 3, "Auto" },
380         { 0, NULL },
381 };
382
383 static const value_string pruning_vals[] = {
384         { 1, "Enabled" },
385         { 2, "Disabled" },
386         { 0, NULL },
387 };
388
389 static const value_string bridge_type_vals[] = {
390         { 1, "SRT" },
391         { 2, "SRB" },
392         { 0, NULL },
393 };
394
395 static const value_string backup_crf_mode_vals[] = {
396         { 1, "TrCRF is configured as a backup" },
397         { 2, "TrCRF is not configured as a backup" },
398         { 0, NULL },
399 };
400
401 static void
402 dissect_vlan_info_tlv(const u_char *pd, int offset, int length,
403     proto_tree *tree, proto_item *ti, guint8 type)
404 {
405         switch (type) {
406
407         case SR_RING_NUM:
408                 if (length == 2) {
409                         proto_item_set_text(ti,
410                             "Source-Routing Ring Number: 0x%04x",
411                             pntohs(&pd[offset]));
412                         proto_tree_add_text(tree, offset, 2,
413                             "Source-Routing Ring Number: 0x%04x",
414                             pntohs(&pd[offset]));
415                 } else {
416                         proto_item_set_text(ti,
417                             "Source-Routing Ring Number: Bad length %u",
418                             length);
419                         proto_tree_add_text(tree, offset, length,
420                             "Source-Routing Ring Number: Bad length %u",
421                             length);
422                 }
423                 break;
424
425         case SR_BRIDGE_NUM:
426                 if (length == 2) {
427                         proto_item_set_text(ti,
428                             "Source-Routing Bridge Number: 0x%04x",
429                             pntohs(&pd[offset]));
430                         proto_tree_add_text(tree, offset, 2,
431                             "Source-Routing Bridge Number: 0x%04x",
432                             pntohs(&pd[offset]));
433                 } else {
434                         proto_item_set_text(ti,
435                             "Source-Routing Bridge Number: Bad length %u",
436                             length);
437                         proto_tree_add_text(tree, offset, length,
438                             "Source-Routing Bridge Number: Bad length %u",
439                             length);
440                 }
441                 break;
442
443         case STP_TYPE:
444                 if (length == 2) {
445                         proto_item_set_text(ti,
446                             "Spanning-Tree Protocol Type: %s",
447                             val_to_str(pntohs(&pd[offset]), stp_type_vals,
448                               "Unknown (0x%04x)"));
449                         proto_tree_add_text(tree, offset, 2,
450                             "Spanning-Tree Protocol Type: %s",
451                             val_to_str(pntohs(&pd[offset]), stp_type_vals,
452                               "Unknown (0x%04x)"));
453                 } else {
454                         proto_item_set_text(ti,
455                             "Spanning-Tree Protocol Type: Bad length %u",
456                             length);
457                         proto_tree_add_text(tree, offset, length,
458                             "Spanning-Tree Protocol Type: Bad length %u",
459                             length);
460                 }
461                 break;
462
463         case PARENT_VLAN:
464                 if (length == 2) {
465                         proto_item_set_text(ti,
466                             "Parent VLAN: 0x%04x",
467                             pntohs(&pd[offset]));
468                         proto_tree_add_text(tree, offset, 2,
469                             "Parent VLAN: 0x%04x",
470                             pntohs(&pd[offset]));
471                 } else {
472                         proto_item_set_text(ti,
473                             "Parent VLAN: Bad length %u",
474                             length);
475                         proto_tree_add_text(tree, offset, length,
476                             "Parent VLAN: Bad length %u",
477                             length);
478                 }
479                 break;
480
481         case TR_BRIDGED_VLANS:
482                 if (length == 2) {
483                         proto_item_set_text(ti,
484                             "Translationally Bridged VLANs: 0x%04x",
485                             pntohs(&pd[offset]));
486                         proto_tree_add_text(tree, offset, 2,
487                             "Translationally Bridged VLANs: 0x%04x",
488                             pntohs(&pd[offset]));
489                 } else {
490                         proto_item_set_text(ti,
491                             "Translationally Bridged VLANs: Bad length %u",
492                             length);
493                         proto_tree_add_text(tree, offset, length,
494                             "Translationally Bridged VLANs: Bad length %u",
495                             length);
496                 }
497                 break;
498
499         case PRUNING:
500                 if (length == 2) {
501                         proto_item_set_text(ti,
502                             "Pruning: %s",
503                             val_to_str(pntohs(&pd[offset]), pruning_vals,
504                               "Unknown (0x%04x)"));
505                         proto_tree_add_text(tree, offset, 2,
506                             "Pruning: %s",
507                             val_to_str(pntohs(&pd[offset]), pruning_vals,
508                               "Unknown (0x%04x)"));
509                 } else {
510                         proto_item_set_text(ti,
511                             "Pruning: Bad length %u",
512                             length);
513                         proto_tree_add_text(tree, offset, length,
514                             "Pruning: Bad length %u",
515                             length);
516                 }
517                 break;
518
519         case BRIDGE_TYPE:
520                 if (length == 2) {
521                         proto_item_set_text(ti,
522                             "Bridge Type: %s",
523                             val_to_str(pntohs(&pd[offset]), bridge_type_vals,
524                               "Unknown (0x%04x)"));
525                         proto_tree_add_text(tree, offset, 2,
526                             "Bridge Type: %s",
527                             val_to_str(pntohs(&pd[offset]), bridge_type_vals,
528                               "Unknown (0x%04x)"));
529                 } else {
530                         proto_item_set_text(ti,
531                             "Bridge Type: Bad length %u",
532                             length);
533                         proto_tree_add_text(tree, offset, length,
534                             "Bridge Type: Bad length %u",
535                             length);
536                 }
537                 break;
538
539         case MAX_ARE_HOP_CNT:
540                 if (length == 2) {
541                         proto_item_set_text(ti,
542                             "Max ARE Hop Count: %u",
543                             pntohs(&pd[offset]));
544                         proto_tree_add_text(tree, offset, 2,
545                             "Max ARE Hop Count: %u",
546                             pntohs(&pd[offset]));
547                 } else {
548                         proto_item_set_text(ti,
549                             "Max ARE Hop Count: Bad length %u",
550                             length);
551                         proto_tree_add_text(tree, offset, length,
552                             "Max ARE Hop Count: Bad length %u",
553                             length);
554                 }
555                 break;
556
557         case MAX_STE_HOP_CNT:
558                 if (length == 2) {
559                         proto_item_set_text(ti,
560                             "Max STE Hop Count: %u",
561                             pntohs(&pd[offset]));
562                         proto_tree_add_text(tree, offset, 2,
563                             "Max STE Hop Count: %u",
564                             pntohs(&pd[offset]));
565                 } else {
566                         proto_item_set_text(ti,
567                             "Max STE Hop Count: Bad length %u",
568                             length);
569                         proto_tree_add_text(tree, offset, length,
570                             "Max STE Hop Count: Bad length %u",
571                             length);
572                 }
573                 break;
574
575         case BACKUP_CRF_MODE:
576                 if (length == 2) {
577                         proto_item_set_text(ti,
578                             "Backup CRF Mode: %s",
579                             val_to_str(pntohs(&pd[offset]), backup_crf_mode_vals,
580                               "Unknown (0x%04x)"));
581                         proto_tree_add_text(tree, offset, 2,
582                             "Backup CRF Mode: %s",
583                             val_to_str(pntohs(&pd[offset]), backup_crf_mode_vals,
584                               "Unknown (0x%04x)"));
585                 } else {
586                         proto_item_set_text(ti,
587                             "Backup CRF Mode: Bad length %u",
588                             length);
589                         proto_tree_add_text(tree, offset, length,
590                             "Backup CRF Mode: Bad length %u",
591                             length);
592                 }
593                 break;
594
595         default:
596                 proto_item_set_text(ti, "Unknown TLV type: 0x%02x", type);
597                 proto_tree_add_text(tree, offset, length, "Data");
598                 break;
599         }
600 }
601
602 void
603 proto_register_vtp(void)
604 {
605         static hf_register_info hf[] = {
606                 { &hf_vtp_version,
607                 { "Version",    "vtp.version", FT_UINT8, BASE_HEX, NULL, 0x0,
608                         "" }},
609
610                 { &hf_vtp_code,
611                 { "Code",       "vtp.code", FT_UINT8, BASE_HEX, VALS(type_vals), 0x0,
612                         "" }},
613
614                 { &hf_vtp_followers,
615                 { "Followers",  "vtp.followers", FT_UINT8, BASE_DEC, NULL, 0x0,
616                         "Number of following Subset-Advert messages" }},
617
618                 { &hf_vtp_md_len,
619                 { "Management Domain Length", "vtp.md_len", FT_UINT8, BASE_DEC, NULL, 0x0,
620                         "Length of management domain string" }},
621
622                 { &hf_vtp_md,
623                 { "Management Domain", "vtp.md", FT_STRING, BASE_DEC, NULL, 0,
624                         "Management domain" }},
625
626                 { &hf_vtp_conf_rev_num,
627                 { "Configuration Revision Number", "vtp.conf_rev_num", FT_UINT32, BASE_DEC, NULL, 0x0,
628                         "Revision number of the configuration information" }},
629
630                 { &hf_vtp_upd_id,
631                 { "Updater Identity", "vtp.upd_id", FT_IPv4, BASE_NONE, NULL, 0x0,
632                         "IP address of the updater" }},
633
634                 { &hf_vtp_upd_ts,
635                 { "Update Timestamp", "vtp.upd_ts", FT_STRING, BASE_DEC, NULL, 0,
636                         "Time stamp of the current configuration revision" }},
637
638                 { &hf_vtp_md5_digest,
639                 { "MD5 Digest", "vtp.md5_digest", FT_BYTES, BASE_HEX, NULL, 0x0,
640                         "" }},
641
642                 { &hf_vtp_seq_num,
643                 { "Sequence Number",    "vtp.seq_num", FT_UINT8, BASE_DEC, NULL, 0x0,
644                         "Order of this frame in the sequence of Subset-Advert frames" }},
645
646                 { &hf_vtp_start_value,
647                 { "Start Value",        "vtp.start_value", FT_UINT16, BASE_HEX, NULL, 0x0,
648                         "Virtual LAN ID of first VLAN for which information is requested" }},
649
650                 { &hf_vtp_vlan_info_len,
651                 { "VLAN Information Length",    "vtp.vlan_info.len", FT_UINT8, BASE_DEC, NULL, 0x0,
652                         "Length of the VLAN information field" }},
653
654                 { &hf_vtp_vlan_status_vlan_susp,
655                 { "VLAN suspended",     "vtp.vlan_info.status.vlan_susp", FT_BOOLEAN, 8, NULL, VLAN_SUSPENDED,
656                         "VLAN suspended" }},
657
658                 { &hf_vtp_vlan_type,
659                 { "VLAN Type",  "vtp.vlan_info.vlan_type", FT_UINT8, BASE_HEX, VALS(vlan_type_vals), 0x0,
660                         "Type of VLAN" }},
661
662                 { &hf_vtp_vlan_name_len,
663                 { "VLAN Name Length", "vtp.vlan_info.vlan_name_len", FT_UINT8, BASE_DEC, NULL, 0x0,
664                         "Length of VLAN name string" }},
665
666                 { &hf_vtp_isl_vlan_id,
667                 { "ISL VLAN ID",        "vtp.vlan_info.isl_vlan_id", FT_UINT16, BASE_HEX, NULL, 0x0,
668                         "ID of this VLAN on ISL trunks" }},
669
670                 { &hf_vtp_mtu_size,
671                 { "MTU Size",   "vtp.vlan_info.mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0,
672                         "MTU for this VLAN" }},
673
674                 { &hf_vtp_802_10_index,
675                 { "802.10 Index", "vtp.vlan_info.802_10_index", FT_UINT32, BASE_HEX, NULL, 0x0,
676                         "IEEE 802.10 security association identifier for this VLAN" }},
677
678                 { &hf_vtp_vlan_name,
679                 { "VLAN Name", "vtp.vlan_info.vlan_name", FT_STRING, BASE_DEC, NULL, 0,
680                         "VLAN name" }},
681
682                 { &hf_vtp_vlan_tlvtype,
683                 { "Type",       "vtp.vlan_info.tlv_type", FT_UINT8, BASE_HEX, VALS(vlan_tlv_type_vals), 0x0,
684                         "" }},
685
686                 { &hf_vtp_vlan_tlvlength,
687                 { "Length",     "vtp.vlan_info.tlv_len", FT_UINT8, BASE_DEC, NULL, 0x0,
688                         "" }},
689         };
690         static gint *ett[] = {
691                 &ett_vtp,
692                 &ett_vtp_vlan_info,
693                 &ett_vtp_vlan_status,
694                 &ett_vtp_tlv,
695         };
696
697         proto_vtp = proto_register_protocol("Virtual Trunking Protocol", "vtp");
698         proto_register_field_array(proto_vtp, hf, array_length(hf));
699         proto_register_subtree_array(ett, array_length(ett));
700 }