Use Ashok's IEEE-float-to-long code as the basis for
[obnox/wireshark/wip.git] / packet-bacapp.c
index 44dc7efb446a8a876e6f838b0ef3af8260be7a82..7571188e6ad422d4b9c5ce20ffbc317754e3cf5d 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for BACnet (APDU) dissection
  * Copyright 2001, Hartmut Mueller <hartmut@abmlinux.org>, FH Dortmund
  *
- * $Id: packet-bacapp.c,v 1.4 2001/06/18 02:17:44 guy Exp $
+ * $Id: packet-bacapp.c,v 1.10 2002/01/24 09:20:47 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -47,7 +47,7 @@
 # include "snprintf.h"
 #endif
 
-#include "packet.h"
+#include <epan/packet.h>
 
 static const char*
 bacapp_type_name (guint8 bacapp_type){
@@ -69,6 +69,8 @@ static int hf_bacapp_type = -1;
 
 static gint ett_bacapp = -1;
 
+static dissector_handle_t data_handle;
+
 static void
 dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
@@ -78,19 +80,19 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        guint8 bacapp_type;
        tvbuff_t *next_tvb;
 
-       if (check_col(pinfo->fd, COL_PROTOCOL))
-               col_set_str(pinfo->fd, COL_PROTOCOL, "BACnet-APDU");
-       if (check_col(pinfo->fd, COL_INFO))
-               col_add_str(pinfo->fd, COL_INFO, "BACnet APDU ");
+       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               col_set_str(pinfo->cinfo, COL_PROTOCOL, "BACnet-APDU");
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_add_str(pinfo->cinfo, COL_INFO, "BACnet APDU ");
 
        offset  = 0;
        bacapp_type = (tvb_get_guint8(tvb, offset) >> 4) & 0x0f;
 
-       if (check_col(pinfo->fd, COL_INFO))
-               col_append_fstr(pinfo->fd, COL_INFO, "(%s)",
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, "(%s)",
                bacapp_type_name(bacapp_type));
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_bacapp, tvb, offset, tvb_length(tvb), FALSE);
+               ti = proto_tree_add_item(tree, proto_bacapp, tvb, offset, -1, FALSE);
 
                bacapp_tree = proto_item_add_subtree(ti, ett_bacapp);
 
@@ -101,7 +103,7 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
        }
        next_tvb = tvb_new_subset(tvb,offset,-1,-1);
-       dissect_data(next_tvb, 0, pinfo, tree);
+       call_dissector(data_handle,next_tvb, pinfo, tree);
 }
 
 
@@ -121,9 +123,12 @@ proto_register_bacapp(void)
            "BACapp", "bacapp");
        proto_register_field_array(proto_bacapp, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
+       register_dissector("bacapp", dissect_bacapp, proto_bacapp);
 }
+
 void
 proto_reg_handoff_bacapp(void)
 {
-       dissector_add("bacnet_control_net", 0, dissect_bacapp, proto_bacapp);
+       data_handle = find_dissector("data");
 }
+