inet6 address components cannot be stored as bytes as they are 16 bits long

db4
Samuel Tardieu 2009-01-16 10:17:36 +01:00
parent 72a3d309f9
commit 573c150409
2 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,9 @@ concurrency.promises threads io.streams.string ;
[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ]
[ "::1" T{ inet6 } inet-pton ] unit-test
[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 } ]
[ "::100" T{ inet6 } inet-pton ] unit-test
[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ]
[ "1::2" T{ inet6 } inet-pton ] unit-test
@ -45,6 +48,9 @@ concurrency.promises threads io.streams.string ;
[ "1:2:0:0:0:0:3:4" ]
[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test
[ "2001:6f8:37a:5:0:0:0:1" ]
[ "2001:6f8:37a:5::1" T{ inet6 } [ inet-pton ] [ inet-ntop ] bi ] unit-test
[ t ] [ "localhost" 80 <inet> resolve-host length 1 >= ] unit-test
! Smoke-test UDP

View File

@ -109,7 +109,7 @@ M: invalid-inet6 summary drop "Invalid IPv6 address" ;
[ f ] [
":" split [
hex> [ "Component not a number" throw ] unless*
] B{ } map-as
] { } map-as
] if-empty ;
: pad-inet6 ( string1 string2 -- seq )