Changeset View
Changeset View
Standalone View
Standalone View
src/netaddress.h
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | protected: | ||||
*/ | */ | ||||
prevector<ADDR_IPV6_SIZE, uint8_t> m_addr{ADDR_IPV6_SIZE, 0x0}; | prevector<ADDR_IPV6_SIZE, uint8_t> m_addr{ADDR_IPV6_SIZE, 0x0}; | ||||
/** | /** | ||||
* Network to which this address belongs. | * Network to which this address belongs. | ||||
*/ | */ | ||||
Network m_net{NET_IPV6}; | Network m_net{NET_IPV6}; | ||||
// for scoped/link-local ipv6 addresses | /** | ||||
uint32_t scopeId{0}; | * Scope id if scoped/link-local IPV6 address. | ||||
* See https://tools.ietf.org/html/rfc4007 | |||||
*/ | |||||
uint32_t m_scope_id{0}; | |||||
public: | public: | ||||
CNetAddr(); | CNetAddr(); | ||||
explicit CNetAddr(const struct in_addr &ipv4Addr); | explicit CNetAddr(const struct in_addr &ipv4Addr); | ||||
void SetIP(const CNetAddr &ip); | void SetIP(const CNetAddr &ip); | ||||
/** | /** | ||||
* Set from a legacy IPv6 address. | * Set from a legacy IPv6 address. | ||||
▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | template <typename Stream> void UnserializeV2Stream(Stream &s) { | ||||
size_t address_size; | size_t address_size; | ||||
s >> COMPACTSIZE(address_size); | s >> COMPACTSIZE(address_size); | ||||
if (address_size > MAX_ADDRV2_SIZE) { | if (address_size > MAX_ADDRV2_SIZE) { | ||||
throw std::ios_base::failure(strprintf( | throw std::ios_base::failure(strprintf( | ||||
"Address too long: %u > %u", address_size, MAX_ADDRV2_SIZE)); | "Address too long: %u > %u", address_size, MAX_ADDRV2_SIZE)); | ||||
} | } | ||||
scopeId = 0; | m_scope_id = 0; | ||||
if (SetNetFromBIP155Network(bip155_net, address_size)) { | if (SetNetFromBIP155Network(bip155_net, address_size)) { | ||||
m_addr.resize(address_size); | m_addr.resize(address_size); | ||||
s >> MakeSpan(m_addr); | s >> MakeSpan(m_addr); | ||||
if (m_net != NET_IPV6) { | if (m_net != NET_IPV6) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |