3 * $Id: packet-eigrp.c,v 1.1 2000/05/28 22:59:18 guy Exp $
5 * Ethereal - Network traffic analyzer
6 * By Gerald Combs <gerald@zing.org>
7 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #ifdef HAVE_SYS_TYPES_H
30 # include <sys/types.h>
37 #include "packet-eigrp.h"
38 #include "packet-atalk.h"
39 #include "packet-ip.h"
41 /* EIGRP Structs and Definitions. */
45 #define EIGRP_UPDATE 0x01
46 #define EIGRP_REQUEST 0x02
47 #define EIGRP_QUERY 0x03
48 #define EIGRP_REPLY 0x04
49 #define EIGRP_HELLO 0x05
51 typedef struct _e_eigrp
55 guint16 eigrp_checksum;
56 guint16 eigrp_subnets;
57 guint16 eigrp_networks;
58 guint32 eigrp_sequence;
59 guint32 eigrp_asnumber;
61 guint8 eigrp_subtype1;
62 guint16 eigrp_length1;
63 guint16 eigrp_holdtime;
65 guint8 eigrp_subtype2;
66 guint16 eigrp_length2;
71 static int proto_eigrp = -1;
73 static gint ett_eigrp = -1;
75 static const value_string eigrp_opcode_vals[] = {
76 { EIGRP_HELLO, "Hello/Ack" },
77 { EIGRP_UPDATE, "Update" },
78 { EIGRP_REPLY, "Reply" },
79 { EIGRP_QUERY, "Query" },
80 { EIGRP_REQUEST, "Request" },
85 dissect_eigrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
87 proto_tree *eigrp_tree;
91 /* Avoids alignment problems on many architectures. */
92 memcpy(&ih, &pd[offset], sizeof(e_eigrp));
93 /* To do: check for runts, errs, etc. */
94 cksum = ntohs(ih.eigrp_checksum);
96 if (check_col(fd, COL_PROTOCOL))
97 col_add_str(fd, COL_PROTOCOL, "EIGRP");
98 if (check_col(fd, COL_INFO))
99 col_add_str(fd, COL_INFO,
100 val_to_str( ih.eigrp_opcode, eigrp_opcode_vals, "Unknown (0x%04x)"));
103 ti = proto_tree_add_item(tree, proto_eigrp, NullTVB, offset, END_OF_FRAME, NULL);
104 eigrp_tree = proto_item_add_subtree(ti, ett_eigrp);
106 proto_tree_add_text(eigrp_tree, NullTVB, offset, 1, "Version: %u", ih.eigrp_version);
107 proto_tree_add_text(eigrp_tree, NullTVB, offset + 1, 1, "Opcode: %u (%s)", ih.eigrp_opcode,
108 val_to_str( ih.eigrp_opcode, eigrp_opcode_vals, "Unknown") );
109 proto_tree_add_text(eigrp_tree, NullTVB, offset + 2, 2, "Checksum: 0x%x", cksum);
110 proto_tree_add_text(eigrp_tree, NullTVB, offset + 4, 2, "Subnets in local net: %u", ih.eigrp_subnets);
111 proto_tree_add_text(eigrp_tree, NullTVB, offset + 6, 2, "Networks in Autonomous System: %d", ih.eigrp_networks);
112 proto_tree_add_text(eigrp_tree, NullTVB, offset + 8, 4, "Sequence Number: 0x%x", ih.eigrp_sequence);
113 proto_tree_add_text(eigrp_tree, NullTVB, offset + 12, 4, "Autonomous System number: %u", ih.eigrp_asnumber);
118 proto_register_eigrp(void)
120 static gint *ett[] = {
123 proto_eigrp = proto_register_protocol("Enhanced Interior Gateway Routing Protocol", "eigrp");
124 proto_register_subtree_array(ett, array_length(ett));
128 proto_reg_handoff_eigrp(void)
130 dissector_add("ip.proto", IP_PROTO_EIGRP, dissect_eigrp);
131 dissector_add("ddp.type", DDP_EIGRP, dissect_eigrp);