resolve.inc 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2005 Soren Ager
  4. Implementation of TCP/IP name resolution for OS/2.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. const
  12. { Net type }
  13. socklib = 'TCP32DLL';
  14. AF_INET = 2;
  15. { Error constants. Returned by LastError method of THost, TNet}
  16. NETDB_INTERNAL= -1; { see errno }
  17. NETDB_SUCCESS = 0; { no problem }
  18. HOST_NOT_FOUND= 1; { Authoritative Answer Host not found }
  19. TRY_AGAIN = 2; { Non-Authoritive Host not found, or SERVERFAIL }
  20. NO_RECOVERY = 3; { Non recoverable errors, FORMERR, REFUSED, NOTIMP }
  21. NO_DATA = 4; { Valid name, no data record of requested type }
  22. NO_ADDRESS = NO_DATA; { no address, look for MX record }
  23. Type
  24. { THostEnt Object }
  25. THostEnt = record
  26. H_Name : pchar; { Official name }
  27. H_Aliases : ppchar; { Null-terminated list of aliases}
  28. H_Addrtype : longint; { Host address type }
  29. H_length : longint; { Length of address }
  30. H_Addr : ppchar; { null-terminated list of adresses }
  31. end;
  32. PHostEntry = ^THostEnt;
  33. { TNetEnt object }
  34. TNetEnt = record
  35. N_Name : pchar; { Official name }
  36. N_Aliases : ppchar; { Nill-terminated alias list }
  37. N_AddrType : longint; { Net address type }
  38. N_net : Cardinal; { Network number }
  39. end;
  40. PNetEntry = ^TNetEnt;
  41. TServEnt = record
  42. s_name : pchar; { Service name }
  43. s_aliases : ppchar; { Null-terminated alias list }
  44. s_port : longint; { Port number }
  45. s_proto : pchar; { Protocol to use }
  46. end;
  47. PServEntry = ^TServEnt;
  48. function gethostent : PHostEntry; cdecl; external socklib index 30;
  49. procedure sethostent (stayopen : longint); cdecl; external socklib index 28;
  50. procedure endhostent; cdecl; external socklib index 29;
  51. function getnetent : PNetEntry; cdecl; external socklib index 17;
  52. procedure setnetent ( Stayopen : Longint); cdecl; external socklib index 15;
  53. procedure endnetent; cdecl; external socklib index 16;
  54. function getservent : PServEntry; cdecl; external socklib index 27;
  55. procedure setservent (StayOpen : longint); cdecl; external socklib index 25;
  56. procedure endservent; cdecl; external socklib index 26;
  57. function getnetbyaddr ( Net : Longint; nettype : Longint) : PNetEntry; cdecl; external socklib index 14;
  58. function gethostbyname ( Name : Pchar) : PHostEntry; cdecl; external socklib index 11;
  59. function gethostbyaddr ( Addr : PChar; Len : Longint; HType : Longint) : PHostentry ; cdecl; external socklib index 12;
  60. function getnetbyname ( Name : pchar) : PNetEntry; cdecl; external socklib index 13;
  61. function getservbyname (name : pchar ; protocol : pchar) : PServEntry; cdecl; external socklib index 24;
  62. function getservbyport (port : longint; protocol : pchar) : PServEntry; cdecl; external socklib index 23;
  63. function GetDNSError : LongInt;
  64. begin
  65. GetDNSError:=0; //!!! fpgetCerrno;
  66. end;
  67. Function InitResolve : Boolean;
  68. begin
  69. Result:=True;
  70. end;
  71. Function FinalResolve : Boolean;
  72. begin
  73. Result:=True;
  74. end;