MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / SetIP

Method SetIP

src/netaddress.cpp:125–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123CNetAddr::CNetAddr() = default;
124
125void CNetAddr::SetIP(const CNetAddr &ipIn) {
126 // Size check.
127 switch (ipIn.m_net) {
128 case NET_IPV4:
129 assert(ipIn.m_addr.size() == ADDR_IPV4_SIZE);
130 break;
131 case NET_IPV6:
132 assert(ipIn.m_addr.size() == ADDR_IPV6_SIZE);
133 break;
134 case NET_ONION:
135 assert(ipIn.m_addr.size() == ADDR_TORV2_SIZE ||
136 ipIn.m_addr.size() == ADDR_TORV3_SIZE);
137 break;
138 case NET_I2P:
139 assert(ipIn.m_addr.size() == ADDR_I2P_SIZE);
140 break;
141 case NET_CJDNS:
142 assert(ipIn.m_addr.size() == ADDR_CJDNS_SIZE);
143 break;
144 case NET_INTERNAL:
145 assert(ipIn.m_addr.size() == ADDR_INTERNAL_SIZE);
146 break;
147 case NET_UNROUTABLE:
148 case NET_MAX:
149 assert(false);
150 } // no default case, so the compiler can warn about missing cases
151
152 m_net = ipIn.m_net;
153 m_addr = ipIn.m_addr;
154}
155
156void CNetAddr::SetLegacyIPv6(Span<const uint8_t> ipv6) {
157 assert(ipv6.size() == ADDR_IPV6_SIZE);

Callers 3

GetLocalAddrForPeerFunction · 0.80
FUZZ_TARGETFunction · 0.80
FUZZ_TARGETFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by 2

FUZZ_TARGETFunction · 0.64
FUZZ_TARGETFunction · 0.64