Add gtk2/glib2 handling to configure. Use --enable-gtk2 to use
[obnox/wireshark/wip.git] / packet-lapd.c
index b8aaa13079a2112cb821e1fc527ba88747fb864d..9ce4035585d021b90acc31fb8b8eba60fb9be2c6 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for LAPD frame disassembly
  * Gilbert Ramirez <gram@alumni.rice.edu>
  *
- * $Id: packet-lapd.c,v 1.27 2001/12/10 00:25:30 guy Exp $
+ * $Id: packet-lapd.c,v 1.30 2002/08/02 23:35:53 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 # include "config.h"
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
 #include <stdio.h>
 #include <glib.h>
 #include <string.h>
-#include "packet.h"
+#include <epan/packet.h>
 #include "xdlc.h"
 
 /* ISDN/LAPD references:
@@ -87,7 +83,7 @@ static void
 dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        proto_tree      *lapd_tree, *addr_tree;
-       proto_item      *ti;
+       proto_item      *lapd_ti, *addr_ti;
        guint16         control;
        int             lapd_header_len;
        guint16         address, cr, sapi;
@@ -120,11 +116,13 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        }
 
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_lapd, tvb, 0, 3, FALSE);
-               lapd_tree = proto_item_add_subtree(ti, ett_lapd);
+               lapd_ti = proto_tree_add_item(tree, proto_lapd, tvb, 0, -1,
+                   FALSE);
+               lapd_tree = proto_item_add_subtree(lapd_ti, ett_lapd);
 
-               ti = proto_tree_add_uint(lapd_tree, hf_lapd_address, tvb, 0, 2, address);
-               addr_tree = proto_item_add_subtree(ti, ett_lapd_address);
+               addr_ti = proto_tree_add_uint(lapd_tree, hf_lapd_address, tvb,
+                   0, 2, address);
+               addr_tree = proto_item_add_subtree(addr_ti, ett_lapd_address);
 
                proto_tree_add_uint(addr_tree, hf_lapd_sapi,tvb, 0, 1, address);
                proto_tree_add_uint(addr_tree, hf_lapd_cr,  tvb, 0, 1, address);
@@ -133,6 +131,7 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                proto_tree_add_uint(addr_tree, hf_lapd_ea2, tvb, 1, 1, address);
        }
        else {
+               lapd_ti = NULL;
                lapd_tree = NULL;
        }
 
@@ -140,6 +139,9 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
            ett_lapd_control, is_response, TRUE);
        lapd_header_len += XDLC_CONTROL_LEN(control, TRUE);
 
+       if (tree)
+               proto_item_set_len(lapd_ti, lapd_header_len);
+
        next_tvb = tvb_new_subset(tvb, lapd_header_len, -1, -1);
        if (XDLC_IS_INFORMATION(control)) {
                /* call next protocol */