summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8e74970)
{\r
(temporarily) use a different nameserver, regardless of the dnsserverlist\r
}\r
{\r
(temporarily) use a different nameserver, regardless of the dnsserverlist\r
}\r
-var overridednsserver:string;\r
+var overridednsserver:ansistring;\r
\r
const\r
maxnamelength=127;\r
\r
const\r
maxnamelength=127;\r
tdnsstate=record\r
id:word;\r
recursioncount:integer;\r
tdnsstate=record\r
id:word;\r
recursioncount:integer;\r
+ queryname:ansistring;\r
requesttype:word;\r
parsepacket:boolean;\r
requesttype:word;\r
parsepacket:boolean;\r
+ resultstr:ansistring;\r
resultbin:tbinip;\r
resultlist:tbiniplist;\r
resultaction:integer;\r
numrr1:array[0..3] of integer;\r
numrr2:integer;\r
resultbin:tbinip;\r
resultlist:tbiniplist;\r
resultaction:integer;\r
numrr1:array[0..3] of integer;\r
numrr2:integer;\r
sendpacketlen:integer;\r
sendpacket:tdnspacket;\r
recvpacketlen:integer;\r
sendpacketlen:integer;\r
sendpacket:tdnspacket;\r
recvpacketlen:integer;\r
//function buildrequest(const name:string;var packet:tdnspacket;requesttype:word):integer;\r
\r
//returns the DNS name used to reverse look up an IP, such as 4.3.2.1.in-addr.arpa for 1.2.3.4\r
//function buildrequest(const name:string;var packet:tdnspacket;requesttype:word):integer;\r
\r
//returns the DNS name used to reverse look up an IP, such as 4.3.2.1.in-addr.arpa for 1.2.3.4\r
-function makereversename(const binip:tbinip):string;\r
+function makereversename(const binip:tbinip):ansistring;\r
-procedure setstate_request_init(const name:string;var state:tdnsstate);\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
//ipv6 results. Any other value will give only ipv4 results\r
\r
//set up state for a foward 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:string;var state:tdnsstate;family:integer);\r
+procedure setstate_forward(const name:ansistring;var state:tdnsstate;family:integer);\r
\r
procedure setstate_reverse(const binip:tbinip;var state:tdnsstate);\r
procedure setstate_failure(var state:tdnsstate);\r
//procedure setstate_return(const rrp:trrpointer;len:integer;var state:tdnsstate);\r
\r
//for custom raw lookups such as TXT, as desired by the user\r
\r
procedure setstate_reverse(const binip:tbinip;var state:tdnsstate);\r
procedure setstate_failure(var state:tdnsstate);\r
//procedure setstate_return(const rrp:trrpointer;len:integer;var state:tdnsstate);\r
\r
//for custom raw lookups such as TXT, as desired by the user\r
-procedure setstate_custom(const name:string; requesttype:integer; var state:tdnsstate);\r
+procedure setstate_custom(const name:ansistring; requesttype:integer; var state:tdnsstate);\r
\r
procedure state_process(var state:tdnsstate);\r
\r
\r
procedure state_process(var state:tdnsstate);\r
\r
//getcurrentsystemnameserver returns the nameserver the app should use and sets\r
//id to the id of that nameserver. id should later be used to report how laggy\r
//the servers response was and if it was timed out.\r
//getcurrentsystemnameserver returns the nameserver the app should use and sets\r
//id to the id of that nameserver. id should later be used to report how laggy\r
//the servers response was and if it was timed out.\r
-function getcurrentsystemnameserver(var id:integer) :string;\r
+function getcurrentsystemnameserver(var id:integer) :ansistring;\r
procedure reportlag(id:integer;lag:integer); //lag should be in microseconds and should be -1 to report a timeout\r
\r
//var\r
procedure reportlag(id:integer;lag:integer); //lag should be in microseconds and should be -1 to report a timeout\r
\r
//var\r
- failurereason:string;\r
+ failurereason:ansistring;\r
-function getquerytype(s:string):integer;\r
+function getquerytype(s:ansistring):integer;\r
-function getquerytype(s:string):integer;\r
+function getquerytype(s:ansistring):integer;\r
begin\r
s := uppercase(s);\r
result := 0;\r
begin\r
s := uppercase(s);\r
result := 0;\r
if (s = 'SPF') then result := querytype_spf;\r
end;\r
\r
if (s = 'SPF') then result := querytype_spf;\r
end;\r
\r
-function buildrequest(const name:string;var packet:tdnspacket;requesttype:word):integer;\r
+function buildrequest(const name:ansistring;var packet:tdnspacket;requesttype:word):integer;\r
arr:array[0..sizeof(packet)-1] of byte absolute packet;\r
begin\r
{ writeln('buildrequest: name: ',name);}\r
arr:array[0..sizeof(packet)-1] of byte absolute packet;\r
begin\r
{ writeln('buildrequest: name: ',name);}\r
arr[result-4] := requesttype shr 8;\r
end;\r
\r
arr[result-4] := requesttype shr 8;\r
end;\r
\r
-function makereversename(const binip:tbinip):string;\r
+function makereversename(const binip:tbinip):ansistring;\r
a,b:integer;\r
begin\r
name := '';\r
a,b:integer;\r
begin\r
name := '';\r
empty result + non null failurereason: failure\r
empty result + null failurereason: internal use\r
}\r
empty result + non null failurereason: failure\r
empty result + null failurereason: internal use\r
}\r
-function decodename(const packet:tdnspacket;len,start,recursion:integer;var numread:integer):string;\r
+function decodename(const packet:tdnspacket;len,start,recursion:integer;var numread:integer):ansistring;\r
var\r
arr:array[0..sizeof(packet)-1] of byte absolute packet;\r
var\r
arr:array[0..sizeof(packet)-1] of byte absolute packet;\r
a,b:integer;\r
begin\r
numread := 0;\r
a,b:integer;\r
begin\r
numread := 0;\r
\r
{==============================================================================}\r
\r
\r
{==============================================================================}\r
\r
-function getrawfromrr(const rrp:trrpointer;len:integer):string;\r
+function getrawfromrr(const rrp:trrpointer;len:integer):ansistring;\r
begin\r
setlength(result,htons(trr(rrp.p^).datalen));\r
uniquestring(result);\r
begin\r
setlength(result,htons(trr(rrp.p^).datalen));\r
uniquestring(result);\r
-procedure setstate_request_init(const name:string;var state:tdnsstate);\r
+procedure setstate_request_init(const name:ansistring;var state:tdnsstate);\r
begin\r
{destroy things properly}\r
state.resultstr := '';\r
begin\r
{destroy things properly}\r
state.resultstr := '';\r
state.parsepacket := false;\r
end;\r
\r
state.parsepacket := false;\r
end;\r
\r
-procedure setstate_forward(const name:string;var state:tdnsstate;family:integer);\r
+procedure setstate_forward(const name:ansistring;var state:tdnsstate;family:integer);\r
begin\r
setstate_request_init(name,state);\r
state.forwardfamily := family;\r
begin\r
setstate_request_init(name,state);\r
state.forwardfamily := family;\r
state.requesttype := querytype_ptr;\r
end;\r
\r
state.requesttype := querytype_ptr;\r
end;\r
\r
-procedure setstate_custom(const name:string; requesttype:integer; var state:tdnsstate);\r
+procedure setstate_custom(const name:ansistring; requesttype:integer; var state:tdnsstate);\r
begin\r
setstate_request_init(name,state);\r
state.requesttype := requesttype;\r
begin\r
setstate_request_init(name,state);\r
state.requesttype := requesttype;\r
currentdnsserver : pip_addr_string;\r
{$else}\r
t:textfile;\r
currentdnsserver : pip_addr_string;\r
{$else}\r
t:textfile;\r
a:integer;\r
{$endif}\r
begin\r
a:integer;\r
{$endif}\r
begin\r
-function getcurrentsystemnameserver(var id:integer):string;\r
+function getcurrentsystemnameserver(var id:integer):ansistring;\r
var\r
counter : integer;\r
\r
var\r
counter : integer;\r
\r
function getv6localips:tbiniplist;\r
var\r
t:textfile;\r
function getv6localips:tbiniplist;\r
var\r
t:textfile;\r
ip:tbinip;\r
a:integer;\r
begin\r
ip:tbinip;\r
a:integer;\r
begin\r
-uses binipstuff,classes,lcore;\r
+uses binipstuff,classes,lcore,pgtypes;\r
\r
{$include lcoreconfig.inc}\r
\r
\r
{$include lcoreconfig.inc}\r
\r
\r
implementation\r
uses\r
\r
implementation\r
uses\r
- lsocket,pgtypes,sysutils,winsock,windows,messages;\r
+ { zipplet: moved pgtypes to interface because it's needed for the string definitions }\r
+ lsocket,sysutils,winsock,windows,messages;\r
\r
type\r
//taddrinfo = record; //forward declaration\r
\r
type\r
//taddrinfo = record; //forward declaration\r
absoloutemaxs:integer=0;\r
\r
type\r
absoloutemaxs:integer=0;\r
\r
type\r
- {$IF CompilerVersion >= 20.0}\r
- { Delphi 2009/2010 widestring is the default string type }\r
- thostname = ansistring;\r
- tbufferstring = ansistring;\r
- tipstring = ansistring;\r
- {$else}\r
- { Old pre-unicode delphi, todo: need to check if ansistring is available\r
- in all older versions of delphi }\r
- thostname = string;\r
- tbufferstring = string;\r
- tipstring = string;\r
- {$ifend}\r
-\r
{$ifdef ver1_0}\r
sigset= array[0..31] of longint;\r
{$endif}\r
{$ifdef ver1_0}\r
sigset= array[0..31] of longint;\r
{$endif}\r
{$endif}\r
paddrint=^taddrint;\r
\r
{$endif}\r
paddrint=^taddrint;\r
\r
+ thostname = ansistring;\r
+ tbufferstring = ansistring;\r
+ tipstring = ansistring;\r
+\r