• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
24 #include <aidl/android/net/ResolverParamsParcel.h>
25 #include "Dns64Configuration.h"
26 #include "netd_resolv/resolv.h"
27 #include "netdutils/DumpWriter.h"
28 
29 struct res_params;
30 
31 namespace android {
32 namespace net {
33 
34 struct ResolverStats;
35 
36 class ResolverController {
37   public:
38     ResolverController();
39     ~ResolverController() = default;
40 
41     void destroyNetworkCache(unsigned netid);
42     int createNetworkCache(unsigned netid);
43 
44     int getPrefix64(unsigned netId, netdutils::IPPrefix* prefix);
45 
46     // Binder specific functions, which convert between the ResolverParamsParcel and the
47     // actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing.
48     int setResolverConfiguration(const aidl::android::net::ResolverParamsParcel& resolverParams,
49                                  const std::set<std::vector<uint8_t>>& tlsFingerprints);
50 
51     int getResolverInfo(int32_t netId, std::vector<std::string>* servers,
52                         std::vector<std::string>* domains, std::vector<std::string>* tlsServers,
53                         std::vector<int32_t>* params, std::vector<int32_t>* stats,
54                         std::vector<int32_t>* wait_for_pending_req_timeout_count);
55 
56     void startPrefix64Discovery(int32_t netId);
57     void stopPrefix64Discovery(int32_t netId);
58 
59     void dump(netdutils::DumpWriter& dw, unsigned netId);
60 
61   private:
62     Dns64Configuration mDns64Configuration;
63 };
64 }  // namespace net
65 }  // namespace android
66 
67 #endif /* _RESOLVER_CONTROLLER_H_ */
68