Reassembly of fragmented NT Transaction responses, from Ronnie Sahlberg.
[obnox/wireshark/wip.git] / packet-sll.c
index 559995ccac4b1686a37a72109b82fab28f962b54..cf1cd7838399b6c13fb701d476b5bd75b1b6461f 100644 (file)
@@ -1,12 +1,11 @@
 /* packet-sll.c
  * Routines for disassembly of packets from Linux "cooked mode" captures
  *
- * $Id: packet-sll.c,v 1.10 2001/06/18 02:17:52 guy Exp $
+ * $Id: packet-sll.c,v 1.15 2001/12/10 00:25:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * 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
@@ -35,6 +34,7 @@
 #include <string.h>
 #include <glib.h>
 #include "packet.h"
+#include "packet-sll.h"
 #include "packet-ipx.h"
 #include "packet-llc.h"
 #include "resolv.h"
@@ -90,13 +90,14 @@ static const value_string ltype_vals[] = {
 
 static dissector_handle_t ipx_handle;
 static dissector_handle_t llc_handle;
+static dissector_handle_t data_handle;
 
 void
-capture_sll(const u_char *pd, packet_counts *ld)
+capture_sll(const u_char *pd, int len, packet_counts *ld)
 {
        guint16 protocol;
 
-       if (!BYTES_ARE_IN_FRAME(0, SLL_HEADER_SIZE)) {
+       if (!BYTES_ARE_IN_FRAME(0, len, SLL_HEADER_SIZE)) {
                ld->other++;
                return;
        }
@@ -112,7 +113,7 @@ capture_sll(const u_char *pd, packet_counts *ld)
                        /*
                         * 802.2 LLC.
                         */
-                       capture_llc(pd, SLL_HEADER_SIZE, ld);
+                       capture_llc(pd, len, SLL_HEADER_SIZE, ld);
                        break;
 
                case LINUX_SLL_P_802_3:
@@ -120,7 +121,7 @@ capture_sll(const u_char *pd, packet_counts *ld)
                         * Novell IPX inside 802.3 with no 802.2 LLC
                         * header.
                         */
-                       capture_ipx(pd, SLL_HEADER_SIZE, ld);
+                       capture_ipx(pd, len, SLL_HEADER_SIZE, ld);
                        break;
 
                default:
@@ -128,7 +129,7 @@ capture_sll(const u_char *pd, packet_counts *ld)
                        break;
                }
        } else
-               capture_ethertype(protocol, SLL_HEADER_SIZE, pd, ld);
+               capture_ethertype(protocol, pd, SLL_HEADER_SIZE, len, ld);
 }
 
 static void
@@ -142,15 +143,15 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        tvbuff_t *next_tvb;
        proto_tree *fh_tree = NULL;
 
-       if (check_col(pinfo->fd, COL_PROTOCOL))
-               col_set_str(pinfo->fd, COL_PROTOCOL, "SLL");
-       if (check_col(pinfo->fd, COL_INFO))
-               col_clear(pinfo->fd, COL_INFO);
+       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               col_set_str(pinfo->cinfo, COL_PROTOCOL, "SLL");
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_clear(pinfo->cinfo, COL_INFO);
 
        pkttype = tvb_get_ntohs(tvb, 0);
 
-       if (check_col(pinfo->fd, COL_INFO))
-               col_add_str(pinfo->fd, COL_INFO,
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_add_str(pinfo->cinfo, COL_INFO,
                    val_to_str(pkttype, packet_type_vals, "Unknown (%u)"));
 
        if (tree) {
@@ -180,8 +181,8 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                }
        } else {
                if (tree) {
-                       proto_tree_add_bytes(fh_tree, hf_sll_src_other, tvb,
-                           6, halen, tvb_get_ptr(tvb, 6, halen));
+                       proto_tree_add_item(fh_tree, hf_sll_src_other, tvb,
+                           6, halen, FALSE);
                }
        }
 
@@ -216,7 +217,7 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        break;
 
                default:
-                       dissect_data(next_tvb, 0, pinfo, tree);
+                       call_dissector(data_handle,next_tvb, pinfo, tree);
                        break;
                }
        } else {
@@ -279,11 +280,15 @@ proto_register_sll(void)
 void
 proto_reg_handoff_sll(void)
 {
+       dissector_handle_t sll_handle;
+
        /*
         * Get handles for the IPX and LLC dissectors.
         */
        llc_handle = find_dissector("llc");
        ipx_handle = find_dissector("ipx");
+       data_handle = find_dissector("data");
 
-       dissector_add("wtap_encap", WTAP_ENCAP_SLL, dissect_sll, proto_sll);
+       sll_handle = create_dissector_handle(dissect_sll, proto_sll);
+       dissector_add("wtap_encap", WTAP_ENCAP_SLL, sll_handle);
 }