Tvbuffify the BOOTP/DHCP dissector.
[obnox/wireshark/wip.git] / packet-ipx.h
1 /* packet-ipx.h
2  * Routines for NetWare's IPX
3  * Gilbert Ramirez <gram@xiexie.org>
4  *
5  * $Id: packet-ipx.h,v 1.10 2000/08/11 13:34:11 deniel Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@zing.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 /*
28  *  ipxlib.h
29  *
30  *  Copyright (C) 1995 by Volker Lendecke
31  *
32  */
33
34 #ifndef __PACKET_IPX_H__
35 #define __PACKET_IPX_H__
36
37 #define IPX_NODE_LEN    6
38
39 typedef guint32 IPXNet;
40 typedef guint16 IPXPort;
41 typedef guint8  IPXNode[IPX_NODE_LEN];
42 typedef const guint8    CIPXNode[IPX_NODE_LEN];
43
44 #define IPX_USER_PTYPE (0x00)
45 #define IPX_RIP_PTYPE (0x01)
46 #define IPX_SAP_PTYPE (0x04)
47 #define IPX_AUTO_PORT (0x0000)
48 #define IPX_SAP_PORT  (0x0452)
49 #define IPX_RIP_PORT  (0x0453)
50
51 #define IPX_SAP_GENERAL_QUERY (0x0001)
52 #define IPX_SAP_GENERAL_RESPONSE (0x0002)
53 #define IPX_SAP_NEAREST_QUERY (0x0003)
54 #define IPX_SAP_NEAREST_RESPONSE (0x0004)
55
56 #define IPX_SAP_FILE_SERVER (0x0004)
57
58 struct sap_query
59 {
60         guint16 query_type;     /* net order */
61         guint16 server_type;    /* net order */
62 };
63
64 struct sap_server_ident
65 {
66         guint16 server_type ;
67         char            server_name[48] ;
68         IPXNet          server_network ;
69         IPXNode         server_node ;
70         IPXPort         server_port ;
71         guint16 intermediate_network ;
72 };
73
74 #define IPX_RIP_REQUEST (0x1)
75 #define IPX_RIP_RESPONSE (0x2)
76
77 struct ipx_rip_packet
78 {
79         guint16 operation ;
80         struct ipx_rt_def
81         {
82                 guint32 network ;
83                 guint16 hops ;
84                 guint16 ticks ;
85         }
86         rt[1] ;
87 };
88
89 #define IPX_BROADCAST_NODE ("\xff\xff\xff\xff\xff\xff")
90 #define IPX_THIS_NODE      ("\0\0\0\0\0\0")
91 #define IPX_THIS_NET (0)
92
93 #ifndef IPX_NODE_LEN
94 #define IPX_NODE_LEN (6)
95 #endif
96
97 /*
98  * From:
99  *
100  *      http://alr.base2co.com:457/netguide/dipxD.ipx_packet_struct.html
101  *
102  * which is part of SCO's "Network Programmer's Guide and Reference".
103  *
104  * It calls type 20 "NetBIOS name packet".  Microsoft Network Monitor
105  * calls it "WAN Broadcast"; it's also used for SMB browser announcements,
106  * i.e. NetBIOS (broadcast) datagrams.
107  */
108 #define IPX_PACKET_TYPE_IPX             0
109 #define IPX_PACKET_TYPE_RIP             1
110 #define IPX_PACKET_TYPE_ECHO            2
111 #define IPX_PACKET_TYPE_ERROR           3
112 #define IPX_PACKET_TYPE_PEP             4
113 #define IPX_PACKET_TYPE_SPX             5
114 #define IPX_PACKET_TYPE_NCP             17
115 #define IPX_PACKET_TYPE_WANBCAST        20      /* propagated NetBIOS packet? */
116
117 /* info on these sockets can be found in this listing from Novell:
118
119         http://developer.novell.com/engsup/sample/tids/dsoc1b/dsoc1b.htm
120 */
121
122 #define IPX_SOCKET_PING_CISCO           0x0002 /* In cisco this is set with: ipx ping-default cisco */
123 #define IPX_SOCKET_NCP                  0x0451
124 #define IPX_SOCKET_SAP                  0x0452
125 #define IPX_SOCKET_IPXRIP               0x0453
126 #define IPX_SOCKET_NETBIOS              0x0455
127 #define IPX_SOCKET_DIAGNOSTIC           0x0456
128 #define IPX_SOCKET_SERIALIZATION        0x0457
129 #define IPX_SOCKET_NWLINK_SMB_NAMEQUERY 0x0551
130 #define IPX_SOCKET_NWLINK_SMB_DGRAM     0x0553
131 #define IPX_SOCKET_NWLINK_SMB_BROWSE    0x0555 /* ? not sure on this
132         but I guessed based on the content of the packet I saw */
133 #define IPX_SOCKET_ATTACHMATE_GW        0x055d
134 #define IPX_SOCKET_IPX_MESSAGE          0x4001
135 #define IPX_SOCKET_ADSM                 0x8522 /* www.tivoli.com */
136 #define IPX_SOCKET_EIGRP                0x85be /* cisco ipx eigrp */
137 #define IPX_SOCKET_WIDE_AREA_ROUTER     0x9001
138 #define IPX_SOCKET_SNMP_AGENT           0x900F /* RFC 1906 */
139 #define IPX_SOCKET_SNMP_SINK            0x9010 /* RFC 1906 */
140 #define IPX_SOCKET_PING_NOVELL          0x9086 /* In cisco this is set with: ipx ping-default novell */
141 #define IPX_SOCKET_TCP_TUNNEL           0x9091 /* RFC 1791 */
142 #define IPX_SOCKET_UDP_TUNNEL           0x9092 /* RFC 1791 */
143
144 gchar* ipxnet_to_string(const guint8 *ad);
145 gchar* ipxnet_to_str_punct(const guint32 ad, char punct);
146
147 void capture_ipx(const u_char *, int, packet_counts *);
148 void dissect_ipx(tvbuff_t *, packet_info *, proto_tree *);
149
150 #endif