Kea 2.7.5
|
Implement a simple length:data input stream message. More...
#include <tcp_stream_msg.h>
Public Member Functions | |
TcpStreamRequest () | |
Constructor. | |
virtual | ~TcpStreamRequest () |
Destructor. | |
const uint8_t * | getRequest () const |
Returns pointer to the first byte of the unpacked request data. | |
size_t | getRequestSize () const |
Returns size of the unpacked request. | |
std::string | getRequestString () const |
Fetches the unpacked request as a string. | |
virtual std::string | logFormatRequest (const size_t limit=0) const |
Returns request contents formatted for log output. | |
virtual bool | needData () const |
Returns true if the request is incomplete. | |
virtual size_t | postBuffer (const void *buf, const size_t nbytes) |
Adds data to an incomplete request. | |
virtual void | unpack () |
Unpacks the wire data into a string request. | |
Public Member Functions inherited from isc::tcp::TcpRequest | |
virtual | ~TcpRequest () |
Destructor. | |
Public Member Functions inherited from isc::tcp::TcpMessage | |
virtual | ~TcpMessage () |
Destructor. | |
const uint8_t * | getWireData () const |
Returns pointer to the first byte of the wire data. | |
size_t | getWireDataSize () const |
Returns current size of the wire data. | |
Protected Attributes | |
std::vector< uint8_t > | request_ |
Unpacked request content. | |
Protected Attributes inherited from isc::tcp::TcpMessage | |
WireData | wire_data_ |
Buffer used for data in wire format data. | |
Implement a simple length:data input stream message.
This class can be used to receive a single message from a TCP stream where the message consists of a 16-bit unsigned length (in network order), followed by that number of bytes of data.
Definition at line 25 of file tcp_stream_msg.h.
|
inline |
Constructor.
Definition at line 28 of file tcp_stream_msg.h.
|
inlinevirtual |
Destructor.
Definition at line 32 of file tcp_stream_msg.h.
|
inline |
Returns pointer to the first byte of the unpacked request data.
InvalidOperation | if request data is empty (i.e. getRequestSize() == 0). |
Definition at line 66 of file tcp_stream_msg.h.
|
inline |
Returns size of the unpacked request.
Definition at line 58 of file tcp_stream_msg.h.
References request_.
|
inline |
Fetches the unpacked request as a string.
Definition at line 78 of file tcp_stream_msg.h.
References request_.
|
virtual |
Returns request contents formatted for log output.
limit | Maximum length of the buffer to be output. If the limit is 0, the length of the output is unlimited. |
Implements isc::tcp::TcpRequest.
Definition at line 69 of file tcp_stream_msg.cc.
References isc::util::str::dumpAsHex(), and isc::tcp::TcpMessage::wire_data_.
|
virtual |
Returns true if the request is incomplete.
Implements isc::tcp::TcpRequest.
Definition at line 20 of file tcp_stream_msg.cc.
References isc::tcp::TcpMessage::wire_data_.
Referenced by unpack().
|
virtual |
Adds data to an incomplete request.
buf | A pointer to the buffer holding the data. |
nbytes | Size of the data within the buffer. |
Implements isc::tcp::TcpRequest.
Definition at line 25 of file tcp_stream_msg.cc.
References isc::tcp::TcpMessage::wire_data_.
|
virtual |
Unpacks the wire data into a string request.
Implements isc::tcp::TcpRequest.
Definition at line 84 of file tcp_stream_msg.cc.
References isc_throw, needData(), request_, and isc::tcp::TcpMessage::wire_data_.
|
protected |
Unpacked request content.
Definition at line 84 of file tcp_stream_msg.h.
Referenced by getRequest(), getRequestSize(), getRequestString(), and unpack().