1
#pragma once
2

            
3
#include <memory>
4

            
5
#include "envoy/config/route/v3/route.pb.h"
6
#include "envoy/http/filter.h"
7
#include "envoy/rds/route_config_provider.h"
8
#include "envoy/router/router.h"
9

            
10
namespace Envoy {
11
namespace Router {
12

            
13
/**
14
 * A provider for constant route configurations.
15
 */
16
class RouteConfigProvider : public Rds::RouteConfigProvider {
17
public:
18
  /**
19
   * Same purpose as Rds::RouteConfigProvider::config()
20
   * but the return is downcasted to proper type.
21
   * @return downcasted ConfigConstSharedPtr from Rds::ConfigConstSharedPtr
22
   */
23
  virtual ConfigConstSharedPtr configCast() const PURE;
24

            
25
  /**
26
   * Callback used to request an update to the route configuration from the management server.
27
   * @param for_domain supplies the domain name that virtual hosts must match on
28
   * @param thread_local_dispatcher thread-local dispatcher
29
   * @param route_config_updated_cb callback to be called when the configuration update has been
30
   * propagated to worker threads
31
   */
32
  virtual void requestVirtualHostsUpdate(
33
      const std::string& for_domain, Event::Dispatcher& thread_local_dispatcher,
34
      std::weak_ptr<Http::RouteConfigUpdatedCallback> route_config_updated_cb) PURE;
35
};
36

            
37
using RouteConfigProviderPtr = std::unique_ptr<RouteConfigProvider>;
38
using RouteConfigProviderSharedPtr = std::shared_ptr<RouteConfigProvider>;
39

            
40
} // namespace Router
41
} // namespace Envoy