Public Member Functions | List of all members
ndn::ControlResponse Class Reference

A ControlResponse holds a status code, status text and other fields for a ControlResponse which is used, for example, in the response from sending a register prefix control command to a forwarder. More...

#include <control-response.hpp>

Public Member Functions

 ControlResponse ()
 Create a new ControlResponse where all values are unspecified.
 
 ControlResponse (const ControlResponse &controlResponse)
 Create a new ControlResponse as a deep copy of the given ControlResponse. More...
 
Blob wireEncode (WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
 Encode this ControlResponse for a particular wire format. More...
 
void wireDecode (const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this ControlResponse. More...
 
void wireDecode (const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this ControlResponse. More...
 
void wireDecode (const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this ControlResponse. More...
 
void get (ControlResponseLite &controlResponseLite) const
 Set controlResponseLite to point to the components in this ControlResponse, without copying any memory. More...
 
void set (const ControlResponseLite &controlResponseLite)
 Clear this ControlResponse, and set the values by copying from controlResponseLite. More...
 
int getStatusCode () const
 Get the status code. More...
 
const std::string & getStatusText () const
 Get the status text. More...
 
const ControlParametersgetBodyAsControlParameters () const
 Get the control response body as a ControlParameters. More...
 
ControlResponsesetStatusCode (int statusCode)
 Set the status code. More...
 
ControlResponsesetStatusText (const std::string &statusText)
 Set the status text. More...
 
ControlResponsesetBodyAsControlParameters (const ControlParameters *controlParameters)
 Set the control response body as a ControlParameters. More...
 

Detailed Description

A ControlResponse holds a status code, status text and other fields for a ControlResponse which is used, for example, in the response from sending a register prefix control command to a forwarder.

See also
http://redmine.named-data.net/projects/nfd/wiki/ControlCommand

Constructor & Destructor Documentation

ndn::ControlResponse::ControlResponse ( const ControlResponse controlResponse)
inline

Create a new ControlResponse as a deep copy of the given ControlResponse.

Parameters
controlResponseThe ControlResponse to copy.

Member Function Documentation

void ndn::ControlResponse::get ( ControlResponseLite controlResponseLite) const

Set controlResponseLite to point to the components in this ControlResponse, without copying any memory.

WARNING: The resulting pointers in controlResponseLite are invalid after a further use of this object which could reallocate memory.

Parameters
controlResponseLiteThe ControlResponseLite object which receives the values. where the name components arrays are already allocated.
const ControlParameters* ndn::ControlResponse::getBodyAsControlParameters ( ) const
inline

Get the control response body as a ControlParameters.

Returns
The ControlParameters, or 0 if the body is not specified or if it is not a ControlParameters.
int ndn::ControlResponse::getStatusCode ( ) const
inline

Get the status code.

Returns
The status code. If not specified, return -1.
const std::string& ndn::ControlResponse::getStatusText ( ) const
inline

Get the status text.

Returns
The status text. If not specified, return "".
void ndn::ControlResponse::set ( const ControlResponseLite controlResponseLite)

Clear this ControlResponse, and set the values by copying from controlResponseLite.

Parameters
controlResponseLiteA ControlResponseLite object.
ControlResponse& ndn::ControlResponse::setBodyAsControlParameters ( const ControlParameters controlParameters)
inline

Set the control response body as a ControlParameters.

Parameters
controlParametersA pointer to the ControlParameters for the body. This makes a copy of the ControlParameters. If not specified or if the body is not a ControlParameters, set to 0.
Returns
This ControlResponse so that you can chain calls to update values.
ControlResponse& ndn::ControlResponse::setStatusCode ( int  statusCode)
inline

Set the status code.

Parameters
statusCodeThe status code. If not specified, set to -1.
Returns
This ControlResponse so that you can chain calls to update values.
ControlResponse& ndn::ControlResponse::setStatusText ( const std::string &  statusText)
inline

Set the status text.

Parameters
statusTextThe status text. If not specified, set to "".
Returns
This ControlResponse so that you can chain calls to update values.
void ndn::ControlResponse::wireDecode ( const uint8_t *  input,
size_t  inputLength,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this ControlResponse.

Parameters
inputThe input byte array to be decoded.
inputLengthThe length of input.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
void ndn::ControlResponse::wireDecode ( const std::vector< uint8_t > &  input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this ControlResponse.

Parameters
inputThe input byte array to be decoded.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
void ndn::ControlResponse::wireDecode ( const Blob input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this ControlResponse.

Parameters
inputThe input byte array to be decoded as an immutable Blob.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
Blob ndn::ControlResponse::wireEncode ( WireFormat wireFormat = *WireFormat::getDefaultWireFormat()) const
inline

Encode this ControlResponse for a particular wire format.

Parameters
wireFormat(optional) A WireFormat object used to encode this ControlResponse. If omitted, use WireFormat::getDefaultWireFormat().
Returns
The encoded buffer.

The documentation for this class was generated from the following files: