MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

connectd/test/run-netaddress.c:157–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155/* AUTOGENERATED MOCKS END */
156
157int main(int argc, char *argv[])
158{
159 struct wireaddr wa;
160 const char *err;
161
162 common_setup(argv[0]);
163
164 // start with IPv4
165 parse_wireaddr("0.0.0.0", &wa, DEFAULT_PORT, NULL, &err);
166 assert(!IsValid(&wa));
167 assert(IsIPv4(&wa));
168 assert(!IsIPv6(&wa));
169 parse_wireaddr("255.255.255.255", &wa, DEFAULT_PORT, NULL, &err);
170 assert(!IsValid(&wa));
171 assert(IsIPv4(&wa));
172 assert(!IsIPv6(&wa));
173
174 parse_wireaddr("127.0.0.1", &wa, DEFAULT_PORT, NULL, &err);
175 assert(IsValid(&wa));
176 assert(IsIPv4(&wa));
177 assert(!IsIPv6(&wa));
178 assert(IsLocal(&wa));
179 assert(address_routable(&wa, true));
180 assert(!address_routable(&wa, false));
181
182 parse_wireaddr("0.1.2.3", &wa, DEFAULT_PORT, NULL, &err);
183 assert(IsValid(&wa));
184 assert(IsIPv4(&wa));
185 assert(!IsIPv6(&wa));
186 assert(IsLocal(&wa));
187 assert(address_routable(&wa, true));
188 assert(!address_routable(&wa, false));
189
190 parse_wireaddr("10.0.21.42", &wa, DEFAULT_PORT, NULL, &err);
191 assert(IsValid(&wa));
192 assert(IsIPv4(&wa));
193 assert(!IsIPv6(&wa));
194 assert(!IsLocal(&wa));
195 assert(IsRFC1918(&wa));
196 assert(!address_routable(&wa, true));
197 assert(!address_routable(&wa, false));
198
199 parse_wireaddr("192.168.123.4", &wa, DEFAULT_PORT, NULL, &err);
200 assert(IsValid(&wa));
201 assert(IsIPv4(&wa));
202 assert(!IsIPv6(&wa));
203 assert(!IsLocal(&wa));
204 assert(IsRFC1918(&wa));
205 assert(!address_routable(&wa, true));
206 assert(!address_routable(&wa, false));
207
208 parse_wireaddr("1.2.3.4", &wa, DEFAULT_PORT, NULL, &err);
209 assert(IsValid(&wa));
210 assert(IsIPv4(&wa));
211 assert(!IsIPv6(&wa));
212 assert(!IsLocal(&wa));
213 assert(address_routable(&wa, true));
214 assert(address_routable(&wa, false));

Callers

nothing calls this directly

Calls 9

common_setupFunction · 0.85
parse_wireaddrFunction · 0.85
IsValidFunction · 0.85
IsIPv4Function · 0.85
IsIPv6Function · 0.85
IsLocalFunction · 0.85
address_routableFunction · 0.85
IsRFC1918Function · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected