Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a0d6e60 authored by Luke Huang's avatar Luke Huang Committed by Gerrit Code Review
Browse files

Merge "Add control flags in asynchronous DNS query API"

parents ab4b7dd2 b12ec34c
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -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.