Kea: option6_status_code.h Source File

| Kea 3.0.3-git

option6_status_code.h
Go to the documentation of this file.
1// Copyright (C) 2015-2022 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
21 typedef boost::shared_ptr<Option6StatusCode> Option6StatusCodePtr;
22
24 class Option6StatusCode: public Option {
25public:
30 Option6StatusCode(const uint16_t status_code, const std::string& status_message);
31
38 Option6StatusCode(OptionBufferConstIter begin, OptionBufferConstIter end);
39
41 virtual OptionPtr clone() const;
42
50 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
51
58 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
59
63 virtual uint16_t len() const;
64
68 virtual std::string toText(int indent = 0) const;
69
74 std::string dataToText() const;
75
77 uint16_t getStatusCode() const {
78 return (status_code_);
79 }
80
82 std::string getStatusCodeName() const;
83
87 void setStatusCode(const uint16_t status_code) {
88 status_code_ = status_code;
89 }
90
92 const std::string& getStatusMessage() const {
93 return (status_message_);
94 }
95
99 void setStatusMessage(const std::string& status_message) {
100 status_message_ = status_message;
101 }
102
103private:
105 uint16_t status_code_;
106
108 std::string status_message_;
109};
110
112
113class Option4SlpServiceScope;
114
116 typedef boost::shared_ptr<Option4SlpServiceScope> Option4SlpServiceScopePtr;
117
119 class Option4SlpServiceScope: public Option {
120public:
125 Option4SlpServiceScope(const bool mandatory_flag, const std::string& scope_list);
126
133 Option4SlpServiceScope(OptionBufferConstIter begin, OptionBufferConstIter end);
134
136 virtual OptionPtr clone() const;
137
145 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) 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:
198 bool mandatory_flag_;
199
201 std::string scope_list_;
202};
203
204} // isc::dhcp namespace
205} // isc namespace
206
207#endif // OPTION6_STATUS_CODE_H
isc::dhcp::Option4SlpServiceScope::pack
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
Definition option6_status_code.cc:161
isc::dhcp::Option4SlpServiceScope::setMandatoryFlag
void setMandatoryFlag(const bool mandatory_flag)
Sets new mandatory flag.
Definition option6_status_code.h:180
isc::dhcp::Option4SlpServiceScope::len
virtual uint16_t len() const
Returns total length of the option.
Definition option6_status_code.cc:196
isc::dhcp::Option4SlpServiceScope::setScopeList
void setScopeList(std::string &scope_list)
Sets new scope list.
Definition option6_status_code.h:192
isc::dhcp::Option4SlpServiceScope::dataToText
std::string dataToText() const
Returns textual representation of the option data.
Definition option6_status_code.cc:209
isc::dhcp::Option4SlpServiceScope::unpack
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Definition option6_status_code.cc:175
isc::dhcp::Option4SlpServiceScope::getMandatoryFlag
bool getMandatoryFlag() const
Returns mandatory flag.
Definition option6_status_code.h:173
isc::dhcp::Option4SlpServiceScope::getScopeList
const std::string & getScopeList() const
Returns scope list.
Definition option6_status_code.h:185
isc::dhcp::Option4SlpServiceScope::Option4SlpServiceScope
Option4SlpServiceScope(const bool mandatory_flag, const std::string &scope_list)
Constructor, used for options constructed (during transmission).
Definition option6_status_code.cc:140
isc::dhcp::Option4SlpServiceScope::toText
virtual std::string toText(int indent=0) const
Returns textual representation of the option.
Definition option6_status_code.cc:201
isc::dhcp::Option4SlpServiceScope::clone
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Definition option6_status_code.cc:156
isc::dhcp::Option6StatusCode
This class represents Status Code option (13) from RFC 8415.
Definition option6_status_code.h:24
isc::dhcp::Option6StatusCode::clone
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Definition option6_status_code.cc:46
isc::dhcp::Option6StatusCode::pack
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
Definition option6_status_code.cc:51
isc::dhcp::Option6StatusCode::Option6StatusCode
Option6StatusCode(const uint16_t status_code, const std::string &status_message)
Constructor, used for options constructed (during transmission).
Definition option6_status_code.cc:30
isc::dhcp::Option6StatusCode::len
virtual uint16_t len() const
Returns total length of the option.
Definition option6_status_code.cc:79
isc::dhcp::Option6StatusCode::getStatusCodeName
std::string getStatusCodeName() const
Returns the name of the status code.
Definition option6_status_code.cc:110
isc::dhcp::Option6StatusCode::dataToText
std::string dataToText() const
Returns textual representation of the option data.
Definition option6_status_code.cc:92
isc::dhcp::Option6StatusCode::toText
virtual std::string toText(int indent=0) const
Returns textual representation of the option.
Definition option6_status_code.cc:84
isc::dhcp::Option6StatusCode::getStatusMessage
const std::string & getStatusMessage() const
Returns status message.
Definition option6_status_code.h:92
isc::dhcp::Option6StatusCode::unpack
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Definition option6_status_code.cc:65
isc::dhcp::Option6StatusCode::setStatusCode
void setStatusCode(const uint16_t status_code)
Sets new numeric status code.
Definition option6_status_code.h:87
isc::dhcp::Option6StatusCode::getStatusCode
uint16_t getStatusCode() const
Returns numeric status code.
Definition option6_status_code.h:77
isc::dhcp::Option6StatusCode::setStatusMessage
void setStatusMessage(const std::string &status_message)
Sets new status message.
Definition option6_status_code.h:99
isc::dhcp::Option::Option
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
Definition option.cc:39
isc::dhcp::Option::check
void check() const
A protected method used for option correctness.
Definition option.cc:90
isc::util::OutputBuffer
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:346
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::OptionBufferConstIter
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
isc::dhcp::Option6StatusCodePtr
boost::shared_ptr< Option6StatusCode > Option6StatusCodePtr
Pointer to the isc::dhcp::Option6StatusCode.
Definition option6_status_code.h:21
isc::dhcp::Option4SlpServiceScopePtr
boost::shared_ptr< Option4SlpServiceScope > Option4SlpServiceScopePtr
Pointer to the isc::dhcp::Option4SlpServiceScope.
Definition option6_status_code.h:116
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
option.h