Kea 2.7.6
option_opaque_data_tuples.h
Go to the documentation of this file.
1// Copyright (C) 2015-2023 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 OPTION_OPAQUE_DATA_TUPLES_H
8#define OPTION_OPAQUE_DATA_TUPLES_H
9
10#include <dhcp/dhcp4.h>
11#include <dhcp/dhcp6.h>
13#include <dhcp/option.h>
14#include <util/buffer.h>
15#include <boost/shared_ptr.hpp>
17#include <stdint.h>
18
19namespace isc {
20namespace dhcp {
21
38public:
39
41 typedef std::vector<OpaqueDataTuple> TuplesCollection;
42
54 const uint16_t type,
56
71 const uint16_t type,
75
77 OptionPtr clone() const;
78
83 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
84
93 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
94
100 void addTuple(const OpaqueDataTuple& tuple);
101
113 void setTuple(const size_t at, const OpaqueDataTuple& tuple);
114
121 OpaqueDataTuple getTuple(const size_t at) const;
122
124 size_t getTuplesNum() const {
125 return (tuples_.size());
126 }
127
130 return (tuples_);
131 }
132
138 bool hasTuple(const std::string& tuple_str) const;
139
141 virtual uint16_t len() const;
142
147 virtual std::string toText(int indent = 0) const;
148
149private:
151 OpaqueDataTuple::LengthFieldType length_field_type_;
152
154 TuplesCollection tuples_;
155
156};
157
159typedef boost::shared_ptr<OptionOpaqueDataTuples> OptionOpaqueDataTuplesPtr;
160
161}
162}
163
164#endif // OPTION_OPAQUE_DATA_TUPLES_H
Represents a single instance of the opaque data preceded by length.
LengthFieldType
Size of the length field in the tuple.
This class encapsulates a collection of data tuples and could be used by multiple options.
void setTuple(const size_t at, const OpaqueDataTuple &tuple)
Replaces tuple at the specified index with a new tuple.
virtual std::string toText(int indent=0) const
Returns text representation of the option.
const TuplesCollection & getTuples() const
Returns collection of opaque data tuples carried in the option.
size_t getTuplesNum() const
Returns the number of opaque data tuples added to the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses buffer holding an option.
void addTuple(const OpaqueDataTuple &tuple)
Adds a new opaque data tuple to the option.
virtual uint16_t len() const
Returns the full length of the option, including option header.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Renders option into the buffer in the wire format.
OpaqueDataTuple getTuple(const size_t at) const
Returns opaque data tuple at the specified position.
std::vector< OpaqueDataTuple > TuplesCollection
Collection of opaque data tuples carried by the option.
bool hasTuple(const std::string &tuple_str) const
Checks if the object holds the opaque data tuple with the specified string.
OptionOpaqueDataTuples(Option::Universe u, const uint16_t type, OpaqueDataTuple::LengthFieldType length_field_type=OpaqueDataTuple::LENGTH_EMPTY)
Constructor.
Universe
defines option universe DHCPv4 or DHCPv6
Definition option.h:90
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
boost::shared_ptr< OptionOpaqueDataTuples > OptionOpaqueDataTuplesPtr
Defines a pointer to the OptionOpaqueDataTuples.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
Defines the logger used by the top-level component of kea-lfc.