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