I've changed the subject since it's now off-topic (solved that part).
And a CRT is what?
A "C Run-time".
// Set country code
loc_network_set_country_code(network4, "ZZ");
I assume you meant to set the country code for network5?
Oh, yes. Silly me.
But other item. I've come a long way integrating 'libloc' support in my program. Basically I do:
struct in6_addr addr; struct loc_network *net; struct loc_as *as = NULL; ... loc_database_lookup (libloc_data.db, &addr, &net); int family = loc_network_address_family (net); const char *country = loc_network_get_country_code (net); const char *AS_name = NULL;
uint32 AS_num = loc_network_get_asn (net); is_anycast = loc_network_has_flag (net, LOC_NETWORK_FLAG_ANYCAST); is_anon_proxy = loc_network_has_flag (net, LOC_NETWORK_FLAG_ANONYMOUS_PROXY); sat_provider = loc_network_has_flag (net, LOC_NETWORK_FLAG_SATELLITE_PROVIDER);
if (AS_num) { int r = loc_as_new (libloc_data.ctx, &as, AS_num); if (r == 0) AS_name = loc_as_get_name (as); } printf ("ASN: %lu, AF: %d, country: %s, name: %s (%d,%d,%d)", AS_num, family, country, AS_name, is_anycast, is_anon_proxy, sat_provider); if (as) loc_as_unref (as); loc_network_unref (net);
-------------
Everything except 'AS_name' is okay and prints sensible values (I've checked all ret-vals). Since there isn't any 'loc_get_asn_by_number()' function, what should I do to get a non-NULL 'AS_name' from 'AS_num'?
PS. do I really need this 'loc_network_unref()'? Or does 'loc_database_lookup()' handle it?