Don't let the user specify a maximum capture file size if they're not
[obnox/wireshark/wip.git] / packet-rip.c
index 0a72e0ee38c87d56ff1006f6fb74cdf07a5f1a7f..79fc1e4c4cfc7e1a00acd5e788c2821c0b8fc6fa 100644 (file)
@@ -2,13 +2,12 @@
  * Routines for RIPv1 and RIPv2 packet disassembly
  * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
  *
- * $Id: packet-rip.c,v 1.25 2001/09/13 08:08:53 guy Exp $
+ * $Id: packet-rip.c,v 1.28 2001/12/10 00:25:33 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
@@ -96,21 +95,20 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     guint8 command;
     guint8 version;
     guint16 family;
-    guint reported_length;
 
-    if (check_col(pinfo->fd, COL_PROTOCOL))
-        col_set_str(pinfo->fd, COL_PROTOCOL, "RIP");
-    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, "RIP");
+    if (check_col(pinfo->cinfo, COL_INFO))
+        col_clear(pinfo->cinfo, COL_INFO);
 
     command = tvb_get_guint8(tvb, 0);
     version = tvb_get_guint8(tvb, 1);
   
-    if (check_col(pinfo->fd, COL_PROTOCOL))
-        col_add_str(pinfo->fd, COL_PROTOCOL,
+    if (check_col(pinfo->cinfo, COL_PROTOCOL))
+        col_add_str(pinfo->cinfo, COL_PROTOCOL,
                    val_to_str(version, version_vals, "RIP"));
-    if (check_col(pinfo->fd, COL_INFO))
-        col_add_str(pinfo->fd, COL_INFO,
+    if (check_col(pinfo->cinfo, COL_INFO))
+        col_add_str(pinfo->cinfo, COL_INFO,
                    val_to_str(command, command_vals, "Unknown command (%u)"));
 
     if (tree) {
@@ -127,8 +125,7 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        offset = RIP_HEADER_LENGTH;
 
         /* zero or more entries */
-       reported_length = tvb_reported_length(tvb);
-       while (offset < reported_length) {
+       while (tvb_reported_length_remaining(tvb, offset) > 0) {
            family = tvb_get_ntohs(tvb, offset);
            switch (family) {
            case 2: /* IP */
@@ -208,7 +205,7 @@ proto_register_rip(void)
 {
        static hf_register_info hf[] = {
                { &hf_rip_command,
-                       { "Command", "rip.command", FT_UINT8, BASE_HEX,
+                       { "Command", "rip.command", FT_UINT8, BASE_DEC,
                        VALS(command_vals), 0, "What type of RIP Command is this", HFILL }},
 
                { &hf_rip_version,
@@ -266,5 +263,8 @@ proto_register_rip(void)
 void
 proto_reg_handoff_rip(void)
 {
-       dissector_add("udp.port", UDP_PORT_RIP, dissect_rip, proto_rip);
+       dissector_handle_t rip_handle;
+
+       rip_handle = create_dissector_handle(dissect_rip, proto_rip);
+       dissector_add("udp.port", UDP_PORT_RIP, rip_handle);
 }