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