5 #ifndef FABCOIN_NETADDRESS_H 6 #define FABCOIN_NETADDRESS_H 8 #if defined(HAVE_CONFIG_H) 39 CNetAddr(
const struct in_addr& ipv4Addr);
79 unsigned int GetByte(
int n)
const;
81 bool GetInAddr(
struct in_addr* pipv4Addr)
const;
82 std::vector<unsigned char>
GetGroup()
const;
85 CNetAddr(
const struct in6_addr& pipv6Addr,
const uint32_t scope = 0);
86 bool GetIn6Addr(
struct in6_addr* pipv6Addr)
const;
94 template <
typename Stream,
typename Operation>
120 bool Match(
const CNetAddr &addr)
const;
131 template <
typename Stream,
typename Operation>
148 CService(
const struct in_addr& ipv4Addr,
unsigned short port);
149 CService(
const struct sockaddr_in& addr);
151 unsigned short GetPort()
const;
152 bool GetSockAddr(
struct sockaddr* paddr, socklen_t *addrlen)
const;
153 bool SetSockAddr(
const struct sockaddr* paddr);
157 std::vector<unsigned char> GetKey()
const;
159 std::string ToStringPort()
const;
160 std::string ToStringIPPort()
const;
162 CService(
const struct in6_addr& ipv6Addr,
unsigned short port);
163 CService(
const struct sockaddr_in6& addr);
167 template <
typename Stream,
typename Operation>
170 unsigned short portN = htons(port);
172 if (ser_action.ForRead())
177 #endif // FABCOIN_NETADDRESS_H
void SetIP(const CNetAddr &ip)
std::string ToStringIP() const
bool GetIn6Addr(struct in6_addr *pipv6Addr) const
CNetAddr network
Network (base) address.
unsigned int GetByte(int n) const
int GetReachabilityFrom(const CNetAddr *paddrPartner=nullptr) const
Calculates a metric for how reachable (*this) is from a given partner.
friend bool operator!=(const CNetAddr &a, const CNetAddr &b)
A combination of a network address (CNetAddr) and a (TCP) port.
bool valid
Is this value valid? (only used to signal parse errors)
bool GetInAddr(struct in_addr *pipv4Addr) const
void SerializationOp(Stream &s, Operation ser_action)
std::vector< unsigned char > GetGroup() const
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
friend bool operator<(const CNetAddr &a, const CNetAddr &b)
friend bool operator==(const CNetAddr &a, const CNetAddr &b)
void SerializationOp(Stream &s, Operation ser_action)
void SetRaw(Network network, const uint8_t *data)
Set raw IPv4 or IPv6 address (in network byte order)
bool SetSpecial(const std::string &strName)
std::string ToString() const
bool SetInternal(const std::string &name)
Transform an arbitrary string into a non-routable ipv6 address.
void SerializationOp(Stream &s, Operation ser_action)
enum Network GetNetwork() const