From Didier Gautheron:
[obnox/wireshark/wip.git] / epan / dissectors / packet-pagp.c
1 /* packet-pagp.c
2  * Routines for PAgP (Port Aggregation Protocol - aka FEC) dissection
3  * Original Author Mark C. Brown <mbrown@hp.com>
4  * Copyright (C) 2004 Hewlett-Packard Development Company, L.P.
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * Copied from packet-slowprotocols.c
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27  */
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include <stdio.h>
34 #include <string.h>
35 #include <glib.h>
36 #include <epan/packet.h>
37 #include <epan/etypes.h>
38 #include <epan/llcsaps.h>
39 #include <epan/ppptypes.h>
40 #include <epan/address.h>
41 #include <epan/addr_resolv.h>
42
43 /* Offsets of fields within a PagP PDU */
44
45 #define PAGP_VERSION_NUMBER             0
46
47 #define PAGP_FLAGS                      1
48 #define PAGP_LOCAL_DEVICE_ID            2
49 #define PAGP_LOCAL_LEARN_CAP            8
50 #define PAGP_LOCAL_PORT_PRIORITY                9
51 #define PAGP_LOCAL_SENT_PORT_IFINDEX    10
52 #define PAGP_LOCAL_GROUP_CAPABILITY     14
53 #define PAGP_LOCAL_GROUP_IFINDEX                18
54 #define PAGP_PARTNER_DEVICE_ID          22
55 #define PAGP_PARTNER_LEARN_CAP          28
56 #define PAGP_PARTNER_PORT_PRIORITY              29
57 #define PAGP_PARTNER_SENT_PORT_IFINDEX  30
58 #define PAGP_PARTNER_GROUP_CAPABILITY   34
59 #define PAGP_PARTNER_GROUP_IFINDEX              38
60 #define PAGP_PARTNER_COUNT              42
61 #define PAGP_NUM_TLVS                   44
62 #define PAGP_FIRST_TLV                  46
63
64 #define PAGP_FLUSH_LOCAL_DEVICE_ID              2
65 #define PAGP_FLUSH_PARTNER_DEVICE_ID    8
66 #define PAGP_FLUSH_TRANSACTION_ID       14
67
68 /* PDU Versions */
69
70 #define PAGP_INFO_PDU                   1
71 #define PAGP_FLUSH_PDU                  2
72
73 /* Flag bits */
74
75 #define PAGP_FLAGS_SLOW_HELLO           0x01
76 #define PAGP_FLAGS_AUTO_MODE            0x02
77 #define PAGP_FLAGS_CONSISTENT_STATE     0x04
78
79 /* TLV Types */
80
81
82 #define PAGP_TLV_DEVICE_NAME            1
83 #define PAGP_TLV_PORT_NAME              2
84 #define PAGP_TLV_AGPORT_MAC             3
85 #define PAGP_TLV_RESERVED               4
86
87 /* Initialise the protocol and registered fields */
88
89 static int proto_pagp = -1;
90
91 static int hf_pagp_version_number = -1;
92
93 static int hf_pagp_flags = -1;
94 static int hf_pagp_flags_slow_hello = -1;
95 static int hf_pagp_flags_auto_mode = -1;
96 static int hf_pagp_flags_consistent_state = -1;
97 static int hf_pagp_local_device_id = -1;
98 static int hf_pagp_local_learn_cap = -1;
99 static int hf_pagp_local_port_priority = -1;
100 static int hf_pagp_local_sent_port_ifindex = -1;
101 static int hf_pagp_local_group_capability = -1;
102 static int hf_pagp_local_group_ifindex = -1;
103 static int hf_pagp_partner_device_id = -1;
104 static int hf_pagp_partner_learn_cap = -1;
105 static int hf_pagp_partner_port_priority = -1;
106 static int hf_pagp_partner_sent_port_ifindex = -1;
107 static int hf_pagp_partner_group_capability = -1;
108 static int hf_pagp_partner_group_ifindex = -1;
109 static int hf_pagp_partner_count = -1;
110 static int hf_pagp_num_tlvs = -1;
111 static int hf_pagp_tlv = -1;
112 static int hf_pagp_tlv_device_name = -1;
113 static int hf_pagp_tlv_port_name = -1;
114 static int hf_pagp_tlv_agport_mac = -1;
115
116 static int hf_pagp_flush_local_device_id = -1;
117 static int hf_pagp_flush_partner_device_id = -1;
118 static int hf_pagp_flush_transaction_id = -1;
119
120 /* Initialise the subtree pointers */
121
122 static gint ett_pagp = -1;
123 static gint ett_pagp_flags = -1;
124 static gint ett_pagp_tlvs = -1;
125
126 /* General declarations and macros */
127
128 static const char initial_sep[] = " (";
129 static const char cont_sep[] = ", ";
130
131 static const value_string pdu_vers[] = {
132         { 1, "Info PDU" },
133         { 2, "Flush PDU" },
134         { 0, NULL }
135 };
136
137 static const value_string learn_cap[] = {
138         { 1, "Source-based Distribution" },
139         { 2, "Arbitrary Distribution" },
140         { 0, NULL }
141 };
142
143 static const value_string tlv_types[] = {
144         { 1, "Device Name TLV" },
145         { 2, "Physical Port Name TLV" },
146         { 3, "Agport MAC Address" },
147         { 4, "Reserved" },
148         { 0, NULL }
149 };
150
151 static const true_false_string automode = {
152         "Yes",
153         "Desirable Mode"
154 };
155
156 #define APPEND_BOOLEAN_FLAG(flag, item, string) \
157         if(flag) {                                                      \
158                 if(item)                                                \
159                         proto_item_append_text(item, string, sep);      \
160                 sep = cont_sep;                                         \
161         }
162
163 /* Code to actually dissect the PAGP packets */
164 static void
165 dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
166 {
167       guint32 raw_word;
168       guint16 raw_half_word;
169       guint16 num_tlvs;
170       guint16 tlv;
171       guint16 len;
172       guint16 i;
173       guint16 offset = PAGP_FIRST_TLV;
174       guint8  raw_octet;
175
176       guint8  flags;
177
178       struct _address device_id;
179
180       const guint8 *p_sys;
181
182       guchar *ch;
183
184       proto_tree *pagp_tree = NULL;
185       proto_item *pagp_item;
186       proto_tree *flags_tree;
187       proto_item *flags_item;
188       proto_tree *tlv_tree;
189       proto_item *tlv_item;
190
191
192       const char *sep;
193
194
195       device_id.type = AT_ETHER;
196       device_id.len = 6;
197
198       col_set_str(pinfo->cinfo, COL_PROTOCOL, "PAGP"); /* PAGP Protocol */
199
200       col_clear(pinfo->cinfo, COL_INFO);
201
202       pinfo->current_proto = "PAGP";
203
204       raw_octet = tvb_get_guint8(tvb, PAGP_VERSION_NUMBER);
205       if (tree) {
206             pagp_item = proto_tree_add_protocol_format(tree, proto_pagp, tvb,
207                                 0, -1, "Port Aggregation Protocol");
208             pagp_tree = proto_item_add_subtree(pagp_item, ett_pagp);
209             proto_tree_add_uint(pagp_tree, hf_pagp_version_number, tvb,
210                                 PAGP_VERSION_NUMBER, 1, raw_octet);
211       }
212       if (check_col(pinfo->cinfo, COL_INFO)) {
213          col_append_str(pinfo->cinfo, COL_INFO,
214                val_to_str(raw_octet, pdu_vers, "Unknown PDU version"));
215       }
216
217       if (raw_octet == PAGP_FLUSH_PDU) {
218
219          device_id.data = tvb_get_ptr(tvb, PAGP_FLUSH_LOCAL_DEVICE_ID, 6);
220          if (check_col(pinfo->cinfo, COL_INFO)) {
221             col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s",
222                ep_address_to_str(&device_id));
223          }
224          if (tree) {
225                proto_tree_add_ether(pagp_tree, hf_pagp_flush_local_device_id, tvb,
226                            PAGP_FLUSH_LOCAL_DEVICE_ID, 6, device_id.data);
227          }
228
229          device_id.data = tvb_get_ptr(tvb, PAGP_FLUSH_PARTNER_DEVICE_ID, 6);
230          if (check_col(pinfo->cinfo, COL_INFO)) {
231             col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s",
232                ep_address_to_str(&device_id));
233          }
234          if (tree) {
235             proto_tree_add_ether(pagp_tree, hf_pagp_flush_partner_device_id, tvb,
236                            PAGP_FLUSH_PARTNER_DEVICE_ID, 6, device_id.data);
237          }
238
239          raw_word = tvb_get_ntohl(tvb, PAGP_FLUSH_TRANSACTION_ID);
240          if (check_col(pinfo->cinfo, COL_INFO)) {
241             col_append_fstr(pinfo->cinfo, COL_INFO,
242                 "; Transaction ID: 0x%x ", raw_word);
243          }
244          if (tree) {
245             proto_tree_add_uint(pagp_tree, hf_pagp_flush_transaction_id, tvb,
246                            PAGP_FLUSH_TRANSACTION_ID, 4, raw_word);
247          }
248          return;
249       }
250
251       /* Info PDU */
252
253       flags = tvb_get_guint8(tvb, PAGP_FLAGS);
254       if (check_col(pinfo->cinfo, COL_INFO)) {
255          col_append_fstr(pinfo->cinfo, COL_INFO, "; Flags 0x%x", flags);
256       }
257
258       if (tree) {
259          flags_item = proto_tree_add_uint(pagp_tree, hf_pagp_flags, tvb,
260                         PAGP_FLAGS, 1, flags);
261          flags_tree = proto_item_add_subtree(flags_item, ett_pagp_flags);
262
263          sep = initial_sep;
264
265          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_SLOW_HELLO, flags_item, "%sSlow Hello");
266          proto_tree_add_boolean(flags_tree, hf_pagp_flags_slow_hello, tvb,
267                         PAGP_FLAGS, 1, flags);
268
269          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_AUTO_MODE, flags_item, "%sAuto Mode");
270          proto_tree_add_boolean(flags_tree, hf_pagp_flags_auto_mode, tvb,
271                         PAGP_FLAGS, 1, flags);
272
273          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_CONSISTENT_STATE, flags_item,
274                         "%sConsistent State");
275          proto_tree_add_boolean(flags_tree, hf_pagp_flags_consistent_state, tvb,
276                                 PAGP_FLAGS, 1, flags);
277
278          sep = cont_sep;
279          if (sep != initial_sep) {
280             /* We put something in; put in the terminating ")" */
281             proto_item_append_text(flags_item, ")");
282          }
283       }
284
285       device_id.data = tvb_get_ptr(tvb, PAGP_LOCAL_DEVICE_ID, 6);
286       if (check_col(pinfo->cinfo, COL_INFO)) {
287          col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s",
288             ep_address_to_str(&device_id));
289       }
290       if (tree) {
291             proto_tree_add_ether(pagp_tree, hf_pagp_local_device_id, tvb,
292                                 PAGP_LOCAL_DEVICE_ID, 6, device_id.data);
293       }
294
295       if (tree) {
296             raw_octet = tvb_get_guint8(tvb, PAGP_LOCAL_LEARN_CAP);
297             proto_tree_add_uint(pagp_tree, hf_pagp_local_learn_cap, tvb,
298                                 PAGP_LOCAL_LEARN_CAP, 1, raw_octet);
299
300             raw_octet = tvb_get_guint8(tvb, PAGP_LOCAL_PORT_PRIORITY);
301             proto_tree_add_uint(pagp_tree, hf_pagp_local_port_priority, tvb,
302                                 PAGP_LOCAL_PORT_PRIORITY, 1, raw_octet);
303
304             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_SENT_PORT_IFINDEX);
305             proto_tree_add_uint(pagp_tree, hf_pagp_local_sent_port_ifindex, tvb,
306                                 PAGP_LOCAL_SENT_PORT_IFINDEX, 4, raw_word);
307
308             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_GROUP_CAPABILITY);
309             proto_tree_add_uint(pagp_tree, hf_pagp_local_group_capability, tvb,
310                                 PAGP_LOCAL_GROUP_CAPABILITY, 4, raw_word);
311
312             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_GROUP_IFINDEX);
313             proto_tree_add_uint(pagp_tree, hf_pagp_local_group_ifindex, tvb,
314                                 PAGP_LOCAL_GROUP_IFINDEX, 4, raw_word);
315       }
316
317       device_id.data = tvb_get_ptr(tvb, PAGP_PARTNER_DEVICE_ID, 6);
318       if (check_col(pinfo->cinfo, COL_INFO)) {
319          col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s",
320                ep_address_to_str(&device_id));
321       }
322       if (tree) {
323             proto_tree_add_ether(pagp_tree, hf_pagp_partner_device_id, tvb,
324                                 PAGP_PARTNER_DEVICE_ID, 6, device_id.data);
325       }
326
327       if (tree) {
328             raw_octet = tvb_get_guint8(tvb, PAGP_PARTNER_LEARN_CAP);
329             proto_tree_add_uint(pagp_tree, hf_pagp_partner_learn_cap, tvb,
330                                 PAGP_PARTNER_LEARN_CAP, 1, raw_octet);
331
332             raw_octet = tvb_get_guint8(tvb, PAGP_PARTNER_PORT_PRIORITY);
333             proto_tree_add_uint(pagp_tree, hf_pagp_partner_port_priority, tvb,
334                                 PAGP_PARTNER_PORT_PRIORITY, 1, raw_octet);
335
336             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_SENT_PORT_IFINDEX);
337             proto_tree_add_uint(pagp_tree, hf_pagp_partner_sent_port_ifindex, tvb,
338                                 PAGP_PARTNER_SENT_PORT_IFINDEX, 4, raw_word);
339
340             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_GROUP_CAPABILITY);
341             proto_tree_add_uint(pagp_tree, hf_pagp_partner_group_capability, tvb,
342                                 PAGP_PARTNER_GROUP_CAPABILITY, 4, raw_word);
343
344             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_GROUP_IFINDEX);
345             proto_tree_add_uint(pagp_tree, hf_pagp_partner_group_ifindex, tvb,
346                                 PAGP_PARTNER_GROUP_IFINDEX, 4, raw_word);
347
348             raw_half_word = tvb_get_ntohs(tvb, PAGP_PARTNER_COUNT);
349             proto_tree_add_uint(pagp_tree, hf_pagp_partner_count, tvb,
350                                 PAGP_PARTNER_COUNT, 2, raw_half_word);
351
352             num_tlvs = tvb_get_ntohs(tvb, PAGP_NUM_TLVS);
353             proto_tree_add_uint(pagp_tree, hf_pagp_num_tlvs, tvb,
354                                 PAGP_NUM_TLVS, 2, num_tlvs);
355
356             /* dump TLV entries */
357
358             for ( i = 1; i <= num_tlvs; i++ ) {
359
360                 tlv = tvb_get_ntohs(tvb, offset);
361                 len = tvb_get_ntohs(tvb, offset + 2);
362                 if ( len == 0 ) {
363                    proto_tree_add_text(pagp_tree, tvb, offset, -1,
364                                        "Unknown data - TLV len=0");
365                    return;
366                 }
367
368                 tlv_item = proto_tree_add_text (pagp_tree, tvb, offset, len,
369                            "TLV Entry #%d", i);
370
371                 tlv_tree = proto_item_add_subtree (tlv_item, ett_pagp_tlvs);
372                 proto_tree_add_uint_format (tlv_tree, hf_pagp_tlv, tvb,
373                         offset,2,tlv,"Type = %d (%s)", tlv,
374                         val_to_str(tlv,tlv_types, "Unknown")) ;
375                 proto_tree_add_text (tlv_tree, tvb, offset+2, 2,
376                         "Length = %u bytes (includes Type and Length)", len) ;
377                 if ( tvb_reported_length_remaining(tvb, offset) < len ) {
378                    proto_tree_add_text(tlv_tree, tvb, offset, -1,
379                                        "TLV length too large");
380                    return;
381                 }
382
383                 switch (tlv) {
384                    case PAGP_TLV_DEVICE_NAME:
385                         ch = tvb_get_ephemeral_string(tvb, offset+4, len-4);
386                         proto_tree_add_string(tlv_tree, hf_pagp_tlv_device_name,
387                            tvb, offset+4, len-4, ch);
388                         break;
389                    case PAGP_TLV_PORT_NAME:
390                         ch = tvb_get_ephemeral_string(tvb, offset+4, len-4);
391                         proto_tree_add_string(tlv_tree, hf_pagp_tlv_port_name,
392                            tvb, offset+4, len-4, ch);
393                         break;
394                    case PAGP_TLV_AGPORT_MAC:
395                         p_sys = tvb_get_ptr(tvb, offset+4, 6);
396                         proto_tree_add_ether(tlv_tree, hf_pagp_tlv_agport_mac,
397                            tvb, offset+4, 6, p_sys);
398                         break;
399                    case PAGP_TLV_RESERVED:
400                         break;
401                 }
402
403                 offset += len;
404
405             }
406       }
407 }
408
409
410 /* Register the protocol with Wireshark */
411
412 void
413 proto_register_pagp(void)
414 {
415 /* Setup list of header fields */
416
417   static hf_register_info hf[] = {
418
419     { &hf_pagp_version_number,
420       { "Version",              "pagp.version",
421         FT_UINT8,       BASE_HEX,       VALS(pdu_vers), 0x0,
422         "Identifies the PAgP PDU version: 1 = Info, 2 = Flush", HFILL }},
423
424     { &hf_pagp_flags,
425       { "Flags",                "pagp.flags",
426         FT_UINT8,       BASE_HEX,       NULL,   0x0,
427         "Information flags", HFILL }},
428
429     { &hf_pagp_flags_slow_hello,
430       { "Slow Hello",           "pagp.flags.slowhello",
431         FT_BOOLEAN,     8,      TFS(&tfs_yes_no), PAGP_FLAGS_SLOW_HELLO,
432         "1 = using Slow Hello, 0 = Slow Hello disabled", HFILL }},
433
434     { &hf_pagp_flags_auto_mode,
435       { "Auto Mode",            "pagp.flags.automode",
436         FT_BOOLEAN,     8,      TFS(&automode), PAGP_FLAGS_AUTO_MODE,
437         "1 = Auto Mode enabled, 0 = Desirable Mode", HFILL }},
438
439     { &hf_pagp_flags_consistent_state,
440       { "Consistent State",     "pagp.flags.state",
441         FT_BOOLEAN,     8,      NULL,   PAGP_FLAGS_CONSISTENT_STATE,
442         "1 = Consistent State, 0 = Not Ready", HFILL }},
443
444     { &hf_pagp_local_device_id,
445       { "Local Device ID",      "pagp.localdevid",
446         FT_ETHER,       BASE_NONE,      NULL,   0x0,
447         "Local device ID", HFILL }},
448
449     { &hf_pagp_local_learn_cap,
450       { "Local Learn Capability",       "pagp.localearncap",
451         FT_UINT8,       BASE_HEX,       VALS(learn_cap),        0x0,
452         "Local learn capability", HFILL }},
453
454     { &hf_pagp_local_port_priority,
455       { "Local Port Hot Standby Priority",      "pagp.localportpri",
456         FT_UINT8,       BASE_DEC,       NULL,   0x0,
457         "The local hot standby priority assigned to this port", HFILL }},
458
459     { &hf_pagp_local_sent_port_ifindex,
460       { "Local Sent Port ifindex",      "pagp.localsentportifindex",
461         FT_UINT32,      BASE_DEC,       NULL,   0x0,
462         "The interface index of the local port used to send PDU", HFILL }},
463
464     { &hf_pagp_local_group_capability,
465       { "Local Group Capability",       "pagp.localgroupcap",
466         FT_UINT32,      BASE_HEX,       NULL,   0x0,
467         "The local group capability", HFILL }},
468
469     { &hf_pagp_local_group_ifindex,
470       { "Local Group ifindex",          "pagp.localgroupifindex",
471         FT_UINT32,      BASE_DEC,       NULL,   0x0,
472         "The local group interface index", HFILL }},
473
474     { &hf_pagp_partner_device_id,
475       { "Partner Device ID",            "pagp.partnerdevid",
476         FT_ETHER,       BASE_NONE,      NULL,   0x0,
477         "Remote Device ID (MAC)", HFILL }},
478
479     { &hf_pagp_partner_learn_cap,
480       { "Partner Learn Capability",     "pagp.partnerlearncap",
481         FT_UINT8,       BASE_HEX,       VALS(learn_cap),        0x0,
482         "Remote learn capability", HFILL }},
483
484     { &hf_pagp_partner_port_priority,
485       { "Partner Port Hot Standby Priority",    "pagp.partnerportpri",
486         FT_UINT8,       BASE_DEC,       NULL,   0x0,
487         "Remote port priority", HFILL }},
488
489     { &hf_pagp_partner_sent_port_ifindex,
490       { "Partner Sent Port ifindex",    "pagp.partnersentportifindex",
491         FT_UINT32,      BASE_DEC,       NULL,   0x0,
492         "Remote port interface index sent", HFILL }},
493
494     { &hf_pagp_partner_group_capability,
495       { "Partner Group Capability",     "pagp.partnergroupcap",
496         FT_UINT32,      BASE_HEX,       NULL,   0x0,
497         "Remote group capability", HFILL }},
498
499     { &hf_pagp_partner_group_ifindex,
500       { "Partner Group ifindex",        "pagp.partnergroupifindex",
501         FT_UINT32,      BASE_DEC,       NULL,   0x0,
502         "Remote group interface index", HFILL }},
503
504     { &hf_pagp_partner_count,
505       { "Partner Count",                "pagp.partnercount",
506         FT_UINT16,      BASE_DEC,       NULL,   0x0,
507         "Partner count", HFILL }},
508
509     { &hf_pagp_num_tlvs,
510       { "Number of TLVs",               "pagp.numtlvs",
511         FT_UINT16,      BASE_DEC,       NULL,   0x0,
512         "Number of TLVs following", HFILL }},
513
514     { &hf_pagp_tlv,
515       { "Entry",                "pagp.tlv",
516         FT_UINT16,      BASE_DEC,       NULL,   0x0,
517         "Type/Length/Value", HFILL }},
518
519     { &hf_pagp_tlv_device_name,
520       { "Device Name",          "pagp.tlvdevname",
521         FT_STRING,      BASE_NONE,      NULL,   0x0,
522         "sysName of device", HFILL }},
523
524     { &hf_pagp_tlv_port_name,
525       { "Physical Port Name",           "pagp.tlvportname",
526         FT_STRING,      BASE_NONE,      NULL,   0x0,
527         "Name of port used to send PDU", HFILL }},
528
529     { &hf_pagp_tlv_agport_mac,
530       { "Agport MAC Address",           "pagp.tlvagportmac",
531         FT_ETHER,       BASE_NONE,      NULL,   0x0,
532         "Source MAC on frames for this aggregate", HFILL }},
533
534     { &hf_pagp_flush_local_device_id,
535       { "Flush Local Device ID",        "pagp.flushlocaldevid",
536         FT_ETHER,       BASE_NONE,      NULL,   0x0,
537         "Flush local device ID", HFILL }},
538
539     { &hf_pagp_flush_partner_device_id,
540       { "Flush Partner Device ID",      "pagp.flushpartnerdevid",
541         FT_ETHER,       BASE_NONE,      NULL,   0x0,
542         "Flush remote device ID", HFILL }},
543
544     { &hf_pagp_flush_transaction_id,
545       { "Transaction ID",               "pagp.transid",
546         FT_UINT32,      BASE_HEX,       NULL,   0x0,
547         "Flush transaction ID", HFILL }},
548
549   };
550
551   /* Setup protocol subtree array */
552
553   static gint *ett[] = {
554     &ett_pagp,
555     &ett_pagp_flags,
556     &ett_pagp_tlvs,
557   };
558
559   /* Register the protocol name and description */
560
561   proto_pagp = proto_register_protocol("Port Aggregation Protocol", "PAGP", "pagp");
562
563   /* Required function calls to register the header fields and subtrees used */
564
565   proto_register_field_array(proto_pagp, hf, array_length(hf));
566   proto_register_subtree_array(ett, array_length(ett));
567
568 }
569
570
571 void
572 proto_reg_handoff_pagp(void)
573 {
574   dissector_handle_t pagp_handle;
575
576   pagp_handle = create_dissector_handle(dissect_pagp, proto_pagp);
577   dissector_add("llc.cisco_pid", 0x0104, pagp_handle);
578 }