/proc/self/cwd/source/extensions/filters/udp/udp_proxy/hash_policy_impl.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include "envoy/extensions/filters/udp/udp_proxy/v3/udp_proxy.pb.h" |
4 | | #include "envoy/udp/hash_policy.h" |
5 | | |
6 | | #include "source/common/common/hash.h" |
7 | | |
8 | | namespace Envoy { |
9 | | namespace Extensions { |
10 | | namespace UdpFilters { |
11 | | namespace UdpProxy { |
12 | | |
13 | | using namespace envoy::extensions::filters::udp::udp_proxy::v3; |
14 | | |
15 | | /** |
16 | | * Implementation of HashPolicy that reads from the UDP proxy filter config. |
17 | | */ |
18 | | class HashPolicyImpl : public Udp::HashPolicy { |
19 | | public: |
20 | | explicit HashPolicyImpl(const absl::Span<const UdpProxyConfig::HashPolicy* const>& hash_policies); |
21 | | |
22 | | // Udp::HashPolicy |
23 | | absl::optional<uint64_t> |
24 | | generateHash(const Network::Address::Instance& downstream_addr) const override; |
25 | | |
26 | | class HashMethod { |
27 | | public: |
28 | 0 | virtual ~HashMethod() = default; |
29 | | virtual absl::optional<uint64_t> |
30 | | evaluate(const Network::Address::Instance& downstream_addr) const PURE; |
31 | | }; |
32 | | |
33 | | using HashMethodPtr = std::unique_ptr<HashMethod>; |
34 | | |
35 | | private: |
36 | | HashMethodPtr hash_impl_; |
37 | | }; |
38 | | |
39 | | } // namespace UdpProxy |
40 | | } // namespace UdpFilters |
41 | | } // namespace Extensions |
42 | | } // namespace Envoy |