fastcgi++
A C++ FastCGI/Web API
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Fastcgipp::Http::Address Class Reference

Efficiently stores IPv6 addresses. More...

#include <fastcgi++/http.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...
 
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) const
 
Addressoperator&= (const Address &x)
 
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 const 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
August 20, 2016
Author
Eddie Carle <eddie.nosp@m.@isa.nosp@m.tec.c.nosp@m.a>

Definition at line 127 of file http.hpp.

Constructor & Destructor Documentation

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

Definition at line 155 of file http.hpp.

References m_data.

Fastcgipp::Http::Address::Address ( )
inline

Initializes an all zero address.

Definition at line 164 of file http.hpp.

Fastcgipp::Http::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 173 of file http.hpp.

Member Function Documentation

template<class charT >
void Fastcgipp::Http::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 798 of file http.cpp.

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

Fastcgipp::Http::Address::operator bool ( ) const

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

Definition at line 1255 of file http.cpp.

References Fastcgipp::Http::SessionId::m_data.

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

Definition at line 783 of file http.cpp.

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

Definition at line 772 of file http.cpp.

References m_data, and Fastcgipp::Http::SessionId::m_data.

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

Definition at line 200 of file http.hpp.

References m_data, and Fastcgipp::Http::File< charT >::size.

Address Fastcgipp::Http::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 140 of file http.hpp.

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

Definition at line 146 of file http.hpp.

References m_data.

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

Definition at line 192 of file http.hpp.

References m_data.

void Fastcgipp::Http::Address::zero ( )
inline

Set all bits to zero in IP address.

Definition at line 213 of file http.hpp.

References Fastcgipp::Http::operator<<(), and Fastcgipp::Http::operator>>().

Member Data Documentation

std::array<unsigned char, size> Fastcgipp::Http::Address::m_data

Data representation of the IPv6 address.

Definition at line 134 of file http.hpp.

Referenced by Address(), operator&=(), operator<(), Fastcgipp::Http::operator<<(), operator=(), and operator==().

const size_t Fastcgipp::Http::Address::size =16
static

This is the data length of the IPv6 address.

Definition at line 131 of file http.hpp.

Referenced by Fastcgipp::Http::operator<<(), and Fastcgipp::Http::operator>>().


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