Have the IPX code set "pi.len" and "pi.captured_len" based on the length
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Sep 1999 23:17:58 +0000 (23:17 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Sep 1999 23:17:58 +0000 (23:17 +0000)
in the IPX header, and have the dissectors it calls use it rather than
being passed the length as an argument.

Treat both packet type 20 ("WAN Broadcast") and 4 ("IPX", although 3 is
also "IPX", according to Network Monitor) as potentially being NetBIOS
packets.

The packet types for the IPX NetBIOS socket (0x0455) and the NWLink
sockets (0x0551 and 0x0553) are different (perhaps because there's one
socket for the 0x0455 NBIPX, so you have to do name service and datagram
service and have the packet types distinguish them, but NWLink has
separate sockets for name service and datagram service).

The packet type for name service and for datagram service are at
*different locations* in the packet, which is unfortunate if you want to
use the packet type to distinguish name service and datagram service
packets.  Use the packet length, for now, to distinguish them, with
socket 0x0455.

Dissect datagram packets differently from name service packets.

Export "packet-netbios.c"'s "netbios_add_name()" routine, and use it
when dissecting NBIPX packets as well.

Label NBIPX packets as "NBIPX" rather than "NetBIOS".

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@627 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
packet-ipx.c
packet-nbipx.c
packet-ncp.c
packet-netbios.c
packet-netbios.h [new file with mode: 0644]
packet.h

index 8d20bd99de7fbd4e1d5492d5c3d8e27b07baed27..b6f7d72cad39370deddc764628647289054e31cf 100644 (file)
@@ -68,6 +68,7 @@ ethereal_SOURCES = \
        packet-ncp.c   \
        packet-ncp.h   \
        packet-netbios.c \
+       packet-netbios.h \
        packet-nntp.c  \
        packet-null.c  \
        packet-osi.c   \
index f71b69388279ba0a91657e0257d6ca939d0aad81..3a395ff199e5e85e074d348a00cb5b4c666b40ef 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for NetWare's IPX
  * Gilbert Ramirez <gram@verdict.uthscsa.edu>
  *
- * $Id: packet-ipx.c,v 1.25 1999/08/01 04:28:08 gram Exp $
+ * $Id: packet-ipx.c,v 1.26 1999/09/02 23:17:57 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -66,19 +66,19 @@ static int proto_ipxrip = -1;
 static int proto_sap = -1;
 
 static void
-dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int max_data);
+dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
 
 static void
-dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int
-max_data);
+dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
 
 static void
-dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int
-max_data);
+dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
+
+typedef        void    (dissect_func_t)(const u_char *, int, frame_data *, proto_tree *);
 
 struct port_info {
        guint16 port;
-       void    (*func) (const u_char *, int, frame_data *, proto_tree *, int);
+       dissect_func_t *func;
        char    *text;
 };
 
