PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Protected Attributes | Friends | List of all members
CService Class Reference

A combination of a network address (CNetAddr) and a (TCP) port. More...

#include <netaddress.h>

Inheritance diagram for CService:
[legend]
Collaboration diagram for CService:
[legend]

Public Member Functions

 CService ()
 
 CService (const CNetAddr &ip, uint16_t port)
 
 CService (const struct in_addr &ipv4Addr, uint16_t port)
 
 CService (const struct sockaddr_in &addr)
 
uint16_t GetPort () const
 
bool GetSockAddr (struct sockaddr *paddr, socklen_t *addrlen) const
 
bool SetSockAddr (const struct sockaddr *paddr)
 
std::vector< unsigned char > GetKey () const
 
std::string ToString () const
 
std::string ToStringPort () const
 
std::string ToStringIPPort () const
 
 CService (const struct in6_addr &ipv6Addr, uint16_t port)
 
 CService (const struct sockaddr_in6 &addr)
 
 SERIALIZE_METHODS (CService, obj)
 
- Public Member Functions inherited from CNetAddr
 CNetAddr ()
 Construct an unspecified IPv6 network address (::/128). More...
 
 CNetAddr (const struct in_addr &ipv4Addr)
 
void SetIP (const CNetAddr &ip)
 
void SetLegacyIPv6 (Span< const uint8_t > ipv6)
 Set from a legacy IPv6 address. More...
 
bool SetInternal (const std::string &name)
 Transform an arbitrary string into a non-routable ipv6 address. More...
 
bool SetSpecial (const std::string &strName)
 Parse a TOR address and set this object to it. More...
 
bool IsBindAny () const
 
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 IsRFC7343 () const
 
bool IsRFC4862 () const
 
bool IsRFC6052 () const
 
bool IsRFC6145 () const
 
bool IsHeNet () const
 
bool IsTor () const
 Check whether this object represents a TOR address. More...
 
bool IsI2P () const
 Check whether this object represents an I2P address. More...
 
bool IsCJDNS () const
 Check whether this object represents a CJDNS address. More...
 
bool IsLocal () const
 
bool IsRoutable () const
 
bool IsInternal () const
 
bool IsValid () const
 
bool IsAddrV1Compatible () const
 Check if the current object can be serialized in pre-ADDRv2/BIP155 format. More...
 
enum Network GetNetwork () const
 
std::string ToString () const
 
std::string ToStringIP () const
 
uint64_t GetHash () const
 
bool GetInAddr (struct in_addr *pipv4Addr) const
 
Network GetNetClass () const
 
uint32_t GetLinkedIPv4 () const
 For IPv4, mapped IPv4, SIIT translated IPv4, Teredo, 6to4 tunneled addresses, return the relevant IPv4 address as a uint32. More...
 
bool HasLinkedIPv4 () const
 Whether this address has a linked IPv4 address (see GetLinkedIPv4()). More...
 
uint32_t GetMappedAS (const std::vector< bool > &asmap) const
 
std::vector< unsigned char > GetGroup (const std::vector< bool > &asmap) const
 Get the canonical identifier of our network group. More...
 
std::vector< unsigned char > GetAddrBytes () 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
 Try to get our IPv6 address. More...
 
bool IsRelayable () const
 Whether this address should be relayed to other peers even if we can't reach it ourselves. More...
 
template<typename Stream >
void Serialize (Stream &s) const
 Serialize to a stream. More...
 
template<typename Stream >
void Unserialize (Stream &s)
 Unserialize from a stream. More...
 

Protected Attributes

uint16_t port
 
- Protected Attributes inherited from CNetAddr
prevector< ADDR_IPV6_SIZE, uint8_t > m_addr {ADDR_IPV6_SIZE, 0x0}
 Raw representation of the network address. More...
 
Network m_net {NET_IPV6}
 Network to which this address belongs. More...
 
uint32_t scopeId {0}
 

Friends

bool operator== (const CService &a, const CService &b)
 
bool operator!= (const CService &a, const CService &b)
 
bool operator< (const CService &a, const CService &b)
 

Detailed Description

A combination of a network address (CNetAddr) and a (TCP) port.

Definition at line 483 of file netaddress.h.

Constructor & Destructor Documentation

◆ CService() [1/6]

CService::CService ( )

Definition at line 842 of file netaddress.cpp.

Here is the caller graph for this function:

◆ CService() [2/6]

CService::CService ( const CNetAddr ip,
uint16_t  port 
)

Definition at line 846 of file netaddress.cpp.

◆ CService() [3/6]

CService::CService ( const struct in_addr &  ipv4Addr,
uint16_t  port 
)

Definition at line 850 of file netaddress.cpp.

◆ CService() [4/6]

CService::CService ( const struct sockaddr_in &  addr)
explicit

Definition at line 858 of file netaddress.cpp.

◆ CService() [5/6]

CService::CService ( const struct in6_addr &  ipv6Addr,
uint16_t  port 
)

Definition at line 854 of file netaddress.cpp.

◆ CService() [6/6]

CService::CService ( const struct sockaddr_in6 &  addr)
explicit

Definition at line 863 of file netaddress.cpp.

Member Function Documentation

◆ GetKey()

std::vector< unsigned char > CService::GetKey ( ) const

Definition at line 932 of file netaddress.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPort()

uint16_t CService::GetPort ( ) const

Definition at line 882 of file netaddress.cpp.

Here is the caller graph for this function:

◆ GetSockAddr()

bool CService::GetSockAddr ( struct sockaddr *  paddr,
socklen_t *  addrlen 
) const

Definition at line 902 of file netaddress.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SERIALIZE_METHODS()

CService::SERIALIZE_METHODS ( CService  ,
obj   
)
inline

Definition at line 507 of file netaddress.h.

◆ SetSockAddr()

bool CService::SetSockAddr ( const struct sockaddr *  paddr)

Definition at line 868 of file netaddress.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

std::string CService::ToString ( ) const

Definition at line 954 of file netaddress.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToStringIPPort()

std::string CService::ToStringIPPort ( ) const

Definition at line 945 of file netaddress.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToStringPort()

std::string CService::ToStringPort ( ) const

Definition at line 940 of file netaddress.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 892 of file netaddress.cpp.

◆ operator<

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

Definition at line 897 of file netaddress.cpp.

◆ operator==

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

Definition at line 887 of file netaddress.cpp.

Member Data Documentation

◆ port

uint16_t CService::port
protected

Definition at line 486 of file netaddress.h.


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