Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Attributes | Friends
CNetAddr Class Reference

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

#include <netbase.h>

+ Inheritance diagram for CNetAddr:
+ Collaboration diagram for CNetAddr:

Public Member Functions

 CNetAddr ()
 
 CNetAddr (const struct in_addr &ipv4Addr)
 
 CNetAddr (const char *pszIp, bool fAllowLookup=false)
 
 CNetAddr (const std::string &strIp, bool fAllowLookup=false)
 
void Init ()
 
void SetIP (const CNetAddr &ip)
 
bool SetSpecial (const std::string &strName)
 
bool IsIPv4 () const
 
bool IsIPv6 () const
 
bool IsRFC1918 () 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 IsValid () const
 
bool IsMulticast () 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=NULL) const
 Calculates a metric for how reachable (*this) is from a given partner. More...
 
void print () const
 
 CNetAddr (const struct in6_addr &pipv6Addr)
 
bool GetIn6Addr (struct in6_addr *pipv6Addr) const
 

Protected Attributes

unsigned char ip [16]
 

Friends

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 40 of file netbase.h.

Constructor & Destructor Documentation

CNetAddr::CNetAddr ( )

Definition at line 567 of file netbase.cpp.

CNetAddr::CNetAddr ( const struct in_addr &  ipv4Addr)

Definition at line 572 of file netbase.cpp.

References memcpy(), and pchIPv4.

+ Here is the call graph for this function:

CNetAddr::CNetAddr ( const char *  pszIp,
bool  fAllowLookup = false 
)
explicit

Definition at line 583 of file netbase.cpp.

References LookupHost().

+ Here is the call graph for this function:

CNetAddr::CNetAddr ( const std::string &  strIp,
bool  fAllowLookup = false 
)
explicit

Definition at line 591 of file netbase.cpp.

References LookupHost().

+ Here is the call graph for this function:

CNetAddr::CNetAddr ( const struct in6_addr &  pipv6Addr)

Definition at line 578 of file netbase.cpp.

References memcpy().

+ Here is the call graph for this function:

Member Function Documentation

unsigned int CNetAddr::GetByte ( int  n) const

Definition at line 599 of file netbase.cpp.

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

Definition at line 808 of file netbase.cpp.

References IsLocal(), NET_IPV4, NET_IPV6, NET_TOR, and NET_UNROUTABLE.

Referenced by CAddrInfo::GetNewBucket(), and ThreadOpenConnections().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t CNetAddr::GetHash ( ) const

Definition at line 875 of file netbase.cpp.

References Hash(), and memcpy().

Referenced by ProcessMessage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CNetAddr::GetIn6Addr ( in6_addr *  pipv6Addr) const

Definition at line 800 of file netbase.cpp.

References memcpy().

Referenced by CService::GetSockAddr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CNetAddr::GetInAddr ( in_addr *  pipv4Addr) const

Definition at line 792 of file netbase.cpp.

References memcpy().

Referenced by CService::GetSockAddr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

enum Network CNetAddr::GetNetwork ( ) const

Definition at line 736 of file netbase.cpp.

References NET_IPV4, NET_IPV6, NET_TOR, and NET_UNROUTABLE.

Referenced by AddLocal(), ConnectSocket(), GetExtNetwork(), IsLimited(), and IsReachable().

+ Here is the caller graph for this function:

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

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

Definition at line 902 of file netbase.cpp.

References GetExtNetwork(), NET_IPV4, NET_IPV6, NET_TOR, and NET_UNROUTABLE.

+ Here is the call graph for this function:

void CNetAddr::Init ( )

Definition at line 541 of file netbase.cpp.

bool CNetAddr::IsIPv4 ( ) const

Definition at line 604 of file netbase.cpp.

References pchIPv4.

Referenced by CService::GetSockAddr(), Socks4(), and CService::ToStringIPPort().

+ Here is the caller graph for this function:

bool CNetAddr::IsIPv6 ( ) const

Definition at line 609 of file netbase.cpp.

Referenced by BindListenPort(), and CService::GetSockAddr().

+ Here is the caller graph for this function:

bool CNetAddr::IsLocal ( ) const

Definition at line 675 of file netbase.cpp.

Referenced by SendMessages().

+ Here is the caller graph for this function:

bool CNetAddr::IsMulticast ( ) const

Definition at line 689 of file netbase.cpp.

bool CNetAddr::IsRFC1918 ( ) const

Definition at line 614 of file netbase.cpp.

bool CNetAddr::IsRFC3849 ( ) const

Definition at line 627 of file netbase.cpp.

bool CNetAddr::IsRFC3927 ( ) const

Definition at line 622 of file netbase.cpp.

bool CNetAddr::IsRFC3964 ( ) const

Definition at line 632 of file netbase.cpp.

bool CNetAddr::IsRFC4193 ( ) const

Definition at line 654 of file netbase.cpp.

bool CNetAddr::IsRFC4380 ( ) const

Definition at line 643 of file netbase.cpp.

Referenced by GetExtNetwork().

+ Here is the caller graph for this function:

bool CNetAddr::IsRFC4843 ( ) const

Definition at line 665 of file netbase.cpp.

bool CNetAddr::IsRFC4862 ( ) const

Definition at line 648 of file netbase.cpp.

bool CNetAddr::IsRFC6052 ( ) const

Definition at line 637 of file netbase.cpp.

bool CNetAddr::IsRFC6145 ( ) const

Definition at line 659 of file netbase.cpp.

bool CNetAddr::IsRoutable ( ) const

Definition at line 731 of file netbase.cpp.

References IsLocal().

Referenced by CAddrMan::Add_(), AddLocal(), AdvertizeLocal(), BindListenPort(), GetMyExternalIP2(), ProcessMessage(), and SendMessages().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CNetAddr::IsTor ( ) const

Definition at line 670 of file netbase.cpp.

References pchOnionCat.

Referenced by CService::ToStringIPPort().

+ Here is the caller graph for this function:

bool CNetAddr::IsValid ( ) const

Definition at line 695 of file netbase.cpp.

References pchIPv4.

Referenced by AppInit2(), ConnectSocketByName(), GetMyExternalIP(), GetMyExternalIP2(), CNode::PushAddress(), SetNameProxy(), SetProxy(), and ThreadOpenConnections().

+ Here is the caller graph for this function:

void CNetAddr::print ( ) const

Definition at line 883 of file netbase.cpp.

References LogPrintf.

void CNetAddr::SetIP ( const CNetAddr ip)

Definition at line 546 of file netbase.cpp.

References ip, and memcpy().

Referenced by GetMyExternalIP2().

+ 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 553 of file netbase.cpp.

References DecodeBase32(), memcpy(), and pchOnionCat.

Referenced by LookupIntern().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string CNetAddr::ToString ( ) const

Definition at line 772 of file netbase.cpp.

Referenced by CAddrMan::Add(), and Discover().

+ Here is the caller graph for this function:

std::string CNetAddr::ToStringIP ( ) const

Definition at line 750 of file netbase.cpp.

References EncodeBase32(), CService::GetSockAddr(), and strprintf.

Referenced by ConnectSocket(), ThreadGetMyExternalIP(), and CService::ToStringIPPort().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

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

Definition at line 782 of file netbase.cpp.

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

Definition at line 787 of file netbase.cpp.

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

Definition at line 777 of file netbase.cpp.

Field Documentation

unsigned char CNetAddr::ip[16]
protected

Definition at line 43 of file netbase.h.

Referenced by CService::CService(), CService::GetKey(), operator!=(), operator<(), operator==(), and SetIP().


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