Kea 2.0.1
option6_pdexclude.h
Go to the documentation of this file.
1// Copyright (C) 2016-2017 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
67 virtual void pack(isc::util::OutputBuffer& buf) const;
68
73 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
74
79 virtual uint16_t len() const;
80
84 virtual std::string toText(int indent = 0) const;
85
95 getExcludedPrefix(const asiolink::IOAddress& delegated_prefix,
96 const uint8_t delegated_prefix_length) const;
97
99 uint8_t getExcludedPrefixLength() const {
100 return (excluded_prefix_length_);
101 }
102
104 const std::vector<uint8_t>& getExcludedPrefixSubnetID() const {
105 return (subnet_id_);
106 }
107
108private:
109
113 uint8_t getSubnetIDLength(const uint8_t delegated_prefix_length,
114 const uint8_t excluded_prefix_length) const;
115
117 uint8_t excluded_prefix_length_;
118
120 std::vector<uint8_t> subnet_id_;
121};
122
124typedef boost::shared_ptr<Option6PDExclude> Option6PDExcludePtr;
125
126} // isc::dhcp namespace
127} // isc namespace
128
129#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 void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format to a buffer.
virtual std::string toText(int indent=0) const
Returns Prefix Exclude option in textual format.
Option6PDExclude(const isc::asiolink::IOAddress &delegated_prefix, const uint8_t delegated_prefix_length, const isc::asiolink::IOAddress &excluded_prefix, const uint8_t excluded_prefix_length)
Constructor.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv6 option header)
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
uint8_t getExcludedPrefixLength() const
Returns excluded prefix length.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
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:36
Defines the logger used by the top-level component of kea-lfc.