More conversions to NDR routines. This commit does most of the printerdata
[obnox/wireshark/wip.git] / packet-isis.c
index 51ad2b2c929bec098dfe7f1b1fd8f6519d63d119..d56e4b8753bd851c622770b0412181e12187c473 100644 (file)
@@ -2,23 +2,23 @@
  * Routines for ISO/OSI network and transport protocol packet disassembly, core
  * bits.
  *
- * $Id: packet-isis.c,v 1.27 2001/12/10 00:25:29 guy Exp $
+ * $Id: packet-isis.c,v 1.34 2002/08/29 18:52:51 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
  * 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
-
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
 #include "nlpid.h"
 #include "packet-osi.h"
 #include "packet-isis.h"
@@ -80,29 +76,28 @@ static const value_string isis_vals[] = {
  *
  * Input
  *     tvbuff_t * : tvbuffer for packet data
- *     packet_info * : info for current packet
  *     proto_tree * : tree of display data.  May be NULL.
  *     int : current offset into packet data
  *     char * : format text
+ *     subsequent args : arguments to format
  *
  * Output:
  *     void (may modify proto tree)
  */
 void
-isis_dissect_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, 
-       int offset, char *fmat, ...)
+isis_dissect_unknown(tvbuff_t *tvb, proto_tree *tree, int offset,
+       char *fmat, ...)
 {
        va_list ap;
 
        va_start(ap, fmat);
-       proto_tree_add_text_valist(tree, tvb, offset, 
-               tvb_length_remaining(tvb, offset), fmat, ap);
+       proto_tree_add_text_valist(tree, tvb, offset, -1, fmat, ap);
        va_end(ap);
 }
 
 /*
  * Name: dissect_isis()
- * 
+ *
  * Description:
  *     Main entry area for isis de-mangling.  This will build the
  *     main isis tree data and call the sub-protocols as needed.
@@ -139,16 +134,15 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                "Unknown ISIS version (%u vs %u)",
                                isis_version, ISIS_REQUIRED_VERSION );
                }
-               isis_dissect_unknown(tvb, pinfo, tree, 0,
+               isis_dissect_unknown(tvb, tree, 0,
                        "Unknown ISIS version (%d vs %d)",
                        isis_version, ISIS_REQUIRED_VERSION);
                return;
        }
-       
+
        isis_header_length = tvb_get_guint8(tvb, 1);
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_isis, tvb, 0, 
-                       tvb_length(tvb), FALSE );
+               ti = proto_tree_add_item(tree, proto_isis, tvb, 0, -1, FALSE);
                isis_tree = proto_item_add_subtree(ti, ett_isis);
        }
 
@@ -246,7 +240,7 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        isis_type, isis_header_length, isis_system_id_len);
                break;
        default:
-               isis_dissect_unknown(tvb, pinfo, tree, offset,
+               isis_dissect_unknown(tvb, tree, offset,
                        "Unknown ISIS packet type");
        }
 } /* dissect_isis */
@@ -262,44 +256,44 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
  *     NOTE: this procedure to autolinked by the makefile process that
  *     builds register.c
  *
- * Input: 
+ * Input:
  *     void
  *
  * Output:
  *     void
  */
-void 
+void
 proto_register_isis(void) {
   static hf_register_info hf[] = {
     { &hf_isis_irpd,
-      { "Intra Domain Routing Protocol Discriminator", "isis.irpd",    
+      { "Intra Domain Routing Protocol Discriminator", "isis.irpd",
         FT_UINT8, BASE_HEX, VALS(nlpid_vals), 0x0, "", HFILL }},
 
     { &hf_isis_header_length,
       { "PDU Header Length  ", "isis.len", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
 
     { &hf_isis_version,
-      { "Version (==1)      ", "isis.version", FT_UINT8, 
+      { "Version (==1)      ", "isis.version", FT_UINT8,
          BASE_DEC, NULL, 0x0, "", HFILL }},
 
     { &hf_isis_system_id_length,
-      { "System ID Length   ", "isis.sysid_len",       
+      { "System ID Length   ", "isis.sysid_len",
         FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
 
-    { &hf_isis_type, 
-      { "PDU Type           ", "isis.type", FT_UINT8, BASE_DEC, 
+    { &hf_isis_type,
+      { "PDU Type           ", "isis.type", FT_UINT8, BASE_DEC,
         VALS(isis_vals), 0xff, "", HFILL }},
 
-    { &hf_isis_version2, 
-      { "Version2 (==1)     ", "isis.version2", FT_UINT8, BASE_DEC, NULL, 
+    { &hf_isis_version2,
+      { "Version2 (==1)     ", "isis.version2", FT_UINT8, BASE_DEC, NULL,
         0x0, "", HFILL }},
 
     { &hf_isis_reserved,
-      { "Reserved (==0)     ", "isis.reserved", FT_UINT8, BASE_DEC, NULL, 
+      { "Reserved (==0)     ", "isis.reserved", FT_UINT8, BASE_DEC, NULL,
         0x0, "", HFILL }},
 
     { &hf_isis_max_area_adr,
-      { "Max.AREAs: (0==3)  ", "isis.max_area_adr", FT_UINT8, BASE_DEC, NULL, 
+      { "Max.AREAs: (0==3)  ", "isis.max_area_adr", FT_UINT8, BASE_DEC, NULL,
       0x0, "", HFILL }},
 
     };
@@ -314,6 +308,15 @@ proto_register_isis(void) {
     proto_isis = proto_register_protocol(PROTO_STRING_ISIS, "ISIS", "isis");
     proto_register_field_array(proto_isis, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
+
+    /*
+     * Call registration routines for other source files in the ISIS
+     * dissector.
+     */
+    isis_register_hello(proto_isis);
+    isis_register_lsp(proto_isis);
+    isis_register_csnp(proto_isis);
+    isis_register_psnp(proto_isis);
 }
 
 void