forked from envoyproxy/envoy-filter-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp_filter.h
More file actions
49 lines (35 loc) · 1.29 KB
/
http_filter.h
File metadata and controls
49 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <string>
#include "server/config/network/http_connection_manager.h"
#include "http-filter-example/http_filter.pb.h"
namespace Envoy {
namespace Http {
class HttpSampleDecoderFilterConfig {
public:
HttpSampleDecoderFilterConfig(const sample::Decoder& proto_config);
const std::string& key() const { return key_; }
const std::string& val() const { return val_; }
private:
const std::string key_;
const std::string val_;
};
typedef std::shared_ptr<HttpSampleDecoderFilterConfig> HttpSampleDecoderFilterConfigSharedPtr;
class HttpSampleDecoderFilter : public StreamDecoderFilter {
public:
HttpSampleDecoderFilter(HttpSampleDecoderFilterConfigSharedPtr);
~HttpSampleDecoderFilter();
// Http::StreamFilterBase
void onDestroy() override;
// Http::StreamDecoderFilter
FilterHeadersStatus decodeHeaders(HeaderMap&, bool) override;
FilterDataStatus decodeData(Buffer::Instance&, bool) override;
FilterTrailersStatus decodeTrailers(HeaderMap&) override;
void setDecoderFilterCallbacks(StreamDecoderFilterCallbacks&) override;
private:
const HttpSampleDecoderFilterConfigSharedPtr config_;
StreamDecoderFilterCallbacks* decoder_callbacks_;
const LowerCaseString headerKey() const;
const std::string headerValue() const;
};
} // namespace Http
} // namespace Envoy