Kea 2.7.6
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
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
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
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
157protected:
160};
161
162} // namespace isc::dhcp
163} // namespace isc
164
165#endif // OPTION4_ADDRLST_H
DHCPv4 Option class for handling list of IPv4 addresses.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
AddressContainer getAddresses() const
Returns vector with addresses.
std::vector< isc::asiolink::IOAddress > AddressContainer
Defines a collection of IPv4 addresses.
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.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in a wire-format to a buffer.
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:343
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:37
Defines the logger used by the top-level component of kea-lfc.