summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Luke Huang <huangluke@google.com> 2018-12-20 14:37:14 +0800
committer Luke Huang <huangluke@google.com> 2019-01-08 17:56:07 +0800
commitb12ec34c69ed4b61097be9715004f182b4bf42c8 (patch)
treed87f9c12d708414df78d58dbc5bc7a3067e47b3e
parent47a389f2acd819d0a9fdb2b8bb0b0254b8e28abc (diff)
Add control flags in asynchronous DNS query API
Test: built, flashed, booted cts test: NativeDnsAsyncTest Change-Id: Ia1a0195a1441ad0f1dcef49fea80266a7180f07f
-rw-r--r--include/android/multinetwork.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/android/multinetwork.h b/include/android/multinetwork.h
index fa7d9080c3..05d96ff2d1 100644
--- a/include/android/multinetwork.h
+++ b/include/android/multinetwork.h
@@ -112,26 +112,43 @@ int android_getaddrinfofornetwork(net_handle_t network,
#if __ANDROID_API__ >= 29
+enum ResNsendFlags : uint32_t {
+ // Send a single request to a single resolver and fail on timeout or network errors
+ ANDROID_RESOLV_NO_RETRY = 1 << 0,
+
+ // Do not cache the result of the lookup. The lookup may return a result that is already
+ // in the cache, unless the ANDROID_RESOLV_NO_CACHE_LOOKUP flag is also specified.
+ ANDROID_RESOLV_NO_CACHE_STORE = 1 << 1,
+
+ // Don't lookup the request in cache, do not write back the response into the cache
+ ANDROID_RESOLV_NO_CACHE_LOOKUP = 1 << 2,
+};
+
/**
* Look up the {|ns_class|, |ns_type|} Resource Record (RR) associated
* with Domain Name |dname| on the given |network|.
* The typical value for |ns_class| is ns_c_in, while |type| can be any
* record type (for instance, ns_t_aaaa or ns_t_txt).
+ * |flags| is a additional config to control actual querying behavior, see
+ * ResNsendFlags for detail.
*
* Returns a file descriptor to watch for read events, or a negative
* POSIX error code (see errno.h) if an immediate error occurs.
*/
int android_res_nquery(net_handle_t network,
- const char *dname, int ns_class, int ns_type) __INTRODUCED_IN(29);
+ const char *dname, int ns_class, int ns_type,
+ enum ResNsendFlags flags) __INTRODUCED_IN(29);
/**
* Issue the query |msg| on the given |network|.
+ * |flags| is a additional config to control actual querying behavior, see
+ * ResNsendFlags for detail.
*
* Returns a file descriptor to watch for read events, or a negative
* POSIX error code (see errno.h) if an immediate error occurs.
*/
int android_res_nsend(net_handle_t network,
- const uint8_t *msg, size_t msglen) __INTRODUCED_IN(29);
+ const uint8_t *msg, size_t msglen, enum ResNsendFlags flags) __INTRODUCED_IN(29);
/**
* Read a result for the query associated with the |fd| descriptor.