@@ -95,18 +95,41 @@ struct server_info {
 /* ================================================================= */
 /* IPX                                                               */
 /* ================================================================= */
+
+#define IPX_SOCKET_NCP                 0x0451
+#define IPX_SOCKET_SAP                 0x0452
+#define IPX_SOCKET_IPXRIP              0x0453
+#define IPX_SOCKET_NETBIOS             0x0455
+#define IPX_SOCKET_DIAGNOSTIC          0x0456
+#define IPX_SOCKET_SERIALIZATION       0x0457
+#define IPX_SOCKET_NWLINK_SMB_NAMEQUERY        0x0551
+#define IPX_SOCKET_NWLINK_SMB_DGRAM    0x0553
+#define IPX_SOCKET_ATTACHMATE_GW       0x055d
+#define IPX_SOCKET_IPX_MESSAGE         0x4001
+
 static struct port_info        ports[] = {
-       { 0x0451, dissect_ncp,          "NCP" },
-       { 0x0452, dissect_sap,          "SAP" },
-       { 0x0453, dissect_ipxrip,       "RIP" },
-       { 0x0455, NULL,                 "NetBIOS" },
-       { 0x0456, NULL,                 "Diagnostic" },
-       { 0x0457, NULL,                 "Serialization" },
-       { 0x0551, NULL,                 "NWLink SMB Name Query" },
-       { 0x0553, dissect_nwlink_dg,    "NWLink SMB Datagram" },
-       { 0x055d, NULL,                 "Attachmate Gateway" },
-       { 0x4001, NULL,                 "IPX Message" },
-       { 0x0000, NULL,                 NULL }
+       { IPX_SOCKET_NCP,                       dissect_ncp,
+                               "NCP" },
+       { IPX_SOCKET_SAP,                       dissect_sap,
+                               "SAP" },
+       { IPX_SOCKET_IPXRIP,                    dissect_ipxrip,
+                               "RIP" },
+       { IPX_SOCKET_NETBIOS,                   NULL,
+                               "NetBIOS" },
+       { IPX_SOCKET_DIAGNOSTIC,                NULL,
+                               "Diagnostic" },
+       { IPX_SOCKET_SERIALIZATION,             NULL,
+                               "Serialization" },
+       { IPX_SOCKET_NWLINK_SMB_NAMEQUERY,      NULL,
+                               "NWLink SMB Name Query" },
+       { IPX_SOCKET_NWLINK_SMB_DGRAM,          dissect_nwlink_dg,
+                               "NWLink SMB Datagram" },
+       { IPX_SOCKET_ATTACHMATE_GW,             NULL,
+                               "Attachmate Gateway" },
+       { IPX_SOCKET_IPX_MESSAGE,               NULL,
+                               "IPX Message" },
+       { 0x0000,                               NULL,
+                               NULL }
 };
 
 static char*
@@ -122,7 +145,7 @@ port_text(guint16 port) {
        return "Unknown";
 }
 
-static void*
+static dissect_func_t*
 port_func(guint16 port) {
        int i=0;
 
@@ -135,26 +158,35 @@ port_func(guint16 port) {
        return NULL;
 }
 
+#define IPX_PACKET_TYPE_IPX            0
+#define IPX_PACKET_TYPE_IPX_4          4
+#define IPX_PACKET_TYPE_SPX            5
+#define IPX_PACKET_TYPE_NCP            17
+#define IPX_PACKET_TYPE_WANBCAST       20
+
 static const value_string ipx_packet_type_vals[] = {
-       { 0,    "IPX" },
-       { 5,    "SPX" },
-       { 16,   "Experimental Protocol" },
-       { 17,   "NCP" },
-       { 18,   "Experimental Protocol" },
-       { 19,   "Experimental Protocol" },
-       { 20,   "NetBIOS Broadcast" },
-       { 21,   "Experimental Protocol" },
-       { 22,   "Experimental Protocol" },
-       { 23,   "Experimental Protocol" },
-       { 24,   "Experimental Protocol" },
-       { 25,   "Experimental Protocol" },
-       { 26,   "Experimental Protocol" },
-       { 27,   "Experimental Protocol" },
-       { 28,   "Experimental Protocol" },
-       { 29,   "Experimental Protocol" },
-       { 30,   "Experimental Protocol" },
-       { 31,   "Experimental Protocol" },
-       { 0,    NULL }
+       { IPX_PACKET_TYPE_IPX,          "IPX" },
+       { IPX_PACKET_TYPE_IPX_4,        "IPX" },
+                               /* NetMon calls it "IPX" */
+       { IPX_PACKET_TYPE_SPX,          "SPX" },
+       { 16,                           "Experimental Protocol" },
+       { IPX_PACKET_TYPE_NCP,          "NCP" },
+       { 18,                           "Experimental Protocol" },
+       { 19,                           "Experimental Protocol" },
+       { IPX_PACKET_TYPE_WANBCAST,     "NetBIOS Broadcast" },
+                               /* NetMon calls it "WAN Broadcast" */
+       { 21,                           "Experimental Protocol" },
+       { 22,                           "Experimental Protocol" },
+       { 23,                           "Experimental Protocol" },
+       { 24,                           "Experimental Protocol" },
+       { 25,                           "Experimental Protocol" },
+       { 26,                           "Experimental Protocol" },
+       { 27,                           "Experimental Protocol" },
+       { 28,                           "Experimental Protocol" },
+       { 29,                           "Experimental Protocol" },
+       { 30,                           "Experimental Protocol" },
+       { 31,                           "Experimental Protocol" },
+       { 0,                            NULL }
 };
 
 gchar*
@@ -201,12 +233,12 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        proto_item      *ti;
        guint8          ipx_type, ipx_hops;
        guint16         ipx_checksum, ipx_length;
+       int             len;
        guint8          *ipx_snode, *ipx_dnode, *ipx_snet, *ipx_dnet;
 
        gchar           *str_dnet, *str_snet;
        guint16         ipx_dsocket, ipx_ssocket;
-       void            (*dissect) (const u_char *, int, frame_data *, proto_tree *, int);
-       int             max_data;
+       dissect_func_t  *dissect;
        guint32         ipx_dnet_val, ipx_snet_val;
 
        /* Calculate here for use in pinfo and in tree */
@@ -222,7 +254,17 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        ipx_snode = (guint8*)&pd[offset+22];
        ipx_type = pd[offset+5];
        ipx_length = pntohs(&pd[offset+2]);
-       max_data = ipx_length - 30;
+
+       /* Length of IPX datagram plus headers above it. */
+               len = ipx_length + offset;
+
+       /* Set the payload and captured-payload lengths to the minima of
+          (the IPX length plus the length of the headers above it) and
+          the frame lengths. */
+       if (pi.len > len)
+               pi.len = len;
+       if (pi.captured_len > len)
+               pi.captured_len = len;
 
        if (check_col(fd, COL_RES_DL_DST))
                col_add_str(fd, COL_RES_DL_DST,
@@ -264,11 +306,11 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        offset += 30;
 
        switch (ipx_type) {
-               case 5: /* SPX */
-                       dissect_spx(pd, offset, fd, tree, max_data);
+               case IPX_PACKET_TYPE_SPX:
+                       dissect_spx(pd, offset, fd, tree);
                        break;
 
-               case 17: /* NCP */
+               case IPX_PACKET_TYPE_NCP:
                        /* Is the destination node 00:00:00:00:00:01 ? */
                        if (pntohl(ipx_dnode) == 0 && pntohs(ipx_dnode + 4) == 1)
                                nw_server_address = pntohl(ipx_dnet);
@@ -279,26 +321,29 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                        else
                                nw_server_address = 0;
 
-                       dissect_ncp(pd, offset, fd, tree, max_data);
+                       dissect_ncp(pd, offset, fd, tree);
                        break;
 
-               case 20: /* NetBIOS */
-                       if (ipx_dsocket == 0x0455) {
-                               dissect_nbipx_ns(pd, offset, fd, tree, max_data);
+               case IPX_PACKET_TYPE_WANBCAST:
+               case IPX_PACKET_TYPE_IPX_4:
+                       if (ipx_dsocket == IPX_SOCKET_NETBIOS) {
+                               dissect_nbipx(pd, offset, fd, tree);
                                break;
                        }
                        /* else fall through */
 
                case 0: /* IPX, fall through to default */
+                       /* XXX - should type 0's be dissected as NBIPX
+                          if they're aimed at the NetBIOS socket? */
                default:
                        dissect = port_func(ipx_dsocket);
                        if (dissect) {
-                               dissect(pd, offset, fd, tree, max_data);
+                               dissect(pd, offset, fd, tree);
                        }
                        else {
                                dissect = port_func(ipx_ssocket);
                                if (dissect) {
-                                       dissect(pd, offset, fd, tree, max_data);
+                                       dissect(pd, offset, fd, tree);
                                }
                                else {
                                        dissect_data(pd, offset, fd, tree);
@@ -347,9 +392,7 @@ spx_datastream(u_char type)
 }
 
 static void
-dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int
-       max_data) {
-
+dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        proto_tree      *spx_tree;
        proto_item      *ti;
 
@@ -394,14 +437,12 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int
 /* IPX RIP                                                           */
 /* ================================================================= */
 static void
-dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-       int max_data) {
-
+dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        proto_tree      *rip_tree;
        proto_item      *ti;
        guint16         operation;
        struct ipx_rt_def route;
-       int                     cursor;
+       int             cursor;
 
        char            *rip_type[2] = { "Request", "Response" };
 
@@ -512,12 +553,11 @@ server_type(guint16 type)
 }
 
 static void
-dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-       int max_data) {
+dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
        proto_tree      *sap_tree, *s_tree;
        proto_item      *ti;
-       int                     cursor;
+       int             cursor;
        struct sap_query query;
        struct sap_server_ident server;
 
index 4f5a12f0f7f5e57125d5ece710b5a69bb2b617f3..8d347e84f6003c0f04d9b88dfaf4caf6ac4af8f1 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for NetBIOS over IPX packet disassembly
  * Gilbert Ramirez <gram@verdict.uthscsa.edu>
  *
- * $Id: packet-nbipx.c,v 1.10 1999/08/25 01:36:21 guy Exp $
+ * $Id: packet-nbipx.c,v 1.11 1999/09/02 23:17:56 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -35,6 +35,7 @@
 #include <glib.h>
 #include "packet.h"
 #include "packet-ipx.h" /* for ipxnet_to_string() */
+#include "packet-netbios.h"
 
 static int proto_nbipx = -1;
 
@@ -46,21 +47,67 @@ enum nbipx_protocol {
 static void
 nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
                enum nbipx_protocol nbipx, int max_data);
+static void
+dissect_nbipx_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
+               int max_data);
 
 /* There is no RFC or public specification of Netware or Microsoft
  * NetBIOS over IPX packets. I have had to decode the protocol myself,
  * so there are holes and perhaps errors in this code. (gram)
+ *
+ * A list of "NovelNetBIOS" packet types can be found at
+ *
+ *     http://www.protocols.com/pbook/novel.htm#NetBIOS
+ *
+ * and at least some of those packet types appear to match what's in
+ * some NBIPX packets.
+ *
+ * Note, however, that the offset of the packet type in an NBIPX packet
+ * *DEPENDS ON THE PACKET TYPE*; "Find name" and "Name recognized" have
+ * it at one offset, "Directed datagram" has it at another.  Does the
+ * NBIPX code base it on the length, or what?  Non-broadcast directed
+ * datagram packets have an IPX type of "IPX", just as "Find name" and
+ * "Name recognized" do....  For now, we base it on the length.
  */
-static char *packet_type[] = {
-       "",
-       "Name Query",
-       "SMB",
-       "NetBIOS Datagram"
+#define NBIPX_FIND_NAME                1
+#define NBIPX_NAME_RECOGNIZED  2
+#define NBIPX_CHECK_NAME       3
+#define NBIPX_NAME_IN_USE      4
+#define NBIPX_DEREGISTER_NAME  5
+#define NBIPX_SESSION_DATA     6
+#define NBIPX_SESSION_END      7
+#define NBIPX_SESSION_END_ACK  8
+#define NBIPX_STATUS_QUERY     9
+#define NBIPX_STATUS_RESPONSE  10
+#define NBIPX_DIRECTED_DATAGRAM        11
+
+static const value_string nbipx_data_stream_type_vals[] = {
+       {NBIPX_FIND_NAME,               "Find name"},
+       {NBIPX_NAME_RECOGNIZED,         "Name recognized"},
+       {NBIPX_CHECK_NAME,              "Check name"},
+       {NBIPX_NAME_IN_USE,             "Name in use"},
+       {NBIPX_DEREGISTER_NAME,         "Deregister name"},
+       {NBIPX_SESSION_DATA,            "Session data"},
+       {NBIPX_SESSION_END,             "Session end"},
+       {NBIPX_SESSION_END_ACK,         "Session end ACK"},
+       {NBIPX_STATUS_QUERY,            "Status query"},
+       {NBIPX_STATUS_RESPONSE,         "Status response"},
+       {NBIPX_DIRECTED_DATAGRAM,       "Directed datagram"},
+       {0,                             NULL}
 };
 
-#define        N_PACKET_TYPES  (sizeof packet_type / sizeof packet_type[0])
+#define NWLINK_NAME_QUERY      1
+#define        NWLINK_SMB              2
+#define        NWLINK_NETBIOS_DATAGRAM 3
+
+static const value_string nwlink_data_stream_type_vals[] = {
+       {NWLINK_NAME_QUERY,             "Name query"},
+       {NWLINK_SMB,                    "SMB"},
+       {NWLINK_NETBIOS_DATAGRAM,       "NetBIOS datagram"},
+       {0,                             NULL}
+};
 
-struct nbipx_header {
+struct nbipx_ns_header {
        /* Netware & NT NetBIOS over IPX */
        guint32         router[8];
        guint8          name_type;
@@ -77,16 +124,27 @@ struct nbipx_header {
 
 /* NetWare */
 void
-dissect_nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-               int max_data)
+dissect_nbipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
 {
-       nbipx_ns(pd, offset, fd, tree, NETBIOS_NETWARE, max_data);
+       int     max_data = pi.captured_len - offset;
+
+       /*
+        * As said above, we look at the length of the packet to decide
+        * whether to treat it as a name-service packet or a datagram
+        * (the packet type would tell us, but it's at a *DIFFERENT
+        * LOCATION* in different types of packet...).
+        */
+       if (END_OF_FRAME == 50)
+               nbipx_ns(pd, offset, fd, tree, NETBIOS_NETWARE, max_data);
+       else
+               dissect_nbipx_dg(pd, offset, fd, tree, max_data);
 }
 
 void
-dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-               int max_data)
+dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
 {
+       int     max_data = pi.captured_len - offset;
+
        nbipx_ns(pd, offset, fd, tree, NETBIOS_NWLINK, max_data);
 }
 
@@ -97,7 +155,7 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
 {
        proto_tree                      *nbipx_tree;
        proto_item                      *ti;
-       struct nbipx_header     header;
+       struct nbipx_ns_header  header;
        int                                     i, rtr_offset;
        int                                     name_offset;
 
@@ -121,7 +179,7 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
 
        if (check_col(fd, COL_PROTOCOL)) {
                if (nbipx == NETBIOS_NETWARE) {
-                       col_add_str(fd, COL_PROTOCOL, "NetBIOS");
+                       col_add_str(fd, COL_PROTOCOL, "NBIPX");
                }
                else {
                        col_add_str(fd, COL_PROTOCOL, "NWLink");
@@ -129,24 +187,44 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
        }
 
        if (check_col(fd, COL_INFO)) {
-               switch (header.packet_type) {
-               case 1:
-                       col_add_fstr(fd, COL_INFO, "Name Query for %s", header.name);
-                       break;
-
-               case 2:
-                       /* Session? */
-                       col_add_fstr(fd, COL_INFO, "SMB over NBIPX");
-                       break;
-
-               case 3:
-                       /* Datagram */
-                       col_add_fstr(fd, COL_INFO, "NetBIOS datagram over NBIPX");
-                       break;
+               if (nbipx == NETBIOS_NETWARE) {
+                       switch (header.packet_type) {
+                       case NBIPX_FIND_NAME:
+                       case NBIPX_NAME_RECOGNIZED:
+                       case NBIPX_CHECK_NAME:
+                       case NBIPX_NAME_IN_USE:
+                       case NBIPX_DEREGISTER_NAME:
+                               col_add_fstr(fd, COL_INFO, "%s %s",
+                                       val_to_str(header.packet_type, nbipx_data_stream_type_vals, "Unknown"),
+                                       header.name);
+                               break;
+
+                       default:
+                               col_add_fstr(fd, COL_INFO, "%s",
+                                       val_to_str(header.packet_type, nbipx_data_stream_type_vals, "Unknown"));
+                               break;
+                       }
+               }
+               else {
+                       switch (header.packet_type) {
+                       case NWLINK_NAME_QUERY:
+                               col_add_fstr(fd, COL_INFO, "Name Query for %s", header.name);
+                               break;
+
+                       case NWLINK_SMB:
+                               /* Session? */
+                               col_add_fstr(fd, COL_INFO, "SMB over NBIPX");
+                               break;
+
+                       case NWLINK_NETBIOS_DATAGRAM:
+                               /* Datagram? (Where did we see this?) */
+                               col_add_fstr(fd, COL_INFO, "NetBIOS datagram over NBIPX");
+                               break;
                                
-               default:
-                       col_add_str(fd, COL_INFO, "NetBIOS over IPX");
-                       break;
+                       default:
+                               col_add_str(fd, COL_INFO, "NetBIOS over IPX (NWLink)");
+                               break;
+                       }
                }
        }
 
@@ -154,14 +232,16 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
                ti = proto_tree_add_item(tree, proto_nbipx, offset, 68, NULL);
                nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX);
 
-               if (header.packet_type < N_PACKET_TYPES) {
+               if (nbipx == NETBIOS_NETWARE) {
                        proto_tree_add_text(nbipx_tree, offset+33, 1,
-                                       "Packet Type: %s (%02X)", packet_type[header.packet_type],
-                                       header.packet_type);
-               }
-               else {
+                               "Packet Type: %s (%02X)",
+                               val_to_str(header.packet_type, nbipx_data_stream_type_vals, "Unknown"),
+                               header.packet_type);
+               else {
                        proto_tree_add_text(nbipx_tree, offset+33, 1,
-                                       "Packet Type: Unknown (%02X)", header.packet_type);
+                               "Packet Type: %s (%02X)",
+                               val_to_str(header.packet_type, nwlink_data_stream_type_vals, "Unknown"),
+                               header.packet_type);
                }
 
                /* Eight routers are listed */
@@ -178,22 +258,21 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
                                header.name_type);
 
                if (nbipx == NETBIOS_NETWARE) {
-                       proto_tree_add_text(nbipx_tree, offset+name_offset, 16,
-                                       "Name String: %s", header.name);
+                       netbios_add_name("Name", &pd[offset], offset,
+                                       name_offset, nbipx_tree);
                }
                else {
-                       proto_tree_add_text(nbipx_tree, offset+name_offset, 16,
-                                       "Group Name String: %s", header.name);
-                       proto_tree_add_text(nbipx_tree, offset+52, 16,
-                                       "Node Name String: %s", header.node_name);
-
+                       netbios_add_name("Group name", &pd[offset], offset,
+                                       name_offset, nbipx_tree);
+                       netbios_add_name("Node name", &pd[offset], offset,
+                                       52, nbipx_tree);
                }
        }
 
        if (nbipx == NETBIOS_NWLINK) {
                switch (header.packet_type) {
-                       case 2:
-                       case 3:
+                       case NWLINK_SMB:
+                       case NWLINK_NETBIOS_DATAGRAM:
                                dissect_smb(pd, offset + 68, fd, tree, max_data - 68);
                                break;
                                
@@ -204,6 +283,38 @@ nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
        }
 }
 
+static void
+dissect_nbipx_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
+               int max_data)
+{
+       proto_tree                      *nbipx_tree;
+       proto_item                      *ti;
+
+       if (check_col(fd, COL_PROTOCOL))
+               col_add_str(fd, COL_PROTOCOL, "NetBIOS");
+
+       if (check_col(fd, COL_INFO))
+               col_add_fstr(fd, COL_INFO, "NetBIOS datagram over NBIPX");
+
+       if (tree) {
+               ti = proto_tree_add_item(tree, proto_nbipx, offset, 68, NULL);
+               nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX);
+
+               proto_tree_add_text(nbipx_tree, offset+1, 1,
+                               "Packet Type: %s (%02X)",
+                               val_to_str(pd[offset+1], nbipx_data_stream_type_vals, "Unknown"),
+                               pd[offset+1]);
+               proto_tree_add_text(nbipx_tree, offset, 1,
+                   "Connection control: 0x%02x", pd[offset]);
+               netbios_add_name("Receiver's Name", &pd[offset],
+                   offset, 2, nbipx_tree);
+               netbios_add_name("Sender's Name", &pd[offset],
+                   offset, 2+16, nbipx_tree);
+
+               dissect_smb(pd, offset+2+16+16, fd, tree, max_data - 2+16+16);
+       }
+}
+
 void
 proto_register_nbipx(void)
 {
index cc17ed6687597ca5456abe3d6b04b4267a938344..3a206f40122100505cce7a9a65acd0dcda7d1ff3 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for NetWare Core Protocol
  * Gilbert Ramirez <gram@verdict.uthscsa.edu>
  *
- * $Id: packet-ncp.c,v 1.18 1999/07/29 05:46:59 gram Exp $
+ * $Id: packet-ncp.c,v 1.19 1999/09/02 23:17:57 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -422,8 +422,7 @@ ncp2222_find(guint8 func, guint8 subfunc)
 }
 
 void
-dissect_ncp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-       int max_data) {
+dissect_ncp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
        proto_tree      *ncp_tree = NULL;
        proto_item      *ti;
index e33abe0e69316fd264c30d03c988c7e73ec7ce62..73d23040a14f25ba8340a13179eb0ef29dd0b427 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * derived from the packet-nbns.c
  *
- * $Id: packet-netbios.c,v 1.3 1999/08/24 22:36:34 gram Exp $
+ * $Id: packet-netbios.c,v 1.4 1999/09/02 23:17:56 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -40,6 +40,7 @@
 #include <glib.h>
 #include "packet.h"
 #include "packet-dns.h"
+#include "packet-netbios.h"
 #include "util.h"
 
 /* Netbios command numbers */
@@ -194,7 +195,7 @@ static guint get_netbios_name(const u_char *data_ptr, int offset, char *name_ret
 }
 
 
-static void netbios_add_name( char* label, const u_char *pd, int offset,
+void netbios_add_name( char* label, const u_char *pd, int offset,
     int nb_offset, proto_tree *tree)
 
 {/* add a name field display tree. Display the name and station type in sub-tree */
diff --git a/packet-netbios.h b/packet-netbios.h
new file mode 100644 (file)
index 0000000..f9cd1c1
--- /dev/null
@@ -0,0 +1,31 @@
+/* packet-netbios.c
+ * Declarations of public routines for NetBIOS protocol packet disassembly
+ * Jeff Foster <foste@woodward.com>            
+ * Copyright 1999 Jeffrey C. Foster
+ * 
+ * derived from the packet-nbns.c
+ *
+ * $Id: packet-netbios.h,v 1.1 1999/09/02 23:17:57 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * 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
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ */
+extern void netbios_add_name( char* label, const u_char *pd, int offset,
+    int nb_offset, proto_tree *tree);
+
index c0c2ba34b7e5d90e283a2e1fa57b98881f327845..142b8f1dc455725c1d3190a276e3624b33cc6e3a 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
 /* packet.h
  * Definitions for packet disassembly structures and routines
  *
- * $Id: packet.h,v 1.91 1999/08/28 08:31:28 guy Exp $
+ * $Id: packet.h,v 1.92 1999/09/02 23:17:58 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -445,12 +445,12 @@ void dissect_llc(const u_char *, int, frame_data *, proto_tree *);
 void dissect_lpd(const u_char *, int, frame_data *, proto_tree *);
 void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *);
 void dissect_netbios(const u_char *, int, frame_data *, proto_tree *);
-void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *, int);
+void dissect_nbipx(const u_char *, int, frame_data *, proto_tree *);
 void dissect_nbns(const u_char *, int, frame_data *, proto_tree *);
 void dissect_nbss(const u_char *, int, frame_data *, proto_tree *);
-void dissect_ncp(const u_char *, int, frame_data *, proto_tree *, int);
+void dissect_ncp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_nntp(const u_char *, int, frame_data *, proto_tree *);
-void dissect_nwlink_dg(const u_char *, int, frame_data *, proto_tree *, int);
+void dissect_nwlink_dg(const u_char *, int, frame_data *, proto_tree *);
 void dissect_osi(const u_char *, int, frame_data *, proto_tree *);
 void dissect_ospf(const u_char *, int, frame_data *, proto_tree *);
 void dissect_ospf_hello(const u_char *, int, frame_data *, proto_tree *);