1
#pragma once
2

            
3
#include "envoy/formatter/http_formatter_context.h"
4
#include "envoy/http/header_map.h"
5
#include "envoy/stream_info/stream_info.h"
6

            
7
namespace Envoy {
8
namespace Http {
9

            
10
// The interface of applying operations to a header map.
11
class HeaderEvaluator {
12
public:
13
7793
  virtual ~HeaderEvaluator() = default;
14
  /**
15
   * Apply the header operations that are saved in the HeaderEvaluator. An example of the operation
16
   * is to add a new header name `foo` to the target header map and the header value is extracted
17
   * from the `bar` field in the stream_info, request headers or response headers.
18
   *
19
   * @param headers the target header map to be mutated.
20
   * @param context context to format the header value.
21
   * @param stream_info the source of values that can be used in the evaluation.
22
   */
23
  virtual void evaluateHeaders(Http::HeaderMap& headers, const Formatter::Context& context,
24
                               const StreamInfo::StreamInfo& stream_info) const PURE;
25
};
26
} // namespace Http
27
} // namespace Envoy