eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'IPv6SocketAddress':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: IPv6SocketAddress


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--SocketAddress
                  |
                  +--IPSocketAddress
                     |
                     +--IPv6SocketAddress

Package:
stx:libbasic2
Category:
OS-Sockets
Version:
rev: 1.27 date: 2019/05/27 12:10:30
user: cg
file: IPv6SocketAddress.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Claus Gittinger (cg@exept)

Description:


Instances of IPv6SocketAddress represent v6 IP socket addresses.
These consist of a 16byte hostId and a port number.

Contains
    2 byte domain AF_INET6  
    2 byte port
    4 byte flowInfo
    16 byte address
    4 byte scope



[instance variables:]

[class variables:]


Related information:



Class protocol:

addressing
o  anyAddress
return the anonymous addresses bytes

o  broadcastAddress
return the addresses bytes of a broadcast address
(this is the all-nodes link-local address ff02::1.
Broadcast is not normally used in IPv6

o  local
return the addresses bytes addressing the local host

conversion
o  hostAddressFromString: aString
convert an address given in a dot notation like 1:2:3:4:5:6:7:8 or ::1 or even ::

usage example(s):

        IPv6SocketAddress hostAddressFromString:'::'
        IPv6SocketAddress hostAddressFromString:'::1'
        IPv6SocketAddress hostAddressFromString:':1:2'
        IPv6SocketAddress hostAddressFromString:'1::2'
        IPv6SocketAddress hostAddressFromString:'1:2:3:4:5:6:7:8'
        IPv6SocketAddress hostAddressFromString:'1234:5678:9abc:def1:2345:6789:abcd:ef12'
        IPv6SocketAddress hostAddressFromString:'a:b:c:d:e:f:7:8'
        IPv6SocketAddress hostAddressFromString:'1::2:3:4'
        IPv6SocketAddress hostAddressFromString:'1:2:3::4'
        IPv6SocketAddress hostAddressFromString:'[1:2:3::4]'
        IPv6SocketAddress hostAddressFromString:'::1.2.3.4'

queries
o  domain

o  hostAddressLen
answer the number of bytes of the host address

o  obsoleteDomainSymbol

o  vwDomainSymbol


Instance protocol:

accessing
o  flowInfo
struct sockaddr_in6 {

o  hostAddress
struct sockaddr_in6 {

o  hostAddress: aByteArray

o  scopeId
struct sockaddr_in6 {

comparing
o  sameHostAddress: aSocketAddress
answer true, if myself and aSocketAddress have the same host address
(but possibly different ports).

converting
o  asIPv4SocketAddress
convert a IPv4 addresse mapped to IPv6 into real IPv4 IPSocketAddress

usage example(s):

        (self addressString:'0:0:0:0:0:ffff::') asIPv4SocketAddress
        (IPSocketAddress localHost port:80) asIPv6SocketAddress asIPv4SocketAddress

o  asIPv4SocketAddressIfPossible
try to convert to an IPv4 socket address (works when a IPv6 adreess is a mapped IPv4 address).
Answer myself, if the conversion is not possible.

usage example(s):

        (self addressString:'0:0:0:0:0:ffff::') asIPv4SocketAddressIfPossible
        (IPSocketAddress localHost port:80) asIPv6SocketAddress asIPv4SocketAddressIfPossible

o  asIPv6SocketAddress

printing & storing
o  printAddressOn: aStream
no more $: may be omitted

usage example(s):

       String streamContents:[:s | self localHost printAddressOn:s]
       String streamContents:[:s |(self hostAddress:#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) printAddressOn:s]
       String streamContents:[:s |(self hostAddress:#[1 2 3 4 5 6 7 8 0 0 0 0 0 0 0 0]) printAddressOn:s]
       String streamContents:[:s |(self hostAddress:#[0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8]) printAddressOn:s]
       String streamContents:[:s |(self hostAddress:#[0 0 0 0 1 2 3 4 5 6 7 8 0 0 0 0]) printAddressOn:s]
       String streamContents:[:s |(self hostAddress:#[16r1a 16r1b 0 0 0 0 0 0  0 0 0 0 0 0 0 0]) printAddressOn:s]

private
o  adrBytesStart

o  numAdrBytes

queries
o  networkAddress

o  networkClass
IPV6 doesn't know about network classes

** This is an obsolete interface - do not use it (it may vanish in future versions) **

testing
o  isBroadcast
answer true, if this is a broadcast address:
all node-local nodes: ff01::1
all link-local nodes: ff02::1

usage example(s):

        (self addressString:'ff01::1') isBroadcast
        (self addressString:'ff02::1') isBroadcast
        (self addressString:'ff01::55') isBroadcast

o  isGlobalUnicast
answer true, if this address is a global unicast address
in the range 2000::/3

o  isIPv6SocketAddress

o  isLinkLocalUnicast
answer true, if this address is a link local unicast address fe80::/10

o  isLocal
answer true, if this address addresses a peer on the same host: ::1/128

usage example(s):

        self localHost isLocal

o  isMappedIPv4
answer true, if this is a mapped IPv4 address

usage example(s):

        (self addressString:'0:0:0:0:0:ffff::') isMappedIPv4

o  isMulticast
answer true, if this address is a multicast address ff::/8

o  isUniqueLocalUnicast
answer true, if this address is a unique local unicast (e.g. private) address
in the range fc::/8 or fd::/8



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 25 Apr 2024 06:20:00 GMT