olsr::net::IPv4Address Class Reference

IPv4 address class. More...

#include <ipv4.hh>

List of all members.

Public Types

enum  { address_size = sizeof (addr_t), proto = PF_INET, family = AF_INET, header_length = 28 }
typedef sockaddr_in sockaddr_t
 System socket type.
typedef in_addr addr_t
 System address type.

Public Member Functions

 IPv4Address ()
 IPv4Address (const sockaddr_t &s)
 IPv4Address (const addr_t &a)
 IPv4Address (const void *bytes, unsigned len)
 IPv4Address (const std::string &s)
const unsigned char * bytes () const
const std::string to_string () const
const sockaddr_t make_sockaddr (u_int16_t port) const
void dump (void *p) const
bool is_linklocal () const
bool operator< (const This &rhs) const
bool operator== (const This &rhs) const
bool operator!= (const This &rhs) const
unsigned long hash () const

Static Public Member Functions

static This netmask (unsigned prefix)
static void set_scope_index (sockaddr_t &, unsigned)
static unsigned netmask_to_prefix (const This &nm)
static const This network (const This &a, unsigned prefix)
static const This resolve (const std::string &s)

Static Public Attributes

static const This addr_any
 Static INADDR_ANY address.

Private Types

typedef IPv4Address This

Private Attributes

::in_addr _addr
 Address data.


Detailed Description

IPv4 address class.

Member Typedef Documentation

System socket type.

System address type.


Member Enumeration Documentation

anonymous enum

Enumerator:
address_size  Address size in bytes.
proto  Protocol index.
family  Family index.
header_length  Length of IP header.


Constructor & Destructor Documentation

olsr::net::IPv4Address::IPv4Address (  )  [inline]

Default constructor

References _addr.

Referenced by resolve().

olsr::net::IPv4Address::IPv4Address ( const sockaddr_t s  )  [inline]

Low-level constructor

  • s Reference to sockaddr_t instance

olsr::net::IPv4Address::IPv4Address ( const addr_t a  )  [inline]

Low-level constructor

  • a Reference to addr_t instance

olsr::net::IPv4Address::IPv4Address ( const void *  bytes,
unsigned  len 
) [inline]

Low-level constructor

  • bytes Pointer to buffer containing address
  • len Length of the buffer

References _addr, and address_size.

olsr::net::IPv4Address::IPv4Address ( const std::string &  s  )  [inline]

User-level constructor

  • s String containing human-readable address


Member Function Documentation

static This olsr::net::IPv4Address::netmask ( unsigned  prefix  )  [inline, static]

User-level netmask constructor

  • prefix Length of prefix in bits

References address_size.

const unsigned char* olsr::net::IPv4Address::bytes (  )  const [inline]

Raw data accessor

Returns:
Pointer to the raw buffer

References _addr.

const std::string olsr::net::IPv4Address::to_string (  )  const [inline]

Utility "to string" converter

Returns:
String containing human-readable address

References _addr.

Referenced by olsr::net::operator<<().

const sockaddr_t olsr::net::IPv4Address::make_sockaddr ( u_int16_t  port  )  const [inline]

Low-level structure accessor

  • port Port number
    Returns:
    Instance of sockaddr_t

References _addr.

void olsr::net::IPv4Address::dump ( void *  p  )  const [inline]

Dumping method

  • p Pointer to destination raw buffer

References _addr.

bool olsr::net::IPv4Address::is_linklocal (  )  const [inline]

Link-local predicate

Returns:
false

static void olsr::net::IPv4Address::set_scope_index ( sockaddr_t ,
unsigned   
) [inline, static]

Scope setting routine (does nothing)

static unsigned olsr::net::IPv4Address::netmask_to_prefix ( const This nm  )  [inline, static]

Prefix computation routine

  • nm Netmask address
    Returns:
    Length of the prefix

References _addr.

static const This olsr::net::IPv4Address::network ( const This a,
unsigned  prefix 
) [inline, static]

Network address computation routine

  • a Address of a node
  • prefix Length of prefix
    Returns:
    Address of the node's network

References _addr.

static const This olsr::net::IPv4Address::resolve ( const std::string &  s  )  [inline, static]

Resolving routine

  • s String containing human-readable address
    Returns:
    Address corresponding to the string

References IPv4Address().

bool olsr::net::IPv4Address::operator< ( const This rhs  )  const [inline]

Less-than comparison method

  • rhs RHS operand
    Returns:
    true if instance's address is lower than RHS's

References _addr.

bool olsr::net::IPv4Address::operator== ( const This rhs  )  const [inline]

Equality comparison method

  • rhs RHS operand
    Returns:
    true if both addresses are equal

References _addr.

Referenced by operator!=().

bool olsr::net::IPv4Address::operator!= ( const This rhs  )  const [inline]

Difference comparison method

  • rhs RHS operand
    Returns:
    true if addresses are different

References operator==().

unsigned long olsr::net::IPv4Address::hash (  )  const [inline]

Hashing method

Returns:
Hashed address

References _addr.


Member Data Documentation

Static INADDR_ANY address.

::in_addr olsr::net::IPv4Address::_addr [private]


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

Generated on Thu Feb 12 20:45:38 2009 for Qolyester daemon by  doxygen 1.5.6