Kea 2.5.8
option6_pdexclude.h
Go to the documentation of this file.
1// Copyright (C) 2016-2022 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 OPTION6_PDEXCLUDE_H
8#define OPTION6_PDEXCLUDE_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/option.h>
12#include <boost/shared_ptr.hpp>
13#include <stdint.h>
14
15namespace isc {
16namespace dhcp {
17
25class Option6PDExclude: public Option {
26public:
27
38 Option6PDExclude(const isc::asiolink::IOAddress& delegated_prefix,
39 const uint8_t delegated_prefix_length,
40 const isc::asiolink::IOAddress& excluded_prefix,
41 const uint8_t excluded_prefix_length);
42
51
53 virtual OptionPtr clone() const;
54
68 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
69
74 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
75
80 virtual uint16_t len() const;
81
85 virtual std::string toText(int indent = 0) const;
86
96 getExcludedPrefix(const asiolink::IOAddress& delegated_prefix,
97 const uint8_t delegated_prefix_length) const;
98
100 uint8_t getExcludedPrefixLength() const {
101 return (excluded_prefix_length_);
102 }
103
105 const std::vector<uint8_t>& getExcludedPrefixSubnetID() const {
106 return (subnet_id_);
107 }
108
109private:
110
114 uint8_t getSubnetIDLength(const uint8_t delegated_prefix_length,
115 const uint8_t excluded_prefix_length) const;
116
118 uint8_t excluded_prefix_length_;
119
121 std::vector<uint8_t> subnet_id_;
122};
123
125typedef boost::shared_ptr<Option6PDExclude> Option6PDExcludePtr;
126
127} // isc::dhcp namespace
128} // isc namespace
129
130#endif // OPTION6_PDEXCLUDE_H
DHCPv6 option class representing Prefix Exclude Option (RFC 6603).
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
asiolink::IOAddress getExcludedPrefix(const asiolink::IOAddress &delegated_prefix, const uint8_t delegated_prefix_length) const
Returns excluded prefix.
const std::vector< uint8_t > & getExcludedPrefixSubnetID() const
Returns an excluded prefix in a binary format.
virtual std::string toText(int indent=0) const
Returns Prefix Exclude option in textual format.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv6 option header)
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format to a buffer.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
uint8_t getExcludedPrefixLength() const
Returns excluded prefix length.
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
boost::shared_ptr< Option6PDExclude > Option6PDExcludePtr
Pointer to the Option6PDExclude object.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
boost::shared_ptr< Option > OptionPtr
Definition: option.h:37
Defines the logger used by the top-level component of kea-lfc.