Merge "Add NDK API for getprocdns,setprocdns"
This commit is contained in:
@@ -276,6 +276,8 @@ LIBANDROID {
|
|||||||
android_getaddrinfofornetwork; # introduced=23
|
android_getaddrinfofornetwork; # introduced=23
|
||||||
android_getprocnetwork; # introduced=31
|
android_getprocnetwork; # introduced=31
|
||||||
android_setprocnetwork; # introduced=23
|
android_setprocnetwork; # introduced=23
|
||||||
|
android_getprocdns; # introduced=31
|
||||||
|
android_setprocdns; # introduced=31
|
||||||
android_setsocknetwork; # introduced=23
|
android_setsocknetwork; # introduced=23
|
||||||
android_res_cancel; # introduced=29
|
android_res_cancel; # introduced=29
|
||||||
android_res_nquery; # introduced=29
|
android_res_nquery; # introduced=29
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ LIBANDROID_NET {
|
|||||||
android_res_nsend; # llndk
|
android_res_nsend; # llndk
|
||||||
# These functions have been part of the NDK since API 31.
|
# These functions have been part of the NDK since API 31.
|
||||||
android_getprocnetwork; # llndk
|
android_getprocnetwork; # llndk
|
||||||
|
android_setprocdns; # llndk
|
||||||
|
android_getprocdns; # llndk
|
||||||
local:
|
local:
|
||||||
*;
|
*;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,6 +90,38 @@ int android_getprocnetwork(net_handle_t *network) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int android_setprocdns(net_handle_t network) {
|
||||||
|
unsigned netid;
|
||||||
|
if (!getnetidfromhandle(network, &netid)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rval = setNetworkForResolv(netid);
|
||||||
|
if (rval < 0) {
|
||||||
|
errno = -rval;
|
||||||
|
rval = -1;
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int android_getprocdns(net_handle_t *network) {
|
||||||
|
if (network == NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned netid;
|
||||||
|
int rval = getNetworkForDns(&netid);
|
||||||
|
if (rval < 0) {
|
||||||
|
errno = -rval;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*network = gethandlefromnetid(netid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int android_getaddrinfofornetwork(net_handle_t network,
|
int android_getaddrinfofornetwork(net_handle_t network,
|
||||||
const char *node, const char *service,
|
const char *node, const char *service,
|
||||||
const struct addrinfo *hints, struct addrinfo **res) {
|
const struct addrinfo *hints, struct addrinfo **res) {
|
||||||
|
|||||||
Reference in New Issue
Block a user