![]() |
Master Core
v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
|
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) More...
#include <netbase.h>
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) |
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
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.
|
explicit |
Definition at line 583 of file netbase.cpp.
References LookupHost().
|
explicit |
Definition at line 591 of file netbase.cpp.
References LookupHost().
CNetAddr::CNetAddr | ( | const struct in6_addr & | pipv6Addr | ) |
Definition at line 578 of file netbase.cpp.
References memcpy().
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().
uint64_t CNetAddr::GetHash | ( | ) | const |
Definition at line 875 of file netbase.cpp.
References Hash(), and memcpy().
Referenced by ProcessMessage().
bool CNetAddr::GetIn6Addr | ( | in6_addr * | pipv6Addr | ) | const |
Definition at line 800 of file netbase.cpp.
References memcpy().
Referenced by CService::GetSockAddr().
bool CNetAddr::GetInAddr | ( | in_addr * | pipv4Addr | ) | const |
Definition at line 792 of file netbase.cpp.
References memcpy().
Referenced by CService::GetSockAddr().
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().
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.
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().
bool CNetAddr::IsIPv6 | ( | ) | const |
Definition at line 609 of file netbase.cpp.
Referenced by BindListenPort(), and CService::GetSockAddr().
bool CNetAddr::IsLocal | ( | ) | const |
Definition at line 675 of file netbase.cpp.
Referenced by SendMessages().
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().
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().
bool CNetAddr::IsTor | ( | ) | const |
Definition at line 670 of file netbase.cpp.
References pchOnionCat.
Referenced by CService::ToStringIPPort().
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().
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.
Referenced by GetMyExternalIP2().
bool CNetAddr::SetSpecial | ( | const std::string & | strName | ) |
Definition at line 553 of file netbase.cpp.
References DecodeBase32(), memcpy(), and pchOnionCat.
Referenced by LookupIntern().
std::string CNetAddr::ToString | ( | ) | const |
Definition at line 772 of file netbase.cpp.
Referenced by CAddrMan::Add(), and Discover().
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().
Definition at line 782 of file netbase.cpp.
Definition at line 787 of file netbase.cpp.
Definition at line 777 of file netbase.cpp.
|
protected |
Definition at line 43 of file netbase.h.
Referenced by CService::CService(), CService::GetKey(), operator!=(), operator<(), operator==(), and SetIP().