Kea 2.7.5
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
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,
104
110 virtual std::string toText(int indent = 0) const;
111
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
143typedef boost::shared_ptr<Option6IAPrefix> Option6IAPrefixPtr;
144
145} // isc::dhcp namespace
146} // isc namespace
147
148#endif // OPTION_IAPREFIX_H
isc::asiolink::IOAddress addr_
contains an IPv6 address
Class that represents IAPREFIX option in DHCPv6.
static const size_t OPTION6_IAPREFIX_LEN
length of the fixed part of the IAPREFIX option
virtual std::string toText(int indent=0) const
Returns string representation of the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
void setPrefix(const isc::asiolink::IOAddress &prefix, uint8_t length)
sets address in this option.
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).
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
virtual bool valid() const
returns if option is valid (e.g.
Definition option.cc:190
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
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Definition option.h:24
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
Defines the logger used by the top-level component of kea-lfc.