bgp route refresh/MP capability option.
[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.7 2000/11/19 08:54:10 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         guint32 upd_id;
103
104         OLD_CHECK_DISPLAY_AS_DATA(proto_vtp, pd, offset, fd, tree);
105
106         if (check_col(fd, COL_PROTOCOL))
107                 col_set_str(fd, COL_PROTOCOL, "VTP");
108         if (check_col(fd, COL_INFO))
109                 col_set_str(fd, COL_INFO, "Virtual Trunking Protocol"); 
110
111         if (tree) {
112                 ti = proto_tree_add_item(tree, proto_vtp, NullTVB, offset, END_OF_FRAME,
113                     FALSE);
114                 vtp_tree = proto_item_add_subtree(ti, ett_vtp);
115
116                 proto_tree_add_uint(vtp_tree, hf_vtp_version, NullTVB, offset, 1,
117                     pd[offset]);
118                 offset += 1;
119
120                 code = pd[offset];
121                 proto_tree_add_uint(vtp_tree, hf_vtp_code, NullTVB, offset, 1,
122                     code);
123                 offset += 1;
124                 
125                 switch (code) {
126
127                 case SUMMARY_ADVERT:
128                         proto_tree_add_uint(vtp_tree, hf_vtp_followers, NullTVB, offset,
129                             1, pd[offset]);
130                         offset += 1;
131
132                         md_len = pd[offset];
133                         proto_tree_add_uint(vtp_tree, hf_vtp_md_len, NullTVB, offset,
134                             1, md_len);
135                         offset += 1;
136
137                         proto_tree_add_string_format(vtp_tree, hf_vtp_md, NullTVB, offset,
138                             32, &pd[offset], "Management Domain: %.32s",
139                             &pd[offset]);
140                         offset += 32;
141
142                         proto_tree_add_uint(vtp_tree, hf_vtp_conf_rev_num, NullTVB,
143                             offset, 4, pntohl(&pd[offset]));
144                         offset += 4;
145
146                         memcpy(&upd_id, &pd[offset], sizeof upd_id);
147                         proto_tree_add_ipv4(vtp_tree, hf_vtp_upd_id, NullTVB,
148                             offset, 4, upd_id);
149                         offset += 4;
150
151                         proto_tree_add_string_format(vtp_tree, hf_vtp_upd_ts, NullTVB,
152                             offset, 12, &pd[offset],
153                             "Update Timestamp: %.2s-%.2s-%.2s %.2s:%.2s:%.2s",
154                             &pd[offset], &pd[offset+2], &pd[offset+4],
155                             &pd[offset+6], &pd[offset+8], &pd[offset+10]);
156                         offset += 12;
157
158                         proto_tree_add_bytes(vtp_tree, hf_vtp_md5_digest, NullTVB,
159                             offset, 16, &pd[offset]);
160                         break;
161
162                 case SUBSET_ADVERT:
163                         proto_tree_add_uint(vtp_tree, hf_vtp_seq_num, NullTVB, offset,
164                             1, pd[offset]);
165                         offset += 1;
166
167                         md_len = pd[offset];
168                         proto_tree_add_uint(vtp_tree, hf_vtp_md_len, NullTVB, offset,
169                             1, md_len);
170                         offset += 1;
171
172                         proto_tree_add_string_format(vtp_tree, hf_vtp_md, NullTVB, offset,
173                             32, &pd[offset], "Management Domain: %.32s",
174                             &pd[offset]);
175                         offset += 32;
176
177                         proto_tree_add_uint(vtp_tree, hf_vtp_conf_rev_num, NullTVB,
178                             offset, 4, pntohl(&pd[offset]));
179                         offset += 4;
180
181                         for (;;) {
182                                 vlan_info_len = 
183                                     dissect_vlan_info(pd, offset, vtp_tree);
184                                 if (vlan_info_len < 0)
185                                         break;
186                                 offset += vlan_info_len;
187                         }
188                         break;
189
190                 case ADVERT_REQUEST:
191                         offset += 1;    /* skip reserved field */
192
193                         md_len = pd[offset];
194                         proto_tree_add_uint(vtp_tree, hf_vtp_md_len, NullTVB, offset,
195                             1, md_len);
196                         offset += 1;
197
198                         proto_tree_add_uint(vtp_tree, hf_vtp_start_value, NullTVB,
199                             offset, 2, pntohs(&pd[offset]));
200                         break;
201
202                 case 0x04:
203                         /*
204                          * Mysterious type, seen a lot.
205                          * Is this some mutant variant of Advert-Request?
206                          */
207                         offset += 1;    /* skip unknown field */
208
209                         md_len = pd[offset];
210                         proto_tree_add_uint(vtp_tree, hf_vtp_md_len, NullTVB, offset,
211                             1, md_len);
212                         offset += 1;
213
214                         proto_tree_add_string_format(vtp_tree, hf_vtp_md, NullTVB, offset,
215                             32, &pd[offset], "Management Domain: %.32s",
216                             &pd[offset]);
217                         offset += 32;
218
219                         offset += 2;    /* skip unknown field */
220
221                         proto_tree_add_text(vtp_tree, NullTVB, offset, 2,
222                             "VLAN ID of some sort: 0x%04x",
223                             pntohs(&pd[offset]));
224                         offset += 2;
225                         break;
226                 }
227         }
228 }
229
230 #define VLAN_SUSPENDED  0x01
231
232 static const value_string vlan_type_vals[] = {
233         { 0x01, "Ethernet" },
234         { 0x02, "FDDI" },
235         { 0x03, "TrCRF" },
236         { 0x04, "FDDI-net" },
237         { 0x05, "TrBRF" },
238         { 0,    NULL },
239 };
240
241 #define SR_RING_NUM             0x01
242 #define SR_BRIDGE_NUM           0x02
243 #define STP_TYPE                0x03
244 #define PARENT_VLAN             0x04
245 #define TR_BRIDGED_VLANS        0x05
246 #define PRUNING                 0x06
247 #define BRIDGE_TYPE             0x07
248 #define MAX_ARE_HOP_CNT         0x08
249 #define MAX_STE_HOP_CNT         0x09
250 #define BACKUP_CRF_MODE         0x0A
251
252 static const value_string vlan_tlv_type_vals[] = {
253         { SR_RING_NUM,      "Source-Routing Ring Number" },
254         { SR_BRIDGE_NUM,    "Source-Routing Bridge Number" },
255         { STP_TYPE,         "Spanning-Tree Protocol Type" },
256         { PARENT_VLAN,      "Parent VLAN" },
257         { TR_BRIDGED_VLANS, "Translationally Bridged VLANs" },
258         { PRUNING,          "Pruning" },
259         { BRIDGE_TYPE,      "Bridge Type" },
260         { MAX_ARE_HOP_CNT,  "Max ARE Hop Count" },
261         { MAX_STE_HOP_CNT,  "Max STE Hop Count" },
262         { BACKUP_CRF_MODE,  "Backup CRF Mode" },
263         { 0,                NULL },
264 };
265
266 static int
267 dissect_vlan_info(const u_char *pd, int offset, proto_tree *tree)
268 {
269         proto_item *ti; 
270         proto_tree *vlan_info_tree;
271         proto_tree *status_tree;
272         guint8 vlan_info_len;
273         int vlan_info_left;
274         guint8 status;
275         guint8 vlan_name_len;
276         guint16 type;
277         int length;
278         char *type_str;
279         proto_tree *tlv_tree;
280
281         if (!BYTES_ARE_IN_FRAME(offset, 1))
282                 return -1;
283         vlan_info_len = pd[offset];
284         ti = proto_tree_add_text(tree, NullTVB, offset, vlan_info_len,
285             "VLAN Information");
286         vlan_info_tree = proto_item_add_subtree(ti, ett_vtp_vlan_info);
287         vlan_info_left = vlan_info_len;
288
289         proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_info_len, NullTVB, offset, 1,
290             vlan_info_len);
291         offset += 1;
292         vlan_info_left -= 1;
293
294         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
295                 return -1;
296         status = pd[offset];
297         ti = proto_tree_add_text(vlan_info_tree, NullTVB, offset, 1,
298             "Status: 0x%02x%s", status,
299             (status & VLAN_SUSPENDED) ? "(VLAN suspended)" : "");
300         status_tree = proto_item_add_subtree(ti, ett_vtp_vlan_status);
301         proto_tree_add_boolean(status_tree, hf_vtp_vlan_status_vlan_susp, NullTVB, offset, 1,
302             status);
303         offset += 1;
304         vlan_info_left -= 1;
305
306         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
307                 return -1;
308         proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_type, NullTVB, offset, 1,
309             pd[offset]);
310         offset += 1;
311         vlan_info_left -= 1;
312
313         if (!BYTES_ARE_IN_FRAME(offset, 1) || vlan_info_left < 1)
314                 return -1;
315         vlan_name_len = pd[offset];
316         proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_name_len, NullTVB, offset, 1,
317             vlan_name_len);
318         offset += 1;
319         vlan_info_left -= 1;
320
321         if (!BYTES_ARE_IN_FRAME(offset, 2) || vlan_info_left < 2)
322                 return -1;
323         proto_tree_add_uint(vlan_info_tree, hf_vtp_isl_vlan_id, NullTVB, offset, 2,
324             pntohs(&pd[offset]));
325         offset += 2;
326         vlan_info_left -= 2;
327
328         if (!BYTES_ARE_IN_FRAME(offset, 2) || vlan_info_left < 2)
329                 return -1;
330         proto_tree_add_uint(vlan_info_tree, hf_vtp_mtu_size, NullTVB, offset, 2,
331             pntohs(&pd[offset]));
332         offset += 2;
333         vlan_info_left -= 2;
334
335         if (!BYTES_ARE_IN_FRAME(offset, 4) || vlan_info_left < 4)
336                 return -1;
337         proto_tree_add_uint(vlan_info_tree, hf_vtp_802_10_index, NullTVB, offset, 4,
338             pntohl(&pd[offset]));
339         offset += 4;
340         vlan_info_left -= 4;
341
342         /* VLAN name length appears to be rounded up to a multiple of
343            4. */
344         vlan_name_len = 4*((vlan_name_len + 3)/4);
345         if (!BYTES_ARE_IN_FRAME(offset, vlan_name_len)
346             || vlan_info_left < vlan_name_len)
347                 return -1;
348         proto_tree_add_string_format(vlan_info_tree, hf_vtp_vlan_name, NullTVB, offset,
349             vlan_name_len, &pd[offset], "VLAN Name: %.*s", vlan_name_len,
350             &pd[offset]);
351         offset += vlan_name_len;
352         vlan_info_left -= vlan_name_len;
353
354         while (IS_DATA_IN_FRAME(offset) && vlan_info_left > 0) {
355                 type = pd[offset + 0];
356                 length = pd[offset + 1];
357                 type_str = val_to_str(type, vlan_tlv_type_vals,
358                     "Unknown (0x%04x)");
359
360                 ti = proto_tree_add_notext(vlan_info_tree, NullTVB, offset,
361                     2 + length*2);
362                 tlv_tree = proto_item_add_subtree(ti, ett_vtp_tlv);
363                 proto_tree_add_uint(tlv_tree, hf_vtp_vlan_tlvtype, NullTVB, offset,
364                     1, type);
365                 proto_tree_add_uint(tlv_tree, hf_vtp_vlan_tlvlength, NullTVB, offset+1,
366                     1, length);
367                 offset += 2;
368                 vlan_info_left -= 2;
369                 if (length > 0) {
370                         dissect_vlan_info_tlv(pd, offset, length*2, tlv_tree,
371                             ti, type);
372                 }
373                 offset += length*2;
374                 vlan_info_left -= length*2;
375         }
376
377         return vlan_info_len;
378 }
379
380 static const value_string stp_type_vals[] = {
381         { 1, "SRT" },
382         { 2, "SRB" },
383         { 3, "Auto" },
384         { 0, NULL },
385 };
386
387 static const value_string pruning_vals[] = {
388         { 1, "Enabled" },
389         { 2, "Disabled" },
390         { 0, NULL },
391 };
392
393 static const value_string bridge_type_vals[] = {
394         { 1, "SRT" },
395         { 2, "SRB" },
396         { 0, NULL },
397 };
398
399 static const value_string backup_crf_mode_vals[] = {
400         { 1, "TrCRF is configured as a backup" },
401         { 2, "TrCRF is not configured as a backup" },
402         { 0, NULL },
403 };
404
405 static void
406 dissect_vlan_info_tlv(const u_char *pd, int offset, int length,
407     proto_tree *tree, proto_item *ti, guint8 type)
408 {
409         switch (type) {
410
411         case SR_RING_NUM:
412                 if (length == 2) {
413                         proto_item_set_text(ti,
414                             "Source-Routing Ring Number: 0x%04x",
415                             pntohs(&pd[offset]));
416                         proto_tree_add_text(tree, NullTVB, offset, 2,
417                             "Source-Routing Ring Number: 0x%04x",
418                             pntohs(&pd[offset]));
419                 } else {
420                         proto_item_set_text(ti,
421                             "Source-Routing Ring Number: Bad length %u",
422                             length);
423                         proto_tree_add_text(tree, NullTVB, offset, length,
424                             "Source-Routing Ring Number: Bad length %u",
425                             length);
426                 }
427                 break;
428
429         case SR_BRIDGE_NUM:
430                 if (length == 2) {
431                         proto_item_set_text(ti,
432                             "Source-Routing Bridge Number: 0x%04x",
433                             pntohs(&pd[offset]));
434                         proto_tree_add_text(tree, NullTVB, offset, 2,
435                             "Source-Routing Bridge Number: 0x%04x",
436                             pntohs(&pd[offset]));
437                 } else {
438                         proto_item_set_text(ti,
439                             "Source-Routing Bridge Number: Bad length %u",
440                             length);
441                         proto_tree_add_text(tree, NullTVB, offset, length,
442                             "Source-Routing Bridge Number: Bad length %u",
443                             length);
444                 }
445                 break;
446
447         case STP_TYPE:
448                 if (length == 2) {
449                         proto_item_set_text(ti,
450                             "Spanning-Tree Protocol Type: %s",
451                             val_to_str(pntohs(&pd[offset]), stp_type_vals,
452                               "Unknown (0x%04x)"));
453                         proto_tree_add_text(tree, NullTVB, offset, 2,
454                             "Spanning-Tree Protocol Type: %s",
455                             val_to_str(pntohs(&pd[offset]), stp_type_vals,
456                               "Unknown (0x%04x)"));
457                 } else {
458                         proto_item_set_text(ti,
459                             "Spanning-Tree Protocol Type: Bad length %u",
460                             length);
461                         proto_tree_add_text(tree, NullTVB, offset, length,
462                             "Spanning-Tree Protocol Type: Bad length %u",
463                             length);
464                 }
465                 break;
466
467         case PARENT_VLAN:
468                 if (length == 2) {
469                         proto_item_set_text(ti,
470                             "Parent VLAN: 0x%04x",
471                             pntohs(&pd[offset]));
472                         proto_tree_add_text(tree, NullTVB, offset, 2,
473                             "Parent VLAN: 0x%04x",
474                             pntohs(&pd[offset]));
475                 } else {
476                         proto_item_set_text(ti,
477                             "Parent VLAN: Bad length %u",
478                             length);
479                         proto_tree_add_text(tree, NullTVB, offset, length,
480                             "Parent VLAN: Bad length %u",
481                             length);
482                 }
483                 break;
484
485         case TR_BRIDGED_VLANS:
486                 if (length == 2) {
487                         proto_item_set_text(ti,
488                             "Translationally Bridged VLANs: 0x%04x",
489                             pntohs(&pd[offset]));
490                         proto_tree_add_text(tree, NullTVB, offset, 2,
491                             "Translationally Bridged VLANs: 0x%04x",
492                             pntohs(&pd[offset]));
493                 } else {
494                         proto_item_set_text(ti,
495                             "Translationally Bridged VLANs: Bad length %u",
496                             length);
497                         proto_tree_add_text(tree, NullTVB, offset, length,
498                             "Translationally Bridged VLANs: Bad length %u",
499                             length);
500                 }
501                 break;
502
503         case PRUNING:
504                 if (length == 2) {
505                         proto_item_set_text(ti,
506                             "Pruning: %s",
507                             val_to_str(pntohs(&pd[offset]), pruning_vals,
508                               "Unknown (0x%04x)"));
509                         proto_tree_add_text(tree, NullTVB, offset, 2,
510                             "Pruning: %s",
511                             val_to_str(pntohs(&pd[offset]), pruning_vals,
512                               "Unknown (0x%04x)"));
513                 } else {
514                         proto_item_set_text(ti,
515                             "Pruning: Bad length %u",
516                             length);
517                         proto_tree_add_text(tree, NullTVB, offset, length,
518                             "Pruning: Bad length %u",
519                             length);
520                 }
521                 break;
522
523         case BRIDGE_TYPE:
524                 if (length == 2) {
525                         proto_item_set_text(ti,
526                             "Bridge Type: %s",
527                             val_to_str(pntohs(&pd[offset]), bridge_type_vals,
528                               "Unknown (0x%04x)"));
529                         proto_tree_add_text(tree, NullTVB, offset, 2,
530                             "Bridge Type: %s",
531                             val_to_str(pntohs(&pd[offset]), bridge_type_vals,
532                               "Unknown (0x%04x)"));
533                 } else {
534                         proto_item_set_text(ti,
535                             "Bridge Type: Bad length %u",
536                             length);
537                         proto_tree_add_text(tree, NullTVB, offset, length,
538                             "Bridge Type: Bad length %u",
539                             length);
540                 }
541                 break;
542
543         case MAX_ARE_HOP_CNT:
544                 if (length == 2) {
545                         proto_item_set_text(ti,
546                             "Max ARE Hop Count: %u",
547                             pntohs(&pd[offset]));
548                         proto_tree_add_text(tree, NullTVB, offset, 2,
549                             "Max ARE Hop Count: %u",
550                             pntohs(&pd[offset]));
551                 } else {
552                         proto_item_set_text(ti,
553                             "Max ARE Hop Count: Bad length %u",
554                             length);
555                         proto_tree_add_text(tree, NullTVB, offset, length,
556                             "Max ARE Hop Count: Bad length %u",
557                             length);
558                 }
559                 break;
560
561         case MAX_STE_HOP_CNT:
562                 if (length == 2) {
563                         proto_item_set_text(ti,
564                             "Max STE Hop Count: %u",
565                             pntohs(&pd[offset]));
566                         proto_tree_add_text(tree, NullTVB, offset, 2,
567                             "Max STE Hop Count: %u",
568                             pntohs(&pd[offset]));
569                 } else {
570                         proto_item_set_text(ti,
571                             "Max STE Hop Count: Bad length %u",
572                             length);
573                         proto_tree_add_text(tree, NullTVB, offset, length,
574                             "Max STE Hop Count: Bad length %u",
575                             length);
576                 }
577                 break;
578
579         case BACKUP_CRF_MODE:
580                 if (length == 2) {
581                         proto_item_set_text(ti,
582                             "Backup CRF Mode: %s",
583                             val_to_str(pntohs(&pd[offset]), backup_crf_mode_vals,
584                               "Unknown (0x%04x)"));
585                         proto_tree_add_text(tree, NullTVB, offset, 2,
586                             "Backup CRF Mode: %s",
587                             val_to_str(pntohs(&pd[offset]), backup_crf_mode_vals,
588                               "Unknown (0x%04x)"));
589                 } else {
590                         proto_item_set_text(ti,
591                             "Backup CRF Mode: Bad length %u",
592                             length);
593                         proto_tree_add_text(tree, NullTVB, offset, length,
594                             "Backup CRF Mode: Bad length %u",
595                             length);
596                 }
597                 break;
598
599         default:
600                 proto_item_set_text(ti, "Unknown TLV type: 0x%02x", type);
601                 proto_tree_add_text(tree, NullTVB, offset, length, "Data");
602                 break;
603         }
604 }
605
606 void
607 proto_register_vtp(void)
608 {
609         static hf_register_info hf[] = {
610                 { &hf_vtp_version,
611                 { "Version",    "vtp.version", FT_UINT8, BASE_HEX, NULL, 0x0,
612                         "" }},
613
614                 { &hf_vtp_code,
615                 { "Code",       "vtp.code", FT_UINT8, BASE_HEX, VALS(type_vals), 0x0,
616                         "" }},
617
618                 { &hf_vtp_followers,
619                 { "Followers",  "vtp.followers", FT_UINT8, BASE_DEC, NULL, 0x0,
620                         "Number of following Subset-Advert messages" }},
621
622                 { &hf_vtp_md_len,
623                 { "Management Domain Length", "vtp.md_len", FT_UINT8, BASE_DEC, NULL, 0x0,
624                         "Length of management domain string" }},
625
626                 { &hf_vtp_md,
627                 { "Management Domain", "vtp.md", FT_STRING, BASE_DEC, NULL, 0,
628                         "Management domain" }},
629
630                 { &hf_vtp_conf_rev_num,
631                 { "Configuration Revision Number", "vtp.conf_rev_num", FT_UINT32, BASE_DEC, NULL, 0x0,
632                         "Revision number of the configuration information" }},
633
634                 { &hf_vtp_upd_id,
635                 { "Updater Identity", "vtp.upd_id", FT_IPv4, BASE_NONE, NULL, 0x0,
636                         "IP address of the updater" }},
637
638                 { &hf_vtp_upd_ts,
639                 { "Update Timestamp", "vtp.upd_ts", FT_STRING, BASE_DEC, NULL, 0,
640                         "Time stamp of the current configuration revision" }},
641
642                 { &hf_vtp_md5_digest,
643                 { "MD5 Digest", "vtp.md5_digest", FT_BYTES, BASE_HEX, NULL, 0x0,
644                         "" }},
645
646                 { &hf_vtp_seq_num,
647                 { "Sequence Number",    "vtp.seq_num", FT_UINT8, BASE_DEC, NULL, 0x0,
648                         "Order of this frame in the sequence of Subset-Advert frames" }},
649
650                 { &hf_vtp_start_value,
651                 { "Start Value",        "vtp.start_value", FT_UINT16, BASE_HEX, NULL, 0x0,
652                         "Virtual LAN ID of first VLAN for which information is requested" }},
653
654                 { &hf_vtp_vlan_info_len,
655                 { "VLAN Information Length",    "vtp.vlan_info.len", FT_UINT8, BASE_DEC, NULL, 0x0,
656                         "Length of the VLAN information field" }},
657
658                 { &hf_vtp_vlan_status_vlan_susp,
659                 { "VLAN suspended",     "vtp.vlan_info.status.vlan_susp", FT_BOOLEAN, 8, NULL, VLAN_SUSPENDED,
660                         "VLAN suspended" }},
661
662                 { &hf_vtp_vlan_type,
663                 { "VLAN Type",  "vtp.vlan_info.vlan_type", FT_UINT8, BASE_HEX, VALS(vlan_type_vals), 0x0,
664                         "Type of VLAN" }},
665
666                 { &hf_vtp_vlan_name_len,
667                 { "VLAN Name Length", "vtp.vlan_info.vlan_name_len", FT_UINT8, BASE_DEC, NULL, 0x0,
668                         "Length of VLAN name string" }},
669
670                 { &hf_vtp_isl_vlan_id,
671                 { "ISL VLAN ID",        "vtp.vlan_info.isl_vlan_id", FT_UINT16, BASE_HEX, NULL, 0x0,
672                         "ID of this VLAN on ISL trunks" }},
673
674                 { &hf_vtp_mtu_size,
675                 { "MTU Size",   "vtp.vlan_info.mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0,
676                         "MTU for this VLAN" }},
677
678                 { &hf_vtp_802_10_index,
679                 { "802.10 Index", "vtp.vlan_info.802_10_index", FT_UINT32, BASE_HEX, NULL, 0x0,
680                         "IEEE 802.10 security association identifier for this VLAN" }},
681
682                 { &hf_vtp_vlan_name,
683                 { "VLAN Name", "vtp.vlan_info.vlan_name", FT_STRING, BASE_DEC, NULL, 0,
684                         "VLAN name" }},
685
686                 { &hf_vtp_vlan_tlvtype,
687                 { "Type",       "vtp.vlan_info.tlv_type", FT_UINT8, BASE_HEX, VALS(vlan_tlv_type_vals), 0x0,
688                         "" }},
689
690                 { &hf_vtp_vlan_tlvlength,
691                 { "Length",     "vtp.vlan_info.tlv_len", FT_UINT8, BASE_DEC, NULL, 0x0,
692                         "" }},
693         };
694         static gint *ett[] = {
695                 &ett_vtp,
696                 &ett_vtp_vlan_info,
697                 &ett_vtp_vlan_status,
698                 &ett_vtp_tlv,
699         };
700
701         proto_vtp = proto_register_protocol("Virtual Trunking Protocol", "vtp");
702         proto_register_field_array(proto_vtp, hf, array_length(hf));
703         proto_register_subtree_array(ett, array_length(ett));
704 }