ResolverController.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef _RESOLVER_CONTROLLER_H_
  17. #define _RESOLVER_CONTROLLER_H_
  18. #include <list>
  19. #include <set>
  20. #include <vector>
  21. #include <aidl/android/net/ResolverParamsParcel.h>
  22. #include "Dns64Configuration.h"
  23. #include "netd_resolv/resolv.h"
  24. #include "netdutils/DumpWriter.h"
  25. struct res_params;
  26. namespace android {
  27. namespace net {
  28. struct ResolverStats;
  29. class ResolverController {
  30. public:
  31. ResolverController();
  32. ~ResolverController() = default;
  33. void destroyNetworkCache(unsigned netid);
  34. int createNetworkCache(unsigned netid);
  35. int getPrefix64(unsigned netId, netdutils::IPPrefix* prefix);
  36. // Binder specific functions, which convert between the ResolverParamsParcel and the
  37. // actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing.
  38. int setResolverConfiguration(const aidl::android::net::ResolverParamsParcel& resolverParams,
  39. const std::set<std::vector<uint8_t>>& tlsFingerprints);
  40. int getResolverInfo(int32_t netId, std::vector<std::string>* servers,
  41. std::vector<std::string>* domains, std::vector<std::string>* tlsServers,
  42. std::vector<int32_t>* params, std::vector<int32_t>* stats,
  43. std::vector<int32_t>* wait_for_pending_req_timeout_count);
  44. void startPrefix64Discovery(int32_t netId);
  45. void stopPrefix64Discovery(int32_t netId);
  46. void dump(netdutils::DumpWriter& dw, unsigned netId);
  47. private:
  48. Dns64Configuration mDns64Configuration;
  49. };
  50. } // namespace net
  51. } // namespace android
  52. #endif /* _RESOLVER_CONTROLLER_H_ */