union io.Address_ip4

Overview

This union holds information about IP4 address More…

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

union Address_ip4 {
    // fields

    bigendian unsigned int m_i32;
    uint8_t m_i8[];

    // methods

    bool errorcode parse(string_t string);
    string_t getString() const;

    // aliases

    alias toString = getString;
};

Detailed Documentation

This union holds information about IP4 address

On the binary level this union directly maps to in_addr.

See also:

io.SocketAddress_ip4

Fields

bigendian unsigned int m_i32

Holds 32-bit representation of IP4 address. There is no need to change the byte order of the address before assignment – this field is already declared as bigendian so all the necessary conversions will happen automatically.

uint8_t m_i8[]

Holds four 8-bit bytes of IP4 address.

Methods

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.Address_ip4 a stringable class.


Footnotes