--- a/IPv6SocketAddress.st Thu Jul 11 13:37:54 2013 +0200
+++ b/IPv6SocketAddress.st Thu Jul 11 13:37:57 2013 +0200
@@ -69,10 +69,10 @@
broadcastAddress
"return the addresses bytes of a broadcast address
- (this is the all-nodes address ff01::1.
+ (this is the all-nodes link-local address ff02::1.
Broadcast is not normally used in IPv6"
- ^ #[16rff 16r01 0 0 0 0 0 0 0 0 0 0 0 0 0 16r01]
+ ^ #[16rff 16r02 0 0 0 0 0 0 0 0 0 0 0 0 0 16r01]
!
local
@@ -158,7 +158,7 @@
hostAddressLen
"answer the number of bytes of the host address"
- ^ 8
+ ^ 16
!
obsoleteDomainSymbol
@@ -270,6 +270,33 @@
!IPv6SocketAddress methodsFor:'testing'!
+isBroadcast
+ "answer true, if this is a broadcast address:
+ all node-local nodes: ff01::1
+ all link-local nodes: ff02::1"
+
+ ^ (self at:9) == 16rff
+ and:[((self at:10) bitAnd:16r03) ~~ 0
+ and:[self sameContentsFrom:11 to:24 as:#[0 0 0 0 0 0 0 0 0 0 0 0 0 1] startingAt:1]]
+
+ "
+ (self addressString:'ff01::1') isBroadcast
+ (self addressString:'ff02::1') isBroadcast
+ (self addressString:'ff01::55') isBroadcast
+ "
+!
+
+isGlobalUnicast
+ "answer true, if this address is a global unicast address
+ in the range 2000::/3"
+
+ ^ (self at:9) between:16r20 and:16r3f
+!
+
+isIPv6SocketAddress
+ ^ true
+!
+
isLinkLocalUnicast
"answer true, if this address is a link local unicast address fe80::/10"
@@ -277,24 +304,35 @@
!
isLocal
- "answer true, if this address adresses a peer on the same host"
+ "answer true, if this address adresses a peer on the same host: ::1/128"
^ (self at:9) == 0 and:[self hostAddress = self class local]
+
+ "
+ self localHost isLocal
+ "
!
isMulticast
- "answer true, if this address is a link local unicast address ff::/8"
+ "answer true, if this address is a multicast address ff::/8"
^ (self at:9) == 16rff
+!
+
+isUniqueLocalUnicast
+ "answer true, if this address is a unique local unicast (e.g. private) address
+ in the range fc::/8 or fd::/8"
+
+ ^ (self at:9) == 16rfc or:[(self at:9) == 16rfd]
! !
!IPv6SocketAddress class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/IPv6SocketAddress.st,v 1.15 2013-07-10 08:22:46 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPv6SocketAddress.st,v 1.16 2013-07-11 11:37:57 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/IPv6SocketAddress.st,v 1.15 2013-07-10 08:22:46 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPv6SocketAddress.st,v 1.16 2013-07-11 11:37:57 stefan Exp $'
! !