From: Nick Mathewson Date: Fri, 3 Sep 2010 20:42:16 +0000 (-0400) Subject: Expose a function to add a nameserver by sockaddr X-Git-Tag: release-2.0.7-rc~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=195214360c7cb107e86bfaa389812c879873f19c;p=libevent Expose a function to add a nameserver by sockaddr --- diff --git a/evdns.c b/evdns.c index 1248d2ae..9c6b104f 100644 --- a/evdns.c +++ b/evdns.c @@ -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) diff --git a/include/event2/dns.h b/include/event2/dns.h index 98eedb47..bfb6dc9f 100644 --- a/include/event2/dns.h +++ b/include/event2/dns.h @@ -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; /**