Kea 2.5.8
option_string.h
Go to the documentation of this file.
1// Copyright (C) 2013-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 OPTION_STRING_H
8#define OPTION_STRING_H
9
10#include <dhcp/option.h>
11#include <util/buffer.h>
12
13#include <boost/shared_ptr.hpp>
14#include <string>
15
16namespace isc {
17namespace dhcp {
18
28class OptionString : public Option {
29public:
30
43 OptionString(const Option::Universe u, const uint16_t type,
44 const std::string& value);
45
58 OptionString(const Option::Universe u, const uint16_t type,
60
62 OptionPtr clone() const;
63
67 virtual uint16_t len() const;
68
72 std::string getValue() const;
73
81 void setValue(const std::string& value);
82
91 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
92
105 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
106
113 virtual std::string toText(int indent = 0) const;
114
119 virtual std::string toString() const;
120};
121
123typedef boost::shared_ptr<OptionString> OptionStringPtr;
124
125} // namespace isc::dhcp
126} // namespace isc
127
128#endif // OPTION_STRING_H
Class which represents an option carrying a single string value.
Definition: option_string.h:28
void setValue(const std::string &value)
Sets the string value to be held by the option.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Creates on-wire format of the option.
virtual uint16_t len() const
Returns length of the whole option, including header.
virtual std::string toString() const
Returns actual value of the option in string format.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Decodes option data from the provided buffer.
std::string getValue() const
Returns the string value held by the option.
virtual std::string toText(int indent=0) const
Returns option information in the textual format.
Universe
defines option universe DHCPv4 or DHCPv6
Definition: option.h:83
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< OptionString > OptionStringPtr
Pointer to the OptionString object.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:37
Defines the logger used by the top-level component of kea-lfc.