blob: a4ea47777066ed0dadda90c53483a40183579478 [file] [log] [blame]
Luke Huang7b26b202019-03-28 14:09:24 +08001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#ifndef _RESOLVER_CONTROLLER_H_
18#define _RESOLVER_CONTROLLER_H_
19
20#include <list>
21#include <set>
22#include <vector>
23
waynema37255182019-03-18 13:22:56 +080024#include <aidl/android/net/ResolverParamsParcel.h>
Luke Huang7b26b202019-03-28 14:09:24 +080025#include "Dns64Configuration.h"
26#include "netd_resolv/resolv.h"
27#include "netdutils/DumpWriter.h"
28
29struct res_params;
30
31namespace android {
32namespace net {
33
Luke Huang7b26b202019-03-28 14:09:24 +080034class ResolverController {
35 public:
36 ResolverController();
37 ~ResolverController() = default;
38
Luke Huang9b80e6c2019-04-09 17:54:09 +080039 void destroyNetworkCache(unsigned netid);
40 int createNetworkCache(unsigned netid);
Luke Huang7b26b202019-03-28 14:09:24 +080041
42 int getPrefix64(unsigned netId, netdutils::IPPrefix* prefix);
43
waynema37255182019-03-18 13:22:56 +080044 // Binder specific functions, which convert between the ResolverParamsParcel and the
Luke Huang7b26b202019-03-28 14:09:24 +080045 // actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing.
waynema0e73c2e2019-07-31 15:04:08 +080046 int setResolverConfiguration(const aidl::android::net::ResolverParamsParcel& resolverParams);
Luke Huang7b26b202019-03-28 14:09:24 +080047
48 int getResolverInfo(int32_t netId, std::vector<std::string>* servers,
49 std::vector<std::string>* domains, std::vector<std::string>* tlsServers,
50 std::vector<int32_t>* params, std::vector<int32_t>* stats,
51 std::vector<int32_t>* wait_for_pending_req_timeout_count);
52
53 void startPrefix64Discovery(int32_t netId);
54 void stopPrefix64Discovery(int32_t netId);
55
56 void dump(netdutils::DumpWriter& dw, unsigned netId);
57
58 private:
59 Dns64Configuration mDns64Configuration;
60};
61} // namespace net
62} // namespace android
63
64#endif /* _RESOLVER_CONTROLLER_H_ */