]> icculus.org git repositories - btb/d2x.git/blob - include/ipx.h
win32 networking fixes
[btb/d2x.git] / include / ipx.h
1 /* $Id: ipx.h,v 1.7 2003-10-04 03:18:02 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14 /*
15  *
16  * Prototypes for lower-level network routines.
17  * This file is called ipx.h and the prefix of these routines is "ipx_"
18  * because orignally IPX was the only network driver.
19  *
20  *
21  * Old Log:
22  * Revision 2.6  1995/03/29  11:19:32  john
23  * Added broadcasting over a net.
24  *
25  * Revision 2.5  1995/03/28  20:04:43  john
26  * Took away alternate server stuff.
27  *
28  * Revision 2.4  1995/03/23  19:00:10  john
29  * Added user list capabitly.
30  *
31  * Revision 2.3  1995/03/23  12:26:57  john
32  * Move IPX into bios lib.
33  *
34  * Revision 2.2  1995/03/22  19:08:14  john
35  * Added code to fix sending packets over router... now
36  * we just need to make broadcasts go over router!!
37  *
38  * Revision 2.1  1995/03/21  08:39:56  john
39  * Ifdef'd out the NETWORK code.
40  *
41  * Revision 2.0  1995/02/27  11:30:16  john
42  * New version 2.0, which has no anonymous unions, builds with
43  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
44  *
45  * Revision 1.16  1995/02/16  17:34:52  john
46  * Added code to allow dynamic socket changing.
47  *
48  * Revision 1.15  1995/01/04  21:43:27  rob
49  * Remove SPX size definition.
50  *
51  * Revision 1.14  1995/01/03  13:46:18  john
52  * Added code that should make ipx work over different servers,
53  * but ifdef'd it out with SHAREWARE in ipx.c.  I haven't tested
54  * this, and I hope it doesn't introduce net bugs.
55  *
56  * Revision 1.13  1994/11/02  11:37:16  rob
57  * Changed default socket number to a higher regions.
58  *
59  * Revision 1.12  1994/11/01  15:56:51  rob
60  * Added defines for SPX socketsx.
61  *
62  * Revision 1.11  1994/10/31  19:23:31  rob
63  * Added a prototype for the new object send function.
64  *
65  * Revision 1.10  1994/09/07  13:37:25  john
66  * Changed default socket to 0x4000, because
67  * the ipx/spx book says that we can only use
68  * sockets 0x4000 - 0x7fff.
69  *
70  * Revision 1.9  1994/08/25  18:14:45  matt
71  * Changed socket because of packet change
72  *
73  * Revision 1.8  1994/08/12  22:42:24  john
74  * Took away Player_stats; added Players array.
75  *
76  * Revision 1.7  1994/08/09  19:31:47  john
77  * Networking changes.
78  *
79  * Revision 1.6  1994/08/05  16:11:46  john
80  * Psuedo working version of networking.
81  *
82  * Revision 1.5  1994/08/04  19:17:20  john
83  * Inbetween version of network stuff.
84  *
85  * Revision 1.4  1994/07/29  16:08:59  john
86  * *** empty log message ***
87  *
88  * Revision 1.3  1994/07/25  12:33:22  john
89  * Network "pinging" in.
90  *
91  * Revision 1.2  1994/07/20  15:58:29  john
92  * First installment of ipx stuff.
93  *
94  * Revision 1.1  1994/07/19  15:43:05  john
95  * Initial revision
96  *
97  *
98  */
99
100 #ifndef _IPX_H
101 #define _IPX_H
102
103 #include "pstypes.h"
104
105 // The default socket to use.
106 #ifdef SHAREWARE
107          #define IPX_DEFAULT_SOCKET 0x5110
108 #else
109          #define IPX_DEFAULT_SOCKET 0x5130
110 #endif
111
112 #define IPX_DRIVER_IPX  1 // IPX "IPX driver" :-)
113 #define IPX_DRIVER_KALI 2
114 #define IPX_DRIVER_UDP  3 // UDP/IP, user datagrams protocol over the internet
115
116 /* Sets the "IPX driver" (net driver).  Takes one of the above consts as argument. */
117 extern void arch_ipx_set_driver(int ipx_driver);
118
119 #define IPX_INIT_OK              0
120 #define IPX_SOCKET_ALREADY_OPEN -1
121 #define IPX_SOCKET_TABLE_FULL   -2
122 #define IPX_NOT_INSTALLED       -3
123 #define IPX_NO_LOW_DOS_MEM      -4 // couldn't allocate low dos memory
124 #define IPX_ERROR_GETTING_ADDR  -5 // error with getting internetwork address
125
126 /* returns one of the above constants */
127 extern int ipx_init(int socket_number);
128
129 extern void ipx_close(void);
130
131 extern int ipx_change_default_socket( ushort socket_number );
132
133 // Returns a pointer to 6-byte address
134 extern ubyte * ipx_get_my_local_address();
135 // Returns a pointer to 4-byte server
136 extern ubyte * ipx_get_my_server_address();
137
138 // Determines the local address equivalent of an internetwork address.
139 void ipx_get_local_target( ubyte * server, ubyte * node, ubyte * local_target );
140
141 // If any packets waiting to be read in, this fills data in with the packet data and returns
142 // the number of bytes read.  Else returns 0 if no packets waiting.
143 extern int ipx_get_packet_data( ubyte * data );
144
145 // Sends a broadcast packet to everyone on this socket.
146 extern void ipx_send_broadcast_packet_data( ubyte * data, int datasize );
147
148 // Sends a packet to a certain address
149 extern void ipx_send_packet_data( ubyte * data, int datasize, ubyte *network, ubyte *address, ubyte *immediate_address );
150 extern void ipx_send_internetwork_packet_data( ubyte * data, int datasize, ubyte * server, ubyte *address );
151
152 #define IPX_MAX_DATA_SIZE (542)         //(546-4)
153
154 extern void ipx_read_user_file(char * filename);
155 extern void ipx_read_network_file(char * filename);
156
157 #endif