23 const size_t OPTION6_STATUS_CODE_MIN_LEN =
sizeof(uint16_t);
24 const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN =
sizeof(uint8_t);
32 const std::string& status_message)
34 status_code_(status_code), status_message_(status_message) {
48 return (cloneInternal<Option6StatusCode>());
58 if (!status_message_.empty()) {
59 buf.
writeData(&status_message_[0], status_message_.size());
68 if (std::distance(begin, end) < OPTION6_STATUS_CODE_MIN_LEN) {
74 begin +=
sizeof(uint16_t);
76 status_message_.assign(begin, end);
81 return (
getHeaderLen() +
sizeof(uint16_t) + status_message_.size());
86 std::ostringstream output;
89 return (output.str());
94 std::ostringstream output;
100 if (!status_message_.empty()) {
101 output <<
"\"" << status_message_ <<
"\"";
104 output <<
"(no status message)";
107 return (output.str());
116 return (
"UnspecFail");
118 return (
"NoAddrsAvail");
120 return (
"NoBinding");
122 return (
"NotOnLink");
124 return (
"UseMulticast");
126 return (
"NoPrefixAvail");
128 return (
"UnknownQueryType");
130 return (
"MalformedQuery");
132 return (
"NotConfigured");
134 return (
"NotAllowed");
138 return (
"(unknown status code)");
142 const std::string& scope_list)
144 mandatory_flag_(mandatory_flag), scope_list_(scope_list) {
150 mandatory_flag_(false), scope_list_() {
158 return (cloneInternal<Option4SlpServiceScope>());
168 if (!scope_list_.empty()) {
169 buf.
writeData(&scope_list_[0], scope_list_.size());
178 if (std::distance(begin, end) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
184 mandatory_flag_ =
true;
185 }
else if (*begin == 0) {
186 mandatory_flag_ =
false;
189 <<
" value. Invalid value " << static_cast<int>(*begin));
191 begin +=
sizeof(uint8_t);
193 scope_list_.assign(begin, end);
198 return (
getHeaderLen() +
sizeof(uint8_t) + scope_list_.size());
203 std::ostringstream output;
206 return (output.str());
211 std::ostringstream output;
213 output <<
", scope-list:\"" << scope_list_ <<
"\"";
214 return (output.str());
virtual std::string toText(int indent=0) const
Returns textual representation of the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
std::string dataToText() const
Returns textual representation of the option data.
boost::shared_ptr< Option > OptionPtr
bool getMandatoryFlag() const
Returns mandatory flag.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
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.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Option4SlpServiceScope(const bool mandatory_flag, const std::string &scope_list)
Constructor, used for options constructed (during transmission).
std::string getStatusCodeName() const
Returns the name of the status code.
virtual uint16_t len() const
Returns total length of the option.
virtual uint16_t len() const
Returns total length of the option.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::string dataToText() const
Returns textual representation of the option data.
uint16_t readUint16(const void *buffer, size_t length)
Read Unsigned 16-Bit Integer from Buffer.
std::string headerToText(const int indent=0, const std::string &type_name="") const
Returns option header in the textual format.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
uint16_t getStatusCode() const
Returns numeric status code.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
Exception to be thrown when cast to the data type was unsuccessful.
Option6StatusCode(const uint16_t status_code, const std::string &status_message)
Constructor, used for options constructed (during transmission).
virtual std::string toText(int indent=0) const
Returns textual representation of the option.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.