2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[#3074] new class for v4 option 121

This commit is contained in:
Piotrek Zadroga
2023-10-06 14:12:32 +02:00
parent faedb7b3dc
commit d0846e7410
3 changed files with 106 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ libkea_dhcp___la_SOURCES += option6_pdexclude.cc option6_pdexclude.h
libkea_dhcp___la_SOURCES += option6_status_code.cc option6_status_code.h
libkea_dhcp___la_SOURCES += option.cc option.h
libkea_dhcp___la_SOURCES += option_custom.cc option_custom.h
libkea_dhcp___la_SOURCES += option_classless_static_route.cc option_classless_static_route.h
libkea_dhcp___la_SOURCES += option_data_types.cc option_data_types.h
libkea_dhcp___la_SOURCES += option_definition.cc option_definition.h
libkea_dhcp___la_SOURCES += option4_dnr.cc option4_dnr.h

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2023 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "option_classless_static_route.h"
namespace isc {
namespace dhcp {
OptionPtr
OptionClasslessStaticRoute::clone() const {
return Option::clone();
}
void
OptionClasslessStaticRoute::pack(isc::util::OutputBuffer& buf, bool check) const {
Option::pack(buf, check);
}
void
OptionClasslessStaticRoute::unpack(OptionBufferConstIter begin,
OptionBufferConstIter end) {
Option::unpack(begin, end);
}
std::string
OptionClasslessStaticRoute::toText(int indent) const {
return Option::toText(indent);
}
uint16_t
OptionClasslessStaticRoute::len() const {
return Option::len();
}
} // namespace dhcp
} // namespace isc

View File

@@ -0,0 +1,65 @@
// Copyright (C) 2023 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef OPTION_CLASSLESS_STATIC_ROUTE_H
#define OPTION_CLASSLESS_STATIC_ROUTE_H
#include <dhcp/dhcp4.h>
#include <dhcp/option.h>
namespace isc {
namespace dhcp {
class OptionClasslessStaticRoute : public Option {
public:
/// @brief Constructor
OptionClasslessStaticRoute() : Option(V4, DHO_CLASSLESS_STATIC_ROUTE) {
}
/// @brief Copies this option and returns a pointer to the copy.
///
/// @return Pointer to the copy of the option.
OptionPtr clone() const override;
/// @brief Writes option in wire-format to a buffer.
///
/// Writes option in wire-format to buffer, returns pointer to first unused
/// byte after stored option (that is useful for writing options one after
/// another).
///
/// @param buf pointer to a buffer
/// @param check flag which indicates if checking the option length is
/// required (used only in V4)
///
/// @throw InvalidOptionDnrDomainName Thrown when Option's mandatory field ADN is empty.
void pack(util::OutputBuffer& buf, bool check = false) const override;
/// @brief Parses received wire data buffer.
///
/// @param begin iterator to first byte of option data
/// @param end iterator to end of option data (first byte after option end)
void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) override;
/// @brief Returns string representation of the option.
///
/// @param indent number of spaces before printing text
///
/// @return string with text representation.
std::string toText(int indent = 0) const override;
/// @brief Returns length of the complete option (data length + DHCPv4/DHCPv6
/// option header)
///
/// @return length of the option
uint16_t len() const override;
};
} // namespace dhcp
} // namespace isc
#endif // OPTION_CLASSLESS_STATIC_ROUTE_H