17 const std::string& value)
41 return (std::string(data.begin(), data.end()));
51 <<
getType() <<
"' must not be empty");
55 auto begin = value.begin();
58 if (std::distance(begin, end) == 0) {
60 <<
getType() <<
"' contained only nuls");
90 if (std::distance(begin, end) == 0) {
92 <<
getType() <<
"' holding string value"
93 <<
"' was empty or contained only nuls");
102 std::ostringstream output;
104 <<
"\"" <<
getValue() <<
"\" (string)";
106 return (output.str());
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
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.
OptionString(const Option::Universe u, const uint16_t type, const std::string &value)
Constructor, used to create options to be sent.
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.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
Universe
defines option universe DHCPv4 or DHCPv6
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
void setData(InputIterator first, InputIterator last)
Sets content of this option from buffer.
OptionPtr cloneInternal() const
Copies this option and returns a pointer to the copy.
void packHeader(isc::util::OutputBuffer &buf, bool check=true) const
Store option's header in a buffer.
void check() const
A protected method used for option correctness.
Exception thrown during option unpacking This exception is thrown when an error has occurred unpackin...
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
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.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
boost::shared_ptr< Option > OptionPtr
Iterator seekTrimmed(Iterator const &begin, Iterator end, uint8_t const trim_val)
Finds the "trimmed" end of a buffer.
Defines the logger used by the top-level component of kea-lfc.