Include files from the "epan" directory and subdirectories thereof with
[obnox/wireshark/wip.git] / packet-isis-lsp.c
index 9882fd257b7eb6dda7ae571570670d18e6210940..a8c04b30733201823ad1f7e6a8fe73638de24bd4 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-isis-lsp.c
  * Routines for decoding isis lsp packets and their CLVs
  *
- * $Id: packet-isis-lsp.c,v 1.20 2001/07/02 00:19:34 guy Exp $
+ * $Id: packet-isis-lsp.c,v 1.25 2002/01/21 07:36:36 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
@@ -21,8 +21,6 @@
  * 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.
- *
- *
  */
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #include "epan/ipv4.h"
-#include "packet.h"
+#include <epan/packet.h>
 #include "packet-osi.h"
 #include "packet-ipv6.h"
 #include "packet-isis.h"
 #include "packet-isis-clv.h"
 #include "packet-isis-lsp.h"
-#include "resolv.h"
+#include <epan/resolv.h>
 
 /* lsp packets */
-static int proto_isis_lsp = -1;
 static int hf_isis_lsp_pdu_length = -1;
 static int hf_isis_lsp_remaining_life = -1;
 static int hf_isis_lsp_sequence_number = -1;
@@ -93,7 +90,7 @@ static const value_string isis_lsp_istype_vals[] = {
        { ISIS_LSP_TYPE_UNUSED0,        "Unused 0x0 (invalid)"},
        { ISIS_LSP_TYPE_LEVEL_1,        "Level 1 IS"},
        { ISIS_LSP_TYPE_UNUSED2,        "Unused 0x2 (invalid)"},
-       { ISIS_LSP_TYPE_LEVEL_2,        "Level 2 IS"},
+       { ISIS_LSP_TYPE_LEVEL_2,        "Level 1 and Level 2 IS"},
        { 0, NULL } };
 
 /* 
@@ -596,7 +593,7 @@ dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb,
                bit_length = ctrl_info & 0x3f;
                byte_length = (bit_length + 7) / 8;
                tvb_memcpy (tvb, prefix, offset+5, byte_length);
-               pi = proto_tree_add_text (tree, tvb, offset, 0,
+               pi = proto_tree_add_text (tree, tvb, offset, -1,
                        "IPv4 prefix: %s/%d", 
                        ip_to_str (prefix),
                        bit_length );
@@ -656,7 +653,7 @@ dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb,
                bit_length = tvb_get_guint8(tvb, offset+5);
                byte_length = (bit_length + 7) / 8;
                tvb_memcpy (tvb, prefix.s6_addr, offset+6, byte_length);
-               ti = proto_tree_add_text (tree, tvb, offset, 0,
+               ti = proto_tree_add_text (tree, tvb, offset, -1,
                        "IP prefix: %s /%d", 
                        ip6_to_str (&prefix),
                        bit_length );
@@ -1290,7 +1287,7 @@ dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb,
        if (!tree) return;
 
        while (length > 0) {
-               ti = proto_tree_add_text (tree, tvb, offset, 0,
+               ti = proto_tree_add_text (tree, tvb, offset, -1,
                        "IS neighbor: %s",
                        print_system_id (tvb_get_ptr(tvb, offset, 7), 7) );
                ntree = proto_item_add_subtree (ti, 
@@ -1409,7 +1406,7 @@ static void dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb,
                                       mt_desc,
                                       mt_block&0xfff ); 
 
-               ti = proto_tree_add_text (tree, tvb, offset+2, 0,
+               ti = proto_tree_add_text (tree, tvb, offset+2, -1,
                        "IS neighbor: %s",
                        print_system_id(tvb_get_ptr(tvb, offset+2, 7), 7) );
              
@@ -1612,14 +1609,9 @@ isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        char            sbuf[128];
        int             inx, q, some, value, len;
 
-       if (!proto_is_protocol_enabled(proto_isis_lsp)) {
-               dissect_data(tvb, offset, pinfo, tree);
-               return;
-       }
-
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_isis_lsp, tvb,
-                       offset, tvb_length_remaining(tvb, offset), FALSE);
+               ti = proto_tree_add_text(tree, tvb, offset, -1,
+                   PROTO_STRING_LSP);
                lsp_tree = proto_item_add_subtree(ti, ett_isis_lsp);
        }
 
@@ -1710,42 +1702,46 @@ isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        }
 }
 /*
- * Name: proto_register_isis_lsp()
+ * Name: isis_register_lsp()
  *
  * Description: 
  *     Register our protocol sub-sets with protocol manager.
- *     NOTE: this procedure is autolinked by the makefile process that
- *             builds register.c
+ *
+ * Input: 
+ *     int : protocol index for the ISIS protocol
+ *
+ * Output:
+ *     void
  */
 void 
-proto_register_isis_lsp(void) {
+isis_register_lsp(int proto_isis) {
        static hf_register_info hf[] = {
                { &hf_isis_lsp_pdu_length,
-               { "PDU length",         "isis_lsp.pdu_length", FT_UINT16, 
+               { "PDU length",         "isis.lsp.pdu_length", FT_UINT16, 
                  BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_remaining_life,
-               { "Remaining lifetime", "isis_lsp.remaining_life", FT_UINT16, 
+               { "Remaining lifetime", "isis.lsp.remaining_life", FT_UINT16, 
                  BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_sequence_number,
-               { "Sequence number",           "isis_lsp.sequence_number", 
+               { "Sequence number",           "isis.lsp.sequence_number", 
                  FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_checksum,
-               { "Checksum",           "isis_lsp.checksum",FT_UINT16, 
+               { "Checksum",           "isis.lsp.checksum",FT_UINT16, 
                  BASE_HEX, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_clv_ipv4_int_addr,
-               { "IPv4 interface address", "isis_lsp.clv_ipv4_int_addr", FT_IPv4,
+               { "IPv4 interface address", "isis.lsp.clv_ipv4_int_addr", FT_IPv4,
                   BASE_NONE, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_clv_ipv6_int_addr,
-               { "IPv6 interface address", "isis_lsp.clv_ipv6_int_addr", FT_IPv6,
+               { "IPv6 interface address", "isis.lsp.clv_ipv6_int_addr", FT_IPv6,
                   BASE_NONE, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_lsp_clv_te_router_id,
-               { "Traffic Engineering Router ID", "isis_lsp.clv_te_router_id", FT_IPv4,
+               { "Traffic Engineering Router ID", "isis.lsp.clv_te_router_id", FT_IPv4,
                   BASE_NONE, NULL, 0x0, "", HFILL }},
        };
        static gint *ett[] = {
@@ -1775,8 +1771,6 @@ proto_register_isis_lsp(void) {
                &ett_isis_lsp_part_of_clv_mt_is,
        };
 
-       proto_isis_lsp = proto_register_protocol(PROTO_STRING_LSP,
-           "ISIS LSP", "isis_lsp");
-       proto_register_field_array(proto_isis_lsp, hf, array_length(hf));
+       proto_register_field_array(proto_isis, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
 }