fastcgi++  3.1alpha
A C++ FastCGI/Web API
Fastcgipp::Address Struct Reference

Efficiently stores IPv6 addresses. More...

#include <fastcgi++/address.hpp>

Collaboration diagram for Fastcgipp::Address:
[legend]

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...
 
Addressoperator&= (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, sizem_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...
 

Detailed Description

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.

Date
October 9, 2018
Author
Eddie Carle <eddie.nosp@m.@isa.nosp@m.tec.c.nosp@m.a>

Definition at line 67 of file address.hpp.

Constructor & Destructor Documentation

◆ Address() [1/4]

Fastcgipp::Address::Address ( const Address address)
inline

Definition at line 111 of file address.hpp.

◆ Address() [2/4]

Fastcgipp::Address::Address ( )
inline

Initializes an all zero address.

Definition at line 120 of file address.hpp.

References m_data.

◆ Address() [3/4]

Fastcgipp::Address::Address ( const unsigned char *  data)
inlineexplicit

Construct the IPv6 address from a data array.

Parameters
[in]dataPointer to a 16 byte array

Definition at line 129 of file address.hpp.

◆ Address() [4/4]

Fastcgipp::Address::Address ( const char *  string)
inline

Definition at line 148 of file address.hpp.

Member Function Documentation

◆ assign()

template<class charT >
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.

Parameters
[in]startFirst character of the string
[in]endLast character of the string + 1
Template Parameters
charTCharacter type.

Definition at line 53 of file address.cpp.

References Fastcgipp::Http::atoi(), and WARNING_LOG.

Here is the call graph for this function:

◆ operator bool()

Fastcgipp::Address::operator bool ( ) const

Returns false if the ip address is zeroed. True otherwise.

Definition at line 510 of file address.cpp.

◆ operator&()

Address Fastcgipp::Address::operator& ( const Address x) const
inline

Definition at line 171 of file address.hpp.

◆ operator&=()

Fastcgipp::Address & Fastcgipp::Address::operator&= ( const Address x)

Definition at line 36 of file address.cpp.

References m_data.

◆ operator<()

bool Fastcgipp::Address::operator< ( const Address x) const
inline

Definition at line 161 of file address.hpp.

◆ operator=() [1/2]

Address Fastcgipp::Address::operator= ( const Address address)
inline

Definition at line 102 of file address.hpp.

◆ operator=() [2/2]

Address Fastcgipp::Address::operator= ( const unsigned char *  data)
inline

Assign the IPv6 address from a data array.

Parameters
[in]dataPointer to a 16 byte array

Definition at line 96 of file address.hpp.

References m_data.

◆ operator==()

bool Fastcgipp::Address::operator== ( const Address x) const
inline

Definition at line 153 of file address.hpp.

◆ zero()

void Fastcgipp::Address::zero ( )
inline

Set all bits to zero in IP address.

Definition at line 180 of file address.hpp.

Member Data Documentation

◆ m_data

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=().

◆ size

constexpr size_t Fastcgipp::Address::size =16
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>>().


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