Make the "Save only marked frames" button in the "Save As..." dialog box
[obnox/wireshark/wip.git] / packet-nbns.c
index 68f9665c0342a647c22b9cb3dcbba4566f2ab9e3..b64d3bc3cc674a4f34d4873ad8dad4dd7bf581bc 100644 (file)
@@ -1,10 +1,9 @@
 /* packet-nbns.c
  * Routines for NetBIOS-over-TCP packet disassembly (the name dates back
  * to when it had only NBNS)
- * Gilbert Ramirez <gram@xiexie.org>
- * Much stuff added by Guy Harris <guy@alum.mit.edu>
+ * Guy Harris <guy@alum.mit.edu>
  *
- * $Id: packet-nbns.c,v 1.61 2001/09/30 23:14:43 guy Exp $
+ * $Id: packet-nbns.c,v 1.66 2001/12/03 03:59:37 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1155,7 +1154,6 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_tree              *nbdgm_tree = NULL;
        proto_item              *ti = NULL;
        struct nbdgm_header     header;
-       int                     msglen;
        int                     flags;
        int                     message_index;
        tvbuff_t                *next_tvb;
@@ -1277,6 +1275,8 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                 * Here we can pass the packet off to the next protocol.
                 * Set the length of our top-level tree item to include
                 * only our stuff.
+                *
+                * XXX - take the datagram length into account?
                 */
                proto_item_set_len(ti, offset);
                next_tvb = tvb_new_subset(tvb, offset, -1, -1);
@@ -1504,7 +1504,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
 static void
 dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-       struct tcpinfo  *tcpinfo = pinfo->private;
+       struct tcpinfo  *tcpinfo = pinfo->private_data;
        int             offset = 0;
        int             max_data;
        guint8          msg_type;
@@ -1610,8 +1610,16 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                         * there should be no compression), and we
                         * shouldn't have more than 128 bytes (actually,
                         * we shouldn't have that many).
+                        *
+                        * XXX - actually, MacOS X 10.1 (yes, that's
+                        * redundant, but that's what Apple calls it,
+                        * not MacOS X.1) puts names longer than 16
+                        * characters into session request messages,
+                        * so we can have more than 32 bytes of
+                        * name value, so we can have more than 128
+                        * bytes of data.
                         */
-                       if (length < 2 || length > 128)
+                       if (length < 2 || length > 256)
                                goto continuation;
                        break;
 
@@ -1799,8 +1807,13 @@ proto_register_nbt(void)
 void
 proto_reg_handoff_nbt(void)
 {
-  dissector_add("udp.port", UDP_PORT_NBNS, dissect_nbns, proto_nbns);
-  dissector_add("udp.port", UDP_PORT_NBDGM, dissect_nbdgm, proto_nbdgm);
-  dissector_add("tcp.port", TCP_PORT_NBSS, dissect_nbss, proto_nbss);
-  dissector_add("tcp.port", TCP_PORT_CIFS, dissect_nbss, proto_nbss);
+  dissector_handle_t nbns_handle, nbdgm_handle, nbss_handle;
+
+  nbns_handle = create_dissector_handle(dissect_nbns, proto_nbns);
+  dissector_add("udp.port", UDP_PORT_NBNS, nbns_handle);
+  nbdgm_handle = create_dissector_handle(dissect_nbdgm, proto_nbdgm);
+  dissector_add("udp.port", UDP_PORT_NBDGM, nbdgm_handle);
+  nbss_handle = create_dissector_handle(dissect_nbss, proto_nbss);
+  dissector_add("tcp.port", TCP_PORT_NBSS, nbss_handle);
+  dissector_add("tcp.port", TCP_PORT_CIFS, nbss_handle);
 }