NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
control-response.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2021 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_CXX_MGMT_CONTROL_RESPONSE_HPP
23
#define NDN_CXX_MGMT_CONTROL_RESPONSE_HPP
24
25
#include "
ndn-cxx/encoding/block.hpp
"
26
27
namespace
ndn
{
28
namespace
mgmt {
29
32
class
ControlResponse
33
{
34
public
:
35
class
Error
:
public
tlv::Error
36
{
37
public
:
38
using
tlv::Error::Error
;
39
};
40
41
ControlResponse
();
42
43
ControlResponse
(uint32_t code,
const
std::string&
text
);
44
45
explicit
46
ControlResponse
(
const
Block
& block);
47
48
uint32_t
49
getCode
()
const
;
50
51
ControlResponse
&
52
setCode
(uint32_t code);
53
54
const
std::string&
55
getText
()
const
;
56
57
ControlResponse
&
58
setText
(
const
std::string& text);
59
60
const
Block
&
61
getBody
()
const
;
62
63
ControlResponse
&
64
setBody
(
const
Block
& body);
65
66
const
Block
&
67
wireEncode
()
const
;
68
69
void
70
wireDecode
(
const
Block
& block);
71
72
protected
:
73
uint32_t
m_code
;
74
std::string
m_text
;
75
Block
m_body
;
76
77
mutable
Block
m_wire
;
78
};
79
80
inline
uint32_t
81
ControlResponse::getCode
()
const
82
{
83
return
m_code
;
84
}
85
86
inline
ControlResponse
&
87
ControlResponse::setCode
(uint32_t code)
88
{
89
m_code
= code;
90
m_wire
.
reset
();
91
return
*
this
;
92
}
93
94
inline
const
std::string&
95
ControlResponse::getText
()
const
96
{
97
return
m_text
;
98
}
99
100
inline
ControlResponse
&
101
ControlResponse::setText
(
const
std::string&
text
)
102
{
103
m_text
=
text
;
104
m_wire
.
reset
();
105
return
*
this
;
106
}
107
108
inline
const
Block
&
109
ControlResponse::getBody
()
const
110
{
111
return
m_body
;
112
}
113
114
inline
ControlResponse
&
115
ControlResponse::setBody
(
const
Block
& body)
116
{
117
m_body
= body;
118
m_body
.
encode
();
// will do nothing if already encoded
119
m_wire
.
reset
();
120
return
*
this
;
121
}
122
123
std::ostream&
124
operator<<
(std::ostream& os,
const
ControlResponse
& response);
125
126
}
// namespace mgmt
127
}
// namespace ndn
128
129
#endif // NDN_CXX_MGMT_CONTROL_RESPONSE_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::mgmt::ControlResponse::getBody
const Block & getBody() const
Definition:
control-response.hpp:109
ndn::Block
Represents a TLV element of the NDN packet format.
Definition:
block.hpp:44
ndn::mgmt::ControlResponse::wireEncode
const Block & wireEncode() const
Definition:
control-response.cpp:52
ndn::mgmt::ControlResponse::Error
Definition:
control-response.hpp:35
ndn::mgmt::ControlResponse::m_text
std::string m_text
Definition:
control-response.hpp:74
ndn::mgmt::ControlResponse::m_code
uint32_t m_code
Definition:
control-response.hpp:73
ndn::Block::reset
void reset() noexcept
Reset the Block to a default-constructed state.
Definition:
block.cpp:254
websocketpp::frame::opcode::text
Definition:
frame.hpp:79
ndn::mgmt::operator<<
std::ostream & operator<<(std::ostream &os, const ControlResponse &response)
Definition:
control-response.cpp:98
ndn::mgmt::ControlResponse::m_body
Block m_body
Definition:
control-response.hpp:75
ndn::mgmt::ControlResponse::setText
ControlResponse & setText(const std::string &text)
Definition:
control-response.hpp:101
ndn::mgmt::ControlResponse::setBody
ControlResponse & setBody(const Block &body)
Definition:
control-response.hpp:115
block.hpp
ndn::mgmt::ControlResponse::wireDecode
void wireDecode(const Block &block)
Definition:
control-response.cpp:70
ndn::Block::encode
void encode()
Encode sub-elements into TLV-VALUE.
Definition:
block.cpp:351
ndn::mgmt::ControlResponse::getCode
uint32_t getCode() const
Definition:
control-response.hpp:81
ndn::mgmt::ControlResponse::m_wire
Block m_wire
Definition:
control-response.hpp:77
ndn::mgmt::ControlResponse::getText
const std::string & getText() const
Definition:
control-response.hpp:95
ndn::mgmt::ControlResponse
ControlCommand response.
Definition:
control-response.hpp:32
ndn::mgmt::ControlResponse::ControlResponse
ControlResponse()
Definition:
control-response.cpp:35
ndn::mgmt::ControlResponse::setCode
ControlResponse & setCode(uint32_t code)
Definition:
control-response.hpp:87
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition:
tlv.cpp:27
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
ndnSIM
ndn-cxx
ndn-cxx
mgmt
control-response.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13