pike.git
/
lib
/
modules
/
Protocols.pmod
/
DNS.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1:
-
// $Id: DNS.pmod,v 1.
79
2003/08/
07
14:
22
:
17
nilsson Exp $
+
// $Id: DNS.pmod,v 1.
80
2003/08/
22
14:
25
:
27
nilsson Exp $
// Not yet finished -- Fredrik Hubinette //! Domain Name System //! RFC 1035 #pike __REAL_VERSION__ constant NOERROR=0; constant FORMERR=1; constant SERVFAIL=2;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:545:
#define RETRY_DELAY 5 //! Synchronous DNS client. class client { inherit protocol; static private int is_ip(string ip) {
-
return(replace(ip,
-
(
{ "0"
, "
1", "2", "3", "4", "5", "6", "7", "8", "9", "
."
})
,
-
(
{ ""
,
""
, "", "", "", "", "", "", "", "", "" }
)) == "");
+
//
FIXME:
Doesn't
work
with
IPv6
+
return
(
replace(ip
, "
0123456789
."
/1
,
allocate
(
11
,"")) == "");
} static private mapping etc_hosts; #ifdef __NT__ array(string) get_tcpip_param(string val, void|string fallbackvalue) { array(string) res = ({}); foreach(({ "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
pike.git/lib/modules/Protocols.pmod/DNS.pmod:621:
} else { // Bad /etc/hosts entry ignored. } } } } else { // Couldn't read /etc/hosts. } } }
-
return
(
etc_hosts[lower_case(host)]
)
;
+
return
etc_hosts[lower_case(host)];
} //! @decl void create() //! @decl void create(void|string|array server, void|int|array domain) array(string) nameservers = ({}); array domains = ({}); void create(void|string|array(string) server, void|int|array(string) domain) { if(!server)
pike.git/lib/modules/Protocols.pmod/DNS.pmod:975:
ips+=({ip_from_arpa(x->name)}); } } return ({ sizeof(names)?names[0]:0, ips, names, }); } else { // Lookup failed.
-
return({ 0, ({}), ({}) });
+
return
({ 0, ({}), ({}) });
} } //! @decl string get_primary_mx(string hostname) //! Queries the primary mx for the host. //! @returns //! Returns the hostname of the primary mail exchanger. //! string get_primary_mx(string host) {