Make various lengths unsigned in "dissect_fhandle_data_unknown()", so
[obnox/wireshark/wip.git] / packet-bacapp.c
index c0337319f5391f5af9433a4d665ac3d1c1699aa2..b9f6965eb92c76664be09e814ae377e19b7f145f 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.6 2001/12/03 03:59:33 guy Exp $
+ * $Id: packet-bacapp.c,v 1.13 2002/08/28 21:00:07 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -19,7 +19,7 @@
  * 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 <stdlib.h>
 #include <string.h>
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
-#include "packet.h"
+#include <epan/packet.h>
 
 static const char*
 bacapp_type_name (guint8 bacapp_type){
@@ -80,23 +68,23 @@ 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);
 
-               proto_tree_add_uint_format(bacapp_tree, hf_bacapp_type, tvb, 
+               proto_tree_add_uint_format(bacapp_tree, hf_bacapp_type, tvb,
                        offset, 1, bacapp_type, "APDU Type: %u (%s)", bacapp_type,
                                bacapp_type_name(bacapp_type));
                offset ++;
@@ -123,13 +111,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_handle_t bacapp_handle;
-
-       bacapp_handle = create_dissector_handle(dissect_bacapp, proto_bacapp);
-       dissector_add("bacnet_control_net", 0, bacapp_handle);
        data_handle = find_dissector("data");
 }
+