The Pedigree Project  0.1
Public Types | Public Member Functions | Private Attributes | List of all members
IpAddress Class Reference

#include <IpAddress.h>

+ Collaboration diagram for IpAddress:

Public Types

enum  IpType { IPv4 = 0x0800, IPv6 = 0x86DD }
 

Public Member Functions

 IpAddress ()
 
 IpAddress (IpType type)
 
 IpAddress (uint32_t ipv4)
 
 IpAddress (uint8_t *ipv6)
 
 IpAddress (const IpAddress &other)
 
void setIp (uint32_t ipv4)
 
void setIp (uint8_t *ipv6)
 
uint32_t getIp () const
 
void getIp (uint8_t *ipv6) const
 
IpType getType () const
 
IpAddress operator+ (const IpAddress &a) const
 
IpAddress operator& (const IpAddress &a) const
 
IpAddressoperator= (const IpAddress &a)
 
bool operator== (const IpAddress &a) const
 
bool operator!= (const IpAddress &a) const
 
bool operator== (uint32_t a) const
 
bool operator!= (uint32_t a) const
 
String toString () const
 
String prefixString (size_t override=256) const
 Prefix string. Not zero-compressed. For routing.
 
bool isLinkLocal () const
 Whether the IP address is considered "link-local" or not.
 
bool isMulticast () const
 Whether the IP address is a valid multicast address.
 
bool isUnicast () const
 Whether the IP address is a valid unicast address.
 
size_t getIpv6Prefix () const
 Obtains the IPv6 prefix for this address.
 
void setIpv6Prefix (size_t prefix)
 Sets the IPv6 prefix for this address.
 

Private Attributes

IpType m_Type
 
uint32_t m_Ipv4
 
uint8_t m_Ipv6 [16]
 
bool m_bSet
 
size_t m_Ipv6Prefix
 

Detailed Description

An IPv4/IPv6 address

Definition at line 29 of file IpAddress.h.

Member Enumeration Documentation

The type of an IP address

Definition at line 33 of file IpAddress.h.

Constructor & Destructor Documentation

IpAddress::IpAddress ( )
inline

Constructors

Definition at line 40 of file IpAddress.h.

References getIp(), getIpv6Prefix(), and getType().

Member Function Documentation

uint32_t IpAddress::getIp ( ) const
inline

IP getters

Definition at line 93 of file IpAddress.h.

Referenced by IpAddress(), and operator+().

+ Here is the caller graph for this function:

IpType IpAddress::getType ( ) const
inline

Type getter

Definition at line 106 of file IpAddress.h.

Referenced by IpAddress(), and operator+().

+ Here is the caller graph for this function:

IpAddress IpAddress::operator+ ( const IpAddress a) const
inline

Operators

Definition at line 113 of file IpAddress.h.

References getIp(), getIpv6Prefix(), getType(), operator!=(), and operator==().

void IpAddress::setIp ( uint32_t  ipv4)
inline

IP setters - only one type is valid at any one point in time

Definition at line 75 of file IpAddress.h.


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