Kea  1.9.9-git
option4_addrlst.h
Go to the documentation of this file.
1 // Copyright (C) 2011-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 OPTION4_ADDRLST_H
8 #define OPTION4_ADDRLST_H
9 
10 #include <asiolink/io_address.h>
11 #include <dhcp/option.h>
12 #include <util/buffer.h>
13 
14 #include <boost/shared_array.hpp>
15 #include <boost/shared_ptr.hpp>
16 
17 #include <map>
18 #include <string>
19 #include <vector>
20 
21 namespace isc {
22 namespace dhcp {
23 
26 
28 typedef boost::shared_ptr<Option4AddrLst> Option4AddrLstPtr;
29 
35 public:
36 
38  typedef std::vector<isc::asiolink::IOAddress> AddressContainer;
39 
46  Option4AddrLst(uint8_t type);
47 
54  Option4AddrLst(uint8_t type, const AddressContainer& addrs);
55 
62  Option4AddrLst(uint8_t type, const isc::asiolink::IOAddress& addr);
63 
80  Option4AddrLst(uint8_t type, OptionBufferConstIter first,
82 
84  virtual OptionPtr clone() const;
85 
91  virtual void pack(isc::util::OutputBuffer& buf) const;
92 
98  virtual std::string toText(int indent = 0) const;
99 
104  virtual uint16_t len() const;
105 
114  AddressContainer getAddresses() const { return addrs_; };
115 
128  void setAddresses(const AddressContainer& addrs);
129 
142  void setAddress(const isc::asiolink::IOAddress& addr);
143 
154  void addAddress(const isc::asiolink::IOAddress& addr);
155 
156 protected:
158  AddressContainer addrs_;
159 };
160 
161 } // namespace isc::dhcp
162 } // namespace isc
163 
164 #endif // OPTION4_ADDRLST_H
void addAddress(const isc::asiolink::IOAddress &addr)
Adds address to existing list of addresses.
DHCPv4 Option class for handling list of IPv4 addresses.
std::vector< isc::asiolink::IOAddress > AddressContainer
Defines a collection of IPv4 addresses.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
Option4AddrLst(uint8_t type)
Constructor, creates an option with empty list of addresses.
AddressContainer getAddresses() const
Returns vector with addresses.
void setAddresses(const AddressContainer &addrs)
Sets addresses list.
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
void setAddress(const isc::asiolink::IOAddress &addr)
Clears address list and sets a single address.
Defines the logger used by the top-level component of kea-dhcp-ddns.
AddressContainer addrs_
contains list of addresses
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
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< Option4AddrLst > Option4AddrLstPtr
A pointer to the Option4AddrLst object.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in a wire-format to a buffer.