scclib
Stable Cloud Computing C++ Library
Public Member Functions | List of all members
scc::net::InetAddr Class Reference

Ipv6 internet address. More...

#include <inet.h>

Inheritance diagram for scc::net::InetAddr:
Inheritance graph
[legend]
Collaboration diagram for scc::net::InetAddr:
Collaboration graph
[legend]

Public Member Functions

 InetAddr ()
 ipv6 internet address, initialized with "any" address
 
 InetAddr (unsigned)
 ipv6 internet address, with specified port (address set to any).
 
 InetAddr (const std::string &, unsigned)
 ipv6 internet address, with specified host address and port.
 
 InetAddr (const sockaddr *)
 ipv6 internet address, initialized with socket address.
 
 InetAddr (const InetAddr &)
 ipv6 internet address, copy constructed.
 
InetAddroperator= (const InetAddr &)
 ipv6 internet address, copy assigned.
 
 InetAddr (InetAddr &&)
 ipv6 internet address, move constructed. More...
 
InetAddroperator= (InetAddr &&)
 ipv6 internet address, move assigned. More...
 
virtual ~InetAddr ()
 ipv6 internet address destructor.
 
virtual operator const sockaddr * () const
 Socket address const pointer.
 
virtual operator sockaddr * ()
 Socket address pointer.
 
virtual unsigned len () const
 Socket address length in bytes.
 
virtual std::string str () const
 Readable address string.
 
virtual std::string host () const
 Get host.
 
 operator const sockaddr_in6 * () const
 IPv6 socket address pointer.
 
void any_host ()
 Set to "any" host address ::
 
void local_host ()
 Set to local (loopback) address ::1.
 
void host (const std::string &)
 Set the host address. More...
 
unsigned port () const
 Get the port.
 
void port (unsigned)
 Set the port.
 
void scope_id (uint32_t)
 Set the scope id of the address. More...
 
uint32_t scope_id () const
 Get the scope id of the address.
 
int flags () const
 Return the address flags. More...
 
bool test_flags (int f) const
 Test if flags are set in this address.
 

Detailed Description

Ipv6 internet address.

An ipv4 address can be embedded in ipv6 for example, with ipv4/ipv6

Example:

::ffff:192.168.1.2

The default address is any host (all zeroes or ::)

Examples
examples/net/netmain.cc, net/unittest/inet.cc, net/unittest/inet_stream.cc, net/unittest/inetaddr.cc, and net/unittest/net_if.cc.

Definition at line 119 of file inet.h.

Constructor & Destructor Documentation

◆ InetAddr()

InetAddr::InetAddr ( InetAddr &&  b)

ipv6 internet address, move constructed.

The original address is set to any.

Definition at line 110 of file inet.cc.

Member Function Documentation

◆ flags()

int InetAddr::flags ( ) const

Return the address flags.

The address flags cover commonly used IPv6 address cases and are not exhaustive.

See also
InetAddrFlag for covered cases.

Definition at line 215 of file inet.cc.

◆ host()

void InetAddr::host ( const std::string &  h)

Set the host address.

Any host :: Local host ::1 ipv4 host ::ffff:192.168.1.2

Definition at line 175 of file inet.cc.

◆ operator=()

InetAddr & InetAddr::operator= ( InetAddr &&  b)

ipv6 internet address, move assigned.

The original address is set to any.

Definition at line 116 of file inet.cc.

◆ scope_id()

void InetAddr::scope_id ( uint32_t  s)

Set the scope id of the address.

Used for "scoped" addresses: for link-local (fe80::/10), the scope_id is the interface index (see net::Network_if). for site-local (fec0::/10), the scope_id is the site identifier.

If the scope_id is not set for a scoped address, the routing table may be used to find an address.

In general link-local unicast (fe80::/64) or link-scope multicast (ff00::/8) may require scope_id to route correctly.

Definition at line 165 of file inet.cc.


The documentation for this class was generated from the following files: