2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "ResolverController"
20 #include <cutils/log.h>
24 // NOTE: <resolv_netid.h> is a private C library header that provides
25 // declarations for _resolv_set_nameservers_for_net and
26 // _resolv_flush_cache_for_net
27 #include <resolv_netid.h>
28 #include <resolv_params.h>
30 #include "ResolverController.h"
32 int ResolverController::setDnsServers(unsigned netId, const char* searchDomains,
33 const char** servers, int numservers, const __res_params* params) {
35 ALOGD("setDnsServers netId = %u\n", netId);
37 _resolv_set_nameservers_for_net(netId, servers, numservers, searchDomains, params);
41 int ResolverController::clearDnsServers(unsigned netId) {
42 _resolv_set_nameservers_for_net(netId, NULL, 0, "", NULL);
44 ALOGD("clearDnsServers netId = %u\n", netId);
49 int ResolverController::flushDnsCache(unsigned netId) {
51 ALOGD("flushDnsCache netId = %u\n", netId);
54 _resolv_flush_cache_for_net(netId);