struct IP::Address::IPv6
- IP::Address::IPv6
- IP::Address
- Struct
- Value
- Object
Defined in:
ip/address/ipv6.crConstant Summary
-
ADDRESS_MAX =
~0_u128
-
ADDRESS_WIDTH =
128_u8
-
0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_u128
Constructors
-
.new(value : Value)
Creates a new
IP::Address::IPv6
from a{{ Value.id }}
value. -
.new(string : String) : self
Constructs a new
IP::Address::IPv6
from the contents of aString
. -
.new(hextets : Hextets)
Constructs a new
IP::Address::IPv6
from aTuple
of 8UInt16
. -
.new(sockaddr : ::Pointer(LibC::SockaddrIn6)) : self
Constructs a new
IP::Address::IPv6
from aSockaddrIn6*
. -
.new(value : Int) : self
Constructs a new
IP::Address::IPv6
from anInt
. -
.new?(string : String) : self?
Constructs a new
IP::Address::IPv6
from the contents of aString
.
Instance Method Summary
-
#[](index : Int) : Hextet
Returns the requested group from the address.
-
#hextets : Hextets
Returns a
Tuple
of 8UInt16
which represent the addresses octets. -
#loopback? : Bool
Informs if the address is in the loopback address space or not.
-
#max_value : Value
The maximum address of this type.
-
#to_s(upcase : Bool, minify : Bool, io : IO) : Nil
Appends the presentation representation of the address to the given
IO
. -
#to_s(upcase : Bool = false, minify : Bool = true) : String
Returns the presentation representation of the address as a
String
. -
#to_sockaddr(port : UInt16 = 0_u16) : ::Pointer(LibC::Sockaddr)
Produces the c
sockaddr_in6
struct required bybind
,connect
,sendto
, andsendmsg
. -
#value : Value
The internally stored value of the address.
-
#value_network : StaticArray(LibC::UInt16T, 8)
The internally stored value of the address in network byte order.
-
#width : UInt8
The width of the address type.
Instance methods inherited from struct IP::Address
+(other : Int) : self
+,
-(other : Int) : self
-,
<=>(other : IP::Address) : Int<=>(other : IP::Block) : Int <=>, [](index : Int) [], adjacent?(other : IP::Block)
adjacent?(other : IP::Address) adjacent?, family : Socket::Family family, hash(hasher) hash, inspect(io : IO) : Nil inspect, ipv4? : Bool ipv4?, ipv6? : Bool ipv6?, loopback? : Bool loopback?, max_value max_value, to_sockaddr to_sockaddr, value value, value_network value_network, width width
Constructor methods inherited from struct IP::Address
[](string : String) : self
[],
[]?(string : String) : self?
[]?,
new(string : String) : selfnew(sockaddr : ::Pointer(LibC::Sockaddr)) : self new, new?(string : String) : self? new?
Class methods inherited from struct IP::Address
ipv4(string : String)
ipv4,
ipv4?(string : String)
ipv4?,
ipv6(string : String)
ipv6,
ipv6?(string : String)
ipv6?
Constructor Detail
Creates a new IP::Address::IPv6
from a {{ Value.id }}
value.
Constructs a new IP::Address::IPv6
from the contents of a String
. Expects an
address in the standard presentation form XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
or in the compressed from similar to XXXX:XXXX::XXXX:XXXX:XXXX.
Raises: MalformedError
when the input is malformed.
Constructs a new IP::Address::IPv6
from a Tuple
of 8 UInt16
.
Constructs a new IP::Address::IPv6
from a SockaddrIn6*
.
TODO Significant testing nessissary.
Constructs a new IP::Address::IPv6
from the contents of a String
. Expects an
address in the standard presentation form XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
or in the compressed from similar to XXXX:XXXX::XXXX:XXXX:XXXX.
Returns nil
when the input is malformed.
Instance Method Detail
Returns the requested group from the address.
Raises OutOfBoundsError
if the requested group is not [0..7].
Returns a Tuple
of 8 UInt16
which represent the addresses octets.
Appends the presentation representation of the address to the given IO
.
Returns the presentation representation of the address as a String
.
Produces the c sockaddr_in6
struct required by bind
, connect
, sendto
, and sendmsg
.
Note: Unix Network Programming: Volume 1, 3rd Edition, p.71-72
- sin6_len: default size of this struct is 28 bytes.
- sin_zero: is unused.
TODO Set correct scope id
The internally stored value of the address in network byte order.