MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetIP

Method SetIP

src/netaddress.cpp:107–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105CNetAddr::CNetAddr() {}
106
107void CNetAddr::SetIP(const CNetAddr& ipIn)
108{
109 // Size check.
110 switch (ipIn.m_net) {
111 case NET_IPV4:
112 assert(ipIn.m_addr.size() == ADDR_IPV4_SIZE);
113 break;
114 case NET_IPV6:
115 assert(ipIn.m_addr.size() == ADDR_IPV6_SIZE);
116 break;
117 case NET_ONION:
118 assert(ipIn.m_addr.size() == ADDR_TORV3_SIZE);
119 break;
120 case NET_I2P:
121 assert(ipIn.m_addr.size() == ADDR_I2P_SIZE);
122 break;
123 case NET_CJDNS:
124 assert(ipIn.m_addr.size() == ADDR_CJDNS_SIZE);
125 break;
126 case NET_INTERNAL:
127 assert(ipIn.m_addr.size() == ADDR_INTERNAL_SIZE);
128 break;
129 case NET_UNROUTABLE:
130 case NET_MAX:
131 assert(false);
132 } // no default case, so the compiler can warn about missing cases
133
134 m_net = ipIn.m_net;
135 m_addr = ipIn.m_addr;
136}
137
138void CNetAddr::SetLegacyIPv6(Span<const uint8_t> ipv6)
139{

Callers 4

ProcessMessageMethod · 0.80
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