Kea 2.0.3
option6_status_code.h
Go to the documentation of this file.
1// Copyright (C) 2015-2018 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 OPTION6_STATUS_CODE_H
8#define OPTION6_STATUS_CODE_H
9
10#include <dhcp/option.h>
11#include <boost/shared_ptr.hpp>
12#include <stdint.h>
13#include <string>
14
15namespace isc {
16namespace dhcp {
17
18class Option6StatusCode;
19
21typedef boost::shared_ptr<Option6StatusCode> Option6StatusCodePtr;
22
25public:
30 Option6StatusCode(const uint16_t status_code, const std::string& status_message);
31
39
41 virtual OptionPtr clone() const;
42
49 virtual void pack(isc::util::OutputBuffer& buf) const;
50
57 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
58
62 virtual uint16_t len() const;
63
67 virtual std::string toText(int indent = 0) const;
68
73 std::string dataToText() const;
74
76 uint16_t getStatusCode() const {
77 return (status_code_);
78 }
79
81 std::string getStatusCodeName() const;
82
86 void setStatusCode(const uint16_t status_code) {
87 status_code_ = status_code;
88 }
89
91 const std::string& getStatusMessage() const {
92 return (status_message_);
93 }
94
98 void setStatusMessage(const std::string& status_message) {
99 status_message_ = status_message;
100 }
101
102private:
103
105 uint16_t status_code_;
106
108 std::string status_message_;
109
110};
111
113
114class Option4SlpServiceScope;
115
117typedef boost::shared_ptr<Option4SlpServiceScope> Option4SlpServiceScopePtr;
118
121public:
126 Option4SlpServiceScope(const bool mandatory_flag, const std::string& scope_list);
127
135
137 virtual OptionPtr clone() const;
138
145 virtual void pack(isc::util::OutputBuffer& buf) const;
146
154 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
155
159 virtual uint16_t len() const;
160
164 virtual std::string toText(int indent = 0) const;
165
170 std::string dataToText() const;
171
173 bool getMandatoryFlag() const {
174 return (mandatory_flag_);
175 }
176
180 void setMandatoryFlag(const bool mandatory_flag) {
181 mandatory_flag_ = mandatory_flag;
182 }
183
185 const std::string& getScopeList() const {
186 return (scope_list_);
187 }
188
192 void setScopeList(std::string& scope_list) {
193 scope_list_ = scope_list;
194 }
195
196private:
197
199 bool mandatory_flag_;
200
202 std::string scope_list_;
203
204};
205
206} // isc::dhcp namespace
207} // isc namespace
208
209#endif // OPTION6_STATUS_CODE_H
This class represents SLP Service Scope option (79) from RFC2610.
void setMandatoryFlag(const bool mandatory_flag)
Sets new mandatory flag.
virtual uint16_t len() const
Returns total length of the option.
void setScopeList(std::string &scope_list)
Sets new scope list.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
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.
const std::string & getScopeList() const
Returns scope list.
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.
This class represents Status Code option (13) from RFC 8415.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
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.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
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.
const std::string & getStatusMessage() const
Returns status message.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
void setStatusCode(const uint16_t status_code)
Sets new numeric status code.
uint16_t getStatusCode() const
Returns numeric status code.
void setStatusMessage(const std::string &status_message)
Sets new status message.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
boost::shared_ptr< Option6StatusCode > Option6StatusCodePtr
Pointer to the isc::dhcp::Option6StatusCode.
boost::shared_ptr< Option4SlpServiceScope > Option4SlpServiceScopePtr
Pointer to the isc::dhcp::Option4SlpServiceScope.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
Defines the logger used by the top-level component of kea-lfc.