UNISTDX_NET_IPV4_ADDRESS
using socket_address_type = struct ::sockaddr

Socket address type.

using prefix_type = unsigned int

Network prefix type.

using sockinet4_type = struct ::sockaddr_in

IPv4 socket address type.

using port_type = ::in_port_t

Socket port type.

using addr4_type = ::in_addr_t

IPv4 address representation unsigned integer type.

using inet4_type = struct ::in_addr

IPv4 Internet address type.

class sys::ipv4_address

IPv4 address class.

Types
  • using size_type = size_t

    Alias to std::size_t.

  • using const_iterator = const_pointer

    Constant iterator.

  • using iterator = pointer

    Iterator.

  • using reference = value_type &

    Reference to octet.

  • using pointer = value_type *

    Pointer to octet.

  • using rep_type = addr4_type

    Unsigned 4-byte integer type.

  • using value_type = u8

    Octet type.

Fields
Methods
  • from_prefix(prefix_type prefix) -> ipv4_address

    Create network mask from network prefix.

  • size() -> constexpr static size_type

    Get the number of octets.

  • position(ipv4_address netmask) const -> constexpr addr4_type

    Compute address position in the subnetwork specified by netmask.

  • to_prefix() const -> prefix_type

    Return network prefix assuming that this address is network mask.

  • clear() -> void
  • back() const -> value_type

    Get last octet.

  • back() -> reference

    Get last octet.

  • front() const -> value_type

    Get first octet.

  • front() -> reference

    Get first octet.

  • end() const -> const_iterator

    Get iterator to the end of octet array.

  • end() -> iterator

    Get iterator to the end of octet array.

  • begin() const -> const_iterator

    Get iterator to the beginning of octet array.

  • begin() -> iterator

    Get iterator to the beginning of octet array.

  • data() const -> const_pointer

    Get pointer to the first octet.

  • data() -> pointer

    Get pointer to the first octet.

  • operator[](size_type i) const -> constexpr value_type

    Get specified octet.

  • operator[](size_type i) -> reference

    Get reference to the specified octet.

  • operator!() const -> constexpr bool

    Returns true if integer representations is nought.

  • operator bool() const -> constexprexplicit

    Returns true if integer representations is non-nought.

  • operator!=(ipv4_address rhs) const -> constexpr bool

    Compare address integer representations.

  • operator==(ipv4_address rhs) const -> constexpr bool

    Compare address integer representations.

  • operator>=(const ipv4_address & rhs) const -> constexpr bool
  • operator>(const ipv4_address & rhs) const -> constexpr bool
  • operator<=(const ipv4_address & rhs) const -> constexpr bool
  • operator<(const ipv4_address & rhs) const -> constexpr bool

    Compare address integer representations.

  • operator const inet4_type &() const -> constexpr

    Automatically cast to in_addr system type.

  • rep() const -> constexpr addr4_type

    Get integer representation of the address.

  • ipv4_address(const char * rhs)explicit
  • ipv4_address(const sockinet4_type & rhs)

    Construct IPv4 address from sockaddr system type.

  • ipv4_address(value_type o1, value_type o2, value_type o3, value_type o4) -> constexpr

    Construct IPv4 address manually specifying each octet.

  • ipv4_address(const inet4_type & rhs) -> constexprexplicit

    Construct IPv4 address from in_addr system type.

  • ipv4_address(const ipv4_address & rhs) -> constexpr

    Copy-constructor.

  • ipv4_address(addr4_type rhs) -> constexprexplicit

    Construct IPv4 address from integer type.

  • ipv4_address() -> constexpr
Friends
  • operator>>

    Get address in binary form.

  • operator<<

    Put address in binary form.

  • operator>>

    Parse textual representation of the address.

  • operator<<

    Print textual representation of the address.

struct sys::ipaddr_traits< ipv4_address >

Specialisation of ipaddr_traits for ipv4_address.

Types
Fields
  • constexpr const sa_family_type family

    IP-address family.

  • constexpr const value_type loopback_first_octet

    First octet of loopback address.

Methods
struct std::hash< sys::ipv4_address >

Specialisation of std::hash for sys::ipv4_address.

Base classes
  • public std::hash< sys::ipv4_address::rep_type >
Derived classes
Types
  • using argument_type = sys::ipv4_address

    Hash function argument type.

  • using result_type = size_t

    Hash function return value type.

Methods
operator<<(std::ostream & out, ipv4_address rhs) -> std::ostream &

Print textual representation of the address.

operator>>(std::istream & in, ipv4_address & rhs) -> std::istream &

Parse textual representation of the address.