net: rename CNetAddr scopeId to m_scope_id, improve code doc
This commit is contained in:
parent
5cb5fd3005
commit
f36887fa47
|
@ -281,7 +281,7 @@ CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
|
||||||
CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope)
|
CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope)
|
||||||
{
|
{
|
||||||
SetLegacyIPv6(Span<const uint8_t>(reinterpret_cast<const uint8_t*>(&ipv6Addr), sizeof(ipv6Addr)));
|
SetLegacyIPv6(Span<const uint8_t>(reinterpret_cast<const uint8_t*>(&ipv6Addr), sizeof(ipv6Addr)));
|
||||||
scopeId = scope;
|
m_scope_id = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNetAddr::IsBindAny() const
|
bool CNetAddr::IsBindAny() const
|
||||||
|
@ -918,7 +918,7 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
|
||||||
memset(paddrin6, 0, *addrlen);
|
memset(paddrin6, 0, *addrlen);
|
||||||
if (!GetIn6Addr(&paddrin6->sin6_addr))
|
if (!GetIn6Addr(&paddrin6->sin6_addr))
|
||||||
return false;
|
return false;
|
||||||
paddrin6->sin6_scope_id = scopeId;
|
paddrin6->sin6_scope_id = m_scope_id;
|
||||||
paddrin6->sin6_family = AF_INET6;
|
paddrin6->sin6_family = AF_INET6;
|
||||||
paddrin6->sin6_port = htons(port);
|
paddrin6->sin6_port = htons(port);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -130,7 +130,11 @@ class CNetAddr
|
||||||
*/
|
*/
|
||||||
Network m_net{NET_IPV6};
|
Network m_net{NET_IPV6};
|
||||||
|
|
||||||
uint32_t scopeId{0}; // for scoped/link-local ipv6 addresses
|
/**
|
||||||
|
* 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();
|
||||||
|
@ -388,7 +392,7 @@ class CNetAddr
|
||||||
"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);
|
||||||
|
|
Loading…
Reference in a new issue