Uh oh!
There was an error while loading. Please reload this page.
forked from CyanogenMod/android_system_netd
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResolverController.cpp
More file actions
Latest commit
125 lines (94 loc) · 3.16 KB
/
Copy pathResolverController.cpp
File metadata and controls
125 lines (94 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#defineLOG_TAG"ResolverController"
#defineDBG0
#include<cutils/log.h>
#include<net/if.h>
// NOTE: <resolv_iface.h> is a private C library header that provides
// declarations for _resolv_set_default_iface() and others.
#include<resolv_iface.h>
#include"ResolverController.h"
intResolverController::setDefaultInterface(constchar* iface) {
if (DBG) {
ALOGD("setDefaultInterface iface = %s\n", iface);
}
_resolv_set_default_iface(iface);
return0;
}
intResolverController::setInterfaceDnsServers(constchar* iface, constchar* domains,
constchar** servers, int numservers) {
if (DBG) {
ALOGD("setInterfaceDnsServers iface = %s\n", iface);
}
_resolv_set_nameservers_for_iface(iface, servers, numservers, domains);
return0;
}
intResolverController::setInterfaceAddress(constchar* iface, structin_addr* addr) {
if (DBG) {
ALOGD("setInterfaceAddress iface = %s\n", iface);
}
_resolv_set_addr_of_iface(iface, addr);
return0;
}
intResolverController::flushDefaultDnsCache() {
if (DBG) {
ALOGD("flushDefaultDnsCache\n");
}
_resolv_flush_cache_for_default_iface();
return0;
}
intResolverController::flushInterfaceDnsCache(constchar* iface) {
if (DBG) {
ALOGD("flushInterfaceDnsCache iface = %s\n", iface);
}
_resolv_flush_cache_for_iface(iface);
return0;
}
intResolverController::setDnsInterfaceForPid(constchar* iface, int pid) {
if (DBG) {
ALOGD("setDnsIfaceForPid iface = %s, pid = %d\n", iface, pid);
}
_resolv_set_iface_for_pid(iface, pid);
return0;
}
intResolverController::clearDnsInterfaceForPid(int pid) {
if (DBG) {
ALOGD("clearDnsIfaceForPid pid = %d\n", pid);
}
_resolv_clear_iface_for_pid(pid);
return0;
}
intResolverController::setDnsInterfaceForUidRange(constchar* iface, int uid_start, int uid_end) {
if (DBG) {
ALOGD("setDnsIfaceForUidRange iface = %s, range = [%d,%d]\n", iface, uid_start, uid_end);
}
return_resolv_set_iface_for_uid_range(iface, uid_start, uid_end);
}
intResolverController::clearDnsInterfaceForUidRange(int uid_start, int uid_end) {
if (DBG) {
ALOGD("clearDnsIfaceForUidRange range = [%d,%d]\n", uid_start, uid_end);
}
return_resolv_clear_iface_for_uid_range(uid_start, uid_end);
}
intResolverController::clearDnsInterfaceMappings()
{
if (DBG) {
ALOGD("clearInterfaceMappings\n");
}
_resolv_clear_iface_uid_range_mapping();
_resolv_clear_iface_pid_mapping();
return0;
}