Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / packet-hsrp.c
index 786122c468665426b8b9c61d5a9d282190f212d5..b40299f7a4ef3da6a3480f6a9a4c0ba9da71bf84 100644 (file)
@@ -4,10 +4,10 @@
  *
  * Heikki Vatiainen <hessu@cs.tut.fi>
  *
- * $Id: packet-hsrp.c,v 1.18 2001/07/12 19:42:57 guy Exp $
+ * $Id: packet-hsrp.c,v 1.23 2002/08/02 23:35:50 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
  * Copied from packet-vrrp.c
 # 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 <epan/packet.h>
 
 static gint proto_hsrp = -1;
 
@@ -107,15 +99,15 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
         guint8 opcode, state;
 
-        if (check_col(pinfo->fd, COL_PROTOCOL))
-                col_set_str(pinfo->fd, COL_PROTOCOL, "HSRP");
-        if (check_col(pinfo->fd, COL_INFO))
-                col_clear(pinfo->fd, COL_INFO);
+        if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSRP");
+        if (check_col(pinfo->cinfo, COL_INFO))
+                col_clear(pinfo->cinfo, COL_INFO);
         
         opcode = tvb_get_guint8(tvb, 1);
         state = tvb_get_guint8(tvb, 2);
-        if (check_col(pinfo->fd, COL_INFO)) {
-                col_add_fstr(pinfo->fd, COL_INFO, "%s (state %s)",
+        if (check_col(pinfo->cinfo, COL_INFO)) {
+                col_add_fstr(pinfo->cinfo, COL_INFO, "%s (state %s)",
                              val_to_str(opcode, hsrp_opcode_vals, "Unknown"),
                              val_to_str(state, hsrp_state_vals, "Unknown"));
         }
@@ -128,7 +120,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                 guint8 auth_buf[8 + 1];
 
                 offset = 0;
-                ti = proto_tree_add_item(tree, proto_hsrp, tvb, offset, tvb_length(tvb), FALSE);
+                ti = proto_tree_add_item(tree, proto_hsrp, tvb, offset, -1, FALSE);
                 hsrp_tree = proto_item_add_subtree(ti, ett_hsrp);
 
                 proto_tree_add_item(hsrp_tree, hf_hsrp_version, tvb, offset, 1, FALSE);
@@ -240,5 +232,8 @@ void proto_register_hsrp(void)
 void
 proto_reg_handoff_hsrp(void)
 {
-       dissector_add("udp.port", UDP_PORT_HSRP, dissect_hsrp, proto_hsrp);
+       dissector_handle_t hsrp_handle;
+
+       hsrp_handle = create_dissector_handle(dissect_hsrp, proto_hsrp);
+       dissector_add("udp.port", UDP_PORT_HSRP, hsrp_handle);
 }