Update dissect_ndr_nt_STRING so it can also accept FT_BYTES and for that type
[obnox/wireshark/wip.git] / packet-igrp.c
index e971b65077922acbf1fd4f1bf77ef53feb9e653b..bdde4877664a3dc2e0db6dff52fcc3c5dfab4cb8 100644 (file)
@@ -2,10 +2,10 @@
  * Routines for IGRP dissection
  * Copyright 2000, Paul Ionescu <paul@acorp.ro>
  * 
- * $Id: packet-igrp.c,v 1.1 2000/10/26 09:14:28 guy Exp $
+ * $Id: packet-igrp.c,v 1.12 2002/01/24 09:20:48 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
  * Copied from packet-syslog.c
@@ -35,9 +35,9 @@
 
 #include <string.h>
 #include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
+#include "ipproto.h"
 
-#define IP_PROTO_IGRP 9
 #define IGRP_HEADER_LENGTH 12
 #define IGRP_ENTRY_LENGTH 14
 
@@ -60,28 +60,26 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   proto_tree *igrp_tree, *igrp_vektor_tree;
   tvbuff_t   *next_tvb; 
   
-  CHECK_DISPLAY_AS_DATA(proto_igrp, tvb, pinfo, tree);
-
-  pinfo->current_proto = "IGRP";
-  
+  if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "IGRP");
+  if (check_col(pinfo->cinfo, COL_INFO))
+    col_clear(pinfo->cinfo, COL_INFO);
+    
   ver_and_opcode = tvb_get_guint8(tvb,0);
   update        = tvb_get_guint8(tvb,1);
   as            = tvb_get_ntohs(tvb,2);
   
   
-  if (check_col(pinfo->fd, COL_PROTOCOL)) 
-    col_add_str(pinfo->fd, COL_PROTOCOL, "IGRP");
-    
-  if (check_col(pinfo->fd, COL_INFO)) {
+  if (check_col(pinfo->cinfo, COL_INFO)) {
     switch (ver_and_opcode) {
     case 0x11:
-       col_add_fstr(pinfo->fd, COL_INFO, "Response" );
+       col_add_fstr(pinfo->cinfo, COL_INFO, "Response" );
        break;
     case 0x12:
-       col_add_fstr(pinfo->fd, COL_INFO, "Request" );
+       col_add_fstr(pinfo->cinfo, COL_INFO, "Request" );
         break;
     default:           
-        col_add_fstr(pinfo->fd, COL_INFO, "Unknown version or opcode"); 
+        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown version or opcode"); 
     }
   }
 
@@ -89,8 +87,8 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   
   if (tree) {
-      ti = proto_tree_add_protocol_format(tree, proto_igrp, tvb, 0,
-        tvb_length(tvb), "Cisco IGRP ");
+      ti = proto_tree_add_protocol_format(tree, proto_igrp, tvb, 0, -1,
+        "Cisco IGRP");
         
       igrp_tree = proto_item_add_subtree(ti, ett_igrp);
       
@@ -179,12 +177,12 @@ void proto_register_igrp(void)
     { &hf_igrp_update,
       { "Update Release",           "igrp.update",
       FT_UINT8, BASE_DEC, NULL, 0x0 ,
-      "Update Release number" },
+      "Update Release number", HFILL }
     },
     { &hf_igrp_as,
       { "Autonomous System",           "igrp.as",
       FT_UINT16, BASE_DEC, NULL, 0x0 ,
-      "Autonomous System number" }
+      "Autonomous System number", HFILL }
     }
   };
 
@@ -196,7 +194,8 @@ void proto_register_igrp(void)
   };
 
   /* Register the protocol name and description */
-  proto_igrp = proto_register_protocol("Cisco Interior Gateway Routing Protocol", "igrp");
+  proto_igrp = proto_register_protocol("Cisco Interior Gateway Routing Protocol",
+                                      "IGRP", "igrp");
 
   /* Required function calls to register the header fields and subtrees used */
   proto_register_field_array(proto_igrp, hf, array_length(hf));
@@ -206,7 +205,10 @@ void proto_register_igrp(void)
 void
 proto_reg_handoff_igrp(void)
 {
-  dissector_add("ip.proto", IP_PROTO_IGRP , dissect_igrp);
+  dissector_handle_t igrp_handle;
+
+  igrp_handle = create_dissector_handle(dissect_igrp, proto_igrp);
+  dissector_add("ip.proto", IP_PROTO_IGRP, igrp_handle);
 }
 
 /*     IGRP Packet structure: