22const size_t OPTION6_STATUS_CODE_MIN_LEN =
sizeof(uint16_t);
23const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN =
sizeof(uint8_t);
31 const std::string& status_message)
33 status_code_(status_code), status_message_(status_message) {
57 if (!status_message_.empty()) {
58 buf.
writeData(&status_message_[0], status_message_.size());
67 if (std::distance(begin, end) < OPTION6_STATUS_CODE_MIN_LEN) {
73 begin +=
sizeof(uint16_t);
75 status_message_.assign(begin, end);
80 return (
getHeaderLen() +
sizeof(uint16_t) + status_message_.size());
85 std::ostringstream output;
88 return (output.str());
93 std::ostringstream output;
99 if (!status_message_.empty()) {
100 output <<
"\"" << status_message_ <<
"\"";
103 output <<
"(no status message)";
106 return (output.str());
115 return (
"UnspecFail");
117 return (
"NoAddrsAvail");
119 return (
"NoBinding");
121 return (
"NotOnLink");
123 return (
"UseMulticast");
125 return (
"NoPrefixAvail");
127 return (
"UnknownQueryType");
129 return (
"MalformedQuery");
131 return (
"NotConfigured");
133 return (
"NotAllowed");
137 return (
"(unknown status code)");
141 const std::string& scope_list)
143 mandatory_flag_(mandatory_flag), scope_list_(scope_list) {
149 mandatory_flag_(false), scope_list_() {
167 if (!scope_list_.empty()) {
168 buf.
writeData(&scope_list_[0], scope_list_.size());
177 if (std::distance(begin, end) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
183 mandatory_flag_ =
true;
184 }
else if (*begin == 0) {
185 mandatory_flag_ =
false;
188 <<
" value. Invalid value " <<
static_cast<int>(*begin));
190 begin +=
sizeof(uint8_t);
192 scope_list_.assign(begin, end);
197 return (
getHeaderLen() +
sizeof(uint8_t) + scope_list_.size());
202 std::ostringstream output;
205 return (output.str());
210 std::ostringstream output;
212 output <<
", scope-list:\"" << scope_list_ <<
"\"";
213 return (output.str());
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.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
virtual uint16_t len() const
Returns total length of the option.
std::string dataToText() const
Returns textual representation of the option data.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
bool getMandatoryFlag() const
Returns mandatory flag.
Option4SlpServiceScope(const bool mandatory_flag, const std::string &scope_list)
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.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
Option6StatusCode(const uint16_t status_code, const std::string &status_message)
Constructor, used for options constructed (during transmission).
virtual uint16_t len() const
Returns total length of the option.
std::string getStatusCodeName() const
Returns the name of the status code.
std::string dataToText() const
Returns textual representation of the option data.
virtual std::string toText(int indent=0) const
Returns textual representation of the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
uint16_t getStatusCode() const
Returns numeric status code.
std::string headerToText(const int indent=0, const std::string &type_name="") const
Returns option header in the textual format.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
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.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order.
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
@ STATUS_UnknownQueryType
#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
boost::shared_ptr< Option > OptionPtr
uint16_t readUint16(void const *const buffer, size_t const length)
uint16_t wrapper over readUint.
Defines the logger used by the top-level component of kea-lfc.