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_iface.h> is a private C library header that provides
25 // declarations for _resolv_set_default_iface() and others.
26 #include <resolv_iface.h>
28 #include "ResolverController.h"
30 int ResolverController::setDefaultInterface(const char* iface) {
32 ALOGD("setDefaultInterface iface = %s\n", iface);
35 _resolv_set_default_iface(iface);
40 int ResolverController::setInterfaceDnsServers(const char* iface, char** servers, int numservers) {
42 ALOGD("setInterfaceDnsServers iface = %s\n", iface);
45 _resolv_set_nameservers_for_iface(iface, servers, numservers);
50 int ResolverController::setInterfaceAddress(const char* iface, struct in_addr* addr) {
52 ALOGD("setInterfaceAddress iface = %s\n", iface);
55 _resolv_set_addr_of_iface(iface, addr);
60 int ResolverController::flushDefaultDnsCache() {
62 ALOGD("flushDefaultDnsCache\n");
65 _resolv_flush_cache_for_default_iface();
70 int ResolverController::flushInterfaceDnsCache(const char* iface) {
72 ALOGD("flushInterfaceDnsCache iface = %s\n", iface);
75 _resolv_flush_cache_for_iface(iface);