{\r
\r
code wanting to use this dns system should act as follows (note: app\r
- developers will probablly want to use dnsasync or dnssync or write a similar\r
- wrapper unit of thier own).\r
+ developers will probably want to use dnsasync or dnssync or write a similar\r
+ wrapper unit of their own).\r
\r
for normal lookups call setstate_forward or setstate_reverse to set up the\r
state, for more obscure lookups use setstate_request_init and fill in other\r
- relavent state manually.\r
+ relevant state manually.\r
\r
call state_process which will do processing on the information in the state\r
and return an action\r
action_sendpacket means that dnscore wants the code that calls it to send\r
the packet in sendpacket/sendpacketlen and then start (or go back to) listening\r
for\r
- action_done means the request has completed (either suceeded or failed)\r
+ action_done means the request has completed (either succeeded or failed)\r
\r
callers should resend the last packet they tried to send if they have not\r
been asked to send a new packet for more than some timeout value they choose.\r
following ways.\r
\r
on failure state.resultstr will be an empty string and state.resultbin will\r
- be zeroed out (easilly detected by the fact that it will have a family of 0)\r
+ be zeroed out (easily detected by the fact that it will have a family of 0)\r
\r
on success for a A or AAAA lookup state.resultstr will be an empty string\r
- and state.resultbin will contain the result (note: AAAA lookups require IPV6\r
+ and state.resultbin will contain the result (note: AAAA lookups require IPv6\r
enabled).\r
\r
- if an A lookup fails and the code is built with ipv6 enabled then the code\r
+ if an A lookup fails and the code is built with IPv6 enabled then the code\r
will return any AAAA records with the same name. The reverse does not apply\r
- so if an application preffers IPV6 but wants IPV4 results as well it must\r
- check them seperately.\r
+ so if an application prefers IPv6 but wants IPv4 results as well it must\r
+ check them separately.\r
\r
on success for any other type of lookup state.resultstr will be an empty\r
\r
note the state contains ansistrings, setstate_init with a null name parameter\r
- can be used to clean theese up if required.\r
+ can be used to clean these up if required.\r
\r
- callers may use setstate_failure to mark the state as failed themseleves\r
+ callers may use setstate_failure to mark the state as failed themselves\r
before passing it on to other code, for example this may be done in the event\r
of a timeout.\r
}\r
end;\r
\r
//commenting out functions from interface that do not have documented semantics\r
-//and probablly should not be called from outside this unit, reenable them\r
+//and probably should not be called from outside this unit, reenable them\r
//if you must but please document them at the same time --plugwash\r
\r
//function buildrequest(const name:string;var packet:tdnspacket;requesttype:word):integer;\r
\r
procedure setstate_request_init(const name:ansistring;var state:tdnsstate);\r
\r
-//set up state for a foward lookup. A family value of AF_INET6 will give only\r
+//set up state for a forward lookup. A family value of AF_INET6 will give only\r
//ipv6 results. Any other value will give only ipv4 results\r
procedure setstate_forward(const name:ansistring;var state:tdnsstate;family:integer);\r
\r
goto failure;\r
end;\r
\r
- {do /ets/hosts lookup here}\r
+ {do /etc/hosts lookup here}\r
state.sendpacketlen := buildrequest(state.queryname,state.sendpacket,state.requesttype);\r
if state.sendpacketlen = 0 then begin\r
failurereason := 'building request packet failed';\r
var\r
counter : integer;\r
begin\r
- {override the name server choice here, instead of overriding it whereever it's called\r
+ {override the name server choice here, instead of overriding it wherever it's called\r
setting ID to -1 causes it to be ignored in reportlag}\r
if (overridednsserver <> '') then begin\r
result := ipstrtobinf(overridednsserver);\r
end;\r
\r
if not assigned(dnsserverlag) then populatednsserverlist;\r
- if dnsserverlag.count=0 then raise exception.create('no dns servers availible');\r
+ if dnsserverlag.count=0 then raise exception.create('no dns servers available');\r
id := 0;\r
if dnsserverlag.count >1 then begin\r
for counter := dnsserverlag.count-1 downto 1 do begin\r
{$ifdef ipv6}\r
\r
procedure initpreferredmode;\r
-var\r
- l:tbiniplist;\r
- a:integer;\r
- ip:tbinip;\r
- ipmask_global,ipmask_6to4,ipmask_teredo:tbinip;\r
-\r
begin\r
if preferredmodeinited then exit;\r
if useaf <> useaf_default then exit;\r
- l := getv6localips;\r
- if biniplist_getcount(l) = 0 then exit;\r
- useaf := useaf_preferv4;\r
- ipstrtobin('2000::',ipmask_global);\r
- ipstrtobin('2001::',ipmask_teredo);\r
- ipstrtobin('2002::',ipmask_6to4);\r
- {if there is any v6 IP which is globally routable and not 6to4 and not teredo, prefer v6}\r
- for a := biniplist_getcount(l)-1 downto 0 do begin\r
- ip := biniplist_get(l,a);\r
- if not comparebinipmask(ip,ipmask_global,3) then continue;\r
- if comparebinipmask(ip,ipmask_teredo,32) then continue;\r
- if comparebinipmask(ip,ipmask_6to4,16) then continue;\r
- useaf := useaf_preferv6;\r
- preferredmodeinited := true;\r
- exit;\r
- end;\r
+\r
+ if (have_ipv6_connectivity) then\r
+ useaf := useaf_preferv6\r
+ else\r
+ useaf := useaf_preferv4;\r
+\r
+ preferredmodeinited := true;\r
end;\r
\r
{$endif}\r