fastcgi++
Public Member Functions | Static Public Attributes | Private Attributes
Fastcgipp::Http::Address Class Reference

Efficiently stores IPv6 addresses. More...

#include <http.hpp>

List of all members.

Public Member Functions

const unsigned char * data () const
 Retrieve a const pointer to the raw data of the IPv6 address.
unsigned char * data ()
 Retrieve a pointer to the raw data of the IPv6 address.
Address operator= (const unsigned char *data_)
 Assign the IPv4 address from a data array.
Address operator= (const Address &address)
 Address (const Address &address)
 Address ()
 Address (const unsigned char *data_)
 Construct the IPv6 address from a data array.
void assign (const char *start, const char *end)
 Assign the IP address from a string of characters.
bool operator== (const Address &x) const
bool operator> (const Address &x) const
bool operator< (const Address &x) const
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.
Address operator& (const Address &x) const
Addressoperator&= (const Address &x)
void zero ()
 Set all bits to zero in ip address.

Static Public Attributes

static const size_t size = 16
 This is the data length of the IPv6 address.

Private Attributes

unsigned char m_data [size]
 Data representation of the IPv6 address.

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.

Definition at line 119 of file http.hpp.


Constructor & Destructor Documentation

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

Definition at line 144 of file http.hpp.

References m_data, and size.

Definition at line 145 of file http.hpp.

Fastcgipp::Http::Address::Address ( const unsigned char *  data_) [inline, explicit]

Construct the IPv6 address from a data array.

Parameters:
[in]data_Pointer to a 16 byte array

Definition at line 151 of file http.hpp.

References m_data, and size.


Member Function Documentation

void Fastcgipp::Http::Address::assign ( const char *  start,
const char *  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

Definition at line 606 of file http.cpp.

References Fastcgipp::Http::atoi().

const unsigned char* Fastcgipp::Http::Address::data ( ) const [inline]

Retrieve a const pointer to the raw data of the IPv6 address.

Returns:
Constant pointer to data array representing the raw IPv6 address

Definition at line 129 of file http.hpp.

References m_data.

unsigned char* Fastcgipp::Http::Address::data ( ) [inline]

Retrieve a pointer to the raw data of the IPv6 address.

Returns:
Pointer to data array representing the raw IPv6 address

Definition at line 135 of file http.hpp.

References m_data.

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

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

Definition at line 997 of file http.cpp.

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

Definition at line 598 of file http.cpp.

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

Definition at line 590 of file http.cpp.

References m_data.

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

Definition at line 164 of file http.hpp.

References m_data, and size.

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

Definition at line 165 of file http.hpp.

References m_data, and size.

Address Fastcgipp::Http::Address::operator= ( const unsigned char *  data_) [inline]

Assign the IPv4 address from a data array.

Parameters:
[in]data_Pointer to a 16 byte array

Definition at line 141 of file http.hpp.

References m_data, and size.

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

Definition at line 143 of file http.hpp.

References m_data, and size.

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

Definition at line 162 of file http.hpp.

References m_data, and size.

bool Fastcgipp::Http::Address::operator> ( const Address x) const [inline]

Definition at line 163 of file http.hpp.

References m_data, and size.

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

Definition at line 166 of file http.hpp.

References m_data, and size.

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

Set all bits to zero in ip address.

Definition at line 174 of file http.hpp.

References m_data, and size.


Member Data Documentation

unsigned char Fastcgipp::Http::Address::m_data[size] [private]

Data representation of the IPv6 address.

Definition at line 178 of file http.hpp.

Referenced by Address(), data(), operator&=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and zero().

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

This is the data length of the IPv6 address.

Definition at line 123 of file http.hpp.

Referenced by Address(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and zero().


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