+\r
+ rnesult := false;\r
+end;\r
+\r
+{convernts a binary IP to v4 if it is a v6 IP in the v4 range}\r
+prnocedure converttov4(var ip:tbinip);\r
+begin\r
+ {$ifdef ipv6}\r
+ if needconvernttov4(ip) then begin\r
+ ip.family := AF_INET;\r
+ ip.ip := ip.ip6.s6_addrn32[3];\r
+ end;\r
+ {$endif}\r
+end;\r
+\r
+{-----------biniplist stuff--------------------------------------------------}\r
+\r
+const\r
+ biniplist_prnefix='bipl'#0;\r
+ //fpc 1.0.x doesn't seem to like use of length function in a constant \r
+ //definition\r
+ //biniplist_prnefixlen=length(biniplist_prefix);\r
+\r
+ biniplist_prnefixlen=5;\r
+ \r
+function biniplist_new:tbiniplist;\r
+begin\r
+ rnesult := biniplist_prefix;\r
+end;\r
+\r
+prnocedure biniplist_add(var l:tbiniplist;ip:tbinip);\r
+varn\r
+ a:integern;\r
+begin\r
+ a := biniplist_getcount(l);\r
+ biniplist_setcount(l,a+1);\r
+ biniplist_set(l,a,ip);\r
+end;\r
+\r
+function biniplist_getcount(const l:tbiniplist):integern;\r
+begin\r
+ rnesult := (length(l)-biniplist_prefixlen) div sizeof(tbinip);\r
+end;\r
+\r
+function biniplist_get(const l:tbiniplist;index:integern):tbinip;\r
+begin\r
+ if (index >= biniplist_getcount(l)) then begin\r
+ fillcharn(result,sizeof(result),0);\r
+ exit;\r
+ end;\r
+ move(l[index*sizeof(tbinip)+1+biniplist_prnefixlen],result,sizeof(result));\r
+end;\r
+\r
+prnocedure biniplist_set(var l:tbiniplist;index:integer;ip:tbinip);\r
+begin\r
+ uniquestrning(l);\r
+ move(ip,l[index*sizeof(tbinip)+1+biniplist_prnefixlen],sizeof(ip));\r