fastcgi++
3.1alpha
A C++ FastCGI/Web API
|
Efficiently stores IPv6 addresses. More...
#include <fastcgi++/address.hpp>
Public Member Functions | |
Address | operator= (const unsigned char *data) |
Assign the IPv6 address from a data array. More... | |
Address | operator= (const Address &address) |
Address (const Address &address) | |
Address () | |
Initializes an all zero address. More... | |
Address (const unsigned char *data) | |
Construct the IPv6 address from a data array. More... | |
template<class charT > | |
void | assign (const charT *start, const charT *end) |
Assign the IP address from a string of characters. More... | |
Address (const char *string) | |
bool | operator== (const Address &x) const |
bool | operator< (const Address &x) const |
operator bool () const | |
Returns false if the ip address is zeroed. True otherwise. More... | |
Address & | operator&= (const Address &x) |
Address | operator& (const Address &x) const |
void | zero () |
Set all bits to zero in IP address. More... | |
Public Attributes | |
std::array< unsigned char, size > | m_data |
Data representation of the IPv6 address. More... | |
Static Public Attributes | |
static constexpr size_t | size =16 |
This is the data length of the IPv6 address. More... | |
Efficiently stores IPv6 addresses.
This class stores IPv6 addresses as a 128 bit array. It does this as opposed to storing the string itself to facilitate efficient logging and processing of the address. The class possesses full IO and comparison capabilities as well as allowing bitwise AND operations for netmask calculation. It detects when an IPv4 address is stored outputs it accordingly.
Definition at line 67 of file address.hpp.
|
inline |
Definition at line 111 of file address.hpp.
|
inline |
|
inlineexplicit |
Construct the IPv6 address from a data array.
[in] | data | Pointer to a 16 byte array |
Definition at line 129 of file address.hpp.
|
inline |
Definition at line 148 of file address.hpp.
void Fastcgipp::Address::assign | ( | const charT * | start, |
const charT * | end | ||
) |
Assign the IP address from a string of characters.
In order for this to work the string must represent either an IPv4 address in standard textual decimal form (127.0.0.1) or an IPv6 in standard form.
[in] | start | First character of the string |
[in] | end | Last character of the string + 1 |
charT | Character type. |
Definition at line 53 of file address.cpp.
References Fastcgipp::Http::atoi(), and WARNING_LOG.
Fastcgipp::Address::operator bool | ( | ) | const |
Returns false if the ip address is zeroed. True otherwise.
Definition at line 510 of file address.cpp.
Definition at line 171 of file address.hpp.
Fastcgipp::Address & Fastcgipp::Address::operator&= | ( | const Address & | x | ) |
Definition at line 36 of file address.cpp.
References m_data.
|
inline |
Definition at line 161 of file address.hpp.
Definition at line 102 of file address.hpp.
|
inline |
Assign the IPv6 address from a data array.
[in] | data | Pointer to a 16 byte array |
Definition at line 96 of file address.hpp.
References m_data.
|
inline |
Definition at line 153 of file address.hpp.
|
inline |
Set all bits to zero in IP address.
Definition at line 180 of file address.hpp.
std::array<unsigned char, size> Fastcgipp::Address::m_data |
Data representation of the IPv6 address.
Definition at line 90 of file address.hpp.
Referenced by Address(), operator&=(), Fastcgipp::operator<<(), and operator=().
|
staticconstexpr |
This is the data length of the IPv6 address.
Definition at line 87 of file address.hpp.
Referenced by Fastcgipp::SQL::Results_base::field< Fastcgipp::Address >(), Fastcgipp::operator<<(), and Fastcgipp::operator>>().