Kea 2.5.9
option_classless_static_route.h
Go to the documentation of this file.
1// Copyright (C) 2023-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef OPTION_CLASSLESS_STATIC_ROUTE_H
8#define OPTION_CLASSLESS_STATIC_ROUTE_H
9
10#include <dhcp/dhcp4.h>
11#include <dhcp/option.h>
13
14namespace isc {
15namespace dhcp {
16
18typedef std::tuple<asiolink::IOAddress, uint8_t, asiolink::IOAddress> StaticRouteTuple;
19
22public:
39 bool convenient_notation = false);
40
44 OptionPtr clone() const override;
45
55 void pack(util::OutputBuffer& buf, bool check = true) const override;
56
63 void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) override;
64
70 std::string toText(int indent = 0) const override;
71
76 uint16_t len() const override;
77
78private:
80 std::vector<StaticRouteTuple> static_routes_;
81
83 uint16_t data_len_;
84
87 bool convenient_notation_;
88
95 static std::vector<uint8_t> encodeDestinationDescriptor(const StaticRouteTuple& route);
96
107 static uint8_t calcSignificantOctets(const uint8_t& mask_width);
108
114 void calcDataLen();
115
126 void parseWireData(OptionBufferConstIter begin, OptionBufferConstIter end);
127
139 void parseConfigData(const std::string& config_txt);
140};
141
143typedef boost::shared_ptr<OptionClasslessStaticRoute> OptionClasslessStaticRoutePtr;
144
145} // namespace dhcp
146} // namespace isc
147
148#endif // OPTION_CLASSLESS_STATIC_ROUTE_H
Represents DHCPv4 Classless Static Route Option (code 121).
std::string toText(int indent=0) const override
Returns string representation of the option.
OptionPtr clone() const override
Copies this option and returns a pointer to the copy.
void pack(util::OutputBuffer &buf, bool check=true) const override
Writes option in wire-format to a buffer.
void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) override
Parses option from the received buffer.
uint16_t len() const override
Returns length of the complete option (data length + DHCPv4 option header)
void check() const
A protected method used for option correctness.
Definition: option.cc:90
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:343
std::tuple< asiolink::IOAddress, uint8_t, asiolink::IOAddress > StaticRouteTuple
Defines a tuple of Subnet number, Subnet mask width and IPv4 router address.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
boost::shared_ptr< OptionClasslessStaticRoute > OptionClasslessStaticRoutePtr
A shared pointer to the OptionClasslessStaticRoute object.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:37
Defines the logger used by the top-level component of kea-lfc.