jwawsnwlink.pas 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. {******************************************************************************}
  2. { }
  3. { Winsock2 IPX/SPX Extensions API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: wsipx.h, released June 2000. The original Pascal }
  9. { code is: WSIpxpas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. unit JwaWSNwLink;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "wsnwlink.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaWinSock2;
  51. // Microsoft Windows
  52. // Copyright (C) Microsoft Corporation, 1992-1999.
  53. // Microsoft-specific extensions to the Windows NT IPX/SPX Windows
  54. // Sockets interface. These extensions are provided for use as
  55. // necessary for compatibility with existing applications. They are
  56. // otherwise not recommended for use, as they are only guaranteed to
  57. // work * over the Microsoft IPX/SPX stack. An application which
  58. // uses these * extensions may not work over other IPX/SPX
  59. // implementations. Include this header file after winsock.h and
  60. // wsipx.h.
  61. //
  62. // To open an IPX socket where a particular packet type is sent in
  63. // the IPX header, specify NSPROTO_IPX + n as the protocol parameter
  64. // of the socket() API. For example, to open an IPX socket that
  65. // sets the packet type to 34, use the following socket() call:
  66. //
  67. // s = socket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX + 34);
  68. //
  69. // Below are socket option that may be set or retrieved by specifying
  70. // the appropriate manifest in the "optname" parameter of getsockopt()
  71. // or setsockopt(). Use NSPROTO_IPX as the "level" argument for the
  72. // call.
  73. //
  74. //
  75. // Set/get the IPX packet type. The value specified in the
  76. // optval argument will be set as the packet type on every IPX
  77. // packet sent from this socket. The optval parameter of
  78. // getsockopt()/setsockopt() points to an int.
  79. //
  80. const
  81. IPX_PTYPE = $4000;
  82. {$EXTERNALSYM IPX_PTYPE}
  83. //
  84. // Set/get the receive filter packet type. Only IPX packets with
  85. // a packet type equal to the value specified in the optval
  86. // argument will be returned; packets with a packet type that
  87. // does not match are discarded. optval points to an int.
  88. //
  89. IPX_FILTERPTYPE = $4001;
  90. {$EXTERNALSYM IPX_FILTERPTYPE}
  91. //
  92. // Stop filtering on packet type set with IPX_FILTERPTYPE.
  93. //
  94. IPX_STOPFILTERPTYPE = $4003;
  95. {$EXTERNALSYM IPX_STOPFILTERPTYPE}
  96. //
  97. // Set/get the value of the datastream field in the SPX header on
  98. // every packet sent. optval points to an int.
  99. //
  100. IPX_DSTYPE = $4002;
  101. {$EXTERNALSYM IPX_DSTYPE}
  102. //
  103. // Enable extended addressing. On sends, adds the element
  104. // "unsigned char sa_ptype" to the SOCKADDR_IPX structure,
  105. // making the total length 15 bytes. On receives, add both
  106. // the sa_ptype and "unsigned char sa_flags" to the SOCKADDR_IPX
  107. // structure, making the total length 16 bytes. The current
  108. // bits defined in sa_flags are:
  109. //
  110. // 0x01 - the received frame was sent as a broadcast
  111. // 0x02 - the received frame was sent from this machine
  112. //
  113. // optval points to a BOOL.
  114. //
  115. IPX_EXTENDED_ADDRESS = $4004;
  116. {$EXTERNALSYM IPX_EXTENDED_ADDRESS}
  117. //
  118. // Send protocol header up on all receive packets. optval points
  119. // to a BOOL.
  120. //
  121. IPX_RECVHDR = $4005;
  122. {$EXTERNALSYM IPX_RECVHDR}
  123. //
  124. // Get the maximum data size that can be sent. Not valid with
  125. // setsockopt(). optval points to an int where the value is
  126. // returned.
  127. //
  128. IPX_MAXSIZE = $4006;
  129. {$EXTERNALSYM IPX_MAXSIZE}
  130. //
  131. // Query information about a specific adapter that IPX is bound
  132. // to. In a system with n adapters they are numbered 0 through n-1.
  133. // Callers can issue the IPX_MAX_ADAPTER_NUM getsockopt() to find
  134. // out the number of adapters present, or call IPX_ADDRESS with
  135. // increasing values of adapternum until it fails. Not valid
  136. // with setsockopt(). optval points to an instance of the
  137. // IPX_ADDRESS_DATA structure with the adapternum filled in.
  138. //
  139. IPX_ADDRESS = $4007;
  140. {$EXTERNALSYM IPX_ADDRESS}
  141. // mvb LongBool's in the following record changed to Boolean's (JCP)
  142. type
  143. _IPX_ADDRESS_DATA = record
  144. adapternum: Integer; // input: 0-based adapter number
  145. netnum: array [0..3] of UCHAR; // output: IPX network number
  146. nodenum: array [0..5] of UCHAR; // output: IPX node address
  147. wan: Boolean; // output: TRUE = adapter is on a wan link
  148. status: Boolean; // output: TRUE = wan link is up (or adapter is not wan)
  149. maxpkt: Integer; // output: max packet size, not including IPX header
  150. linkspeed: ULONG; // output: link speed in 100 bytes/sec (i.e. 96 == 9600 bps)
  151. end;
  152. {$EXTERNALSYM _IPX_ADDRESS_DATA}
  153. IPX_ADDRESS_DATA = _IPX_ADDRESS_DATA;
  154. {$EXTERNALSYM IPX_ADDRESS_DATA}
  155. PIPX_ADDRESS_DATA = ^IPX_ADDRESS_DATA;
  156. {$EXTERNALSYM PIPX_ADDRESS_DATA}
  157. TIpxAddressData = IPX_ADDRESS_DATA;
  158. PIpxAddressData = PIPX_ADDRESS_DATA;
  159. //
  160. // Query information about a specific IPX network number. If the
  161. // network is in IPX's cache it will return the information directly,
  162. // otherwise it will issue RIP requests to find it. Not valid with
  163. // setsockopt(). optval points to an instance of the IPX_NETNUM_DATA
  164. // structure with the netnum filled in.
  165. //
  166. const
  167. IPX_GETNETINFO = $4008;
  168. {$EXTERNALSYM IPX_GETNETINFO}
  169. type
  170. _IPX_NETNUM_DATA = record
  171. netnum: array [0..3] of UCHAR; // input: IPX network number
  172. hopcount: USHORT; // output: hop count to this network, in machine order
  173. netdelay: USHORT; // output: tick count to this network, in machine order
  174. cardnum: Integer; // output: 0-based adapter number used to route to this net;
  175. // can be used as adapternum input to IPX_ADDRESS
  176. router: array [0..5] of UCHAR; // output: MAC address of the next hop router, zeroed if
  177. // the network is directly attached
  178. end;
  179. {$EXTERNALSYM _IPX_NETNUM_DATA}
  180. IPX_NETNUM_DATA = _IPX_NETNUM_DATA;
  181. {$EXTERNALSYM IPX_NETNUM_DATA}
  182. PIPX_NETNUM_DATA = ^IPX_NETNUM_DATA;
  183. {$EXTERNALSYM PIPX_NETNUM_DATA}
  184. TIpxNetNumData = IPX_NETNUM_DATA;
  185. PIpxNetNumData = PIPX_NETNUM_DATA;
  186. //
  187. // Like IPX_GETNETINFO except it *does not* issue RIP requests. If the
  188. // network is in IPX's cache it will return the information, otherwise
  189. // it will fail (see also IPX_RERIPNETNUMBER which *always* forces a
  190. // re-RIP). Not valid with setsockopt(). optval points to an instance of
  191. // the IPX_NETNUM_DATA structure with the netnum filled in.
  192. //
  193. const
  194. IPX_GETNETINFO_NORIP = $4009;
  195. {$EXTERNALSYM IPX_GETNETINFO_NORIP}
  196. //
  197. // Get information on a connected SPX socket. optval points
  198. // to an instance of the IPX_SPXCONNSTATUS_DATA structure.
  199. //
  200. // All numbers are in Novell (high-low) order.
  201. //
  202. IPX_SPXGETCONNECTIONSTATUS = $400B;
  203. {$EXTERNALSYM IPX_SPXGETCONNECTIONSTATUS}
  204. type
  205. _IPX_SPXCONNSTATUS_DATA = record
  206. ConnectionState: UCHAR;
  207. WatchDogActive: UCHAR;
  208. LocalConnectionId: USHORT;
  209. RemoteConnectionId: USHORT;
  210. LocalSequenceNumber: USHORT;
  211. LocalAckNumber: USHORT;
  212. LocalAllocNumber: USHORT;
  213. RemoteAckNumber: USHORT;
  214. RemoteAllocNumber: USHORT;
  215. LocalSocket: USHORT;
  216. ImmediateAddress: array [0..5] of UCHAR;
  217. RemoteNetwork: array [0..3] of UCHAR;
  218. RemoteNode: array [0..5] of UCHAR;
  219. RemoteSocket: USHORT;
  220. RetransmissionCount: USHORT;
  221. EstimatedRoundTripDelay: USHORT; // In milliseconds
  222. RetransmittedPackets: USHORT;
  223. SuppressedPacket: USHORT;
  224. end;
  225. {$EXTERNALSYM _IPX_SPXCONNSTATUS_DATA}
  226. IPX_SPXCONNSTATUS_DATA = _IPX_SPXCONNSTATUS_DATA;
  227. {$EXTERNALSYM IPX_SPXCONNSTATUS_DATA}
  228. PIPX_SPXCONNSTATUS_DATA = ^IPX_SPXCONNSTATUS_DATA;
  229. {$EXTERNALSYM PIPX_SPXCONNSTATUS_DATA}
  230. TIpxSpcConnStatusData = IPX_SPXCONNSTATUS_DATA;
  231. PIpxSpcConnStatusData = PIPX_SPXCONNSTATUS_DATA;
  232. //
  233. // Get notification when the status of an adapter that IPX is
  234. // bound to changes. Typically this will happen when a wan line
  235. // goes up or down. Not valid with setsockopt(). optval points
  236. // to a buffer which contains an IPX_ADDRESS_DATA structure
  237. // followed immediately by a HANDLE to an unsignaled event.
  238. //
  239. // When the getsockopt() query is submitted, it will complete
  240. // successfully. However, the IPX_ADDRESS_DATA pointed to by
  241. // optval will not be updated at that point. Instead the
  242. // request is queued internally inside the transport.
  243. //
  244. // When the status of an adapter changes, IPX will locate a
  245. // queued getsockopt() query and fill in all the fields in the
  246. // IPX_ADDRESS_DATA structure. It will then signal the event
  247. // pointed to by the HANDLE in the optval buffer. This handle
  248. // should be obtained before calling getsockopt() by calling
  249. // CreateEvent(). If multiple getsockopts() are submitted at
  250. // once, different events must be used.
  251. //
  252. // The event is used because the call needs to be asynchronous
  253. // but currently getsockopt() does not support this.
  254. //
  255. // WARNING: In the current implementation, the transport will
  256. // only signal one queued query for each status change. Therefore
  257. // only one service which uses this query should be running at
  258. // once.
  259. //
  260. const
  261. IPX_ADDRESS_NOTIFY = $400C;
  262. {$EXTERNALSYM IPX_ADDRESS_NOTIFY}
  263. //
  264. // Get the maximum number of adapters present. If this call returns
  265. // n then the adapters are numbered 0 through n-1. Not valid
  266. // with setsockopt(). optval points to an int where the value
  267. // is returned.
  268. //
  269. IPX_MAX_ADAPTER_NUM = $400D;
  270. {$EXTERNALSYM IPX_MAX_ADAPTER_NUM}
  271. //
  272. // Like IPX_GETNETINFO except it forces IPX to re-RIP even if the
  273. // network is in its cache (but not if it is directly attached to).
  274. // Not valid with setsockopt(). optval points to an instance of
  275. // the IPX_NETNUM_DATA structure with the netnum filled in.
  276. //
  277. IPX_RERIPNETNUMBER = $400E;
  278. {$EXTERNALSYM IPX_RERIPNETNUMBER}
  279. //
  280. // A hint that broadcast packets may be received. The default is
  281. // TRUE. Applications that do not need to receive broadcast packets
  282. // should set this sockopt to FALSE which may cause better system
  283. // performance (note that it does not necessarily cause broadcasts
  284. // to be filtered for the application). Not valid with getsockopt().
  285. // optval points to a BOOL.
  286. //
  287. IPX_RECEIVE_BROADCAST = $400F;
  288. {$EXTERNALSYM IPX_RECEIVE_BROADCAST}
  289. //
  290. // On SPX connections, don't delay before sending ack. Applications
  291. // that do not tend to have back-and-forth traffic over SPX should
  292. // set this; it will increase the number of acks sent but will remove
  293. // delays in sending acks. optval points to a BOOL.
  294. //
  295. IPX_IMMEDIATESPXACK = $4010;
  296. {$EXTERNALSYM IPX_IMMEDIATESPXACK}
  297. implementation
  298. end.