Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 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 | |
waynema | 3725518 | 2019-03-18 13:22:56 +0800 | [diff] [blame] | 24 | #include <aidl/android/net/ResolverParamsParcel.h> |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 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 | |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 34 | class ResolverController { |
| 35 | public: |
| 36 | ResolverController(); |
| 37 | ~ResolverController() = default; |
| 38 | |
Luke Huang | 9b80e6c | 2019-04-09 17:54:09 +0800 | [diff] [blame] | 39 | void destroyNetworkCache(unsigned netid); |
| 40 | int createNetworkCache(unsigned netid); |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 41 | |
| 42 | int getPrefix64(unsigned netId, netdutils::IPPrefix* prefix); |
| 43 | |
waynema | 3725518 | 2019-03-18 13:22:56 +0800 | [diff] [blame] | 44 | // Binder specific functions, which convert between the ResolverParamsParcel and the |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 45 | // actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing. |
waynema | 0e73c2e | 2019-07-31 15:04:08 +0800 | [diff] [blame] | 46 | int setResolverConfiguration(const aidl::android::net::ResolverParamsParcel& resolverParams); |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 47 | |
| 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_ */ |