Kea  2.3.4-git
option6_addrlst.h
Go to the documentation of this file.
1 // Copyright (C) 2011-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_ADDRLST_H
8 #define OPTION6_ADDRLST_H
9 
10 #include <asiolink/io_address.h>
11 #include <dhcp/option.h>
12 #include <boost/shared_ptr.hpp>
13 #include <vector>
14 
15 namespace isc {
16 namespace dhcp {
17 
22 class Option6AddrLst: public Option {
23 
24 public:
26  typedef std::vector<isc::asiolink::IOAddress> AddressContainer;
27 
32  Option6AddrLst(uint16_t type, const AddressContainer& addrs);
33 
38  Option6AddrLst(uint16_t type, const isc::asiolink::IOAddress& addr);
39 
45  Option6AddrLst(uint16_t type, OptionBufferConstIter begin,
47 
48  virtual OptionPtr clone() const;
49 
54  void pack(isc::util::OutputBuffer& buf, bool check = true) const;
55 
60  virtual void unpack(OptionBufferConstIter begin,
62 
63  virtual std::string toText(int indent = 0) const;
64 
68  void setAddress(const isc::asiolink::IOAddress& addr);
69 
73  void setAddresses(const AddressContainer& addrs);
74 
83  AddressContainer getAddresses() const { return addrs_; };
84 
85  // returns data length (data length + DHCPv4/DHCPv6 option header)
86  virtual uint16_t len() const;
87 
88 protected:
89  AddressContainer addrs_;
90 };
91 
93 typedef boost::shared_ptr<Option6AddrLst> Option6AddrLstPtr;
94 
95 } // isc::dhcp namespace
96 } // isc namespace
97 
98 #endif // OPTION_ADDRLST_H
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
DHCPv6 Option class for handling list of IPv6 addresses.
virtual std::string toText(int indent=0) const
Returns string representation of the option.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header) ...
boost::shared_ptr< Option6AddrLst > Option6AddrLstPtr
Pointer to the Option6AddrLst object.
std::vector< isc::asiolink::IOAddress > AddressContainer
a container for (IPv6) addresses
void setAddress(const isc::asiolink::IOAddress &addr)
Sets a single address.
AddressContainer getAddresses() const
Returns vector with addresses.
void check() const
A protected method used for option correctness.
Definition: option.cc:90
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received data.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
Option6AddrLst(uint16_t type, const AddressContainer &addrs)
Constructor used during option generation.
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-lfc.
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Assembles on-wire form of this option.
void setAddresses(const AddressContainer &addrs)
Sets list of addresses.