Kea  1.9.9-git
option_string.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2019 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 
16 namespace isc {
17 namespace dhcp {
18 
28 class OptionString : public Option {
29 public:
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 
90  virtual void pack(isc::util::OutputBuffer& buf) const;
91 
104  virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
105 
112  virtual std::string toText(int indent = 0) const;
113 
118  virtual std::string toString() const;
119 };
120 
122 typedef boost::shared_ptr<OptionString> OptionStringPtr;
123 
124 } // namespace isc::dhcp
125 } // namespace isc
126 
127 #endif // OPTION_STRING_H
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Decodes option data from the provided buffer.
Universe
defines option universe DHCPv4 or DHCPv6
Definition: option.h:82
boost::shared_ptr< OptionString > OptionStringPtr
Pointer to the OptionString object.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual void pack(isc::util::OutputBuffer &buf) const
Creates on-wire format of the option.
OptionString(const Option::Universe u, const uint16_t type, const std::string &value)
Constructor, used to create options to be sent.
virtual std::string toText(int indent=0) const
Returns option information in the textual format.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
virtual std::string toString() const
Returns actual value of the option in string format.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::string getValue() const
Returns the string value held by the option.
virtual uint16_t len() const
Returns length of the whole option, including header.
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.