WSNWLINK.H (9886B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* 17 * wsnwlink.h 18 * 19 * 20 * Microsoft Windows 21 * Copyright (C) Microsoft Corporation, 1992-1996. 22 * Microsoft-specific extensions to the Windows NT IPX/SPX Windows 23 * Sockets interface. These extensions are provided for use as 24 * necessary for compatibility with existing applications. They are 25 * otherwise not recommended for use, as they are only guaranteed to 26 * work * over the Microsoft IPX/SPX stack. An application which 27 * uses these * extensions may not work over other IPX/SPX 28 * implementations. Include this header file after winsock.h and 29 * wsipx.h. 30 * 31 * To open an IPX socket where a particular packet type is sent in 32 * the IPX header, specify NSPROTO_IPX + n as the protocol parameter 33 * of the socket() API. For example, to open an IPX socket that 34 * sets the packet type to 34, use the following socket() call: 35 * 36 * s = socket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX + 34); 37 * 38 * Below are socket option that may be set or retrieved by specifying 39 * the appropriate manifest in the "optname" parameter of getsockopt() 40 * or setsockopt(). Use NSPROTO_IPX as the "level" argument for the 41 * call. 42 * 43 */ 44 45 #ifndef _WSNWLINK_ 46 #define _WSNWLINK_ 47 48 49 /* 50 * Set/get the IPX packet type. The value specified in the 51 * optval argument will be set as the packet type on every IPX 52 * packet sent from this socket. The optval parameter of 53 * getsockopt()/setsockopt() points to an int. 54 * 55 */ 56 57 #define IPX_PTYPE 0x4000 58 59 60 /* 61 * Set/get the receive filter packet type. Only IPX packets with 62 * a packet type equal to the value specified in the optval 63 * argument will be returned; packets with a packet type that 64 * does not match are discarded. optval points to an int. 65 * 66 */ 67 68 #define IPX_FILTERPTYPE 0x4001 69 70 71 /* 72 * Stop filtering on packet type set with IPX_FILTERPTYPE. 73 * 74 */ 75 76 #define IPX_STOPFILTERPTYPE 0x4003 77 78 79 /* 80 * Set/get the value of the datastream field in the SPX header on 81 * every packet sent. optval points to an int. 82 * 83 */ 84 85 #define IPX_DSTYPE 0x4002 86 87 88 /* 89 * Enable extended addressing. On sends, adds the element 90 * "unsigned char sa_ptype" to the SOCKADDR_IPX structure, 91 * making the total length 15 bytes. On receives, add both 92 * the sa_ptype and "unsigned char sa_flags" to the SOCKADDR_IPX 93 * structure, making the total length 16 bytes. The current 94 * bits defined in sa_flags are: 95 * 96 * 0x01 - the received frame was sent as a broadcast 97 * 0x02 - the received frame was sent from this machine 98 * 99 * optval points to a BOOL. 100 * 101 */ 102 103 #define IPX_EXTENDED_ADDRESS 0x4004 104 105 106 /* 107 * Send protocol header up on all receive packets. optval points 108 * to a BOOL. 109 * 110 */ 111 112 #define IPX_RECVHDR 0x4005 113 114 115 /* 116 * Get the maximum data size that can be sent. Not valid with 117 * setsockopt(). optval points to an int where the value is 118 * returned. 119 * 120 */ 121 122 #define IPX_MAXSIZE 0x4006 123 124 125 /* 126 * Query information about a specific adapter that IPX is bound 127 * to. In a system with n adapters they are numbered 0 through n-1. 128 * Callers can issue the IPX_MAX_ADAPTER_NUM getsockopt() to find 129 * out the number of adapters present, or call IPX_ADDRESS with 130 * increasing values of adapternum until it fails. Not valid 131 * with setsockopt(). optval points to an instance of the 132 * IPX_ADDRESS_DATA structure with the adapternum filled in. 133 * 134 */ 135 136 #define IPX_ADDRESS 0x4007 137 138 typedef struct _IPX_ADDRESS_DATA { 139 INT adapternum; /* input: 0-based adapter number */ 140 UCHAR netnum[4]; /* output: IPX network number */ 141 UCHAR nodenum[6]; /* output: IPX node address */ 142 BOOLEAN wan; /* output: TRUE = adapter is on a wan link */ 143 BOOLEAN status; /* output: TRUE = wan link is up (or adapter is not wan) */ 144 INT maxpkt; /* output: max packet size, not including IPX header */ 145 ULONG linkspeed; /* output: link speed in 100 bytes/sec (i.e. 96 == 9600 bps) */ 146 } IPX_ADDRESS_DATA, *PIPX_ADDRESS_DATA; 147 148 149 /* 150 * Query information about a specific IPX network number. If the 151 * network is in IPX's cache it will return the information directly, 152 * otherwise it will issue RIP requests to find it. Not valid with 153 * setsockopt(). optval points to an instance of the IPX_NETNUM_DATA 154 * structure with the netnum filled in. 155 * 156 */ 157 158 #define IPX_GETNETINFO 0x4008 159 160 typedef struct _IPX_NETNUM_DATA { 161 UCHAR netnum[4]; /* input: IPX network number */ 162 USHORT hopcount; /* output: hop count to this network, in machine order */ 163 USHORT netdelay; /* output: tick count to this network, in machine order */ 164 INT cardnum; /* output: 0-based adapter number used to route to this net */ 165 /* can be used as adapternum input to IPX_ADDRESS */ 166 UCHAR router[6]; /* output: MAC address of the next hop router, zeroed if */ 167 /* the network is directly attached */ 168 } IPX_NETNUM_DATA, *PIPX_NETNUM_DATA; 169 170 171 /* 172 * Like IPX_GETNETINFO except it *does not* issue RIP requests. If the 173 * network is in IPX's cache it will return the information, otherwise 174 * it will fail (see also IPX_RERIPNETNUMBER which *always* forces a 175 * re-RIP). Not valid with setsockopt(). optval points to an instance of 176 * the IPX_NETNUM_DATA structure with the netnum filled in. 177 * 178 */ 179 180 #define IPX_GETNETINFO_NORIP 0x4009 181 182 183 /* 184 * Get information on a connected SPX socket. optval points 185 * to an instance of the IPX_SPXCONNSTATUS_DATA structure. 186 * 187 * All numbers are in Novell (high-low) order. 188 * 189 */ 190 191 #define IPX_SPXGETCONNECTIONSTATUS 0x400B 192 193 typedef struct _IPX_SPXCONNSTATUS_DATA { 194 UCHAR ConnectionState; 195 UCHAR WatchDogActive; 196 USHORT LocalConnectionId; 197 USHORT RemoteConnectionId; 198 USHORT LocalSequenceNumber; 199 USHORT LocalAckNumber; 200 USHORT LocalAllocNumber; 201 USHORT RemoteAckNumber; 202 USHORT RemoteAllocNumber; 203 USHORT LocalSocket; 204 UCHAR ImmediateAddress[6]; 205 UCHAR RemoteNetwork[4]; 206 UCHAR RemoteNode[6]; 207 USHORT RemoteSocket; 208 USHORT RetransmissionCount; 209 USHORT EstimatedRoundTripDelay; /* In milliseconds */ 210 USHORT RetransmittedPackets; 211 USHORT SuppressedPacket; 212 } IPX_SPXCONNSTATUS_DATA, *PIPX_SPXCONNSTATUS_DATA; 213 214 215 /* 216 * Get notification when the status of an adapter that IPX is 217 * bound to changes. Typically this will happen when a wan line 218 * goes up or down. Not valid with setsockopt(). optval points 219 * to a buffer which contains an IPX_ADDRESS_DATA structure 220 * followed immediately by a HANDLE to an unsignaled event. 221 * 222 * When the getsockopt() query is submitted, it will complete 223 * successfully. However, the IPX_ADDRESS_DATA pointed to by 224 * optval will not be updated at that point. Instead the 225 * request is queued internally inside the transport. 226 * 227 * When the status of an adapter changes, IPX will locate a 228 * queued getsockopt() query and fill in all the fields in the 229 * IPX_ADDRESS_DATA structure. It will then signal the event 230 * pointed to by the HANDLE in the optval buffer. This handle 231 * should be obtained before calling getsockopt() by calling 232 * CreateEvent(). If multiple getsockopts() are submitted at 233 * once, different events must be used. 234 * 235 * The event is used because the call needs to be asynchronous 236 * but currently getsockopt() does not support this. 237 * 238 * WARNING: In the current implementation, the transport will 239 * only signal one queued query for each status change. Therefore 240 * only one service which uses this query should be running at 241 * once. 242 * 243 */ 244 245 #define IPX_ADDRESS_NOTIFY 0x400C 246 247 248 /* 249 * Get the maximum number of adapters present. If this call returns 250 * n then the adapters are numbered 0 through n-1. Not valid 251 * with setsockopt(). optval points to an int where the value 252 * is returned. 253 * 254 */ 255 256 #define IPX_MAX_ADAPTER_NUM 0x400D 257 258 259 /* 260 * Like IPX_GETNETINFO except it forces IPX to re-RIP even if the 261 * network is in its cache (but not if it is directly attached to). 262 * Not valid with setsockopt(). optval points to an instance of 263 * the IPX_NETNUM_DATA structure with the netnum filled in. 264 * 265 */ 266 267 #define IPX_RERIPNETNUMBER 0x400E 268 269 270 /* 271 * A hint that broadcast packets may be received. The default is 272 * TRUE. Applications that do not need to receive broadcast packets 273 * should set this sockopt to FALSE which may cause better system 274 * performance (note that it does not necessarily cause broadcasts 275 * to be filtered for the application). Not valid with getsockopt(). 276 * optval points to a BOOL. 277 * 278 */ 279 280 #define IPX_RECEIVE_BROADCAST 0x400F 281 282 283 /* 284 * On SPX connections, don't delay before sending ack. Applications 285 * that do not tend to have back-and-forth traffic over SPX should 286 * set this; it will increase the number of acks sent but will remove 287 * delays in sending acks. optval points to a BOOL. 288 * 289 */ 290 291 #define IPX_IMMEDIATESPXACK 0x4010 292 293 #endif 294