Changeset View
Changeset View
Standalone View
Standalone View
src/netaddress.cpp
Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | bool CNetAddr::GetInAddr(struct in_addr *pipv4Addr) const { | ||||
if (!IsIPv4()) { | if (!IsIPv4()) { | ||||
return false; | return false; | ||||
} | } | ||||
memcpy(pipv4Addr, ip + 12, 4); | memcpy(pipv4Addr, ip + 12, 4); | ||||
return true; | return true; | ||||
} | } | ||||
bool CNetAddr::GetIn6Addr(struct in6_addr *pipv6Addr) const { | bool CNetAddr::GetIn6Addr(struct in6_addr *pipv6Addr) const { | ||||
if (!IsIPv6()) { | |||||
return false; | |||||
} | |||||
memcpy(pipv6Addr, ip, 16); | memcpy(pipv6Addr, ip, 16); | ||||
return true; | return true; | ||||
} | } | ||||
// get canonical identifier of an address' group no two connections will be | // get canonical identifier of an address' group no two connections will be | ||||
// attempted to addresses with the same group | // attempted to addresses with the same group | ||||
std::vector<uint8_t> CNetAddr::GetGroup() const { | std::vector<uint8_t> CNetAddr::GetGroup() const { | ||||
std::vector<uint8_t> vchRet; | std::vector<uint8_t> vchRet; | ||||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |