SOLA
Loading...
Searching...
No Matches
forwarding_limit.h
1// Copyright The SOLA Contributors
2//
3// Licensed under the MIT License.
4// For details on the licensing terms, see the LICENSE file.
5// SPDX-License-Identifier: MIT
6
7#ifndef NATTER_FORWARDING_LIMIT_H_
8#define NATTER_FORWARDING_LIMIT_H_
9
10#include <cstdint>
11#include <limits>
12#include <tuple>
13
14#include "core/natter_check.h"
15#include "natter/minhcast_level_number.h"
16#include "solanet/serializer/serialize.h"
17
18namespace natter::minhcast {
20public:
21 ForwardingLimit(uint32_t forwarding_up, uint32_t forwarding_down)
22 : forwarding_limits_(forwarding_up, forwarding_down) {
23 NATTER_CHECK(forwarding_up <= forwarding_down, "Forwarding up is greater than forwarding down");
24 }
25
26 ForwardingLimit() : forwarding_limits_(0, std::numeric_limits<Level>::max()) {}
27
28 uint32_t up() const { return std::get<0>(forwarding_limits_); }
29 uint32_t down() const { return std::get<1>(forwarding_limits_); }
30
31 SERIALIZE(forwarding_limits_);
32
33private:
34 std::tuple<Level, Level> forwarding_limits_;
35};
36} // namespace natter::minhcast
37
38#endif // DAISI_FORWARDING_LIMIT_H_
Definition forwarding_limit.h:19