21 #ifndef BM_BM_SIM_MATCH_KEY_TYPES_H_
22 #define BM_BM_SIM_MATCH_KEY_TYPES_H_
32 using internal_handle_t = uintptr_t;
33 using entry_handle_t = uint32_t;
35 enum class MatchUnitType {
36 EXACT, LPM, TERNARY, RANGE
42 MatchKey(ByteContainer data, uint32_t version)
43 : data(std::move(data)), version(version) {}
53 struct ExactMatchKey :
public MatchKey {
54 static constexpr MatchUnitType mut = MatchUnitType::EXACT;
57 struct LPMMatchKey :
public MatchKey {
59 LPMMatchKey(ByteContainer data,
int prefix_length, uint32_t version)
60 : MatchKey(std::move(data), version), prefix_length(prefix_length) {}
64 static constexpr MatchUnitType mut = MatchUnitType::LPM;
67 struct TernaryMatchKey :
public MatchKey {
69 TernaryMatchKey(ByteContainer data, ByteContainer mask,
int priority,
71 : MatchKey(std::move(data), version), mask(std::move(mask)),
78 int priority{std::numeric_limits<decltype(priority)>::max()};
80 static constexpr MatchUnitType mut = MatchUnitType::TERNARY;
83 struct RangeMatchKey :
public TernaryMatchKey {
85 RangeMatchKey(ByteContainer data, ByteContainer mask,
int priority,
86 std::vector<size_t> range_widths, uint32_t version)
87 : TernaryMatchKey(std::move(data), std::move(mask), priority, version),
88 range_widths(std::move(range_widths)) {}
90 std::vector<size_t> range_widths;
92 static constexpr MatchUnitType mut = MatchUnitType::RANGE;
97 #endif // BM_BM_SIM_MATCH_KEY_TYPES_H_