Kea 2.0.1
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
21namespace isc {
22namespace dhcp {
23
25class Option4AddrLst;
26
28typedef boost::shared_ptr<Option4AddrLst> Option4AddrLstPtr;
29
35public:
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
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
156protected:
159};
160
161} // namespace isc::dhcp
162} // namespace isc
163
164#endif // OPTION4_ADDRLST_H
DHCPv4 Option class for handling list of IPv4 addresses.
std::vector< isc::asiolink::IOAddress > AddressContainer
Defines a collection of IPv4 addresses.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
AddressContainer getAddresses() const
Returns vector with addresses.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in a wire-format to a buffer.
Option4AddrLst(uint8_t type)
Constructor, creates an option with empty list of addresses.
void setAddresses(const AddressContainer &addrs)
Sets addresses list.
void setAddress(const isc::asiolink::IOAddress &addr)
Clears address list and sets a single address.
AddressContainer addrs_
contains list of 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)
void addAddress(const isc::asiolink::IOAddress &addr)
Adds address to existing list of addresses.
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
boost::shared_ptr< Option4AddrLst > Option4AddrLstPtr
A pointer to the Option4AddrLst object.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
Defines the logger used by the top-level component of kea-lfc.