Kea  1.9.9-git
option6_iaprefix.h
Go to the documentation of this file.
1 // Copyright (C) 2013-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_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 
14 namespace isc {
15 namespace dhcp {
16 
17 
52 
53 public:
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 
88  void pack(isc::util::OutputBuffer& buf) const;
89 
101  virtual void unpack(OptionBufferConstIter begin,
103 
109  virtual std::string toText(int indent = 0) const;
110 
116  uint8_t length) { addr_ = prefix; prefix_len_ = length; }
117 
118  uint8_t getLength() const { return prefix_len_; }
119 
121  virtual uint16_t len() const;
122 
123 private:
124 
133  void mask(OptionBuffer::const_iterator begin,
134  OptionBuffer::const_iterator end,
135  const uint8_t len,
136  OptionBuffer& output_address) const;
137 
138  uint8_t prefix_len_;
139 };
140 
142 typedef boost::shared_ptr<Option6IAPrefix> Option6IAPrefixPtr;
143 
144 } // isc::dhcp namespace
145 } // isc namespace
146 
147 #endif // OPTION_IAPREFIX_H
virtual std::string toText(int indent=0) const
Returns string representation of the option.
isc::asiolink::IOAddress addr_
contains an IPv6 address
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
void setPrefix(const isc::asiolink::IOAddress &prefix, uint8_t length)
sets address in this option.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Definition: option.h:24
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
Defines the logger used by the top-level component of kea-dhcp-ddns.
static const size_t OPTION6_IAPREFIX_LEN
length of the fixed part of the IAPREFIX option
void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
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).
Class that represents IAPREFIX option in DHCPv6.
virtual bool valid() const
returns if option is valid (e.g.
Definition: option.cc:202