addr_storage Class Reference
Wrapper for ip an IP address storage.
#include "addr_storage.hpp"
Public Member Functions | |
addr_storage (const struct sockaddr &m_addr) | |
addr_storage (const struct in6_addr &m_addr) | |
addr_storage (const struct in_addr &m_addr) | |
addr_storage (const addr_storage &m_addr) | |
addr_storage (const struct sockaddr_storage &m_addr) | |
addr_storage (const std::string &m_addr) | |
addr_storage (int addr_family) | |
addr_storage () | |
int | get_addr_family () const |
struct sockaddr_storage | get_sockaddr_storage () |
addr_storage & | mask (const addr_storage &s) |
bool | operator!= (addr_storage &addr) const |
addr_storage & | operator= (const struct sockaddr &s) |
addr_storage & | operator= (const struct in6_addr &s) |
addr_storage & | operator= (const struct in_addr &s) |
addr_storage & | operator= (const std::string &s) |
addr_storage & | operator= (const struct sockaddr_storage &s) |
addr_storage & | operator= (const addr_storage &s) |
bool | operator== (const addr_storage &addr) const |
std::string | to_string () const |
Static Public Member Functions | |
static void | test_addr_storage () |
Friends | |
bool | operator< (const addr_storage &addr1, const addr_storage &addr2) |
std::ostream & | operator<< (std::ostream &s, const addr_storage a) |
struct in6_addr & | operator<<= (struct in6_addr &l, const addr_storage &r) |
struct in_addr & | operator<<= (struct in_addr &l, const addr_storage &r) |
struct sockaddr_storage & | operator<<= (struct sockaddr_storage &l, const addr_storage &r) |
Constructor & Destructor Documentation
addr_storage::addr_storage | ( | ) |
Create a zero addr_storage.
References HC_LOG_TRACE, and INIT_ADDR_FAMILY.
Referenced by test_addr_storage().
addr_storage::addr_storage | ( | int | addr_family | ) |
Create a zero address specific storage.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const std::string & | m_addr | ) |
Create an addr_storage based on a clear text ip.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const struct sockaddr_storage & | m_addr | ) |
Create an addr_storage based on the struct sockaddr_storage.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const addr_storage & | m_addr | ) |
Copy constructor.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const struct in_addr & | m_addr | ) |
Create an addr_storage based on struct in_add.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const struct in6_addr & | m_addr | ) |
Create an addr_storage based on struct in6_addr.
References HC_LOG_TRACE.
addr_storage::addr_storage | ( | const struct sockaddr & | m_addr | ) |
Create an addr_storage based on struct sockaddr.
References HC_LOG_TRACE.
Member Function Documentation
int addr_storage::get_addr_family | ( | ) | const |
- Returns:
- current address family AF_INET or AF_INET6 or INIT_ADDR_FAMILY
References HC_LOG_TRACE.
struct sockaddr_storage addr_storage::get_sockaddr_storage | ( | ) | [read] |
- Returns:
- struct sockaddr_storage
References HC_LOG_TRACE.
addr_storage & addr_storage::mask | ( | const addr_storage & | s | ) |
mask an addr with a netmask
References HC_LOG_ERROR, and HC_LOG_TRACE.
Referenced by test_addr_storage().
bool addr_storage::operator!= | ( | addr_storage & | addr | ) | const |
disjunction to operator==
References HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const struct sockaddr & | s | ) |
copy operator struct sockaddr to class addr_storage
References HC_LOG_ERROR, and HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const struct in6_addr & | s | ) |
copy operator struct in6_addr to class addr_storage
References HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const struct in_addr & | s | ) |
copy operator struct in_addr to class addr_storage
References HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const std::string & | s | ) |
copy operator string to class addr_storage
References HC_LOG_ERROR, and HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const struct sockaddr_storage & | s | ) |
copy operator struct sockaddr_storage to class addr_storage
References HC_LOG_TRACE.
addr_storage & addr_storage::operator= | ( | const addr_storage & | s | ) |
default copy operator
References HC_LOG_TRACE.
bool addr_storage::operator== | ( | const addr_storage & | addr | ) | const |
compare two addresses if one of this addresses unknown the function returns false
References HC_LOG_TRACE, and to_string().
void addr_storage::test_addr_storage | ( | ) | [static] |
simple test output
References addr_storage(), HC_LOG_TRACE, mask(), and to_string().
std::string addr_storage::to_string | ( | ) | const |
- Returns:
- current address as string or "??" for unknown address
References HC_LOG_ERROR, and HC_LOG_TRACE.
Referenced by operator==(), mld_sender::send_group_specific_query(), igmp_sender::send_group_specific_query(), mld_sender::send_leave(), igmp_sender::send_leave(), mld_sender::send_report(), igmp_sender::send_report(), and test_addr_storage().
Friends And Related Function Documentation
bool operator< | ( | const addr_storage & | addr1, | |
const addr_storage & | addr2 | |||
) | [friend] |
lower then operator (only for IPv4 implemented)
std::ostream& operator<< | ( | std::ostream & | s, | |
const addr_storage | a | |||
) | [friend] |
cout output operator
struct in6_addr& operator<<= | ( | struct in6_addr & | l, | |
const addr_storage & | r | |||
) | [friend] |
copy operator "<<=" class addr_storage& to struct in6_addr
struct in_addr& operator<<= | ( | struct in_addr & | l, | |
const addr_storage & | r | |||
) | [friend] |
copy operator "<<=" class addr_storage& to struct in_addr
struct sockaddr_storage& operator<<= | ( | struct sockaddr_storage & | l, | |
const addr_storage & | r | |||
) | [friend] |
copy operator "<<=" class addr_storage& to struct sockaddr_storage