Macros | Functions
resolve.h File Reference
#include "orconfig.h"
#include "lib/cc/torint.h"
#include "lib/testsupport/testsupport.h"

Go to the source code of this file.


#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()


 MOCK_DECL (int, tor_lookup_hostname,(const char *name, uint32_t *addr))
 MOCK_DECL (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)

Detailed Description

Header for resolve.c.

Definition in file resolve.h.

Function Documentation

◆ tor_addr_port_lookup()

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:

  • IPv6 address and port, when the IPv6 address is in square brackets,
  • IPv6 address with square brackets,
  • IPv6 address without square brackets.

Return 0 on success, negative on failure.

Definition at line 255 of file resolve.c.

References eat_whitespace(), LOG_WARN, tor_addr_parse(), tor_addr_port_parse(), and tor_assert().