Thrill  0.1
IPv6Address Class Reference

Detailed Description

IPv6 Subclass of SocketAddress for direct initialization from a known IPv6 address, known either in binary format, numerals, or in some IPv6 format.

No name lookup or resolution takes place in these functions.

Definition at line 247 of file socket_address.hpp.

+ Inheritance diagram for IPv6Address:
+ Collaboration diagram for IPv6Address:

#include <socket_address.hpp>

Public Member Functions

 IPv6Address ()
 Create uninitialized IPv6 address. More...
 
 IPv6Address (uint16_t port)
 Create an IPv6 address and initialize only the port part. More...
 
 IPv6Address (uint8_t addr[16], uint16_t port)
 Create an IPv6 address object with initialized address and port parts. More...
 
 IPv6Address (struct in6_addr &addr, uint16_t port)
 Create an IPv4 address object with initialized address and port parts. More...
 
 IPv6Address (struct sockaddr_in6 &sa)
 Create an IPv4 address object and copy the given sockaddr_in structure. More...
 
 IPv6Address (const char *ipstring, uint16_t port=0)
 
- Public Member Functions inherited from SocketAddress
 SocketAddress ()
 Create empty invalid address object by clearing all bytes. More...
 
 SocketAddress (struct sockaddr *sa, socklen_t salen)
 Create a socket address object with the given sockaddr data. More...
 
 SocketAddress (const std::string &hostport)
 
 SocketAddress (const char *hostname, const char *servicename)
 
uint16_t GetPort () const
 Return the currently set port address in host byte-order. More...
 
const char * GetResolveError () const
 
bool IsIPv4 () const
 Returns true if the enclosed socket address is a IPv4 address. More...
 
bool IsIPv6 () const
 Returns true if the enclosed socket address is a IPv6 address. More...
 
bool IsValid () const
 
bool Resolve (const char *hostname, const char *servicename=nullptr)
 
void SetPort (uint16_t port)
 Change the currently set port address. More...
 
struct sockaddr * sockaddr ()
 Return pointer to enclosed address as a generic sockattr struct. More...
 
const struct sockaddr * sockaddr () const
 Return pointer to enclosed address as a generic sockattr struct. More...
 
struct sockaddr_in * sockaddr_in ()
 Cast the enclosed sockaddr into the sockaddr_in IPv4 structure. More...
 
const struct sockaddr_in * sockaddr_in () const
 
struct sockaddr_in6 * sockaddr_in6 ()
 Cast the enclosed sockaddr into the sockaddr_in6 IPv6 structure. More...
 
const struct sockaddr_in6 * sockaddr_in6 () const
 
socklen_t socklen () const
 Return total length of enclosed sockaddr structure. More...
 
std::string ToStringHost () const
 Return the enclosed socket address as a string without the port number. More...
 
std::string ToStringHostPort () const
 Return the enclosed socket address as a string with the port number. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SocketAddress
static std::vector< SocketAddressResolveAll (const char *hostname, const char *servicename=nullptr)
 
static SocketAddress ResolveOne (const char *hostname, const char *servicename=nullptr)
 
static SocketAddress ResolveWithPort (const char *hostname, const char *defaultservice)
 
- Protected Attributes inherited from SocketAddress
union thrill::net::tcp::SocketAddress::SockAddrUnion sockaddr_
 

Constructor & Destructor Documentation

◆ IPv6Address() [1/6]

IPv6Address ( )
inline

Create uninitialized IPv6 address.

Definition at line 251 of file socket_address.hpp.

References SocketAddress::SockAddrUnion::in6, and SocketAddress::sockaddr_.

◆ IPv6Address() [2/6]

IPv6Address ( uint16_t  port)
inlineexplicit

Create an IPv6 address and initialize only the port part.

Definition at line 256 of file socket_address.hpp.

References SocketAddress::SockAddrUnion::in6, and SocketAddress::sockaddr_.

◆ IPv6Address() [3/6]

IPv6Address ( uint8_t  addr[16],
uint16_t  port 
)
inline

Create an IPv6 address object with initialized address and port parts.

Definition at line 263 of file socket_address.hpp.

References SocketAddress::SockAddrUnion::in6, and SocketAddress::sockaddr_.

◆ IPv6Address() [4/6]

IPv6Address ( struct in6_addr &  addr,
uint16_t  port 
)
inline

Create an IPv4 address object with initialized address and port parts.

Definition at line 271 of file socket_address.hpp.

References SocketAddress::SockAddrUnion::in6, and SocketAddress::sockaddr_.

◆ IPv6Address() [5/6]

IPv6Address ( struct sockaddr_in6 sa)
inlineexplicit

Create an IPv4 address object and copy the given sockaddr_in structure.

Definition at line 279 of file socket_address.hpp.

References SocketAddress::SockAddrUnion::in6, and SocketAddress::sockaddr_.

◆ IPv6Address() [6/6]

IPv6Address ( const char *  ipstring,
uint16_t  port = 0 
)
explicit

Create an IPv6 address object and initialize it with the given ip address string, which is given in some IPv6 format. You must check with IsValid() if the conversion was successfull.

Definition at line 198 of file socket_address.cpp.

References SocketAddress::sockaddr_in6().


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