Fix files that had Gilbert's old e-mail address or that didn't have my
[obnox/wireshark/wip.git] / packet-ipx.c
index 4e8353431a8542ebb43d664df5308e3d1e2be798..8a58fd392d4ffd920c72f63f1c0f32ff39b10284 100644 (file)
@@ -1,11 +1,11 @@
 /* packet-ipx.c
  * Routines for NetWare's IPX
- * Gilbert Ramirez <gram@verdict.uthscsa.edu>
+ * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-ipx.c,v 1.39 1999/11/30 23:56:35 gram Exp $
+ * $Id: packet-ipx.c,v 1.46 2000/01/22 06:22:13 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@unicom.net>
+ * By Gerald Combs <gerald@zing.org>
  * Copyright 1998 Gerald Combs
  *
  * 
@@ -39,6 +39,8 @@
 #include "packet-ncp.h"
 #include "resolv.h"
 
+#include "packet-snmp.h"
+
 /* The information in this module (IPX, SPX, NCP) comes from:
        NetWare LAN Analysis, Second Edition
        Laura A. Chappell and Dan E. Hakes
@@ -88,6 +90,11 @@ static int hf_sap_response = -1;
 static gint ett_ipxsap = -1;
 static gint ett_ipxsap_server = -1;
 
+static gint ett_ipxmsg = -1;
+static int proto_ipxmsg = -1;
+static int hf_msg_conn = -1;
+static int hf_msg_sigchar = -1;
+
 static void
 dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
 
@@ -97,6 +104,9 @@ dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
 static void
 dissect_ipxsap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
 
+static void
+dissect_ipxmsg(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 {
@@ -119,6 +129,11 @@ struct server_info {
 /* IPX                                                               */
 /* ================================================================= */
 
+/* info on these sockets can be found in this listing from Novell:
+
+       http://developer.novell.com/engsup/sample/tids/dsoc1b/dsoc1b.htm
+*/
+
 #define IPX_SOCKET_NCP                 0x0451
 #define IPX_SOCKET_SAP                 0x0452
 #define IPX_SOCKET_IPXRIP              0x0453
@@ -132,6 +147,7 @@ struct server_info {
 #define IPX_SOCKET_ATTACHMATE_GW       0x055d
 #define IPX_SOCKET_IPX_MESSAGE         0x4001
 #define IPX_SOCKET_ADSM                 0x8522 /* www.tivoli.com */
+#define IPX_SOCKET_WIDE_AREA_ROUTER    0x9001
 #define IPX_SOCKET_SNMP_AGENT           0x900F /* RFC 1906 */
 #define IPX_SOCKET_SNMP_SINK            0x9010 /* RFC 1906 */
 #define IPX_SOCKET_TCP_TUNNEL           0x9091 /* RFC 1791 */
@@ -153,19 +169,18 @@ static struct port_info   ports[] = {
        { IPX_SOCKET_NWLINK_SMB_NAMEQUERY,      NULL,
                                "NWLink SMB Name Query" },
        { IPX_SOCKET_NWLINK_SMB_DGRAM,          dissect_nwlink_dg,
-                               "NWLink SMB Datagram" },
-       { IPX_SOCKET_NWLINK_SMB_BROWSE, NULL,
-                               "NWLink SMB Browse" },
-       { IPX_SOCKET_ATTACHMATE_GW,             NULL,
-                               "Attachmate Gateway" },
-       { IPX_SOCKET_IPX_MESSAGE,               NULL,
-                               "IPX Message" },
-       { IPX_SOCKET_SNMP_AGENT, NULL, "SNMP Agent" },
-       { IPX_SOCKET_SNMP_SINK, NULL, "SNMP Sink" },
+                "NWLink SMB Datagram" },
+       { IPX_SOCKET_NWLINK_SMB_BROWSE, NULL, "NWLink SMB Browse" },
+       { IPX_SOCKET_ATTACHMATE_GW,             NULL, "Attachmate Gateway" },
+       { IPX_SOCKET_IPX_MESSAGE, dissect_ipxmsg, "IPX Message" },
+       { IPX_SOCKET_SNMP_AGENT, dissect_snmp, "SNMP Agent" },
+       { IPX_SOCKET_SNMP_SINK, dissect_snmp, "SNMP Sink" },
+
        { IPX_SOCKET_UDP_TUNNEL, NULL, "UDP Tunnel" },
        { IPX_SOCKET_TCP_TUNNEL, NULL, "TCP Tunnel" },
        { IPX_SOCKET_TCP_TUNNEL, NULL, "TCP Tunnel" },
        { IPX_SOCKET_ADSM, NULL, "ADSM" },
+       { IPX_SOCKET_WIDE_AREA_ROUTER, NULL, "Wide Area Router" },
        { 0x0000,                               NULL,
                                NULL }
 };
