]> icculus.org git repositories - btb/d2x.git/blob - include/ipx.h
build dumpmine.c for editor
[btb/d2x.git] / include / ipx.h
1 /* $Id: ipx.h,v 1.9 2004-08-28 23:17:45 schaffner 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
22 #ifndef _IPX_H
23 #define _IPX_H
24
25 #include "pstypes.h"
26
27 // The default socket to use.
28 #ifdef SHAREWARE
29          #define IPX_DEFAULT_SOCKET 0x5110
30 #else
31          #define IPX_DEFAULT_SOCKET 0x5130
32 #endif
33
34 #define IPX_DRIVER_IPX  1 // IPX "IPX driver" :-)
35 #define IPX_DRIVER_KALI 2
36 #define IPX_DRIVER_UDP  3 // UDP/IP, user datagrams protocol over the internet
37 #define IPX_DRIVER_MCAST4 4 // UDP/IP, user datagrams protocol over multicast networks
38
39 /* Sets the "IPX driver" (net driver).  Takes one of the above consts as argument. */
40 extern void arch_ipx_set_driver(int ipx_driver);
41
42 #define IPX_INIT_OK              0
43 #define IPX_SOCKET_ALREADY_OPEN -1
44 #define IPX_SOCKET_TABLE_FULL   -2
45 #define IPX_NOT_INSTALLED       -3
46 #define IPX_NO_LOW_DOS_MEM      -4 // couldn't allocate low dos memory
47 #define IPX_ERROR_GETTING_ADDR  -5 // error with getting internetwork address
48
49 /* returns one of the above constants */
50 extern int ipx_init(int socket_number);
51
52 extern void ipx_close(void);
53
54 extern int ipx_change_default_socket( ushort socket_number );
55
56 // Returns a pointer to 6-byte address
57 extern ubyte * ipx_get_my_local_address();
58 // Returns a pointer to 4-byte server
59 extern ubyte * ipx_get_my_server_address();
60
61 // Determines the local address equivalent of an internetwork address.
62 void ipx_get_local_target( ubyte * server, ubyte * node, ubyte * local_target );
63
64 // If any packets waiting to be read in, this fills data in with the packet data and returns
65 // the number of bytes read.  Else returns 0 if no packets waiting.
66 extern int ipx_get_packet_data( ubyte * data );
67
68 // Sends a broadcast packet to everyone on this socket.
69 extern void ipx_send_broadcast_packet_data( ubyte * data, int datasize );
70
71 // Sends a packet to a certain address
72 extern void ipx_send_packet_data( ubyte * data, int datasize, ubyte *network, ubyte *address, ubyte *immediate_address );
73 extern void ipx_send_internetwork_packet_data( ubyte * data, int datasize, ubyte * server, ubyte *address );
74
75 // Sends a packet to everyone in the game
76 extern int ipx_send_game_packet(ubyte *data, int datasize);
77
78 // Initialize and handle the protocol-specific field of the netgame struct.
79 extern void ipx_init_netgame_aux_data(ubyte data[]);
80 extern int ipx_handle_netgame_aux_data(const ubyte data[]);
81 // Handle disconnecting from the game
82 extern void ipx_handle_leave_game();
83
84 #define IPX_MAX_DATA_SIZE (542)         //(546-4)
85
86 extern void ipx_read_user_file(char * filename);
87 extern void ipx_read_network_file(char * filename);
88
89 #endif