Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
CNetAddr Class Reference

IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) More...

#include <netaddress.h>

Inheritance diagram for CNetAddr:
[legend]

Public Member Functions

 CNetAddr ()
 
 CNetAddr (const struct in_addr &ipv4Addr)
 
void Init ()
 
void SetIP (const CNetAddr &ip)
 
void SetRaw (Network network, const uint8_t *data)
 Set raw IPv4 or IPv6 address (in network byte order) More...
 
bool SetInternal (const std::string &name)
 Transform an arbitrary string into a non-routable ipv6 address. More...
 
bool SetSpecial (const std::string &strName)
 
bool IsIPv4 () const
 
bool IsIPv6 () const
 
bool IsRFC1918 () const
 
bool IsRFC2544 () const
 
bool IsRFC6598 () const
 
bool IsRFC5737 () const
 
bool IsRFC3849 () const
 
bool IsRFC3927 () const
 
bool IsRFC3964 () const
 
bool IsRFC4193 () const
 
bool IsRFC4380 () const
 
bool IsRFC4843 () const
 
bool IsRFC4862 () const
 
bool IsRFC6052 () const
 
bool IsRFC6145 () const
 
bool IsTor () const
 
bool IsLocal () const
 
bool IsRoutable () const
 
bool IsInternal () const
 
bool IsValid () const
 
enum Network GetNetwork () const
 
std::string ToString () const
 
std::string ToStringIP () const
 
unsigned int GetByte (int n) const
 
uint64_t GetHash () const
 
bool GetInAddr (struct in_addr *pipv4Addr) const
 
std::vector< unsigned char > GetGroup () const
 
int GetReachabilityFrom (const CNetAddr *paddrPartner=nullptr) const
 Calculates a metric for how reachable (*this) is from a given partner. More...
 
 CNetAddr (const struct in6_addr &pipv6Addr, const uint32_t scope=0)
 
bool GetIn6Addr (struct in6_addr *pipv6Addr) const
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 

Protected Attributes

unsigned char ip [16]
 
uint32_t scopeId
 

Friends

class CSubNet
 
bool operator== (const CNetAddr &a, const CNetAddr &b)
 
bool operator!= (const CNetAddr &a, const CNetAddr &b)
 
bool operator< (const CNetAddr &a, const CNetAddr &b)
 

Detailed Description

IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))

Definition at line 31 of file netaddress.h.

Constructor & Destructor Documentation

CNetAddr::CNetAddr ( )

Definition at line 74 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CNetAddr::CNetAddr ( const struct in_addr &  ipv4Addr)

Definition at line 79 of file netaddress.cpp.

Here is the call graph for this function:

CNetAddr::CNetAddr ( const struct in6_addr &  pipv6Addr,
const uint32_t  scope = 0 
)

Definition at line 84 of file netaddress.cpp.

Here is the call graph for this function:

Member Function Documentation

unsigned int CNetAddr::GetByte ( int  n) const

Definition at line 90 of file netaddress.cpp.

Here is the caller graph for this function:

std::vector< unsigned char > CNetAddr::GetGroup ( ) const

Definition at line 323 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t CNetAddr::GetHash ( ) const

Definition at line 396 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::GetIn6Addr ( struct in6_addr *  pipv6Addr) const

Definition at line 315 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::GetInAddr ( struct in_addr *  pipv4Addr) const

Definition at line 307 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

enum Network CNetAddr::GetNetwork ( ) const

Definition at line 246 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int CNetAddr::GetReachabilityFrom ( const CNetAddr paddrPartner = nullptr) const

Calculates a metric for how reachable (*this) is from a given partner.

Definition at line 418 of file netaddress.cpp.

Here is the call graph for this function:

void CNetAddr::Init ( )

Definition at line 21 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsInternal ( ) const

Definition at line 241 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsIPv4 ( ) const

Definition at line 95 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsIPv6 ( ) const

Definition at line 100 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsLocal ( ) const

Definition at line 183 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC1918 ( ) const

Definition at line 105 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC2544 ( ) const

Definition at line 113 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC3849 ( ) const

Definition at line 135 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC3927 ( ) const

Definition at line 118 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC3964 ( ) const

Definition at line 140 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC4193 ( ) const

Definition at line 162 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC4380 ( ) const

Definition at line 151 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC4843 ( ) const

Definition at line 173 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC4862 ( ) const

Definition at line 156 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsRFC5737 ( ) const

Definition at line 128 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRFC6052 ( ) const

Definition at line 145 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsRFC6145 ( ) const

Definition at line 167 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsRFC6598 ( ) const

Definition at line 123 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsRoutable ( ) const

Definition at line 236 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::IsTor ( ) const

Definition at line 178 of file netaddress.cpp.

Here is the caller graph for this function:

bool CNetAddr::IsValid ( ) const

Definition at line 197 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename Stream , typename Operation >
void CNetAddr::SerializationOp ( Stream &  s,
Operation  ser_action 
)
inline

Definition at line 95 of file netaddress.h.

bool CNetAddr::SetInternal ( const std::string &  name)

Transform an arbitrary string into a non-routable ipv6 address.

Useful for mapping resolved addresses back to their source.

Definition at line 48 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNetAddr::SetIP ( const CNetAddr ip)

Definition at line 27 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNetAddr::SetRaw ( Network  network,
const uint8_t *  data 
)

Set raw IPv4 or IPv6 address (in network byte order)

Note
Only NET_IPV4 and NET_IPV6 are allowed for network.

Definition at line 32 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNetAddr::SetSpecial ( const std::string &  strName)

Definition at line 60 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string CNetAddr::ToString ( ) const

Definition at line 287 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string CNetAddr::ToStringIP ( ) const

Definition at line 263 of file netaddress.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class CSubNet
friend

Definition at line 99 of file netaddress.h.

bool operator!= ( const CNetAddr a,
const CNetAddr b 
)
friend

Definition at line 297 of file netaddress.cpp.

bool operator< ( const CNetAddr a,
const CNetAddr b 
)
friend

Definition at line 302 of file netaddress.cpp.

bool operator== ( const CNetAddr a,
const CNetAddr b 
)
friend

Definition at line 292 of file netaddress.cpp.

Member Data Documentation

CNetAddr::ADD_SERIALIZE_METHODS

Definition at line 92 of file netaddress.h.

unsigned char CNetAddr::ip[16]
protected

Definition at line 34 of file netaddress.h.

uint32_t CNetAddr::scopeId
protected

Definition at line 35 of file netaddress.h.


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