@@ -242,6 +257,11 @@ static const value_string ipx_packet_type_vals[] = {
        { 0,                            NULL }
 };
 
+static const value_string ipxmsg_sigchar_vals[] = {
+       { '?', "Poll inactive station" },
+       { 0, NULL }
+};
+
 gchar*
 ipxnet_to_string(const guint8 *ad)
 {
@@ -534,6 +554,41 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
        }
 }
 
+/* ================================================================= */
+/* IPX Message                                                           */
+/* ================================================================= */
+static void
+dissect_ipxmsg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
+       proto_tree      *msg_tree;
+       proto_item      *ti;
+       u_char conn_number, sig_char;
+
+       if ( ! BYTES_ARE_IN_FRAME(offset,2) )
+       {
+               return;
+       }
+
+       conn_number = pd[offset];
+       sig_char = pd[offset+1];
+
+       if (check_col(fd, COL_PROTOCOL))
+        col_add_str(fd, COL_PROTOCOL, "IPX MSG");
+       if (check_col(fd, COL_PROTOCOL)) {
+               col_add_fstr(fd, COL_INFO, 
+                       "%s, Connection %d", 
+                       val_to_str(sig_char, ipxmsg_sigchar_vals, "Unknown Signature Char"), conn_number);
+       }
+
+       if (tree) {
+               ti = proto_tree_add_item(tree, proto_ipxmsg, offset, END_OF_FRAME, NULL);
+               msg_tree = proto_item_add_subtree(ti, ett_ipxmsg);
+
+               proto_tree_add_item(msg_tree, hf_msg_conn, offset, 1, conn_number);
+               proto_tree_add_item(msg_tree, hf_msg_sigchar, offset+1, 1, sig_char);
+       }
+}
+
+
 /* ================================================================= */
 /* IPX RIP                                                           */
 /* ================================================================= */
@@ -871,9 +926,23 @@ proto_register_ipx(void)
                  FT_BOOLEAN,   BASE_NONE,      NULL,   0x0,
                  "TRUE if SAP response" }}
        };
+
+       static hf_register_info hf_ipxmsg[] = {
+               { &hf_msg_conn,
+               { "Connection Number",                  "ipxmsg.conn", 
+                 FT_UINT8,     BASE_NONE,      NULL,   0x0,
+                 "Connection Number" }},
+
+               { &hf_msg_sigchar,
+               { "Signature Char",                     "ipxmsg.sigchar", 
+                 FT_UINT8,     BASE_NONE,      VALS(ipxmsg_sigchar_vals),      0x0,
+                 "Signature Char" }}
+       };
+
        static gint *ett[] = {
                &ett_ipx,
                &ett_spx,
+               &ett_ipxmsg,
                &ett_ipxrip,
                &ett_ipxsap,
                &ett_ipxsap_server,
@@ -888,6 +957,9 @@ proto_register_ipx(void)
        proto_ipxrip = proto_register_protocol ("IPX Routing Information Protocol", "ipxrip");
        proto_register_field_array(proto_ipxrip, hf_ipxrip, array_length(hf_ipxrip));
 
+       proto_ipxmsg = proto_register_protocol ("IPX Message", "ipxmsg");
+       proto_register_field_array(proto_ipxmsg, hf_ipxmsg, array_length(hf_ipxmsg));
+
        proto_sap = proto_register_protocol ("Service Advertisement Protocol", "sap");
        proto_register_field_array(proto_sap, hf_sap, array_length(hf_sap));