Expose a function to add a nameserver by sockaddr

This commit is contained in:
Nick Mathewson 2010-09-03 16:42:16 -04:00
parent fab50488fc
commit 195214360c
2 changed files with 20 additions and 1 deletions

12
evdns.c
View File

@ -2499,6 +2499,18 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
return evdns_base_nameserver_ip_add(current_base, ip_as_string);
}
int
evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
const struct sockaddr *sa, ev_socklen_t len, unsigned flags)
{
int res;
EVUTIL_ASSERT(base);
EVDNS_LOCK(base);
res = _evdns_nameserver_add_impl(base, sa, len);
EVDNS_UNLOCK(base);
return res;
}
/* remove from the queue */
static void
evdns_request_remove(struct request *req, struct request **head)

View File

@ -288,7 +288,7 @@ int evdns_base_clear_nameservers_and_suspend(struct evdns_base *base);
int evdns_base_resume(struct evdns_base *base);
/**
Add a nameserver.
Add a nameserver by string address.
This function parses a n IPv4 or IPv6 address from a string and adds it as a
nameserver. It supports the following formats:
@ -307,6 +307,13 @@ int evdns_base_resume(struct evdns_base *base);
int evdns_base_nameserver_ip_add(struct evdns_base *base,
const char *ip_as_string);
/**
Add a nameserver by sockaddr.
**/
int
evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
const struct sockaddr *sa, ev_socklen_t len, unsigned flags);
struct evdns_request;
/**