Kea: option6_iaprefix.h Source File

| Kea 3.2.0-git

option6_iaprefix.h
Go to the documentation of this file.
1// Copyright (C) 2013-2026 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
75 Option6IAPrefix(uint32_t type, OptionBuffer::const_iterator begin,
76 OptionBuffer::const_iterator end, size_t rec_level = 0);
77
79 virtual OptionPtr clone() const;
80
90 void pack(isc::util::OutputBuffer& buf, bool check = true) const;
91
103 virtual void unpack(OptionBufferConstIter begin,
104 OptionBufferConstIter end);
105
113 void unpack(OptionBufferConstIter begin,
114 OptionBufferConstIter end,
115 size_t rec_level);
116
122 virtual std::string toText(int indent = 0) const;
123
128 void setPrefix(const isc::asiolink::IOAddress& prefix,
129 uint8_t length) { addr_ = prefix; prefix_len_ = length; }
130
131 uint8_t getLength() const { return prefix_len_; }
132
134 virtual uint16_t len() const;
135
136private:
137
146 void mask(OptionBuffer::const_iterator begin,
147 OptionBuffer::const_iterator end,
148 const uint8_t len,
149 OptionBuffer& output_address) const;
150
151 uint8_t prefix_len_;
152};
153
155 typedef boost::shared_ptr<Option6IAPrefix> Option6IAPrefixPtr;
156
157} // isc::dhcp namespace
158} // isc namespace
159
160#endif // OPTION_IAPREFIX_H
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:53
isc::dhcp::Option6IAAddr::Option6IAAddr
Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress &addr, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
Definition option6_iaaddr.cc:29
isc::dhcp::Option6IAAddr::addr_
isc::asiolink::IOAddress addr_
contains an IPv6 address
Definition option6_iaaddr.h:127
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:116
isc::dhcp::Option6IAPrefix::getLength
uint8_t getLength() const
Definition option6_iaprefix.h:131
isc::dhcp::Option6IAPrefix::unpack
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Definition option6_iaprefix.cc:85
isc::dhcp::Option6IAPrefix::setPrefix
void setPrefix(const isc::asiolink::IOAddress &prefix, uint8_t length)
sets address in this option.
Definition option6_iaprefix.h:128
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:30
isc::dhcp::Option6IAPrefix::clone
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Definition option6_iaprefix.cc:60
isc::dhcp::Option6IAPrefix::len
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
Definition option6_iaprefix.cc:127
isc::dhcp::Option6IAPrefix::pack
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
Definition option6_iaprefix.cc:64
isc::dhcp::Option::valid
virtual bool valid() const
returns if option is valid (e.g.
Definition option.cc:191
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:346
io_address.h
isc::dhcp
Definition dhcp4/client_handler.cc:20
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:155
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:37
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
option6_iaaddr.h
option.h