315690200c78b76800efd97d2e831d4f3bf4841e
[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       if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
199             col_set_str(pinfo->cinfo, COL_PROTOCOL, "PAGP"); /* PAGP Protocol */
200       }
201
202       col_clear(pinfo->cinfo, COL_INFO);
203
204       pinfo->current_proto = "PAGP";
205
206       raw_octet = tvb_get_guint8(tvb, PAGP_VERSION_NUMBER);
207       if (tree) {
208             pagp_item = proto_tree_add_protocol_format(tree, proto_pagp, tvb,
209                                 0, -1, "Port Aggregation Protocol");
210             pagp_tree = proto_item_add_subtree(pagp_item, ett_pagp);
211             proto_tree_add_uint(pagp_tree, hf_pagp_version_number, tvb,
212                                 PAGP_VERSION_NUMBER, 1, raw_octet);
213       } 
214       if (check_col(pinfo->cinfo, COL_INFO)) {
215          col_append_str(pinfo->cinfo, COL_INFO,
216                val_to_str(raw_octet, pdu_vers, "Unknown PDU version"));
217       }
218
219       if (raw_octet == PAGP_FLUSH_PDU) {
220
221          device_id.data = tvb_get_ptr(tvb, PAGP_FLUSH_LOCAL_DEVICE_ID, 6);
222          if (check_col(pinfo->cinfo, COL_INFO)) {
223             col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s",
224                address_to_str(&device_id));
225          }
226          if (tree) {
227                proto_tree_add_ether(pagp_tree, hf_pagp_flush_local_device_id, tvb,
228                            PAGP_FLUSH_LOCAL_DEVICE_ID, 6, device_id.data);
229          }
230
231          device_id.data = tvb_get_ptr(tvb, PAGP_FLUSH_PARTNER_DEVICE_ID, 6);
232          if (check_col(pinfo->cinfo, COL_INFO)) {
233             col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s",
234                address_to_str(&device_id));
235          }
236          if (tree) {
237             proto_tree_add_ether(pagp_tree, hf_pagp_flush_partner_device_id, tvb,
238                            PAGP_FLUSH_PARTNER_DEVICE_ID, 6, device_id.data);
239          }
240
241          raw_word = tvb_get_ntohl(tvb, PAGP_FLUSH_TRANSACTION_ID);
242          if (check_col(pinfo->cinfo, COL_INFO)) {
243             col_append_fstr(pinfo->cinfo, COL_INFO,
244                 "; Transaction ID: 0x%x ", raw_word);
245          }
246          if (tree) {
247             proto_tree_add_uint(pagp_tree, hf_pagp_flush_transaction_id, tvb,
248                            PAGP_FLUSH_TRANSACTION_ID, 4, raw_word);
249          }
250          return;
251       }
252
253       /* Info PDU */
254
255       flags = tvb_get_guint8(tvb, PAGP_FLAGS);
256       if (check_col(pinfo->cinfo, COL_INFO)) {
257          col_append_fstr(pinfo->cinfo, COL_INFO, "; Flags 0x%x", flags);
258       }
259
260       if (tree) {
261          flags_item = proto_tree_add_uint(pagp_tree, hf_pagp_flags, tvb,
262                         PAGP_FLAGS, 1, flags);
263          flags_tree = proto_item_add_subtree(flags_item, ett_pagp_flags);
264
265          sep = initial_sep;
266
267          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_SLOW_HELLO, flags_item, "%sSlow Hello");
268          proto_tree_add_boolean(flags_tree, hf_pagp_flags_slow_hello, tvb,
269                         PAGP_FLAGS, 1, flags);
270
271          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_AUTO_MODE, flags_item, "%sAuto Mode");
272          proto_tree_add_boolean(flags_tree, hf_pagp_flags_auto_mode, tvb,
273                         PAGP_FLAGS, 1, flags);
274
275          APPEND_BOOLEAN_FLAG(flags & PAGP_FLAGS_CONSISTENT_STATE, flags_item,
276                         "%sConsistent State");
277          proto_tree_add_boolean(flags_tree, hf_pagp_flags_consistent_state, tvb,
278                                 PAGP_FLAGS, 1, flags);
279
280          sep = cont_sep;
281          if (sep != initial_sep) {
282             /* We put something in; put in the terminating ")" */
283             proto_item_append_text(flags_item, ")");
284          }
285       }
286
287       device_id.data = tvb_get_ptr(tvb, PAGP_LOCAL_DEVICE_ID, 6);
288       if (check_col(pinfo->cinfo, COL_INFO)) {
289          col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s",
290             address_to_str(&device_id));
291       }
292       if (tree) {
293             proto_tree_add_ether(pagp_tree, hf_pagp_local_device_id, tvb,
294                                 PAGP_LOCAL_DEVICE_ID, 6, device_id.data);
295       }
296
297       if (tree) {
298             raw_octet = tvb_get_guint8(tvb, PAGP_LOCAL_LEARN_CAP);
299             proto_tree_add_uint(pagp_tree, hf_pagp_local_learn_cap, tvb,
300                                 PAGP_LOCAL_LEARN_CAP, 1, raw_octet);
301
302             raw_octet = tvb_get_guint8(tvb, PAGP_LOCAL_PORT_PRIORITY);
303             proto_tree_add_uint(pagp_tree, hf_pagp_local_port_priority, tvb,
304                                 PAGP_LOCAL_PORT_PRIORITY, 1, raw_octet);
305
306             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_SENT_PORT_IFINDEX);
307             proto_tree_add_uint(pagp_tree, hf_pagp_local_sent_port_ifindex, tvb,
308                                 PAGP_LOCAL_SENT_PORT_IFINDEX, 4, raw_word);
309
310             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_GROUP_CAPABILITY);
311             proto_tree_add_uint(pagp_tree, hf_pagp_local_group_capability, tvb,
312                                 PAGP_LOCAL_GROUP_CAPABILITY, 4, raw_word);
313
314             raw_word = tvb_get_ntohl(tvb, PAGP_LOCAL_GROUP_IFINDEX);
315             proto_tree_add_uint(pagp_tree, hf_pagp_local_group_ifindex, tvb,
316                                 PAGP_LOCAL_GROUP_IFINDEX, 4, raw_word);
317       }
318
319       device_id.data = tvb_get_ptr(tvb, PAGP_PARTNER_DEVICE_ID, 6);
320       if (check_col(pinfo->cinfo, COL_INFO)) {
321          col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s",
322                address_to_str(&device_id));
323       }
324       if (tree) {
325             proto_tree_add_ether(pagp_tree, hf_pagp_partner_device_id, tvb,
326                                 PAGP_PARTNER_DEVICE_ID, 6, device_id.data);
327       }
328
329       if (tree) {
330             raw_octet = tvb_get_guint8(tvb, PAGP_PARTNER_LEARN_CAP);
331             proto_tree_add_uint(pagp_tree, hf_pagp_partner_learn_cap, tvb,
332                                 PAGP_PARTNER_LEARN_CAP, 1, raw_octet);
333
334             raw_octet = tvb_get_guint8(tvb, PAGP_PARTNER_PORT_PRIORITY);
335             proto_tree_add_uint(pagp_tree, hf_pagp_partner_port_priority, tvb,
336                                 PAGP_PARTNER_PORT_PRIORITY, 1, raw_octet);
337
338             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_SENT_PORT_IFINDEX);
339             proto_tree_add_uint(pagp_tree, hf_pagp_partner_sent_port_ifindex, tvb,
340                                 PAGP_PARTNER_SENT_PORT_IFINDEX, 4, raw_word);
341
342             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_GROUP_CAPABILITY);
343             proto_tree_add_uint(pagp_tree, hf_pagp_partner_group_capability, tvb,
344                                 PAGP_PARTNER_GROUP_CAPABILITY, 4, raw_word);
345
346             raw_word = tvb_get_ntohl(tvb, PAGP_PARTNER_GROUP_IFINDEX);
347             proto_tree_add_uint(pagp_tree, hf_pagp_partner_group_ifindex, tvb,
348                                 PAGP_PARTNER_GROUP_IFINDEX, 4, raw_word);
349
350             raw_half_word = tvb_get_ntohs(tvb, PAGP_PARTNER_COUNT);
351             proto_tree_add_uint(pagp_tree, hf_pagp_partner_count, tvb,
352                                 PAGP_PARTNER_COUNT, 2, raw_half_word);
353
354             num_tlvs = tvb_get_ntohs(tvb, PAGP_NUM_TLVS);
355             proto_tree_add_uint(pagp_tree, hf_pagp_num_tlvs, tvb,
356                                 PAGP_NUM_TLVS, 2, num_tlvs);
357
358             /* dump TLV entries */
359
360             for ( i = 1; i <= num_tlvs; i++ ) {
361
362                 tlv = tvb_get_ntohs(tvb, offset);
363                 len = tvb_get_ntohs(tvb, offset + 2);
364                 if ( len == 0 ) {
365                    proto_tree_add_text(pagp_tree, tvb, offset, -1,
366                                        "Unknown data - TLV len=0");
367                    return;
368                 }
369
370                 tlv_item = proto_tree_add_text (pagp_tree, tvb, offset, len,
371                            "TLV Entry #%d", i);
372                                                                                 
373                 tlv_tree = proto_item_add_subtree (tlv_item, ett_pagp_tlvs);
374                 proto_tree_add_uint_format (tlv_tree, hf_pagp_tlv, tvb,
375                         offset,2,tlv,"Type = %d (%s)", tlv,
376                         val_to_str(tlv,tlv_types, "Unknown")) ;
377                 proto_tree_add_text (tlv_tree, tvb, offset+2, 2,
378                         "Length = %u bytes (includes Type and Length)", len) ;
379                 if ( tvb_reported_length_remaining(tvb, offset) < len ) {
380                    proto_tree_add_text(tlv_tree, tvb, offset, -1,
381                                        "TLV length too large");
382                    return;
383                 }
384                                                                                 
385                 switch (tlv) {
386                    case PAGP_TLV_DEVICE_NAME:
387                         ch = tvb_get_ephemeral_string(tvb, offset+4, len-4);
388                         proto_tree_add_string(tlv_tree, hf_pagp_tlv_device_name,
389                            tvb, offset+4, len-4, ch);
390                         break;
391                    case PAGP_TLV_PORT_NAME:
392                         ch = tvb_get_ephemeral_string(tvb, offset+4, len-4);
393                         proto_tree_add_string(tlv_tree, hf_pagp_tlv_port_name,
394                            tvb, offset+4, len-4, ch);
395                         break;
396                    case PAGP_TLV_AGPORT_MAC:
397                         p_sys = tvb_get_ptr(tvb, offset+4, 6);
398                         proto_tree_add_ether(tlv_tree, hf_pagp_tlv_agport_mac,
399                            tvb, offset+4, 6, p_sys);
400                         break;
401                    case PAGP_TLV_RESERVED:
402                         break;
403                 }
404
405                 offset += len;
406
407             }
408       }
409 }
410
411
412 /* Register the protocol with Wireshark */
413
414 void
415 proto_register_pagp(void)
416 {
417 /* Setup list of header fields */
418
419   static hf_register_info hf[] = {
420
421     { &hf_pagp_version_number,
422       { "Version",              "pagp.version",
423         FT_UINT8,       BASE_HEX,       VALS(pdu_vers), 0x0,
424         "Identifies the PAgP PDU version: 1 = Info, 2 = Flush", HFILL }},
425
426     { &hf_pagp_flags,
427       { "Flags",                "pagp.flags",
428         FT_UINT8,       BASE_HEX,       NULL,   0x0,
429         "Information flags", HFILL }},
430
431     { &hf_pagp_flags_slow_hello,
432       { "Slow Hello",           "pagp.flags.slowhello",
433         FT_BOOLEAN,     8,      TFS(&tfs_yes_no), PAGP_FLAGS_SLOW_HELLO,
434         "1 = using Slow Hello, 0 = Slow Hello disabled", HFILL }},
435
436     { &hf_pagp_flags_auto_mode,
437       { "Auto Mode",            "pagp.flags.automode",
438         FT_BOOLEAN,     8,      TFS(&automode), PAGP_FLAGS_AUTO_MODE,
439         "1 = Auto Mode enabled, 0 = Desirable Mode", HFILL }},
440
441     { &hf_pagp_flags_consistent_state,
442       { "Consistent State",     "pagp.flags.state",
443         FT_BOOLEAN,     8,      NULL,   PAGP_FLAGS_CONSISTENT_STATE,
444         "1 = Consistent State, 0 = Not Ready", HFILL }},
445
446     { &hf_pagp_local_device_id,
447       { "Local Device ID",      "pagp.localdevid",
448         FT_ETHER,       BASE_NONE,      NULL,   0x0,
449         "Local device ID", HFILL }},
450
451     { &hf_pagp_local_learn_cap,
452       { "Local Learn Capability",       "pagp.localearncap",
453         FT_UINT8,       BASE_HEX,       VALS(learn_cap),        0x0,
454         "Local learn capability", HFILL }},
455
456     { &hf_pagp_local_port_priority,
457       { "Local Port Hot Standby Priority",      "pagp.localportpri",
458         FT_UINT8,       BASE_DEC,       NULL,   0x0,
459         "The local hot standby priority assigned to this port", HFILL }},
460
461     { &hf_pagp_local_sent_port_ifindex,
462       { "Local Sent Port ifindex",      "pagp.localsentportifindex",
463         FT_UINT32,      BASE_DEC,       NULL,   0x0,
464         "The interface index of the local port used to send PDU", HFILL }},
465
466     { &hf_pagp_local_group_capability,
467       { "Local Group Capability",       "pagp.localgroupcap",
468         FT_UINT32,      BASE_HEX,       NULL,   0x0,
469         "The local group capability", HFILL }},
470
471     { &hf_pagp_local_group_ifindex,
472       { "Local Group ifindex",          "pagp.localgroupifindex",
473         FT_UINT32,      BASE_DEC,       NULL,   0x0,
474         "The local group interface index", HFILL }},
475
476     { &hf_pagp_partner_device_id,
477       { "Partner Device ID",            "pagp.partnerdevid",
478         FT_ETHER,       BASE_NONE,      NULL,   0x0,
479         "Remote Device ID (MAC)", HFILL }},
480
481     { &hf_pagp_partner_learn_cap,
482       { "Partner Learn Capability",     "pagp.partnerlearncap",
483         FT_UINT8,       BASE_HEX,       VALS(learn_cap),        0x0,
484         "Remote learn capability", HFILL }},
485
486     { &hf_pagp_partner_port_priority,
487       { "Partner Port Hot Standby Priority",    "pagp.partnerportpri",
488         FT_UINT8,       BASE_DEC,       NULL,   0x0,
489         "Remote port priority", HFILL }},
490
491     { &hf_pagp_partner_sent_port_ifindex,
492       { "Partner Sent Port ifindex",    "pagp.partnersentportifindex",
493         FT_UINT32,      BASE_DEC,       NULL,   0x0,
494         "Remote port interface index sent", HFILL }},
495
496     { &hf_pagp_partner_group_capability,
497       { "Partner Group Capability",     "pagp.partnergroupcap",
498         FT_UINT32,      BASE_HEX,       NULL,   0x0,
499         "Remote group capability", HFILL }},
500
501     { &hf_pagp_partner_group_ifindex,
502       { "Partner Group ifindex",        "pagp.partnergroupifindex",
503         FT_UINT32,      BASE_DEC,       NULL,   0x0,
504         "Remote group interface index", HFILL }},
505
506     { &hf_pagp_partner_count,
507       { "Partner Count",                "pagp.partnercount",
508         FT_UINT16,      BASE_DEC,       NULL,   0x0,
509         "Partner count", HFILL }},
510
511     { &hf_pagp_num_tlvs,
512       { "Number of TLVs",               "pagp.numtlvs",
513         FT_UINT16,      BASE_DEC,       NULL,   0x0,
514         "Number of TLVs following", HFILL }},
515
516     { &hf_pagp_tlv,
517       { "Entry",                "pagp.tlv",
518         FT_UINT16,      BASE_DEC,       NULL,   0x0,
519         "Type/Length/Value", HFILL }},
520
521     { &hf_pagp_tlv_device_name,
522       { "Device Name",          "pagp.tlvdevname",
523         FT_STRING,      BASE_NONE,      NULL,   0x0,
524         "sysName of device", HFILL }},
525
526     { &hf_pagp_tlv_port_name,
527       { "Physical Port Name",           "pagp.tlvportname",
528         FT_STRING,      BASE_NONE,      NULL,   0x0,
529         "Name of port used to send PDU", HFILL }},
530
531     { &hf_pagp_tlv_agport_mac,
532       { "Agport MAC Address",           "pagp.tlvagportmac",
533         FT_ETHER,       BASE_NONE,      NULL,   0x0,
534         "Source MAC on frames for this aggregate", HFILL }},
535
536     { &hf_pagp_flush_local_device_id,
537       { "Flush Local Device ID",        "pagp.flushlocaldevid",
538         FT_ETHER,       BASE_NONE,      NULL,   0x0,
539         "Flush local device ID", HFILL }},
540
541     { &hf_pagp_flush_partner_device_id,
542       { "Flush Partner Device ID",      "pagp.flushpartnerdevid",
543         FT_ETHER,       BASE_NONE,      NULL,   0x0,
544         "Flush remote device ID", HFILL }},
545
546     { &hf_pagp_flush_transaction_id,
547       { "Transaction ID",               "pagp.transid",
548         FT_UINT32,      BASE_HEX,       NULL,   0x0,
549         "Flush transaction ID", HFILL }},
550
551   };
552
553   /* Setup protocol subtree array */
554
555   static gint *ett[] = {
556     &ett_pagp,
557     &ett_pagp_flags,
558     &ett_pagp_tlvs,
559   };
560
561   /* Register the protocol name and description */
562
563   proto_pagp = proto_register_protocol("Port Aggregation Protocol", "PAGP", "pagp");
564
565   /* Required function calls to register the header fields and subtrees used */
566
567   proto_register_field_array(proto_pagp, hf, array_length(hf));
568   proto_register_subtree_array(ett, array_length(ett));
569
570 }
571
572
573 void
574 proto_reg_handoff_pagp(void)
575 {
576   dissector_handle_t pagp_handle;
577
578   pagp_handle = create_dissector_handle(dissect_pagp, proto_pagp);
579   dissector_add("llc.cisco_pid", 0x0104, pagp_handle);
580 }