procedure biniplist_free(var l:tbiniplist);\r
procedure biniplist_addlist(var l:tbiniplist;const l2:tbiniplist);\r
function biniplist_tostr(const l:tbiniplist):string;\r
+function isbiniplist(const l:tbiniplist):boolean;\r
\r
function htons(w:word):word;\r
function htonl(i:uint32):uint32;\r
{$endif}\r
end;\r
\r
-{------------------------------------------------------------------------------}\r
+{-----------biniplist stuff--------------------------------------------------}\r
+\r
+const\r
+ biniplist_prefix='bipl'#0;\r
+ biniplist_prefixlen=length(biniplist_prefix);\r
\r
function biniplist_new:tbiniplist;\r
begin\r
- result := '';\r
+ result := biniplist_prefix;\r
end;\r
\r
procedure biniplist_add(var l:tbiniplist;ip:tbinip);\r
\r
function biniplist_getcount(const l:tbiniplist):integer;\r
begin\r
- result := length(l) div sizeof(tbinip);\r
+ result := (length(l)-biniplist_prefixlen) div sizeof(tbinip);\r
end;\r
\r
function biniplist_get(const l:tbiniplist;index:integer):tbinip;\r
fillchar(result,sizeof(result),0);\r
exit;\r
end;\r
- move(l[index*sizeof(tbinip)+1],result,sizeof(result));\r
+ move(l[index*sizeof(tbinip)+1+biniplist_prefixlen],result,sizeof(result));\r
end;\r
\r
procedure biniplist_set(var l:tbiniplist;index:integer;ip:tbinip);\r
begin\r
uniquestring(l);\r
- move(ip,l[index*sizeof(tbinip)+1],sizeof(ip));\r
+ move(ip,l[index*sizeof(tbinip)+1+biniplist_prefixlen],sizeof(ip));\r
end;\r
\r
procedure biniplist_setcount(var l:tbiniplist;newlen:integer);\r
begin\r
- setlength(l,sizeof(tbinip)*newlen);\r
+ setlength(l,(sizeof(tbinip)*newlen)+biniplist_prefixlen);\r
end;\r
\r
procedure biniplist_free(var l:tbiniplist);\r
result := result + ')';\r
end;\r
\r
+function isbiniplist(const l:tbiniplist):boolean;\r
+var\r
+ i : integer;\r
+begin\r
+ for i := 1 to biniplist_prefixlen do begin\r
+ if biniplist_prefix[i] <> l[i] then begin\r
+ result := false;\r
+ exit;\r
+ end;\r
+ end;\r
+ result := true;\r
+end;\r
+\r
end.\r
end;\r
\r
procedure tsc.dnsrequestdone(sender:tobject;error : word);\r
+var\r
+ tempbinip : tbinip;\r
+ tempbiniplist : tbiniplist;\r
begin\r
writeln('irc.ipv6.p10link.net resolved to '+das.dnsresult+' connecting client socket there');\r
- clientsocket.addr := das.dnsresult;\r
+ das.dnsresultbin(tempbinip);\r
+ tempbiniplist := biniplist_new;\r
+ biniplist_add(tempbiniplist,tempbinip);\r
+ clientsocket.addr := tempbiniplist;\r
clientsocket.port := '6667';\r
clientsocket.connect;\r
writeln(clientsocket.getxaddr);\r
begin\r
if state <> wsclosed then close;\r
//prevtime := 0;\r
-\r
- biniplist := forwardlookuplist(addr,0);\r
+ if isbiniplist(addr) then biniplist := addr else biniplist := forwardlookuplist(addr,0);\r
if biniplist_getcount(biniplist) = 0 then raise exception.create('unable to resolve '+addr);\r
\r
//makeinaddrv(addr,port,inaddr);\r
{$endif}\r
addr := '0.0.0.0';\r
end;\r
- biniptemp := forwardlookup(addr,10);\r
+ if isbiniplist(addr) then biniptemp := biniplist_get(addr,0) else biniptemp := forwardlookup(addr,10);\r
addr := ipbintostr(biniptemp);\r
fdhandlein := socket(biniptemp.family,socktype,0);\r
{$ifdef ipv6}\r