20 const char *question,
char **answer,
28 question += strlen(
"ip-to-country/");
30 if (!strcmp(question,
"ipv4-available") ||
31 !strcmp(question,
"ipv6-available")) {
32 family = !strcmp(question,
"ipv4-available") ? AF_INET : AF_INET6;
39 if (family != AF_INET && family != AF_INET6) {
40 *errmsg =
"Invalid address family";
44 *errmsg =
"GeoIP data not loaded";
47 if (family == AF_INET)
int tor_addr_parse(tor_addr_t *addr, const char *src)
static uint32_t tor_addr_to_ipv4h(const tor_addr_t *a)
static const struct in6_addr * tor_addr_to_in6(const tor_addr_t *a)
Header file for connection.c.
Header file for control.c.
int geoip_get_country_by_ipv6(const struct in6_addr *addr)
int geoip_is_loaded(sa_family_t family)
const char * geoip_get_country_name(country_t num)
int geoip_get_country_by_ipv4(uint32_t ipaddr)
int getinfo_helper_geoip(control_connection_t *control_conn, const char *question, char **answer, const char **errmsg)
Header for getinfo_geoip.c.
Master header file for Tor-specific functionality.
int tor_asprintf(char **strp, const char *fmt,...)
int strcmpstart(const char *s1, const char *s2)