]> icculus.org git repositories - btb/d2x.git/blob - arch/win32/ipx_drv.h
oops, can't get rid of main INCLUDE yet...
[btb/d2x.git] / arch / win32 / ipx_drv.h
1 /* $Id: */
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 typedef unsigned char ubyte;
21 typedef unsigned short ushort;
22 typedef unsigned int uint;
23
24 #ifdef __GNUC__
25 # define __pack__ __attribute__((packed))
26 #else
27 # define __pack__
28 #endif
29
30 #define MAX_PACKET_DATA 1500
31
32 #ifdef _MSC_VER
33 #pragma pack (push, 1)
34 #endif
35
36 typedef struct IPXAddressStruct {
37         u_char Network[4] __pack__;
38         u_char Node[6] __pack__;
39         u_char Socket[2] __pack__;
40 } IPXAddress_t;
41
42 typedef struct IPXPacketStructure {
43         u_short Checksum __pack__;
44         u_short Length __pack__;
45         u_char TransportControl __pack__;
46         u_char PacketType __pack__;
47         IPXAddress_t Destination __pack__;
48         IPXAddress_t Source __pack__;
49 } IPXPacket_t;
50
51 #ifdef _MSC_VER
52 #pragma pack (pop)
53 #endif
54
55 typedef struct ipx_socket_struct {
56         u_short socket;
57         int fd;
58 } ipx_socket_t;
59
60 struct ipx_recv_data {
61         /* all network order */
62         u_char src_network[4];
63         u_char src_node[6];
64         u_short src_socket;
65         u_short dst_socket;
66         int pkt_type;
67 };
68
69 struct ipx_driver {
70         int (*GetMyAddress)(void);
71         int (*OpenSocket)(ipx_socket_t *sk, int port);
72         void (*CloseSocket)(ipx_socket_t *mysock);
73         int (*SendPacket)(ipx_socket_t *mysock, IPXPacket_t *IPXHeader,
74                           u_char *data, int dataLen);
75         int (*ReceivePacket)(ipx_socket_t *s, char *buffer, int bufsize,
76                              struct ipx_recv_data *rec);
77         int (*PacketReady)(ipx_socket_t *s);
78 };
79
80 int ipx_general_PacketReady(ipx_socket_t *s);
81
82 extern unsigned char ipx_MyAddress[10];
83
84 #endif /* _IPX_DRV_H */