Tor
0.4.7.0-alpha-dev
|
Go to the source code of this file.
Macros | |
#define | tor_getaddrinfo(name, servname, hints, res) getaddrinfo((name),(servname), (hints),(res)) |
#define | tor_add_addrinfo(name) ((void)(name)) |
#define | tor_freeaddrinfo(addrinfo) freeaddrinfo((addrinfo)) |
#define | tor_free_getaddrinfo_cache() |
Functions | |
int | tor_lookup_hostname (const char *name, uint32_t *addr) |
int | tor_addr_lookup (const char *name, uint16_t family, struct tor_addr_t *addr_out) |
int | tor_addr_port_lookup (const char *s, struct tor_addr_t *addr_out, uint16_t *port_out) |
void | sandbox_disable_getaddrinfo_cache (void) |
void | tor_make_getaddrinfo_cache_active (void) |
int tor_addr_lookup | ( | const char * | name, |
uint16_t | family, | ||
tor_addr_t * | addr | ||
) |
Similar behavior to Unix gethostbyname: resolve name, and set *addr to the proper IP address and family. The family argument (which must be AF_INET, AF_INET6, or AF_UNSPEC) declares a preferred family, though another one may be returned if only one family is implemented for this address.
Like tor_addr_parse(), this function accepts IPv6 addresses with or without square brackets.
Return 0 on success, -1 on failure; 1 on transient failure.
int tor_addr_port_lookup | ( | const char * | s, |
tor_addr_t * | addr_out, | ||
uint16_t * | port_out | ||
) |
Parse an address or address-port combination from s, resolve the address as needed, and put the result in addr_out and (optionally) port_out.
Like tor_addr_port_parse(), this function accepts:
Return 0 on success, negative on failure.
int tor_lookup_hostname | ( | const char * | name, |
uint32_t * | addr | ||
) |
Similar behavior to Unix gethostbyname: resolve name, and set *addr to the proper IP address, in host byte order. Returns 0 on success, -1 on failure; 1 on transient failure.
This function only accepts IPv4 addresses.
(This function exists because standard windows gethostbyname doesn't treat raw IP addresses properly.)