NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
control-response.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NDN_MGMT_CONTROL_RESPONSE_HPP
27
#define NDN_MGMT_CONTROL_RESPONSE_HPP
28
29
#include "../encoding/block.hpp"
30
31
namespace
ndn
{
32
namespace
mgmt {
33
36
class
ControlResponse
37
{
38
public
:
39
class
Error
:
public
tlv::Error
40
{
41
public
:
42
explicit
43
Error
(
const
std::string& what)
44
: tlv::
Error
(what)
45
{
46
}
47
};
48
49
ControlResponse
();
50
51
ControlResponse
(uint32_t code,
const
std::string& text);
52
53
explicit
54
ControlResponse
(
const
Block
& block);
55
56
uint32_t
57
getCode
()
const
;
58
59
ControlResponse
&
60
setCode
(uint32_t code);
61
62
const
std::string&
63
getText
()
const
;
64
65
ControlResponse
&
66
setText
(
const
std::string& text);
67
68
const
Block
&
69
getBody
()
const
;
70
71
ControlResponse
&
72
setBody
(
const
Block
& body);
73
74
const
Block
&
75
wireEncode
()
const
;
76
77
void
78
wireDecode
(
const
Block
& block);
79
80
protected
:
81
uint32_t
m_code
;
82
std::string
m_text
;
83
Block
m_body
;
84
85
mutable
Block
m_wire
;
86
};
87
88
inline
uint32_t
89
ControlResponse::getCode
()
const
90
{
91
return
m_code
;
92
}
93
94
inline
ControlResponse
&
95
ControlResponse::setCode
(uint32_t code)
96
{
97
m_code
= code;
98
m_wire
.
reset
();
99
return
*
this
;
100
}
101
102
inline
const
std::string&
103
ControlResponse::getText
()
const
104
{
105
return
m_text
;
106
}
107
108
inline
ControlResponse
&
109
ControlResponse::setText
(
const
std::string& text)
110
{
111
m_text
= text;
112
m_wire
.
reset
();
113
return
*
this
;
114
}
115
116
inline
const
Block
&
117
ControlResponse::getBody
()
const
118
{
119
return
m_body
;
120
}
121
122
inline
ControlResponse
&
123
ControlResponse::setBody
(
const
Block
& body)
124
{
125
m_body
= body;
126
m_body
.
encode
();
// will do nothing if already encoded
127
m_wire
.
reset
();
128
return
*
this
;
129
}
130
131
std::ostream&
132
operator<<
(std::ostream& os,
const
ControlResponse
& response);
133
134
}
// namespace mgmt
135
}
// namespace ndn
136
137
#endif // NDN_MGMT_CONTRO_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:117
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::mgmt::ControlResponse::wireEncode
const Block & wireEncode() const
Definition:
control-response.cpp:56
ndn::mgmt::ControlResponse::getText
const std::string & getText() const
Definition:
control-response.hpp:103
ndn::mgmt::ControlResponse::Error
Definition:
control-response.hpp:39
ndn::mgmt::ControlResponse::m_text
std::string m_text
Definition:
control-response.hpp:82
ndn::mgmt::ControlResponse::getCode
uint32_t getCode() const
Definition:
control-response.hpp:89
ndn::mgmt::ControlResponse::m_code
uint32_t m_code
Definition:
control-response.hpp:81
ndn::Block::reset
void reset()
Reset wire buffer of the element.
Definition:
block.cpp:302
ndn::mgmt::operator<<
std::ostream & operator<<(std::ostream &os, const ControlResponse &response)
Definition:
control-response.cpp:104
ndn::mgmt::ControlResponse::Error::Error
Error(const std::string &what)
Definition:
control-response.hpp:43
ndn::mgmt::ControlResponse::m_body
Block m_body
Definition:
control-response.hpp:83
ndn::mgmt::ControlResponse::setText
ControlResponse & setText(const std::string &text)
Definition:
control-response.hpp:109
ndn::mgmt::ControlResponse::setBody
ControlResponse & setBody(const Block &body)
Definition:
control-response.hpp:123
ndn::mgmt::ControlResponse::wireDecode
void wireDecode(const Block &block)
Definition:
control-response.cpp:75
ndn::Block::encode
void encode()
Encode subblocks into wire buffer.
Definition:
block.cpp:355
ndn::mgmt::ControlResponse::m_wire
Block m_wire
Definition:
control-response.hpp:85
ndn::mgmt::ControlResponse
ControlCommand response.
Definition:
control-response.hpp:36
ndn::mgmt::ControlResponse::ControlResponse
ControlResponse()
Definition:
control-response.cpp:39
ndn::mgmt::ControlResponse::setCode
ControlResponse & setCode(uint32_t code)
Definition:
control-response.hpp:95
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndnSIM
ndn-cxx
src
mgmt
control-response.hpp
Generated on Tue Feb 23 2016 22:18:43 for ndnSIM by
1.8.11