6 #ifndef RAVEN_NETADDRESS_H 7 #define RAVEN_NETADDRESS_H 9 #if defined(HAVE_CONFIG_H) 40 explicit CNetAddr(
const struct in_addr& ipv4Addr);
80 unsigned int GetByte(
int n)
const;
82 bool GetInAddr(
struct in_addr* pipv4Addr)
const;
83 std::vector<unsigned char>
GetGroup()
const;
86 explicit CNetAddr(
const struct in6_addr& pipv6Addr,
const uint32_t scope = 0);
87 bool GetIn6Addr(
struct in6_addr* pipv6Addr)
const;
95 template <
typename Stream,
typename Operation>
121 bool Match(
const CNetAddr &addr)
const;
132 template <
typename Stream,
typename Operation>
149 CService(
const struct in_addr& ipv4Addr,
unsigned short port);
150 explicit CService(
const struct sockaddr_in& addr);
152 unsigned short GetPort()
const;
153 bool GetSockAddr(
struct sockaddr* paddr, socklen_t *addrlen)
const;
154 bool SetSockAddr(
const struct sockaddr* paddr);
158 std::vector<unsigned char> GetKey()
const;
160 std::string ToStringPort()
const;
161 std::string ToStringIPPort()
const;
163 CService(
const struct in6_addr& ipv6Addr,
unsigned short port);
164 explicit CService(
const struct sockaddr_in6& addr);
168 template <
typename Stream,
typename Operation>
171 unsigned short portN = htons(port);
173 if (ser_action.ForRead())
178 #endif // RAVEN_NETADDRESS_H int GetReachabilityFrom(const CNetAddr *paddrPartner=nullptr) const
Calculates a metric for how reachable (*this) is from a given partner.
void SetIP(const CNetAddr &ip)
CNetAddr network
Network (base) address.
bool GetInAddr(struct in_addr *pipv4Addr) const
std::string ToString() const
bool GetIn6Addr(struct in6_addr *pipv6Addr) const
enum Network GetNetwork() const
std::vector< unsigned char > GetGroup() const
friend bool operator!=(const CNetAddr &a, const CNetAddr &b)
std::string ToStringIP() const
A combination of a network address (CNetAddr) and a (TCP) port.
unsigned int GetByte(int n) const
bool valid
Is this value valid? (only used to signal parse errors)
void SerializationOp(Stream &s, Operation ser_action)
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)
bool SetInternal(const std::string &name)
Transform an arbitrary string into a non-routable ipv6 address.
void SerializationOp(Stream &s, Operation ser_action)