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