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