]> icculus.org git repositories - btb/d2x.git/blob - arch/win32/ipx_drv.h
add level component saving functions which use PhysicsFS (didn't commit properly...
[btb/d2x.git] / arch / win32 / ipx_drv.h
1 /* $Id: ipx_drv.h,v 1.7 2003-10-12 09:17:47 btb Exp $ */
2
3 /*
4  *
5  * IPX driver interface
6  *
7  * parts from:
8  * ipx.h header file for IPX for the DOS emulator
9  *              Tim Bird, tbird@novell.com
10  *
11  */
12
13 #ifndef _IPX_DRV_H
14 #define _IPX_DRV_H
15
16 #define IPX_MANUAL_ADDRESS
17
18 #include <winsock.h>
19
20 #include "pstypes.h"
21
22 #define MAX_PACKET_DATA 1500
23
24 #ifdef _MSC_VER
25 #pragma pack (push, 1)
26 #endif
27
28 typedef struct IPXAddressStruct {
29         u_char Network[4] __pack__;
30         u_char Node[6] __pack__;
31         u_char Socket[2] __pack__;
32 } IPXAddress_t;
33
34 typedef struct IPXPacketStructure {
35         u_short Checksum __pack__;
36         u_short Length __pack__;
37         u_char TransportControl __pack__;
38         u_char PacketType __pack__;
39         IPXAddress_t Destination __pack__;
40         IPXAddress_t Source __pack__;
41 } IPXPacket_t;
42
43 #ifdef _MSC_VER
44 #pragma pack (pop)
45 #endif
46
47 typedef struct ipx_socket_struct {
48         u_short socket;
49         int fd;
50 } ipx_socket_t;
51
52 struct ipx_recv_data {
53         /* all network order */
54         u_char src_network[4];
55         u_char src_node[6];
56         u_short src_socket;
57         u_short dst_socket;
58         int pkt_type;
59 };
60
61 struct ipx_driver {
62         int (*GetMyAddress)(void);
63         int (*OpenSocket)(ipx_socket_t *sk, int port);
64         void (*CloseSocket)(ipx_socket_t *mysock);
65         int (*SendPacket)(ipx_socket_t *mysock, IPXPacket_t *IPXHeader,
66                           u_char *data, int dataLen);
67         int (*ReceivePacket)(ipx_socket_t *s, char *buffer, int bufsize,
68                              struct ipx_recv_data *rec);
69         int (*PacketReady)(ipx_socket_t *s);
70         void (*InitNetgameAuxData)(ipx_socket_t *s, u_char buf[]);
71         int (*HandleNetgameAuxData)(ipx_socket_t *s, const u_char buf[]);
72         void (*HandleLeaveGame)(ipx_socket_t *s);
73         int (*SendGamePacket)(ipx_socket_t *s, u_char *data, int dataLen);
74 };
75
76 int ipx_general_PacketReady(ipx_socket_t *s);
77
78 extern unsigned char ipx_MyAddress[10];
79
80 #endif /* _IPX_DRV_H */