diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-07 22:52:57 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-07 22:52:57 +0000 |
commit | 07f42b5b31f9523deeb147226521f77a2c8dd797 (patch) | |
tree | c720d2a42f11c9d14ac1a161eb785b438c2c4b14 /packet-rip.c | |
parent | fba49cfe85d4b23ebbffa97fae126a379e913ecd (diff) | |
download | wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.tar.gz wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.tar.bz2 wireshark-07f42b5b31f9523deeb147226521f77a2c8dd797.zip |
Created a new protocol tree implementation and a new display filter
mechanism that is built into ethereal. Wiretap is now used to read all
file formats. Libpcap is used only for capturing.
svn path=/trunk/; revision=342
Diffstat (limited to 'packet-rip.c')
-rw-r--r-- | packet-rip.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/packet-rip.c b/packet-rip.c index b4d3a992e7..7d1a780638 100644 --- a/packet-rip.c +++ b/packet-rip.c @@ -2,7 +2,7 @@ * Routines for RIPv1 and RIPv2 packet disassembly * (c) Copyright Hannes R. Boehm <hannes@boehm.org> * - * $Id: packet-rip.c,v 1.8 1999/03/23 03:14:43 gram Exp $ + * $Id: packet-rip.c,v 1.9 1999/07/07 22:51:52 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -90,14 +90,13 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { col_add_str(fd, COL_INFO, packet_type[rip_header.command]); if (tree) { - ti = proto_tree_add_item(tree, offset, (fd->cap_len - offset), "Routing Information Protocol"); - rip_tree = proto_tree_new(); - proto_item_add_subtree(ti, rip_tree, ETT_RIP); + ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset), "Routing Information Protocol"); + rip_tree = proto_item_add_subtree(ti, ETT_RIP); - proto_tree_add_item(rip_tree, offset, 1, "Command: %d (%s)", rip_header.command, packet_type[rip_header.command]); - proto_tree_add_item(rip_tree, offset + 1, 1, "Version: %d", rip_header.version); + proto_tree_add_text(rip_tree, offset, 1, "Command: %d (%s)", rip_header.command, packet_type[rip_header.command]); + proto_tree_add_text(rip_tree, offset + 1, 1, "Version: %d", rip_header.version); if(rip_header.version == RIPv2) - proto_tree_add_item(rip_tree, offset + 2 , 2, "Routing Domain: %d", ntohs(rip_header.domain)); + proto_tree_add_text(rip_tree, offset + 2 , 2, "Routing Domain: %d", ntohs(rip_header.domain)); /* skip header */ offset += RIP_HEADER_LENGTH; @@ -109,7 +108,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { family = ntohs(rip_entry.vektor.family); switch (family) { case 2: /* IP */ - ti = proto_tree_add_item(rip_tree, offset, + ti = proto_tree_add_text(rip_tree, offset, RIP_ENTRY_LENGTH, "IP Address: %s, Metric: %ld", ip_to_str((guint8 *) &(rip_entry.vektor.ip)), (long)ntohl(rip_entry.vektor.metric)); @@ -117,13 +116,13 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset, ti); break; case 0xFFFF: - proto_tree_add_item(rip_tree, offset, + proto_tree_add_text(rip_tree, offset, RIP_ENTRY_LENGTH, "Authentication"); dissect_rip_authentication(&rip_entry.authentication, offset, ti); break; default: - proto_tree_add_item(rip_tree, offset, + proto_tree_add_text(rip_tree, offset, RIP_ENTRY_LENGTH, "Unknown address family %u", family); break; @@ -140,22 +139,21 @@ dissect_ip_rip_vektor(guint8 version, const e_rip_vektor *rip_vektor, { proto_tree *rip_vektor_tree; - rip_vektor_tree = proto_tree_new(); - proto_item_add_subtree(tree, rip_vektor_tree, ETT_RIP_VEC); + rip_vektor_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); - proto_tree_add_item(rip_vektor_tree, offset, 2, "Address Family ID: IP"); + proto_tree_add_text(rip_vektor_tree, offset, 2, "Address Family ID: IP"); if(version == RIPv2) - proto_tree_add_item(rip_vektor_tree, offset + 2 , 2, "Route Tag: %d", + proto_tree_add_text(rip_vektor_tree, offset + 2 , 2, "Route Tag: %d", ntohs(rip_vektor->tag)); - proto_tree_add_item(rip_vektor_tree, offset + 4, 4, "IP Address: %s", + proto_tree_add_text(rip_vektor_tree, offset + 4, 4, "IP Address: %s", ip_to_str((guint8 *) &(rip_vektor->ip))); if(version == RIPv2) { - proto_tree_add_item(rip_vektor_tree, offset + 8 , 4, "Netmask: %s", + proto_tree_add_text(rip_vektor_tree, offset + 8 , 4, "Netmask: %s", ip_to_str((guint8 *) &(rip_vektor->mask))); - proto_tree_add_item(rip_vektor_tree, offset + 12, 4, "Next Hop: %s", + proto_tree_add_text(rip_vektor_tree, offset + 12, 4, "Next Hop: %s", ip_to_str((guint8 *) &(rip_vektor->next_hop))); } - proto_tree_add_item(rip_vektor_tree, offset + 16, 4, "Metric: %ld", + proto_tree_add_text(rip_vektor_tree, offset + 16, 4, "Metric: %ld", (long)ntohl(rip_vektor->metric)); } @@ -166,14 +164,13 @@ dissect_rip_authentication(const e_rip_authentication *rip_authentication, proto_tree *rip_authentication_tree; guint16 authtype; - rip_authentication_tree = proto_tree_new(); - proto_item_add_subtree(tree, rip_authentication_tree, ETT_RIP_VEC); + rip_authentication_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); authtype = ntohs(rip_authentication->authtype); - proto_tree_add_item(rip_authentication_tree, offset + 2, 2, + proto_tree_add_text(rip_authentication_tree, offset + 2, 2, "Authentication type: %u", authtype); if (authtype == 2) - proto_tree_add_item(rip_authentication_tree, offset + 4 , 16, + proto_tree_add_text(rip_authentication_tree, offset + 4 , 16, "Password: %.16s", rip_authentication->authentication); } |