jwawsnwlink.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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. // $Id: JwaWSNwLink.pas,v 1.7 2007/09/05 11:58:53 dezipaitor Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS}
  44. unit JwaWSNwLink;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "wsnwlink.h"'}
  49. {$HPPEMIT ''}
  50. {$IFNDEF JWA_OMIT_SECTIONS}
  51. {$I jediapilib.inc}
  52. interface
  53. uses
  54. JwaWinSock2, JwaWinType;
  55. {$ENDIF JWA_OMIT_SECTIONS}
  56. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  57. // Microsoft Windows
  58. // Copyright (C) Microsoft Corporation, 1992-1999.
  59. // Microsoft-specific extensions to the Windows NT IPX/SPX Windows
  60. // Sockets interface. These extensions are provided for use as
  61. // necessary for compatibility with existing applications. They are
  62. // otherwise not recommended for use, as they are only guaranteed to
  63. // work * over the Microsoft IPX/SPX stack. An application which
  64. // uses these * extensions may not work over other IPX/SPX
  65. // implementations. Include this header file after winsock.h and
  66. // wsipx.h.
  67. //
  68. // To open an IPX socket where a particular packet type is sent in
  69. // the IPX header, specify NSPROTO_IPX + n as the protocol parameter
  70. // of the socket() API. For example, to open an IPX socket that
  71. // sets the packet type to 34, use the following socket() call:
  72. //
  73. // s = socket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX + 34);
  74. //
  75. // Below are socket option that may be set or retrieved by specifying
  76. // the appropriate manifest in the "optname" parameter of getsockopt()
  77. // or setsockopt(). Use NSPROTO_IPX as the "level" argument for the
  78. // call.
  79. //
  80. //
  81. // Set/get the IPX packet type. The value specified in the
  82. // optval argument will be set as the packet type on every IPX
  83. // packet sent from this socket. The optval parameter of
  84. // getsockopt()/setsockopt() points to an int.
  85. //
  86. const
  87. IPX_PTYPE = $4000;
  88. {$EXTERNALSYM IPX_PTYPE}
  89. //
  90. // Set/get the receive filter packet type. Only IPX packets with
  91. // a packet type equal to the value specified in the optval
  92. // argument will be returned; packets with a packet type that
  93. // does not match are discarded. optval points to an int.
  94. //
  95. IPX_FILTERPTYPE = $4001;
  96. {$EXTERNALSYM IPX_FILTERPTYPE}
  97. //
  98. // Stop filtering on packet type set with IPX_FILTERPTYPE.
  99. //
  100. IPX_STOPFILTERPTYPE = $4003;
  101. {$EXTERNALSYM IPX_STOPFILTERPTYPE}
  102. //
  103. // Set/get the value of the datastream field in the SPX header on
  104. // every packet sent. optval points to an int.
  105. //
  106. IPX_DSTYPE = $4002;
  107. {$EXTERNALSYM IPX_DSTYPE}
  108. //
  109. // Enable extended addressing. On sends, adds the element
  110. // "unsigned char sa_ptype" to the SOCKADDR_IPX structure,
  111. // making the total length 15 bytes. On receives, add both
  112. // the sa_ptype and "unsigned char sa_flags" to the SOCKADDR_IPX
  113. // structure, making the total length 16 bytes. The current
  114. // bits defined in sa_flags are:
  115. //
  116. // 0x01 - the received frame was sent as a broadcast
  117. // 0x02 - the received frame was sent from this machine
  118. //
  119. // optval points to a BOOL.
  120. //
  121. IPX_EXTENDED_ADDRESS = $4004;
  122. {$EXTERNALSYM IPX_EXTENDED_ADDRESS}
  123. //
  124. // Send protocol header up on all receive packets. optval points
  125. // to a BOOL.
  126. //
  127. IPX_RECVHDR = $4005;
  128. {$EXTERNALSYM IPX_RECVHDR}
  129. //
  130. // Get the maximum data size that can be sent. Not valid with
  131. // setsockopt(). optval points to an int where the value is
  132. // returned.
  133. //
  134. IPX_MAXSIZE = $4006;
  135. {$EXTERNALSYM IPX_MAXSIZE}
  136. //
  137. // Query information about a specific adapter that IPX is bound
  138. // to. In a system with n adapters they are numbered 0 through n-1.
  139. // Callers can issue the IPX_MAX_ADAPTER_NUM getsockopt() to find
  140. // out the number of adapters present, or call IPX_ADDRESS with
  141. // increasing values of adapternum until it fails. Not valid
  142. // with setsockopt(). optval points to an instance of the
  143. // IPX_ADDRESS_DATA structure with the adapternum filled in.
  144. //
  145. IPX_ADDRESS = $4007;
  146. {$EXTERNALSYM IPX_ADDRESS}
  147. // mvb LongBool's in the following record changed to Boolean's (JCP)
  148. type
  149. _IPX_ADDRESS_DATA = record
  150. adapternum: Integer; // input: 0-based adapter number
  151. netnum: array [0..3] of UCHAR; // output: IPX network number
  152. nodenum: array [0..5] of UCHAR; // output: IPX node address
  153. wan: Boolean; // output: TRUE = adapter is on a wan link
  154. status: Boolean; // output: TRUE = wan link is up (or adapter is not wan)
  155. maxpkt: Integer; // output: max packet size, not including IPX header
  156. linkspeed: ULONG; // output: link speed in 100 bytes/sec (i.e. 96 == 9600 bps)
  157. end;
  158. {$EXTERNALSYM _IPX_ADDRESS_DATA}
  159. IPX_ADDRESS_DATA = _IPX_ADDRESS_DATA;
  160. {$EXTERNALSYM IPX_ADDRESS_DATA}
  161. PIPX_ADDRESS_DATA = ^IPX_ADDRESS_DATA;
  162. {$EXTERNALSYM PIPX_ADDRESS_DATA}
  163. TIpxAddressData = IPX_ADDRESS_DATA;
  164. PIpxAddressData = PIPX_ADDRESS_DATA;
  165. //
  166. // Query information about a specific IPX network number. If the
  167. // network is in IPX's cache it will return the information directly,
  168. // otherwise it will issue RIP requests to find it. Not valid with
  169. // setsockopt(). optval points to an instance of the IPX_NETNUM_DATA
  170. // structure with the netnum filled in.
  171. //
  172. const
  173. IPX_GETNETINFO = $4008;
  174. {$EXTERNALSYM IPX_GETNETINFO}
  175. type
  176. _IPX_NETNUM_DATA = record
  177. netnum: array [0..3] of UCHAR; // input: IPX network number
  178. hopcount: USHORT; // output: hop count to this network, in machine order
  179. netdelay: USHORT; // output: tick count to this network, in machine order
  180. cardnum: Integer; // output: 0-based adapter number used to route to this net;
  181. // can be used as adapternum input to IPX_ADDRESS
  182. router: array [0..5] of UCHAR; // output: MAC address of the next hop router, zeroed if
  183. // the network is directly attached
  184. end;
  185. {$EXTERNALSYM _IPX_NETNUM_DATA}
  186. IPX_NETNUM_DATA = _IPX_NETNUM_DATA;
  187. {$EXTERNALSYM IPX_NETNUM_DATA}
  188. PIPX_NETNUM_DATA = ^IPX_NETNUM_DATA;
  189. {$EXTERNALSYM PIPX_NETNUM_DATA}
  190. TIpxNetNumData = IPX_NETNUM_DATA;
  191. PIpxNetNumData = PIPX_NETNUM_DATA;
  192. //
  193. // Like IPX_GETNETINFO except it *does not* issue RIP requests. If the
  194. // network is in IPX's cache it will return the information, otherwise
  195. // it will fail (see also IPX_RERIPNETNUMBER which *always* forces a
  196. // re-RIP). Not valid with setsockopt(). optval points to an instance of
  197. // the IPX_NETNUM_DATA structure with the netnum filled in.
  198. //
  199. const
  200. IPX_GETNETINFO_NORIP = $4009;
  201. {$EXTERNALSYM IPX_GETNETINFO_NORIP}
  202. //
  203. // Get information on a connected SPX socket. optval points
  204. // to an instance of the IPX_SPXCONNSTATUS_DATA structure.
  205. //
  206. // All numbers are in Novell (high-low) order.
  207. //
  208. IPX_SPXGETCONNECTIONSTATUS = $400B;
  209. {$EXTERNALSYM IPX_SPXGETCONNECTIONSTATUS}
  210. type
  211. _IPX_SPXCONNSTATUS_DATA = record
  212. ConnectionState: UCHAR;
  213. WatchDogActive: UCHAR;
  214. LocalConnectionId: USHORT;
  215. RemoteConnectionId: USHORT;
  216. LocalSequenceNumber: USHORT;
  217. LocalAckNumber: USHORT;
  218. LocalAllocNumber: USHORT;
  219. RemoteAckNumber: USHORT;
  220. RemoteAllocNumber: USHORT;
  221. LocalSocket: USHORT;
  222. ImmediateAddress: array [0..5] of UCHAR;
  223. RemoteNetwork: array [0..3] of UCHAR;
  224. RemoteNode: array [0..5] of UCHAR;
  225. RemoteSocket: USHORT;
  226. RetransmissionCount: USHORT;
  227. EstimatedRoundTripDelay: USHORT; // In milliseconds
  228. RetransmittedPackets: USHORT;
  229. SuppressedPacket: USHORT;
  230. end;
  231. {$EXTERNALSYM _IPX_SPXCONNSTATUS_DATA}
  232. IPX_SPXCONNSTATUS_DATA = _IPX_SPXCONNSTATUS_DATA;
  233. {$EXTERNALSYM IPX_SPXCONNSTATUS_DATA}
  234. PIPX_SPXCONNSTATUS_DATA = ^IPX_SPXCONNSTATUS_DATA;
  235. {$EXTERNALSYM PIPX_SPXCONNSTATUS_DATA}
  236. TIpxSpcConnStatusData = IPX_SPXCONNSTATUS_DATA;
  237. PIpxSpcConnStatusData = PIPX_SPXCONNSTATUS_DATA;
  238. //
  239. // Get notification when the status of an adapter that IPX is
  240. // bound to changes. Typically this will happen when a wan line
  241. // goes up or down. Not valid with setsockopt(). optval points
  242. // to a buffer which contains an IPX_ADDRESS_DATA structure
  243. // followed immediately by a HANDLE to an unsignaled event.
  244. //
  245. // When the getsockopt() query is submitted, it will complete
  246. // successfully. However, the IPX_ADDRESS_DATA pointed to by
  247. // optval will not be updated at that point. Instead the
  248. // request is queued internally inside the transport.
  249. //
  250. // When the status of an adapter changes, IPX will locate a
  251. // queued getsockopt() query and fill in all the fields in the
  252. // IPX_ADDRESS_DATA structure. It will then signal the event
  253. // pointed to by the HANDLE in the optval buffer. This handle
  254. // should be obtained before calling getsockopt() by calling
  255. // CreateEvent(). If multiple getsockopts() are submitted at
  256. // once, different events must be used.
  257. //
  258. // The event is used because the call needs to be asynchronous
  259. // but currently getsockopt() does not support this.
  260. //
  261. // WARNING: In the current implementation, the transport will
  262. // only signal one queued query for each status change. Therefore
  263. // only one service which uses this query should be running at
  264. // once.
  265. //
  266. const
  267. IPX_ADDRESS_NOTIFY = $400C;
  268. {$EXTERNALSYM IPX_ADDRESS_NOTIFY}
  269. //
  270. // Get the maximum number of adapters present. If this call returns
  271. // n then the adapters are numbered 0 through n-1. Not valid
  272. // with setsockopt(). optval points to an int where the value
  273. // is returned.
  274. //
  275. IPX_MAX_ADAPTER_NUM = $400D;
  276. {$EXTERNALSYM IPX_MAX_ADAPTER_NUM}
  277. //
  278. // Like IPX_GETNETINFO except it forces IPX to re-RIP even if the
  279. // network is in its cache (but not if it is directly attached to).
  280. // Not valid with setsockopt(). optval points to an instance of
  281. // the IPX_NETNUM_DATA structure with the netnum filled in.
  282. //
  283. IPX_RERIPNETNUMBER = $400E;
  284. {$EXTERNALSYM IPX_RERIPNETNUMBER}
  285. //
  286. // A hint that broadcast packets may be received. The default is
  287. // TRUE. Applications that do not need to receive broadcast packets
  288. // should set this sockopt to FALSE which may cause better system
  289. // performance (note that it does not necessarily cause broadcasts
  290. // to be filtered for the application). Not valid with getsockopt().
  291. // optval points to a BOOL.
  292. //
  293. IPX_RECEIVE_BROADCAST = $400F;
  294. {$EXTERNALSYM IPX_RECEIVE_BROADCAST}
  295. //
  296. // On SPX connections, don't delay before sending ack. Applications
  297. // that do not tend to have back-and-forth traffic over SPX should
  298. // set this; it will increase the number of acks sent but will remove
  299. // delays in sending acks. optval points to a BOOL.
  300. //
  301. IPX_IMMEDIATESPXACK = $4010;
  302. {$EXTERNALSYM IPX_IMMEDIATESPXACK}
  303. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  304. {$IFNDEF JWA_OMIT_SECTIONS}
  305. implementation
  306. //uses ...
  307. {$ENDIF JWA_OMIT_SECTIONS}
  308. {$IFNDEF JWA_INTERFACESECTION}
  309. //your implementation here
  310. {$ENDIF JWA_INTERFACESECTION}
  311. {$IFNDEF JWA_OMIT_SECTIONS}
  312. end.
  313. {$ENDIF JWA_OMIT_SECTIONS}