]> icculus.org git repositories - btb/d2x.git/blob - arch/linux/include/ipx_drv.h
formatting
[btb/d2x.git] / arch / linux / include / ipx_drv.h
1 /* $Id: ipx_drv.h,v 1.4 2003-03-13 00:20:21 btb Exp $ */
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 #include <sys/types.h>
15
16 #define IPX_MANUAL_ADDRESS
17
18 #define MAX_PACKET_DATA         1500
19
20 typedef struct IPXAddressStruct {
21         u_char Network[4] __attribute__((packed));
22         u_char Node[6] __attribute__((packed));
23         u_char Socket[2] __attribute__((packed));
24 } IPXAddress_t;
25
26 typedef struct IPXPacketStructure {
27         u_short Checksum __attribute__((packed));
28         u_short Length __attribute__((packed));
29         u_char TransportControl __attribute__((packed));
30         u_char PacketType __attribute__((packed));
31         IPXAddress_t Destination __attribute__((packed));
32         IPXAddress_t Source __attribute__((packed));
33 } IPXPacket_t;
34
35 typedef struct ipx_socket_struct {
36 #ifdef DOSEMU
37         struct ipx_socket_struct *next;
38         far_t listenList;
39         int listenCount;
40         far_t AESList;
41         int AESCount;
42         u_short PSP;
43 #endif
44         u_short socket;
45         int fd;
46 } ipx_socket_t;
47
48 struct ipx_recv_data {
49         /* all network order */
50         u_char src_network[4];
51         u_char src_node[6];
52         u_short src_socket;
53         u_short dst_socket;
54         int pkt_type;
55 };
56
57 struct ipx_driver {
58         int (*GetMyAddress)(void);
59         int (*OpenSocket)(ipx_socket_t *sk, int port);
60         void (*CloseSocket)(ipx_socket_t *mysock);
61         int (*SendPacket)(ipx_socket_t *mysock, IPXPacket_t *IPXHeader,
62                           u_char *data, int dataLen);
63         int (*ReceivePacket)(ipx_socket_t *s, char *buffer, int bufsize,
64                              struct ipx_recv_data *rec);
65         int (*PacketReady)(ipx_socket_t *s);
66 };
67
68 int ipx_general_PacketReady(ipx_socket_t *s);
69
70 extern unsigned char ipx_MyAddress[10];
71
72 #endif /* _IPX_DRV_H */