struct io.SocketAddress_ip6

Overview

This struct holds information about IP6 address in the form suitable for socket communications. More…

import "io_base.jncx"
import "io_SocketAddress.jnc"

struct SocketAddress_ip6 {
    // fields

    io.AddressFamily m_family;
    uint16_t bigendian m_port;
    uint32_t m_flow;
    io.Address_ip6 m_address;
    uint32_t m_scope;

    // methods

    bool isEqual(io.SocketAddress_ip6 const* address) const;
    bool isMatch(io.SocketAddress_ip6 const* filterAddress) const;
    bool errorcode parse(string_t string);
    string_t getString() const;

    // aliases

    alias toString = getString;
    alias fromString = parse;
};

Detailed Documentation

This struct holds information about IP6 address in the form suitable for socket communications.

On the binary level this structure directly maps to sockaddr_in6.

See also:

io.Socket, io.HostNameResolver

Fields

io.AddressFamily m_family

Holds the address family of the socket address; should be set to io.AddressFamily.Ip6.

uint16_t bigendian m_port

Holds the number of TCP or UDP port. There is no need to change the byte order of the port before assignment – this field is already declared as bigendian so all the necessary conversions will happen automatically.

uint32_t m_flow

Holds IP6 flow information.

io.Address_ip6 m_address

Holds IP6 address as io.Address_ip6.

uint32_t m_scope

Holds 32-bit IP6 scope identifier.

Methods

bool isEqual(io.SocketAddress_ip6 const* address) const

Checks two IP6 socket addresses for equality; returns true if addresses are equal and false otherwise.

bool isMatch(io.SocketAddress_ip6 const* filterAddress) const

Checks two IP6 socket addresses for matching. The term matching requires some explanation.

Matching could be described as a non-strict equality check. We may decide to only check port for equality and ignore the address. To do so, set m_address field of filter argument to 0.

Or the other way around – only check address and ignore port – set m_port field of filter argument to 0.

Returns true if addresses match and false otherwise.

bool errorcode parse(string_t string)

Constructs the address from a string representation in string argument.

Returns true if address string was parsed successfully. Otherwise, sets the description of parsing error and returns false [1].

string_t getString() const

Creates and returns a string representation of the address.

Aliases

alias toString = getString

Effectively makes io.SocketAddress_ip6 a stringable class.


Footnotes