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
 
IpAddress & operator= (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

◆ IpType

The type of an IP address

Definition at line 32 of file IpAddress.h.

Constructor & Destructor Documentation

◆ IpAddress() [1/5]

IpAddress::IpAddress ( )
inline

Constructors

Definition at line 35 of file IpAddress.h.

◆ IpAddress() [2/5]

IpAddress::IpAddress ( IpType  type)
inline

Definition at line 36 of file IpAddress.h.

◆ IpAddress() [3/5]

IpAddress::IpAddress ( uint32_t  ipv4)
inline

Definition at line 37 of file IpAddress.h.

◆ IpAddress() [4/5]

IpAddress::IpAddress ( uint8_t *  ipv6)
inline

Definition at line 39 of file IpAddress.h.

◆ IpAddress() [5/5]

IpAddress::IpAddress ( const IpAddress &  other)
inline

Definition at line 42 of file IpAddress.h.

Member Function Documentation

◆ getIp() [1/2]

uint32_t IpAddress::getIp ( ) const
inline

IP getters

Definition at line 72 of file IpAddress.h.

Referenced by operator+().

+ Here is the caller graph for this function:

◆ getIp() [2/2]

void IpAddress::getIp ( uint8_t *  ipv6) const
inline

Definition at line 76 of file IpAddress.h.

◆ getIpv6Prefix()

size_t IpAddress::getIpv6Prefix ( ) const
inline

Obtains the IPv6 prefix for this address.

Definition at line 166 of file IpAddress.h.

◆ getType()

IpType IpAddress::getType ( ) const
inline

Type getter

Definition at line 83 of file IpAddress.h.

Referenced by operator+().

+ Here is the caller graph for this function:

◆ isLinkLocal()

bool IpAddress::isLinkLocal ( ) const

Whether the IP address is considered "link-local" or not.

Definition at line 23 of file IpAddress.cc.

◆ isMulticast()

bool IpAddress::isMulticast ( ) const

Whether the IP address is a valid multicast address.

Definition at line 110 of file IpAddress.cc.

◆ isUnicast()

bool IpAddress::isUnicast ( ) const
inline

Whether the IP address is a valid unicast address.

Definition at line 161 of file IpAddress.h.

◆ operator!=() [1/2]

bool IpAddress::operator!= ( const IpAddress &  a) const
inline

Definition at line 127 of file IpAddress.h.

◆ operator!=() [2/2]

bool IpAddress::operator!= ( uint32_t  a) const
inline

Definition at line 142 of file IpAddress.h.

◆ operator&()

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

Definition at line 98 of file IpAddress.h.

◆ operator+()

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

Operators

Definition at line 89 of file IpAddress.h.

References getIp(), and getType().

◆ operator=()

IpAddress & IpAddress::operator= ( const IpAddress &  a)
inline

Definition at line 107 of file IpAddress.h.

◆ operator==() [1/2]

bool IpAddress::operator== ( const IpAddress &  a) const
inline

Definition at line 119 of file IpAddress.h.

◆ operator==() [2/2]

bool IpAddress::operator== ( uint32_t  a) const
inline

Definition at line 135 of file IpAddress.h.

◆ prefixString()

String IpAddress::prefixString ( size_t  override = 256) const

Prefix string. Not zero-compressed. For routing.

Definition at line 30 of file IpAddress.cc.

◆ setIp() [1/2]

void IpAddress::setIp ( uint32_t  ipv4)
inline

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

Definition at line 56 of file IpAddress.h.

◆ setIp() [2/2]

void IpAddress::setIp ( uint8_t *  ipv6)
inline

Definition at line 63 of file IpAddress.h.

◆ setIpv6Prefix()

void IpAddress::setIpv6Prefix ( size_t  prefix)
inline

Sets the IPv6 prefix for this address.

Definition at line 171 of file IpAddress.h.

◆ toString()

String IpAddress::toString ( ) const

Definition at line 52 of file IpAddress.cc.

Member Data Documentation

◆ m_bSet

bool IpAddress::m_bSet
private

Definition at line 181 of file IpAddress.h.

◆ m_Ipv4

uint32_t IpAddress::m_Ipv4
private

Definition at line 178 of file IpAddress.h.

◆ m_Ipv6

uint8_t IpAddress::m_Ipv6[16]
private

Definition at line 179 of file IpAddress.h.

◆ m_Ipv6Prefix

size_t IpAddress::m_Ipv6Prefix
private

Definition at line 183 of file IpAddress.h.

◆ m_Type

IpType IpAddress::m_Type
private

Definition at line 176 of file IpAddress.h.


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