16 const std::string& value)
34 return (cloneInternal<OptionString>());
40 return (std::string(data.begin(), data.end()));
50 <<
getType() <<
"' must not be empty");
53 setData(value.begin(), value.end());
77 if (std::distance(begin, end) == 0) {
79 <<
getType() <<
"' holding string value" 80 <<
" - empty value is not accepted");
87 std::ostringstream output;
89 <<
"\"" <<
getValue() <<
"\" (string)";
91 return (output.str());
virtual std::string toText(int indent=0) const
Returns option information in the textual format.
virtual void pack(isc::util::OutputBuffer &buf) const
Creates on-wire format of the option.
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
boost::shared_ptr< Option > OptionPtr
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Decodes option data from the provided buffer.
Universe
defines option universe DHCPv4 or DHCPv6
virtual uint16_t len() const
Returns length of the whole option, including header.
std::string getValue() const
Returns the string value held by the option.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
OptionString(const Option::Universe u, const uint16_t type, const std::string &value)
Constructor, used to create options to be sent.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string headerToText(const int indent=0, const std::string &type_name="") const
Returns option header in the textual format.
virtual const OptionBuffer & getData() const
Returns pointer to actual data.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual std::string toString() const
Returns actual value of the option in string format.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
void setData(InputIterator first, InputIterator last)
Sets content of this option from buffer.
void setValue(const std::string &value)
Sets the string value to be held by the option.