MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetInAddr

Method GetInAddr

src/netaddress.cpp:623–630  ·  view source on GitHub ↗

* Try to get our IPv4 address. * * @param[out] pipv4Addr The in_addr struct to which to copy. * * @returns Whether or not the operation was successful, in particular, whether * or not our address was an IPv4 address. * * @see CNetAddr::IsIPv4() */

Source from the content-addressed store, hash-verified

621 * @see CNetAddr::IsIPv4()
622 */
623bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
624{
625 if (!IsIPv4())
626 return false;
627 assert(sizeof(*pipv4Addr) == m_addr.size());
628 memcpy(pipv4Addr, m_addr.data(), m_addr.size());
629 return true;
630}
631
632/**
633 * Try to get our IPv6 (or CJDNS) address.

Callers 1

PCPWrapAddressFunction · 0.80

Calls 3

IsIPv4Function · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected