Kea: option6_iaprefix.h Source File

| Kea 2.2.0

option6_iaprefix.h
Go to the documentation of this file.
1// Copyright (C) 2013-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_IAPREFIX_H
8#define OPTION6_IAPREFIX_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/option6_iaaddr.h>
12#include <dhcp/option.h>
13
14namespace isc {
15namespace dhcp {
16
17
51 class Option6IAPrefix : public Option6IAAddr {
52
53public:
55 static const size_t OPTION6_IAPREFIX_LEN = 25;
56
64 Option6IAPrefix(uint16_t type, const isc::asiolink::IOAddress& addr,
65 uint8_t prefix_length, uint32_t preferred, uint32_t valid);
66
74 Option6IAPrefix(uint32_t type, OptionBuffer::const_iterator begin,
75 OptionBuffer::const_iterator end);
76
78 virtual OptionPtr clone() const;
79
89 void pack(isc::util::OutputBuffer& buf, bool check = true) const;
90
102 virtual void unpack(OptionBufferConstIter begin,
103 OptionBufferConstIter end);
104
110 virtual std::string toText(int indent = 0) const;
111
116 void setPrefix(const isc::asiolink::IOAddress& prefix,
117 uint8_t length) { addr_ = prefix; prefix_len_ = length; }
118
119 uint8_t getLength() const { return prefix_len_; }
120
122 virtual uint16_t len() const;
123
124private:
125
134 void mask(OptionBuffer::const_iterator begin,
135 OptionBuffer::const_iterator end,
136 const uint8_t len,
137 OptionBuffer& output_address) const;
138
139 uint8_t prefix_len_;
140};
141
143 typedef boost::shared_ptr<Option6IAPrefix> Option6IAPrefixPtr;
144
145} // isc::dhcp namespace
146} // isc namespace
147
148#endif // OPTION_IAPREFIX_H
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic)
Definition: io_address.h:45
isc::dhcp::Option6IAAddr
Definition: option6_iaaddr.h:22
isc::dhcp::Option6IAAddr::addr_
isc::asiolink::IOAddress addr_
contains an IPv6 address
Definition: option6_iaaddr.h:117
isc::dhcp::Option6IAPrefix
Class that represents IAPREFIX option in DHCPv6.
Definition: option6_iaprefix.h:51
isc::dhcp::Option6IAPrefix::OPTION6_IAPREFIX_LEN
static const size_t OPTION6_IAPREFIX_LEN
length of the fixed part of the IAPREFIX option
Definition: option6_iaprefix.h:55
isc::dhcp::Option6IAPrefix::toText
virtual std::string toText(int indent=0) const
Returns string representation of the option.
Definition: option6_iaprefix.cc:99
isc::dhcp::Option6IAPrefix::getLength
uint8_t getLength() const
Definition: option6_iaprefix.h:119
isc::dhcp::Option6IAPrefix::unpack
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Definition: option6_iaprefix.cc:74
isc::dhcp::Option6IAPrefix::setPrefix
void setPrefix(const isc::asiolink::IOAddress &prefix, uint8_t length)
sets address in this option.
Definition: option6_iaprefix.h:116
isc::dhcp::Option6IAPrefix::Option6IAPrefix
Option6IAPrefix(uint16_t type, const isc::asiolink::IOAddress &addr, uint8_t prefix_length, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
Definition: option6_iaprefix.cc:29
isc::dhcp::Option6IAPrefix::clone
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Definition: option6_iaprefix.cc:49
isc::dhcp::Option6IAPrefix::len
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
Definition: option6_iaprefix.cc:110
isc::dhcp::Option6IAPrefix::pack
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
Definition: option6_iaprefix.cc:53
isc::dhcp::Option::valid
virtual bool valid() const
returns if option is valid (e.g.
Definition: option.cc:190
isc::dhcp::Option::check
void check() const
A protected method used for option correctness.
Definition: option.cc:90
isc::util::OutputBuffer
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
io_address.h
isc::dhcp::OptionBufferConstIter
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
isc::dhcp::Option6IAPrefixPtr
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
Definition: option6_iaprefix.h:143
isc::dhcp::OptionBuffer
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Definition: option.h:24
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143
option6_iaaddr.h
option.h