WSNWLINK.H 9.7 KB

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