*
* Heikki Vatiainen <hessu@cs.tut.fi>
*
- * $Id: packet-auto_rp.c,v 1.11 2001/01/03 06:55:27 guy Exp $
+ * $Id: packet-auto_rp.c,v 1.23 2003/01/31 03:17:45 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#include <string.h>
#include <glib.h>
-#include "packet.h"
-#include "resolv.h"
+#include <epan/packet.h>
+#include <epan/resolv.h>
static gint proto_auto_rp = -1;
static gint ett_auto_rp = -1;
{
guint8 ver_type, rp_count;
- CHECK_DISPLAY_AS_DATA(proto_auto_rp, tvb, pinfo, tree);
-
- pinfo->current_proto = "Auto-RP";
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Auto-RP");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "Auto-RP");
-
ver_type = tvb_get_guint8(tvb, 0);
rp_count = tvb_get_guint8(tvb, 1);
- if (check_col(pinfo->fd, COL_INFO))
- col_add_fstr(pinfo->fd, COL_INFO, "%s (v%s) for %u RP%s",
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%s) for %u RP%s",
val_to_str(lo_nibble(ver_type), auto_rp_type_vals, "Unknown"),
val_to_str(hi_nibble(ver_type), auto_rp_ver_vals, "Unknown"),
rp_count, plurality(rp_count, "", "s"));
guint16 holdtime;
offset = 0;
- ti = proto_tree_add_item(tree, proto_auto_rp, tvb, offset, tvb_length(tvb), FALSE);
+ ti = proto_tree_add_item(tree, proto_auto_rp, tvb, offset, -1, FALSE);
auto_rp_tree = proto_item_add_subtree(ti, ett_auto_rp);
tv = proto_tree_add_text(auto_rp_tree, tvb, offset, 1, "Version: %s, Packet type: %s",
for (i = 0; i < rp_count; i++)
offset = do_auto_rp_map(tvb, offset, auto_rp_tree);
- if (tvb_length_remaining(tvb, offset) > 0)
- proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Trailing junk");
+ if (tvb_offset_exists(tvb, offset))
+ proto_tree_add_text(tree, tvb, offset, -1, "Trailing junk");
}
return;
{ &hf_auto_rp_version,
{"Protocol version", "auto_rp.version",
FT_UINT8, BASE_DEC, VALS(auto_rp_ver_vals), AUTO_RP_VERSION_MASK,
- "Auto-RP protocol version"}},
+ "Auto-RP protocol version", HFILL }},
{ &hf_auto_rp_type,
{"Packet type", "auto_rp.type",
FT_UINT8, BASE_DEC, VALS(auto_rp_type_vals), AUTO_RP_TYPE_MASK,
- "Auto-RP packet type"}},
+ "Auto-RP packet type", HFILL }},
{ &hf_auto_rp_count,
{"RP count", "auto_rp.rp_count",
FT_UINT8, BASE_DEC, NULL, 0,
- "The number of RP addresses contained in this message"}},
+ "The number of RP addresses contained in this message", HFILL }},
{ &hf_auto_rp_holdtime,
{"Holdtime", "auto_rp.holdtime",
FT_UINT16, BASE_DEC, NULL, 0,
- "The amount of time in seconds this announcement is valid"}},
+ "The amount of time in seconds this announcement is valid", HFILL }},
{ &hf_auto_rp_pim_ver,
{"Version", "auto_rp.pim_ver",
FT_UINT8, BASE_DEC, VALS(auto_rp_pim_ver_vals), AUTO_RP_PIM_VER_MASK,
- "RP's highest PIM version"}},
+ "RP's highest PIM version", HFILL }},
{ &hf_auto_rp_rp_addr,
{"RP address", "auto_rp.rp_addr",
FT_IPv4, 0, NULL, 0,
- "The unicast IP address of the RP"}},
+ "The unicast IP address of the RP", HFILL }},
{ &hf_auto_rp_prefix_sgn,
{"Sign", "auto_rp.prefix_sign",
FT_UINT8, BASE_DEC, VALS(auto_rp_mask_sign_vals), AUTO_RP_SIGN_MASK,
- "Group prefix sign"}},
+ "Group prefix sign", HFILL }},
{ &hf_auto_rp_mask_len,
{"Mask length", "auto_rp.mask_len",
- FT_UINT8, BASE_BIN, NULL, 0x0,
- "Length of group prefix"}},
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Length of group prefix", HFILL }},
{ &hf_auto_rp_group_prefix,
{"Prefix", "auto_rp.group_prefix",
FT_IPv4, 0, NULL, 0,
- "Group prefix"}}
+ "Group prefix", HFILL }}
};
static gint *ett[] = {
void
proto_reg_handoff_auto_rp(void)
{
- dissector_add("udp.port", UDP_PORT_PIM_RP_DISC, dissect_auto_rp);
+ dissector_handle_t auto_rp_handle;
+
+ auto_rp_handle = create_dissector_handle(dissect_auto_rp,
+ proto_auto_rp);
+ dissector_add("udp.port", UDP_PORT_PIM_RP_DISC, auto_rp_handle);
}
/*
offset++;
proto_tree_add_ipv4(grp_tree, hf_auto_rp_group_prefix, tvb, offset, 4, group_addr);
offset += 4;
-
+
}
return offset;