Kea  2.3.4-git
option4_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 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 
92  virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
93 
99  virtual std::string toText(int indent = 0) const;
100 
105  virtual uint16_t len() const;
106 
115  AddressContainer getAddresses() const { return addrs_; };
116 
129  void setAddresses(const AddressContainer& addrs);
130 
143  void setAddress(const isc::asiolink::IOAddress& addr);
144 
155  void addAddress(const isc::asiolink::IOAddress& addr);
156 
157 protected:
159  AddressContainer addrs_;
160 };
161 
162 } // namespace isc::dhcp
163 } // namespace isc
164 
165 #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.
void setAddresses(const AddressContainer &addrs)
Sets addresses list.
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: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-lfc.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in a wire-format to a buffer.
AddressContainer addrs_
contains list of addresses
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header) ...
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.
boost::shared_ptr< Option4AddrLst > Option4AddrLstPtr
A pointer to the Option4AddrLst object.
AddressContainer getAddresses() const
Returns vector with addresses.