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