PageRenderTime 33ms CodeModel.GetById 22ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/fcl-net/src/unix/resolve.inc

https://github.com/slibre/freepascal
Pascal | 86 lines | 62 code | 19 blank | 5 comment | 0 complexity | 572f4b2bab06b0392d820af000432d4a MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1uses
 2  initc;
 3
 4const
 5  { Net type }
 6  socklib = 'c';
 7  AF_INET = 2;
 8
 9  { Error constants. Returned by LastError method of THost, TNet}
10
11  NETDB_INTERNAL= -1;       { see errno }
12  NETDB_SUCCESS = 0;        { no problem }
13  HOST_NOT_FOUND= 1;        { Authoritative Answer Host not found }
14  TRY_AGAIN     = 2;        { Non-Authoritive Host not found, or SERVERFAIL }
15  NO_RECOVERY   = 3;        { Non recoverable errors, FORMERR, REFUSED, NOTIMP }
16  NO_DATA       = 4;        { Valid name, no data record of requested type }
17  NO_ADDRESS    = NO_DATA;  { no address, look for MX record }
18
19
20Type
21
22  { THostEnt Object }
23  THostEnt = record
24    H_Name     : pchar;   { Official name }
25    H_Aliases  : ppchar;  { Null-terminated list of aliases}
26    H_Addrtype : longint;   { Host address type }
27    H_length  : longint;   { Length of address }
28    H_Addr : ppchar;    { null-terminated list of adresses }
29  end;
30  PHostEntry = ^THostEnt;
31
32  { TNetEnt object }
33  TNetEnt = record
34    N_Name     : pchar;   { Official name }
35    N_Aliases  : ppchar;  { Nill-terminated alias list }
36    N_AddrType : longint; { Net address type }
37    N_net      : Cardinal; { Network number }
38  end;
39  PNetEntry = ^TNetEnt;
40
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
49{ C style calls, linked in from Libc }
50
51function gethostent : PHostEntry; cdecl; external socklib;
52procedure sethostent (stayopen : longint); cdecl; external socklib;
53procedure endhostent; cdecl; external socklib;
54
55function getnetent : PNetEntry; cdecl; external socklib;
56procedure setnetent ( Stayopen : Longint);  cdecl; external socklib;
57procedure endnetent; cdecl; external socklib;
58
59function getservent : PServEntry; cdecl; external socklib;
60procedure setservent (StayOpen : longint); cdecl; external socklib;
61procedure endservent; cdecl; external socklib;
62
63function getnetbyaddr ( Net : Longint; nettype : Longint) : PNetEntry; cdecl; external socklib;
64function gethostbyname ( Name : Pchar) : PHostEntry; cdecl; external socklib;
65function gethostbyaddr ( Addr : PChar; Len : Longint; HType : Longint) : PHostentry ; cdecl; external socklib;
66function getnetbyname ( Name : pchar) : PNetEntry; cdecl; external socklib;
67function getservbyname (name : pchar  ; protocol : pchar) : PServEntry; cdecl; external socklib;
68function getservbyport (port : longint; protocol : pchar) : PServEntry; cdecl; external socklib;
69
70function  GetDNSError : libcint;
71
72begin
73  GetDNSError:=fpgetCerrno;
74end;
75
76Function InitResolve : Boolean;
77
78begin
79  Result:=True;
80end;
81
82Function FinalResolve : Boolean;
83
84begin
85  Result:=True;
86end;