Debian Codegraph @

include/ipx.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: ipx.h,v 1.13 2009-05-27 09:15:41 qbix79 Exp $ */
20
21 #ifndef DOSBOX_IPX_H
22 #define DOSBOX_IPX_H
23
24 // Uncomment this for a lot of debug messages:
25 //#define IPX_DEBUGMSG
26
27 #ifdef IPX_DEBUGMSG
28 #define LOG_IPX LOG_MSG
29 #else
30 #if defined (_MSC_VER)
31 #define LOG_IPX
32 #else
33 #define LOG_IPX(...)
34 #endif
35 #endif
36
37 #ifndef DOSBOX_DOSBOX_H
38 #include "dosbox.h"
39 #endif
40 #ifndef DOSBOX_MEM_H
41 #include "mem.h"
42 #endif
43
44 // In Use Flag codes
45 #define USEFLAG_AVAILABLE 0x00
46 #define USEFLAG_AESTEMP 0xe0
47 #define USEFLAG_IPXCRIT 0xf8
48 #define USEFLAG_SPXLISTEN 0xf9
49 #define USEFLAG_PROCESSING 0xfa
50 #define USEFLAG_HOLDING 0xfb
51 #define USEFLAG_AESWAITING 0xfc
52 #define USEFLAG_AESCOUNT 0xfd
53 #define USEFLAG_LISTENING 0xfe
54 #define USEFLAG_SENDING 0xff
55
56 // Completion codes
57 #define COMP_SUCCESS 0x00
58 #define COMP_REMOTETERM 0xec
59 #define COMP_DISCONNECT 0xed
60 #define COMP_INVALIDID 0xee
61 #define COMP_SPXTABLEFULL 0xef
62 #define COMP_EVENTNOTCANCELED 0xf9
63 #define COMP_NOCONNECTION 0xfa
64 #define COMP_CANCELLED 0xfc
65 #define COMP_MALFORMED 0xfd
66 #define COMP_UNDELIVERABLE 0xfe
67 #define COMP_HARDWAREERROR 0xff
68
69 #ifdef _MSC_VER
70 #pragma pack(1)
71 #endif
72
73 // For Uint8 type
74 #include "SDL_net.h"
75
76 struct PackedIP {
77 Uint32 host;
78 Uint16 port;
79 } GCC_ATTRIBUTE(packed);
80
81 struct nodeType {
82 Uint8 node[6];
83 } GCC_ATTRIBUTE(packed) ;
84
85 struct IPXHeader {
86 Uint8 checkSum[2];
87 Uint8 length[2];
88 Uint8 transControl; // Transport control
89 Uint8 pType; // Packet type
90
91 struct transport {
92 Uint8 network[4];
93 union addrtype {
94 nodeType byNode;
95 PackedIP byIP ;
96 } GCC_ATTRIBUTE(packed) addr;
97 Uint8 socket[2];
98 } dest, src;
99 } GCC_ATTRIBUTE(packed);
100
101 struct fragmentDescriptor {
102 Bit16u offset;
103 Bit16u segment;
104 Bit16u size;
105 };
106
107 #define IPXBUFFERSIZE 1424
108
109 class ECBClass {
110 public:
111 RealPt ECBAddr;
112 bool isInESRList;
113 ECBClass *prevECB; // Linked List
114 ECBClass *nextECB;
115
116 Bit8u iuflag; // Need to save data since we are not always in
117 Bit16u mysocket; // real mode
118
119 Bit8u* databuffer; // received data is stored here until we get called
120 Bitu buflen; // by Interrupt
121
122 #ifdef IPX_DEBUGMSG
123 Bitu SerialNumber;
124 #endif
125
126 ECBClass(Bit16u segment, Bit16u offset);
127 Bit16u getSocket(void);
128
129 Bit8u getInUseFlag(void);
130
131 void setInUseFlag(Bit8u flagval);
132
133 void setCompletionFlag(Bit8u flagval);
134
135 Bit16u getFragCount(void);
136
137 bool writeData();
138 void writeDataBuffer(Bit8u* buffer, Bit16u length);
139
140 void getFragDesc(Bit16u descNum, fragmentDescriptor *fragDesc);
141 RealPt getESRAddr(void);
142
143 void NotifyESR(void);
144
145 void setImmAddress(Bit8u *immAddr);
146 void getImmAddress(Bit8u* immAddr);
147
148 ~ECBClass();
149 };
150
151 // The following routines may not be needed on all systems. On my build of SDL the IPaddress structure is 8 octects
152 // and therefore screws up my IPXheader structure since it needs to be packed.
153
154 void UnpackIP(PackedIP ipPack, IPaddress * ipAddr);
155 void PackIP(IPaddress ipAddr, PackedIP *ipPack);
156
157 #ifdef _MSC_VER
158 #pragma pack()
159 #endif
160
161 #endif