LCOV - code coverage report
Current view: top level - envoy/network - dns_resolver.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 2 3 66.7 %
Date: 2024-01-05 06:35:25 Functions: 2 3 66.7 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "envoy/api/api.h"
       4             : #include "envoy/event/dispatcher.h"
       5             : #include "envoy/network/dns.h"
       6             : 
       7             : #include "source/common/config/utility.h"
       8             : 
       9             : namespace Envoy {
      10             : namespace Network {
      11             : 
      12             : constexpr absl::string_view CaresDnsResolver = "envoy.network.dns_resolver.cares";
      13             : constexpr absl::string_view AppleDnsResolver = "envoy.network.dns_resolver.apple";
      14             : constexpr absl::string_view DnsResolverCategory = "envoy.network.dns_resolver";
      15             : 
      16             : class DnsResolverFactory : public Config::TypedFactory {
      17             : public:
      18             :   /**
      19             :    * @returns a DnsResolver object.
      20             :    * @param dispatcher: the local dispatcher thread
      21             :    * @param api: API interface to interact with system resources
      22             :    * @param typed_dns_resolver_config: the typed DNS resolver config
      23             :    */
      24             :   virtual DnsResolverSharedPtr createDnsResolver(
      25             :       Event::Dispatcher& dispatcher, Api::Api& api,
      26             :       const envoy::config::core::v3::TypedExtensionConfig& typed_dns_resolver_config) const PURE;
      27             : 
      28          29 :   std::string category() const override { return std::string(DnsResolverCategory); }
      29             : 
      30             :   /**
      31             :    * Initialize the related data for this type of DNS resolver.
      32             :    * For some DNS resolvers, like c-ares, there are some specific data structure
      33             :    * needs to be initialized before using it to resolve target.
      34             :    */
      35           0 :   virtual void initialize() {}
      36             : 
      37             :   /**
      38             :    * Cleanup the related data for this type of DNS resolver.
      39             :    * For some DNS resolvers, like c-ares, there are some specific data structure
      40             :    * needs to be cleaned up before terminates Envoy.
      41             :    */
      42           2 :   virtual void terminate() {}
      43             : 
      44             :   /**
      45             :    * Create the DNS resolver factory based on the typed config and initialize it.
      46             :    * @returns the DNS Resolver factory.
      47             :    * @param typed_dns_resolver_config: the typed DNS resolver config
      48             :    */
      49             :   static Network::DnsResolverFactory&
      50             :   createFactory(const envoy::config::core::v3::TypedExtensionConfig& typed_dns_resolver_config);
      51             : 
      52             :   /**
      53             :    * Call the terminate method on all the registered DNS resolver factories.
      54             :    */
      55             :   static void terminateFactories();
      56             : };
      57             : 
      58             : } // namespace Network
      59             : } // namespace Envoy

Generated by: LCOV version 1.15