1
#pragma once
2

            
3
#include "envoy/network/address.h"
4

            
5
#include "absl/types/optional.h"
6

            
7
namespace Envoy {
8
namespace Udp {
9
/**
10
 * Hash policy for UDP transport layer protocol.
11
 */
12
class HashPolicy {
13
public:
14
7
  virtual ~HashPolicy() = default;
15

            
16
  /**
17
   * @param downstream_address is the address of the peer client.
18
   * @return absl::optional<uint64_t> an optional hash value to route on. A hash value might not be
19
   * returned if for example the downstream address has a unix domain socket type.
20
   */
21
  virtual absl::optional<uint64_t>
22
  generateHash(const Network::Address::Instance& downstream_address) const PURE;
23
};
24
} // namespace Udp
25
} // namespace Envoy