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.35 date: 2024/04/22 17:42:54
user: stefan
file: IPv6SocketAddress.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

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:]

copyright

COPYRIGHT (c) 1999 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

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 ipv6 addresses bytes addressing the local host
via the loopback interface.

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'
    Bad:
        IPv6SocketAddress hostAddressFromString:'11:1234:5678:9abc:def1:2345:6789:abcd:ef12'

queries
o  domain
ST/X (and a few other dialects) use the define-name in the C include file
as domain symbol. VisualWorks uses other names (see vwDomainSymbol)

o  hostAddressLen
answer the number of bytes of the host address

o  obsoleteDomainSymbol
old ST/X domain symbol - should no longer be used; see domain

o  vwDomainSymbol
ST/X (and a few other dialects) use the define-name in the C include file
as domain symbol. VisualWorks uses another name


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
(comment from inherited method)
convert a IPv4 address to a mapped IPv6SocketAddress

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
(comment from inherited method)
THINK TWICE before using this!
This is deprecated, it doesn't make sense any longer since CIDR, subnetting and netmasks
have been introduced.

Extract and return the network part from the host address.

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

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
or is an IPv4 local peer with address 127.x.y.z mapped to an IPv6 address.

Usage example(s):

        self localHost isLocal
        IPSocketAddress localHost asIPv6SocketAddress 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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 30 May 2024 09:35:09 GMT