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