IdStackConsts.pas 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.0 2004.02.07 12:25:16 PM czhower
  18. Recheckin to fix case of filename
  19. Rev 1.1 2/7/2004 5:20:06 AM JPMugaas
  20. Added some constants that were pasted from other places. DotNET uses the
  21. standard Winsock 2 error consstants. We don't want to link to IdWInsock or
  22. Windows though because that causes other problems.
  23. Rev 1.0 2004.02.03 3:14:44 PM czhower
  24. Move and updates
  25. Rev 1.12 2003.12.28 6:53:46 PM czhower
  26. Added some consts.
  27. Rev 1.11 10/28/2003 9:14:54 PM BGooijen
  28. .net
  29. Rev 1.10 10/19/2003 10:46:18 PM BGooijen
  30. Added more consts
  31. Rev 1.9 10/19/2003 9:15:28 PM BGooijen
  32. added some SocketOptionName consts for dotnet
  33. Rev 1.8 10/19/2003 5:21:30 PM BGooijen
  34. SetSocketOption
  35. Rev 1.7 10/2/2003 7:31:18 PM BGooijen
  36. .net
  37. Rev 1.6 2003.10.02 10:16:32 AM czhower
  38. .Net
  39. Rev 1.5 2003.10.01 5:05:18 PM czhower
  40. .Net
  41. Rev 1.4 2003.10.01 1:12:40 AM czhower
  42. .Net
  43. Rev 1.3 2003.09.30 12:09:38 PM czhower
  44. DotNet changes.
  45. Rev 1.2 9/29/2003 10:28:30 PM BGooijen
  46. Added constants for DotNet
  47. Rev 1.1 12-14-2002 14:58:34 BGooijen
  48. Added definition for Id_SOCK_RDM and Id_SOCK_SEQPACKET
  49. Rev 1.0 11/13/2002 08:59:14 AM JPMugaas
  50. }
  51. unit IdStackConsts;
  52. interface
  53. {$I IdCompilerDefines.inc}
  54. { This should be the only unit except OS Stack units that reference
  55. Winsock or lnxsock }
  56. uses
  57. {$IFDEF DOTNET}
  58. System.Net.Sockets;
  59. {$ENDIF}
  60. //TODO: I'm not really sure how other platforms are supported with asockets header
  61. //Do I use the sockets unit or do something totally different for each platform
  62. {$IFDEF WINDOWS}
  63. IdWship6, //for some constants that supplement IdWinsock
  64. IdWinsock2;
  65. {$ENDIF}
  66. {$IFDEF OS2}
  67. pmwsock;
  68. {$ENDIF}
  69. {$IFDEF SOCKETTYPE_IS_CINT}
  70. IdCTypes,
  71. {$ENDIF}
  72. {$IFDEF NETWARE_CLIB}
  73. winsock; //not sure if this is correct
  74. {$ENDIF}
  75. {$IFDEF NETWARE_LIBC}
  76. winsock; //not sure if this is correct
  77. {$ENDIF}
  78. {$IFDEF MACOS_CLASSIC}
  79. {$ENDIF}
  80. {$IFDEF UNIX}
  81. {$IFDEF USE_VCL_POSIX}
  82. {
  83. IMPORTANT!!!
  84. The new Posix units have platform specific stuff. Since this code and
  85. the definitions are not intented to be compiled in non-Unix-like operating
  86. systems, platform warnings are not going to be too helpful.
  87. }
  88. {$I IdSymbolPlatformOff.inc}
  89. IdVCLPosixSupplemental,
  90. Posix.Errno,Posix.NetDB, Posix.NetinetIn, Posix.SysSocket;
  91. {$ENDIF}
  92. {$IFDEF KYLIXCOMPAT}
  93. libc;
  94. {$ENDIF}
  95. {$IFDEF USE_BASEUNIX}
  96. Sockets, BaseUnix, Unix; // FPC "native" Unix units.
  97. //Marco may want to change the socket interface unit
  98. //so we don't use the libc header.
  99. {$ENDIF}
  100. {$ENDIF}
  101. type
  102. {$IFDEF USE_BASEUNIX}
  103. TSocket = cint; // TSocket is afaik not POSIX, so we have to add it
  104. // (Socket() returns a C int according to opengroup)
  105. {$ENDIF}
  106. TIdStackSocketHandle =
  107. {$IFDEF DOTNET}
  108. Socket
  109. {$ELSE}
  110. {$IFDEF USE_VCL_POSIX}
  111. Integer
  112. {$ELSE}
  113. TSocket
  114. {$ENDIF}
  115. {$ENDIF};
  116. var
  117. Id_SO_True: Integer = 1;
  118. Id_SO_False: Integer = 0;
  119. const
  120. {$IFDEF DOTNET}
  121. Id_IPV6_UNICAST_HOPS = SocketOptionName.IpTimeToLive;
  122. Id_IPV6_MULTICAST_IF = SocketOptionName.MulticastInterface;
  123. Id_IPV6_MULTICAST_HOPS = SocketOptionName.MulticastTimeToLive;
  124. Id_IPV6_MULTICAST_LOOP = SocketOptionName.MulticastLoopback;
  125. Id_IPV6_ADD_MEMBERSHIP = SocketOptionName.AddMembership;
  126. Id_IPV6_DROP_MEMBERSHIP = SocketOptionName.DropMembership;
  127. Id_IPV6_PKTINFO = SocketOptionName.PacketInformation;
  128. Id_IP_MULTICAST_TTL = SocketOptionName.MulticastTimeToLive;
  129. Id_IP_MULTICAST_LOOP = SocketOptionName.MulticastLoopback;
  130. Id_IP_ADD_MEMBERSHIP = SocketOptionName.AddMembership;
  131. Id_IP_DROP_MEMBERSHIP = SocketOptionName.DropMembership;
  132. Id_IP_HDR_INCLUDED = SocketOptionName.HeaderIncluded;
  133. {$ENDIF}
  134. {$IFDEF UNIX}
  135. Id_IPV6_UNICAST_HOPS = IPV6_UNICAST_HOPS;
  136. Id_IPV6_MULTICAST_IF = IPV6_MULTICAST_IF;
  137. Id_IPV6_MULTICAST_HOPS = IPV6_MULTICAST_HOPS;
  138. Id_IPV6_MULTICAST_LOOP = IPV6_MULTICAST_LOOP;
  139. {$IFDEF LINUX}
  140. // These are probably leftovers from the non-final IPV6 KAME standard
  141. // in Linux. They only seem to exist in Linux, others use
  142. // the standarised versions.
  143. // Probably the JOIN_GROUP ones replaced these,
  144. // but they have different numbers in Linux, and possibly
  145. // also different behaviour?
  146. {$IFNDEF KYLIX}
  147. {$IFDEF USE_BASEUNIX}
  148. //In Linux, the libc.pp header maps the old values to new ones,
  149. //probably for consistancy. I'm doing this because we can't link
  150. //to Libc for Basic Unix stuff and some people may want to use this API
  151. //in Linux instead of the libc API.
  152. IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP;
  153. IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP;
  154. {$ENDIF}
  155. {$ENDIF}
  156. {$ELSE}
  157. // FIXME: Android compiler is using these definitions, but maybe some
  158. // EXTERNALSYM-work is needed above.
  159. IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP;
  160. {$EXTERNALSYM IPV6_ADD_MEMBERSHIP}
  161. IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP;
  162. {$EXTERNALSYM IPV6_DROP_MEMBERSHIP}
  163. {$IFNDEF USE_VCL_POSIX}
  164. IPV6_CHECKSUM = 26;
  165. {$ENDIF}
  166. {$ENDIF}
  167. Id_IPV6_ADD_MEMBERSHIP = IPV6_ADD_MEMBERSHIP;
  168. Id_IPV6_DROP_MEMBERSHIP = IPV6_DROP_MEMBERSHIP;
  169. Id_IPV6_PKTINFO = IPV6_PKTINFO;
  170. Id_IPV6_HOPLIMIT = IPV6_HOPLIMIT;
  171. Id_IP_MULTICAST_TTL = IP_MULTICAST_TTL; // TODO integrate into IdStackConsts
  172. Id_IP_MULTICAST_LOOP = IP_MULTICAST_LOOP; // TODO integrate into IdStackConsts
  173. Id_IP_ADD_MEMBERSHIP = IP_ADD_MEMBERSHIP; // TODO integrate into IdStackConsts
  174. Id_IP_DROP_MEMBERSHIP = IP_DROP_MEMBERSHIP; // TODO integrate into IdStackConsts
  175. //In Windows CE 4.2, IP_HDRINCL may not be supported.
  176. Id_IP_HDR_INCLUDED = IP_HDRINCL; // TODO integrate into IdStackConsts
  177. {$ENDIF}
  178. {$IFDEF WINDOWS}
  179. Id_IPV6_HDRINCL = IPV6_HDRINCL;
  180. Id_IPV6_UNICAST_HOPS = IPV6_UNICAST_HOPS;
  181. Id_IPV6_MULTICAST_IF = IPV6_MULTICAST_IF;
  182. Id_IPV6_MULTICAST_HOPS = IPV6_MULTICAST_HOPS;
  183. Id_IPV6_MULTICAST_LOOP = IPV6_MULTICAST_LOOP;
  184. Id_IPV6_ADD_MEMBERSHIP = IPV6_ADD_MEMBERSHIP;
  185. Id_IPV6_DROP_MEMBERSHIP = IPV6_DROP_MEMBERSHIP;
  186. Id_IPV6_PKTINFO = IPV6_PKTINFO;
  187. Id_IPV6_HOPLIMIT = IPV6_HOPLIMIT;
  188. Id_IP_MULTICAST_TTL = 10; // TODO integrate into IdStackConsts FIX ERROR in IdWinsock
  189. Id_IP_MULTICAST_LOOP = 11; // TODO integrate into IdStackConsts FIX ERROR in IdWinsock
  190. Id_IP_ADD_MEMBERSHIP = 12; // TODO integrate into IdStackConsts FIX ERROR in IdWinsock
  191. Id_IP_DROP_MEMBERSHIP = 13; // TODO integrate into IdStackConsts FIX ERROR in IdWinsock
  192. Id_IP_HDR_INCLUDED = 2; // TODO integrate into IdStackConsts FIX ERROR in IdWinsock
  193. {$ENDIF}
  194. (*
  195. There seems to be an error in the correct values of multicast values in IdWinsock
  196. The values should be:
  197. ip_options = 1; //* set/get IP options */
  198. ip_hdrincl = 2; //* header is included with data */
  199. ip_tos = 3; //* IP type of service and preced*/
  200. ip_ttl = 4; //* IP time to live */
  201. ip_multicast_if = 9; //* set/get IP multicast i/f */
  202. ip_multicast_ttl = 10; //* set/get IP multicast ttl */
  203. ip_multicast_loop = 11; //*set/get IP multicast loopback */
  204. ip_add_membership = 12; //* add an IP group membership */
  205. ip_drop_membership = 13; //* drop an IP group membership */
  206. ip_dontfragment = 14; //* don't fragment IP datagrams */ {Do not Localize}
  207. *)
  208. {$IFDEF UNIX}
  209. TCP_NODELAY = 1;
  210. {$ENDIF}
  211. // Protocol Family
  212. {$IFNDEF DOTNET}
  213. {$IFDEF USE_VCL_POSIX}
  214. Id_PF_INET4 = AF_INET;
  215. Id_PF_INET6 = AF_INET6;
  216. {$ELSE}
  217. Id_PF_INET4 = PF_INET;
  218. Id_PF_INET6 = PF_INET6;
  219. {$ENDIF}
  220. {$ELSE}
  221. Id_PF_INET4 = ProtocolFamily.InterNetwork;
  222. Id_PF_INET6 = ProtocolFamily.InterNetworkV6;
  223. {$ENDIF}
  224. {$IFDEF USE_BASEUNIX}
  225. // These constants are actually WinSock specific, not std TCP/IP
  226. // FPC doesn't emulate WinSock.
  227. INVALID_SOCKET = -1;
  228. SOCKET_ERROR = -1;
  229. {$ENDIF}
  230. // Socket Type
  231. {$IFDEF SOCKETTYPE_IS_CINT}
  232. type
  233. TIdSocketType = TIdC_INT;
  234. {$ENDIF}
  235. {$IFDEF SOCKETTYPE_IS___SOCKETTYPE}
  236. type
  237. TIdSocketType = __socket_type;
  238. {$ENDIF}
  239. {$IFDEF SOCKETTYPE_IS_LONGINT}
  240. type
  241. TIdSocketType = Integer;
  242. {$ENDIF}
  243. {$IFDEF SOCKETTYPE_IS_SOCKETTYPE}
  244. type
  245. TIdSocketType = SocketType;
  246. {$ENDIF}
  247. const
  248. // {$IFNDEF DOTNET}
  249. // {$IFDEF KYLIXCOMPAT}
  250. // Id_SOCK_STREAM = TIdSocketType(SOCK_STREAM); //1 /* stream socket */
  251. // Id_SOCK_DGRAM = TIdSocketType(SOCK_DGRAM); //2 /* datagram socket */
  252. // Id_SOCK_RAW = TIdSocketType(SOCK_RAW); //3 /* raw-protocol interface */
  253. // Id_SOCK_RDM = TIdSocketType(SOCK_RDM); //4 /* reliably-delivered message */
  254. // Id_SOCK_SEQPACKET = SOCK_SEQPACKET; //5 /* sequenced packet stream */
  255. // {$ELSE}
  256. // Id_SOCK_STREAM = SOCK_STREAM; //1 /* stream socket */
  257. // Id_SOCK_DGRAM = SOCK_DGRAM; //2 /* datagram socket */
  258. // Id_SOCK_RAW = SOCK_RAW; //3 /* raw-protocol interface */
  259. // Id_SOCK_RDM = SOCK_RDM; //4 /* reliably-delivered message */
  260. // Id_SOCK_SEQPACKET = SOCK_SEQPACKET; //5 /* sequenced packet stream */
  261. // {$ENDIF}
  262. {$IFDEF SOCKETTYPE_IS_SOCKETTYPE}
  263. Id_SOCK_STREAM = SocketType.Stream; // /* stream socket */
  264. Id_SOCK_DGRAM = SocketType.Dgram; // /* datagram socket */
  265. Id_SOCK_RAW = SocketType.Raw; // /* raw-protocol interface */
  266. Id_SOCK_RDM = SocketType.Rdm; // /* reliably-delivered message */
  267. Id_SOCK_SEQPACKET = SocketType.Seqpacket; // /* sequenced packet stream */
  268. Id_SOCK_UNKNOWN = SocketType.Unknown; // /* unknown */
  269. {$ELSE}
  270. Id_SOCK_UNKNOWN = TIdSocketType(0);
  271. Id_SOCK_STREAM = TIdSocketType(SOCK_STREAM); //1 /* stream socket */
  272. Id_SOCK_DGRAM = TIdSocketType(SOCK_DGRAM); //2 /* datagram socket */
  273. Id_SOCK_RAW = TIdSocketType(SOCK_RAW); //3 /* raw-protocol interface */
  274. {$IFNDEF USE_VCL_POSIX}
  275. Id_SOCK_RDM = TIdSocketType(SOCK_RDM); //4 /* reliably-delivered message */
  276. {$ENDIF}
  277. Id_SOCK_SEQPACKET = SOCK_SEQPACKET; //5 /* sequenced packet stream */
  278. {$ENDIF}
  279. type
  280. // IP Protocol type
  281. TIdSocketProtocol = {$IFDEF DOTNET}ProtocolType{$ELSE}Integer{$ENDIF};
  282. TIdSocketOption = {$IFDEF DOTNET}SocketOptionName{$ELSE}Integer{$ENDIF};
  283. TIdSocketOptionLevel = {$IFDEF DOTNET}SocketOptionLevel{$ELSE}Integer{$ENDIF};
  284. const
  285. {$IFNDEF DOTNET}
  286. {$IFDEF OS2}
  287. Id_IPPROTO_GGP = IPPROTO_GGP; //OS/2 does something strange and we might wind up
  288. //supporting it later for all we know.
  289. {$ELSE}
  290. Id_IPPROTO_GGP = 3;// IPPROTO_GGP; may not be defined in some headers in FPC
  291. {$ENDIF}
  292. Id_IPPROTO_ICMP = IPPROTO_ICMP;
  293. Id_IPPROTO_ICMPV6 = IPPROTO_ICMPV6;
  294. {$IFNDEF USE_VCL_POSIX}
  295. Id_IPPROTO_IDP = IPPROTO_IDP;
  296. Id_IPPROTO_IGMP = IPPROTO_IGMP;
  297. {$ENDIF}
  298. Id_IPPROTO_IP = IPPROTO_IP;
  299. Id_IPPROTO_IPv6 = IPPROTO_IPV6;
  300. Id_IPPROTO_ND = 77; //IPPROTO_ND; is not defined in some headers in FPC
  301. Id_IPPROTO_PUP = IPPROTO_PUP;
  302. Id_IPPROTO_RAW = IPPROTO_RAW;
  303. Id_IPPROTO_TCP = IPPROTO_TCP;
  304. Id_IPPROTO_UDP = IPPROTO_UDP;
  305. Id_IPPROTO_MAX = IPPROTO_MAX;
  306. {$ELSE}
  307. Id_IPPROTO_GGP = ProtocolType.Ggp; //Gateway To Gateway Protocol.
  308. Id_IPPROTO_ICMP = ProtocolType.Icmp; //Internet Control Message Protocol.
  309. Id_IPPROTO_ICMPv6 = ProtocolType.IcmpV6; //ICMP for IPv6
  310. Id_IPPROTO_IDP = ProtocolType.Idp; //IDP Protocol.
  311. Id_IPPROTO_IGMP = ProtocolType.Igmp; //Internet Group Management Protocol.
  312. Id_IPPROTO_IP = ProtocolType.IP; //Internet Protocol.
  313. Id_IPPROTO_IPv6 = ProtocolType.IPv6;
  314. Id_IPPROTO_IPX = ProtocolType.Ipx; //IPX Protocol.
  315. Id_IPPROTO_ND = ProtocolType.ND; //Net Disk Protocol (unofficial).
  316. Id_IPPROTO_PUP = ProtocolType.Pup; //PUP Protocol.
  317. Id_IPPROTO_RAW = ProtocolType.Raw; //Raw UP packet protocol.
  318. Id_IPPROTO_SPX = ProtocolType.Spx; //SPX Protocol.
  319. Id_IPPROTO_SPXII = ProtocolType.SpxII; //SPX Version 2 Protocol.
  320. Id_IPPROTO_TCP = ProtocolType.Tcp; //Transmission Control Protocol.
  321. Id_IPPROTO_UDP = ProtocolType.Udp; //User Datagram Protocol.
  322. Id_IPPROTO_UNKNOWN = ProtocolType.Unknown; //Unknown protocol.
  323. Id_IPPROTO_UNSPECIFIED = ProtocolType.Unspecified; //unspecified protocol.
  324. // Id_IPPROTO_MAX = ProtocolType.; ?????????????????????
  325. {$ENDIF}
  326. // Socket Option level
  327. {$IFNDEF DOTNET}
  328. Id_SOL_SOCKET = SOL_SOCKET;
  329. Id_SOL_IP = IPPROTO_IP;
  330. Id_SOL_IPv6 = IPPROTO_IPV6;
  331. Id_SOL_TCP = IPPROTO_TCP;
  332. Id_SOL_UDP = IPPROTO_UDP;
  333. {$ELSE}
  334. Id_SOL_SOCKET = SocketOptionLevel.Socket;
  335. Id_SOL_IP = SocketOptionLevel.Ip;
  336. Id_SOL_IPv6 = SocketOptionLevel.IPv6;
  337. Id_SOL_TCP = SocketOptionLevel.Tcp;
  338. Id_SOL_UDP = SocketOptionLevel.Udp;
  339. {$ENDIF}
  340. // Socket options
  341. {$IFNDEF DOTNET}
  342. {$IFNDEF WINDOWS}
  343. SO_DONTLINGER = not SO_LINGER;
  344. {$EXTERNALSYM SO_DONTLINGER}
  345. {$ENDIF}
  346. Id_SO_BROADCAST = SO_BROADCAST;
  347. Id_SO_DEBUG = SO_DEBUG;
  348. Id_SO_DONTLINGER = SO_DONTLINGER;
  349. Id_SO_DONTROUTE = SO_DONTROUTE;
  350. Id_SO_ERROR = SO_ERROR;
  351. Id_SO_KEEPALIVE = SO_KEEPALIVE;
  352. Id_SO_LINGER = SO_LINGER;
  353. Id_SO_OOBINLINE = SO_OOBINLINE;
  354. Id_SO_RCVBUF = SO_RCVBUF;
  355. Id_SO_REUSEADDR = SO_REUSEADDR;
  356. {$IFDEF LINUX}
  357. // SO_REUSEPORT has different values on different platforms, but for
  358. // right now we are only interested in it on Linux (it is 512 on BSD)...
  359. Id_SO_REUSEPORT = 15;//SO_REUSEPORT; is not defined in some headers in FPC
  360. {$ENDIF}
  361. Id_SO_SNDBUF = SO_SNDBUF;
  362. Id_SO_TYPE = SO_TYPE;
  363. {$IFDEF WINDOWS}
  364. Id_SO_UPDATE_ACCEPT_CONTEXT = SO_UPDATE_ACCEPT_CONTEXT;
  365. Id_SO_UPDATE_CONNECT_CONTEXT = SO_UPDATE_CONNECT_CONTEXT;
  366. {$ENDIF}
  367. {$ELSE}
  368. {
  369. SocketOptionName.AcceptConnection;// Socket is listening.
  370. SocketOptionName.AddMembership;// Add an IP group membership.
  371. SocketOptionName.AddSourceMembership;// Join a source group.
  372. SocketOptionName.BlockSource;// Block data from a source.
  373. }
  374. Id_SO_BROADCAST = SocketOptionName.Broadcast;// Permit sending broadcast messages on the socket.
  375. {
  376. SocketOptionName.BsdUrgent;// Use urgent data as defined in RFC-1222. This option can be set only once, and once set, cannot be turned off.
  377. SocketOptionName.ChecksumCoverage;// Set or get UDP checksum coverage.
  378. }
  379. Id_SO_DEBUG = SocketOptionName.Debug;// Record debugging information.
  380. {
  381. SocketOptionName.DontFragment;// Do not fragment IP datagrams.
  382. }
  383. Id_SO_DONTLINGER = SocketOptionName.DontLinger;// Close socket gracefully without lingering.
  384. Id_SO_DONTROUTE = SocketOptionName.DontRoute;// Do not route; send directly to interface addresses.
  385. {
  386. SocketOptionName.DropMembership;// Drop an IP group membership.
  387. SocketOptionName.DropSourceMembership;// Drop a source group.
  388. }
  389. Id_SO_ERROR = SocketOptionName.Error;// Get error status and clear.
  390. {
  391. SocketOptionName.ExclusiveAddressUse;// Enables a socket to be bound for exclusive access.
  392. SocketOptionName.Expedited;// Use expedited data as defined in RFC-1222. This option can be set only once, and once set, cannot be turned off.
  393. SocketOptionName.HeaderIncluded;// Indicates application is providing the IP header for outgoing datagrams.
  394. SocketOptionName.IPOptions;// Specifies IP options to be inserted into outgoing datagrams.
  395. }
  396. Id_SO_KEEPALIVE = SocketOptionName.KeepAlive;// Send keep-alives.
  397. Id_SO_LINGER = SocketOptionName.Linger;// Linger on close if unsent data is present.
  398. {
  399. SocketOptionName.MaxConnections;// Maximum queue length that can be specified by Listen.
  400. SocketOptionName.MulticastInterface;// Set the interface for outgoing multicast packets.
  401. SocketOptionName.MulticastLoopback;// IP multicast loopback.
  402. SocketOptionName.MulticastTimeToLive;// IP multicast time to live.
  403. SocketOptionName.NoChecksum;// Send UDP datagrams with checksum set to zero.
  404. SocketOptionName.NoDelay;// Disables the Nagle algorithm for send coalescing.
  405. }
  406. Id_SO_OOBINLINE = SocketOptionName.OutOfBandInline;// Receives out-of-band data in the normal data stream.
  407. {
  408. SocketOptionName.PacketInformation;// Return information about received packets.
  409. }
  410. Id_SO_RCVBUF = SocketOptionName.ReceiveBuffer;// Specifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window.
  411. {
  412. SocketOptionName.ReceiveLowWater;// Receive low water mark.
  413. SocketOptionName.ReceiveTimeout;// Receive time out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as BeginSend.
  414. }
  415. Id_SO_REUSEADDR = SocketOptionName.ReuseAddress;// Allows the socket to be bound to an address that is already in use.
  416. Id_SO_SNDBUF = SocketOptionName.SendBuffer;// Specifies the total per-socket buffer space reserved for sends. This is unrelated to the maximum message size or the size of a TCP window.
  417. {
  418. SocketOptionName.SendLowWater;// Specifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window.
  419. SocketOptionName.SendTimeout;// Send timeout. This option applies only to synchronous methods; it has no effect on asynchronous methods such as BeginSend.
  420. }
  421. Id_SO_TYPE = SocketOptionName.Type;// Get socket type.
  422. {
  423. SocketOptionName.TypeOfService;// Change the IP header type of service field.
  424. SocketOptionName.UnblockSource;// Unblock a previously blocked source.
  425. }
  426. Id_SO_UPDATE_ACCEPT_CONTEXT = SocketOptionName.UpdateAcceptContext;// Updates an accepted socket's properties by using those of an existing socket.
  427. Id_SO_UPDATE_CONNECT_CONTEXT = SocketOptionName.UpdateConnectContext;// Updates a connected socket's properties by using those of an existing socket.
  428. {
  429. SocketOptionName.UseLoopback;// Bypass hardware when possible.
  430. }
  431. {$ENDIF}
  432. // Additional socket options
  433. {$IFNDEF DOTNET}
  434. Id_SO_RCVTIMEO = SO_RCVTIMEO;
  435. Id_SO_SNDTIMEO = SO_SNDTIMEO;
  436. {$ELSE}
  437. Id_SO_RCVTIMEO = SocketOptionName.ReceiveTimeout;
  438. Id_SO_SNDTIMEO = SocketOptionName.SendTimeout;
  439. {$ENDIF}
  440. {$IFNDEF DOTNET}
  441. Id_SO_IP_TTL = IP_TTL;
  442. {$ELSE}
  443. Id_SO_IP_TTL = SocketOptionName.IpTimeToLive; // Set the IP header time-to-live field.
  444. {$ENDIF}
  445. {$IFNDEF DOTNET}
  446. {for some reason, the compiler doesn't accept INADDR_ANY below saying a constant is expected. }
  447. {$IFDEF USE_VCL_POSIX}
  448. Id_INADDR_ANY = 0;// INADDR_ANY;
  449. Id_INADDR_NONE = $ffffffff;// INADDR_NONE;
  450. {$ELSE}
  451. Id_INADDR_ANY = INADDR_ANY;
  452. Id_INADDR_NONE = INADDR_NONE;
  453. {$ENDIF}
  454. {$ENDIF}
  455. // TCP Options
  456. {$IFNDEF DOTNET}
  457. {$IFDEF USE_VCL_POSIX}
  458. INVALID_SOCKET = -1;
  459. SOCKET_ERROR = -1;
  460. {$ENDIF}
  461. Id_TCP_NODELAY = TCP_NODELAY;
  462. Id_INVALID_SOCKET = INVALID_SOCKET;
  463. Id_SOCKET_ERROR = SOCKET_ERROR;
  464. Id_SOCKETOPTIONLEVEL_TCP = Id_IPPROTO_TCP; // BGO: rename to Id_SOL_TCP
  465. {$IFDEF HAS_TCP_CORK}
  466. Id_TCP_CORK = TCP_CORK;
  467. {$ENDIF}
  468. {$IFDEF HAS_TCP_NOPUSH}
  469. Id_TCP_NOPUSH = TCP_NOPUSH;
  470. {$ENDIF}
  471. {$IFDEF HAS_TCP_KEEPIDLE}
  472. Id_TCP_KEEPIDLE = TCP_KEEPIDLE;
  473. {$ENDIF}
  474. {$IFDEF HAS_TCP_KEEPINTVL}
  475. Id_TCP_KEEPINTVL = TCP_KEEPINTVL;
  476. {$ENDIF}
  477. {$ELSE}
  478. Id_TCP_NODELAY = SocketOptionName.NoDelay;
  479. Id_INVALID_SOCKET = nil;
  480. Id_SOCKET_ERROR = -1;
  481. Id_SOCKETOPTIONLEVEL_TCP = SocketOptionLevel.TCP; // BGO: rename to Id_SOL_TCP
  482. {$ENDIF}
  483. {$IFDEF USE_VCL_POSIX}
  484. // Shutdown Options
  485. // RLebeau 7/23/2019: Delphi 10.2 Tokyo defines SHUT_WR and SHUT_RDWR incorrectly
  486. // for Linux! So just define them manually... (Was this ever fixed in a later version?)
  487. Id_SD_Recv = 0{SHUT_RD};
  488. Id_SD_Send = 1{SHUT_WR};
  489. Id_SD_Both = 2{SHUT_RDWR};
  490. //
  491. //Temp defines. They should be in Delphi's Posix.Errno.pas
  492. ESOCKTNOSUPPORT = 44; //* Socket type not supported */
  493. {$EXTERNALSYM ESOCKTNOSUPPORT}
  494. EPFNOSUPPORT = 46; //* Protocol family not supported */
  495. {$EXTERNALSYM EPFNOSUPPORT}
  496. ESHUTDOWN = 58; //* Can't send after socket shutdown */
  497. {$EXTERNALSYM ESHUTDOWN}
  498. ETOOMANYREFS = 59; //* Too many references: can't splice */
  499. {$EXTERNALSYM ETOOMANYREFS}
  500. EHOSTDOWN = 64; //* Host is down */
  501. {$EXTERNALSYM EHOSTDOWN}
  502. //
  503. Id_WSAEINTR = EINTR;
  504. Id_WSAEBADF = EBADF;
  505. Id_WSAEACCES = EACCES;
  506. Id_WSAEFAULT = EFAULT;
  507. Id_WSAEINVAL = EINVAL;
  508. Id_WSAEMFILE = EMFILE;
  509. Id_WSAEAGAIN = EAGAIN;
  510. Id_WSAEWOULDBLOCK = EWOULDBLOCK;
  511. Id_WSAEINPROGRESS = EINPROGRESS;
  512. Id_WSAEALREADY = EALREADY;
  513. Id_WSAENOTSOCK = ENOTSOCK;
  514. Id_WSAEDESTADDRREQ = EDESTADDRREQ;
  515. Id_WSAEMSGSIZE = EMSGSIZE;
  516. Id_WSAEPROTOTYPE = EPROTOTYPE;
  517. Id_WSAENOPROTOOPT = ENOPROTOOPT;
  518. Id_WSAEPROTONOSUPPORT = EPROTONOSUPPORT;
  519. Id_WSAESOCKTNOSUPPORT = ESOCKTNOSUPPORT;
  520. Id_WSAEOPNOTSUPP = EOPNOTSUPP;
  521. Id_WSAEPFNOSUPPORT = EPFNOSUPPORT;
  522. Id_WSAEAFNOSUPPORT = EAFNOSUPPORT;
  523. Id_WSAEADDRINUSE = EADDRINUSE;
  524. Id_WSAEADDRNOTAVAIL = EADDRNOTAVAIL;
  525. Id_WSAENETDOWN = ENETDOWN;
  526. Id_WSAENETUNREACH = ENETUNREACH;
  527. Id_WSAENETRESET = ENETRESET;
  528. Id_WSAECONNABORTED = ECONNABORTED;
  529. Id_WSAECONNRESET = ECONNRESET;
  530. Id_WSAENOBUFS = ENOBUFS;
  531. Id_WSAEISCONN = EISCONN;
  532. Id_WSAENOTCONN = ENOTCONN;
  533. Id_WSAESHUTDOWN = ESHUTDOWN;
  534. Id_WSAETOOMANYREFS = ETOOMANYREFS;
  535. Id_WSAETIMEDOUT = ETIMEDOUT;
  536. Id_WSAECONNREFUSED = ECONNREFUSED;
  537. Id_WSAELOOP = ELOOP;
  538. Id_WSAENAMETOOLONG = ENAMETOOLONG;
  539. Id_WSAEHOSTDOWN = EHOSTDOWN;
  540. Id_WSAEHOSTUNREACH = EHOSTUNREACH;
  541. Id_WSAENOTEMPTY = ENOTEMPTY;
  542. {$ENDIF}
  543. {$IFDEF KYLIXCOMPAT}
  544. // Shutdown Options
  545. Id_SD_Recv = SHUT_RD;
  546. Id_SD_Send = SHUT_WR;
  547. Id_SD_Both = SHUT_RDWR;
  548. //
  549. Id_WSAEINTR = EINTR;
  550. Id_WSAEBADF = EBADF;
  551. Id_WSAEACCES = EACCES;
  552. Id_WSAEFAULT = EFAULT;
  553. Id_WSAEINVAL = EINVAL;
  554. Id_WSAEMFILE = EMFILE;
  555. Id_WSAEAGAIN = EAGAIN;
  556. Id_WSAEWOULDBLOCK = EWOULDBLOCK;
  557. Id_WSAEINPROGRESS = EINPROGRESS;
  558. Id_WSAEALREADY = EALREADY;
  559. Id_WSAENOTSOCK = ENOTSOCK;
  560. Id_WSAEDESTADDRREQ = EDESTADDRREQ;
  561. Id_WSAEMSGSIZE = EMSGSIZE;
  562. Id_WSAEPROTOTYPE = EPROTOTYPE;
  563. Id_WSAENOPROTOOPT = ENOPROTOOPT;
  564. Id_WSAEPROTONOSUPPORT = EPROTONOSUPPORT;
  565. Id_WSAESOCKTNOSUPPORT = ESOCKTNOSUPPORT;
  566. Id_WSAEOPNOTSUPP = EOPNOTSUPP;
  567. Id_WSAEPFNOSUPPORT = EPFNOSUPPORT;
  568. Id_WSAEAFNOSUPPORT = EAFNOSUPPORT;
  569. Id_WSAEADDRINUSE = EADDRINUSE;
  570. Id_WSAEADDRNOTAVAIL = EADDRNOTAVAIL;
  571. Id_WSAENETDOWN = ENETDOWN;
  572. Id_WSAENETUNREACH = ENETUNREACH;
  573. Id_WSAENETRESET = ENETRESET;
  574. Id_WSAECONNABORTED = ECONNABORTED;
  575. Id_WSAECONNRESET = ECONNRESET;
  576. Id_WSAENOBUFS = ENOBUFS;
  577. Id_WSAEISCONN = EISCONN;
  578. Id_WSAENOTCONN = ENOTCONN;
  579. Id_WSAESHUTDOWN = ESHUTDOWN;
  580. Id_WSAETOOMANYREFS = ETOOMANYREFS;
  581. Id_WSAETIMEDOUT = ETIMEDOUT;
  582. Id_WSAECONNREFUSED = ECONNREFUSED;
  583. Id_WSAELOOP = ELOOP;
  584. Id_WSAENAMETOOLONG = ENAMETOOLONG;
  585. Id_WSAEHOSTDOWN = EHOSTDOWN;
  586. Id_WSAEHOSTUNREACH = EHOSTUNREACH;
  587. Id_WSAENOTEMPTY = ENOTEMPTY;
  588. {$ENDIF}
  589. {$IFDEF USE_BASEUNIX}
  590. // Shutdown Options
  591. Id_SD_Recv = SHUT_RD;
  592. Id_SD_Send = SHUT_WR;
  593. Id_SD_Both = SHUT_RDWR;
  594. {$IFDEF BEOS}
  595. {work around incomplete definitions in BeOS FPC compiler.}
  596. EDESTADDRREQ = (B_POSIX_ERROR_BASE + 48);
  597. {$EXTERNALSYM EDESTADDRREQ}
  598. EHOSTDOWN = (B_POSIX_ERROR_BASE + 45);
  599. {$EXTERNALSYM EHOSTDOWN}
  600. ESysENOTSOCK = ENOTSOCK;
  601. ESysEDESTADDRREQ = EDESTADDRREQ;
  602. ESysEMSGSIZE = EMSGSIZE;
  603. ESysEOPNOTSUPP = EOPNOTSUPP;
  604. ESysEHOSTDOWN = EHOSTDOWN;
  605. {$ENDIF}
  606. //
  607. Id_WSAEINTR = ESysEINTR;
  608. Id_WSAEBADF = ESysEBADF;
  609. Id_WSAEACCES = ESysEACCES;
  610. Id_WSAEFAULT = ESysEFAULT;
  611. Id_WSAEINVAL = ESysEINVAL;
  612. Id_WSAEMFILE = ESysEMFILE;
  613. Id_WSAEAGAIN = ESysEAGAIN;
  614. Id_WSAEWOULDBLOCK = ESysEWOULDBLOCK;
  615. Id_WSAEINPROGRESS = ESysEINPROGRESS;
  616. Id_WSAEALREADY = ESysEALREADY;
  617. Id_WSAENOTSOCK = ESysENOTSOCK;
  618. Id_WSAEDESTADDRREQ = ESysEDESTADDRREQ;
  619. Id_WSAEMSGSIZE = ESysEMSGSIZE;
  620. Id_WSAEPROTOTYPE = ESysEPROTOTYPE;
  621. Id_WSAENOPROTOOPT = ESysENOPROTOOPT;
  622. Id_WSAEPROTONOSUPPORT = ESysEPROTONOSUPPORT;
  623. {$IFNDEF BEOS}
  624. Id_WSAESOCKTNOSUPPORT = ESysESOCKTNOSUPPORT;
  625. {$ENDIF}
  626. Id_WSAEOPNOTSUPP = ESysEOPNOTSUPP;
  627. Id_WSAEPFNOSUPPORT = ESysEPFNOSUPPORT;
  628. Id_WSAEAFNOSUPPORT = ESysEAFNOSUPPORT;
  629. Id_WSAEADDRINUSE = ESysEADDRINUSE;
  630. Id_WSAEADDRNOTAVAIL = ESysEADDRNOTAVAIL;
  631. Id_WSAENETDOWN = ESysENETDOWN;
  632. Id_WSAENETUNREACH = ESysENETUNREACH;
  633. Id_WSAENETRESET = ESysENETRESET;
  634. Id_WSAECONNABORTED = ESysECONNABORTED;
  635. Id_WSAECONNRESET = ESysECONNRESET;
  636. Id_WSAENOBUFS = ESysENOBUFS;
  637. Id_WSAEISCONN = ESysEISCONN;
  638. Id_WSAENOTCONN = ESysENOTCONN;
  639. Id_WSAESHUTDOWN = ESysESHUTDOWN;
  640. {$IFNDEF BEOS}
  641. Id_WSAETOOMANYREFS = ESysETOOMANYREFS;
  642. {$ENDIF}
  643. Id_WSAETIMEDOUT = ESysETIMEDOUT;
  644. Id_WSAECONNREFUSED = ESysECONNREFUSED;
  645. Id_WSAELOOP = ESysELOOP;
  646. Id_WSAENAMETOOLONG = ESysENAMETOOLONG;
  647. Id_WSAEHOSTDOWN = ESysEHOSTDOWN;
  648. Id_WSAEHOSTUNREACH = ESysEHOSTUNREACH;
  649. Id_WSAENOTEMPTY = ESysENOTEMPTY;
  650. {$ENDIF}
  651. {$IFDEF WINDOWS}
  652. // Shutdown Options
  653. Id_SD_Recv = 0;
  654. Id_SD_Send = 1;
  655. Id_SD_Both = 2;
  656. //
  657. Id_WSAEINTR = WSAEINTR;
  658. Id_WSAEBADF = WSAEBADF;
  659. Id_WSAEACCES = WSAEACCES;
  660. Id_WSAEFAULT = WSAEFAULT;
  661. Id_WSAEINVAL = WSAEINVAL;
  662. Id_WSAEMFILE = WSAEMFILE;
  663. Id_WSAEWOULDBLOCK = WSAEWOULDBLOCK;
  664. Id_WSAEINPROGRESS = WSAEINPROGRESS;
  665. Id_WSAEALREADY = WSAEALREADY;
  666. Id_WSAENOTSOCK = WSAENOTSOCK;
  667. Id_WSAEDESTADDRREQ = WSAEDESTADDRREQ;
  668. Id_WSAEMSGSIZE = WSAEMSGSIZE;
  669. Id_WSAEPROTOTYPE = WSAEPROTOTYPE;
  670. Id_WSAENOPROTOOPT = WSAENOPROTOOPT;
  671. Id_WSAEPROTONOSUPPORT = WSAEPROTONOSUPPORT;
  672. Id_WSAESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;
  673. Id_WSAEOPNOTSUPP = WSAEOPNOTSUPP;
  674. Id_WSAEPFNOSUPPORT = WSAEPFNOSUPPORT;
  675. Id_WSAEAFNOSUPPORT = WSAEAFNOSUPPORT;
  676. Id_WSAEADDRINUSE = WSAEADDRINUSE;
  677. Id_WSAEADDRNOTAVAIL = WSAEADDRNOTAVAIL;
  678. Id_WSAENETDOWN = WSAENETDOWN;
  679. Id_WSAENETUNREACH = WSAENETUNREACH;
  680. Id_WSAENETRESET = WSAENETRESET;
  681. Id_WSAECONNABORTED = WSAECONNABORTED;
  682. Id_WSAECONNRESET = WSAECONNRESET;
  683. Id_WSAENOBUFS = WSAENOBUFS;
  684. Id_WSAEISCONN = WSAEISCONN;
  685. Id_WSAENOTCONN = WSAENOTCONN;
  686. Id_WSAESHUTDOWN = WSAESHUTDOWN;
  687. Id_WSAETOOMANYREFS = WSAETOOMANYREFS;
  688. Id_WSAETIMEDOUT = WSAETIMEDOUT;
  689. Id_WSAECONNREFUSED = WSAECONNREFUSED;
  690. Id_WSAELOOP = WSAELOOP;
  691. Id_WSAENAMETOOLONG = WSAENAMETOOLONG;
  692. Id_WSAEHOSTDOWN = WSAEHOSTDOWN;
  693. Id_WSAEHOSTUNREACH = WSAEHOSTUNREACH;
  694. Id_WSAENOTEMPTY = WSAENOTEMPTY;
  695. {$ENDIF}
  696. {$IFDEF DOTNET}
  697. //In DotNET, the constants are the same as in Winsock2.
  698. //Ripped from IdWinsock2 - don't use that in DotNET.
  699. WSABASEERR = 10000;
  700. // Windows Sockets definitions of regular Microsoft C error constants
  701. WSAEINTR = WSABASEERR + 4;
  702. WSAEBADF = WSABASEERR + 9;
  703. WSAEACCES = WSABASEERR + 13;
  704. WSAEFAULT = WSABASEERR + 14;
  705. WSAEINVAL = WSABASEERR + 22;
  706. WSAEMFILE = WSABASEERR + 24;
  707. // Windows Sockets definitions of regular Berkeley error constants
  708. WSAEWOULDBLOCK = WSABASEERR + 35;
  709. WSAEINPROGRESS = WSABASEERR + 36;
  710. WSAEALREADY = WSABASEERR + 37;
  711. WSAENOTSOCK = WSABASEERR + 38;
  712. WSAEDESTADDRREQ = WSABASEERR + 39;
  713. WSAEMSGSIZE = WSABASEERR + 40;
  714. WSAEPROTOTYPE = WSABASEERR + 41;
  715. WSAENOPROTOOPT = WSABASEERR + 42;
  716. WSAEPROTONOSUPPORT = WSABASEERR + 43;
  717. WSAESOCKTNOSUPPORT = WSABASEERR + 44;
  718. WSAEOPNOTSUPP = WSABASEERR + 45;
  719. WSAEPFNOSUPPORT = WSABASEERR + 46;
  720. WSAEAFNOSUPPORT = WSABASEERR + 47;
  721. WSAEADDRINUSE = WSABASEERR + 48;
  722. WSAEADDRNOTAVAIL = WSABASEERR + 49;
  723. WSAENETDOWN = WSABASEERR + 50;
  724. WSAENETUNREACH = WSABASEERR + 51;
  725. WSAENETRESET = WSABASEERR + 52;
  726. WSAECONNABORTED = WSABASEERR + 53;
  727. WSAECONNRESET = WSABASEERR + 54;
  728. WSAENOBUFS = WSABASEERR + 55;
  729. WSAEISCONN = WSABASEERR + 56;
  730. WSAENOTCONN = WSABASEERR + 57;
  731. WSAESHUTDOWN = WSABASEERR + 58;
  732. WSAETOOMANYREFS = WSABASEERR + 59;
  733. WSAETIMEDOUT = WSABASEERR + 60;
  734. WSAECONNREFUSED = WSABASEERR + 61;
  735. WSAELOOP = WSABASEERR + 62;
  736. WSAENAMETOOLONG = WSABASEERR + 63;
  737. WSAEHOSTDOWN = WSABASEERR + 64;
  738. WSAEHOSTUNREACH = WSABASEERR + 65;
  739. WSAENOTEMPTY = WSABASEERR + 66;
  740. WSAEPROCLIM = WSABASEERR + 67;
  741. WSAEUSERS = WSABASEERR + 68;
  742. WSAEDQUOT = WSABASEERR + 69;
  743. WSAESTALE = WSABASEERR + 70;
  744. WSAEREMOTE = WSABASEERR + 71;
  745. // Extended Windows Sockets error constant definitions
  746. WSASYSNOTREADY = WSABASEERR + 91;
  747. WSAVERNOTSUPPORTED = WSABASEERR + 92;
  748. WSANOTINITIALIZED = WSABASEERR + 93;
  749. WSAEDISCON = WSABASEERR + 101;
  750. WSAENOMORE = WSABASEERR + 102;
  751. WSAECANCELLED = WSABASEERR + 103;
  752. WSAEINVALIDPROCTABLE = WSABASEERR + 104;
  753. WSAEINVALIDPROVIDER = WSABASEERR + 105;
  754. WSAEPROVIDERFAILEDINIT = WSABASEERR + 106;
  755. WSASYSCALLFAILURE = WSABASEERR + 107;
  756. WSASERVICE_NOT_FOUND = WSABASEERR + 108;
  757. WSATYPE_NOT_FOUND = WSABASEERR + 109;
  758. WSA_E_NO_MORE = WSABASEERR + 110;
  759. WSA_E_CANCELLED = WSABASEERR + 111;
  760. WSAEREFUSED = WSABASEERR + 112;
  761. { Error return codes from gethostbyname() and gethostbyaddr()
  762. when using the resolver. Note that these errors are retrieved
  763. via WSAGetLastError() and must therefore follow the rules for
  764. avoiding clashes with error numbers from specific implementations
  765. or language run-time systems. For this reason the codes are based
  766. at WSABASEERR+1001. Note also that [WSA]NO_ADDRESS is defined
  767. only for compatibility purposes. }
  768. // Authoritative Answer: Host not found
  769. WSAHOST_NOT_FOUND = WSABASEERR + 1001;
  770. HOST_NOT_FOUND = WSAHOST_NOT_FOUND;
  771. // Non-Authoritative: Host not found, or SERVERFAIL
  772. WSATRY_AGAIN = WSABASEERR + 1002;
  773. TRY_AGAIN = WSATRY_AGAIN;
  774. // Non recoverable errors, FORMERR, REFUSED, NOTIMP
  775. WSANO_RECOVERY = WSABASEERR + 1003;
  776. NO_RECOVERY = WSANO_RECOVERY;
  777. // Valid name, no data record of requested type
  778. WSANO_DATA = WSABASEERR + 1004;
  779. NO_DATA = WSANO_DATA;
  780. // no address, look for MX record
  781. WSANO_ADDRESS = WSANO_DATA;
  782. NO_ADDRESS = WSANO_ADDRESS;
  783. // Define QOS related error return codes
  784. WSA_QOS_RECEIVERS = WSABASEERR + 1005; // at least one reserve has arrived
  785. WSA_QOS_SENDERS = WSABASEERR + 1006; // at least one path has arrived
  786. WSA_QOS_NO_SENDERS = WSABASEERR + 1007; // there are no senders
  787. WSA_QOS_NO_RECEIVERS = WSABASEERR + 1008; // there are no receivers
  788. WSA_QOS_REQUEST_CONFIRMED = WSABASEERR + 1009; // reserve has been confirmed
  789. WSA_QOS_ADMISSION_FAILURE = WSABASEERR + 1010; // error due to lack of resources
  790. WSA_QOS_POLICY_FAILURE = WSABASEERR + 1011; // rejected for administrative reasons - bad credentials
  791. WSA_QOS_BAD_STYLE = WSABASEERR + 1012; // unknown or conflicting style
  792. WSA_QOS_BAD_OBJECT = WSABASEERR + 1013; // problem with some part of the filterspec or providerspecific buffer in general
  793. WSA_QOS_TRAFFIC_CTRL_ERROR = WSABASEERR + 1014; // problem with some part of the flowspec
  794. WSA_QOS_GENERIC_ERROR = WSABASEERR + 1015; // general error
  795. WSA_QOS_ESERVICETYPE = WSABASEERR + 1016; // invalid service type in flowspec
  796. WSA_QOS_EFLOWSPEC = WSABASEERR + 1017; // invalid flowspec
  797. WSA_QOS_EPROVSPECBUF = WSABASEERR + 1018; // invalid provider specific buffer
  798. WSA_QOS_EFILTERSTYLE = WSABASEERR + 1019; // invalid filter style
  799. WSA_QOS_EFILTERTYPE = WSABASEERR + 1020; // invalid filter type
  800. WSA_QOS_EFILTERCOUNT = WSABASEERR + 1021; // incorrect number of filters
  801. WSA_QOS_EOBJLENGTH = WSABASEERR + 1022; // invalid object length
  802. WSA_QOS_EFLOWCOUNT = WSABASEERR + 1023; // incorrect number of flows
  803. WSA_QOS_EUNKNOWNSOBJ = WSABASEERR + 1024; // unknown object in provider specific buffer
  804. WSA_QOS_EPOLICYOBJ = WSABASEERR + 1025; // invalid policy object in provider specific buffer
  805. WSA_QOS_EFLOWDESC = WSABASEERR + 1026; // invalid flow descriptor in the list
  806. WSA_QOS_EPSFLOWSPEC = WSABASEERR + 1027; // inconsistent flow spec in provider specific buffer
  807. WSA_QOS_EPSFILTERSPEC = WSABASEERR + 1028; // invalid filter spec in provider specific buffer
  808. WSA_QOS_ESDMODEOBJ = WSABASEERR + 1029; // invalid shape discard mode object in provider specific buffer
  809. WSA_QOS_ESHAPERATEOBJ = WSABASEERR + 1030; // invalid shaping rate object in provider specific buffer
  810. WSA_QOS_RESERVED_PETYPE = WSABASEERR + 1031; // reserved policy element in provider specific buffer
  811. {This section defines error constants used in Winsock 2 indirectly. These
  812. are from Borland's header.}
  813. { The handle is invalid. }
  814. ERROR_INVALID_HANDLE = 6;
  815. { Not enough storage is available to process this command. }
  816. ERROR_NOT_ENOUGH_MEMORY = 8; { dderror }
  817. { The parameter is incorrect. }
  818. ERROR_INVALID_PARAMETER = 87; { dderror }
  819. { The I/O operation has been aborted because of either a thread exit }
  820. { or an application request. }
  821. ERROR_OPERATION_ABORTED = 995;
  822. { Overlapped I/O event is not in a signalled state. }
  823. ERROR_IO_INCOMPLETE = 996;
  824. { Overlapped I/O operation is in progress. }
  825. ERROR_IO_PENDING = 997; { dderror }
  826. { WinSock 2 extension -- new error codes and type definition }
  827. WSA_IO_PENDING = ERROR_IO_PENDING;
  828. WSA_IO_INCOMPLETE = ERROR_IO_INCOMPLETE;
  829. WSA_INVALID_HANDLE = ERROR_INVALID_HANDLE;
  830. WSA_INVALID_PARAMETER = ERROR_INVALID_PARAMETER;
  831. WSA_NOT_ENOUGH_MEMORY = ERROR_NOT_ENOUGH_MEMORY;
  832. WSA_OPERATION_ABORTED = ERROR_OPERATION_ABORTED;
  833. //TODO: Map these to .net constants. Unfortunately .net does not seem to
  834. //define these anywhere.
  835. Id_WSAEINTR = WSAEINTR;
  836. Id_WSAEBADF = WSAEBADF;
  837. Id_WSAEACCES = WSAEACCES;
  838. Id_WSAEFAULT = WSAEFAULT;
  839. Id_WSAEINVAL = WSAEINVAL;
  840. Id_WSAEMFILE = WSAEMFILE;
  841. Id_WSAEWOULDBLOCK = WSAEWOULDBLOCK;
  842. Id_WSAEINPROGRESS = WSAEINPROGRESS;
  843. Id_WSAEALREADY = WSAEALREADY;
  844. Id_WSAENOTSOCK = WSAENOTSOCK;
  845. Id_WSAEDESTADDRREQ = WSAEDESTADDRREQ;
  846. Id_WSAEMSGSIZE = WSAEMSGSIZE;
  847. Id_WSAEPROTOTYPE = WSAEPROTOTYPE;
  848. Id_WSAENOPROTOOPT = WSAENOPROTOOPT;
  849. Id_WSAEPROTONOSUPPORT = WSAEPROTONOSUPPORT;
  850. Id_WSAESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;
  851. Id_WSAEOPNOTSUPP = WSAEOPNOTSUPP;
  852. Id_WSAEPFNOSUPPORT = WSAEPFNOSUPPORT;
  853. Id_WSAEAFNOSUPPORT = WSAEAFNOSUPPORT;
  854. Id_WSAEADDRINUSE = WSAEADDRINUSE;
  855. Id_WSAEADDRNOTAVAIL = WSAEADDRNOTAVAIL;
  856. Id_WSAENETDOWN = WSAENETDOWN;
  857. Id_WSAENETUNREACH = WSAENETUNREACH;
  858. Id_WSAENETRESET = WSAENETRESET;
  859. Id_WSAECONNABORTED = WSAECONNABORTED;
  860. Id_WSAECONNRESET = WSAECONNRESET;
  861. Id_WSAENOBUFS = WSAENOBUFS;
  862. Id_WSAEISCONN = WSAEISCONN;
  863. Id_WSAENOTCONN = WSAENOTCONN;
  864. Id_WSAESHUTDOWN = WSAESHUTDOWN;
  865. Id_WSAETOOMANYREFS = WSAETOOMANYREFS;
  866. Id_WSAETIMEDOUT = WSAETIMEDOUT;
  867. Id_WSAECONNREFUSED = WSAECONNREFUSED;
  868. Id_WSAELOOP = WSAELOOP;
  869. Id_WSAENAMETOOLONG = WSAENAMETOOLONG;
  870. Id_WSAEHOSTDOWN = WSAEHOSTDOWN;
  871. Id_WSAEHOSTUNREACH = WSAEHOSTUNREACH;
  872. Id_WSAENOTEMPTY = WSAENOTEMPTY;
  873. Id_SD_Recv = SocketShutdown.Receive;
  874. Id_SD_Send = SocketShutdown.Send;
  875. Id_SD_Both = SocketShutdown.Both;
  876. {$ENDIF}
  877. implementation
  878. {$IFDEF USE_VCL_POSIX}
  879. {$I IdSymbolPlatformOn.inc}
  880. {$ENDIF}
  881. end.