Abstract base class for server protocol drivers. More...
#include <Protocol.h>
Public Member Functions | |
virtual | ~Protocol () |
Destructor. More... | |
virtual const char * | command_text (uint64_t command)=0 |
Returns the string representation of a command code. More... | |
Static Public Member Functions | |
static int32_t | response_code (const Event *event) |
Returns the response code from an event event generated in response to a request message. More... | |
static int32_t | response_code (const EventPtr &event) |
Returns the response code from an event event generated in response to a request message. More... | |
static String | string_format_message (const Event *event) |
Returns error message decoded standard error MESSAGE generated in response to a request message. More... | |
static String | string_format_message (const EventPtr &event) |
Returns error message decoded from standard error MESSAGE generated in response to a request message. More... | |
static CommBufPtr | create_error_message (CommHeader &header, int error, const char *msg) |
Creates a standard error message response. More... | |
Abstract base class for server protocol drivers.
This is the base class for all server protocol drivers. A server protocol driver is responsible for encoding and decoding messages sent and received to and from a service.
Definition at line 49 of file Protocol.h.
|
inlinevirtual |
Destructor.
Definition at line 54 of file Protocol.h.
|
pure virtual |
Returns the string representation of a command code.
Each protocol defines a set of command codes that are sent in the CommHeader::command field of a reqeust's message header to indicate which server command (method) is to be executed. This method returns a human readable string mnemonic for the command.
command | Command code |
command
. Implemented in Hyperspace::Protocol.
|
static |
Creates a standard error message response.
This method creates a standard error message response encoded in the following format:
[int32] error code [int16] error message length [chars] error message
header | Reference to header to use in response buffer |
error | Error code |
msg | Error message |
Definition at line 81 of file Protocol.cc.
|
static |
Returns the response code from an event event
generated in response to a request message.
If event
is of type ERROR, then event->error
is returned, otherwise the response code is decoded from the first four bytes of the message payload.
event
or Error::SERIALIZATION_INPUT_OVERRUN if payload of MESSAGE event is less than 4 bytes. Definition at line 39 of file Protocol.cc.
|
inlinestatic |
Returns the response code from an event event
generated in response to a request message.
If event
is of type ERROR, then event->error
is returned, otherwise the response code is decoded from the first four bytes of the message payload.
event
or Error::SERIALIZATION_INPUT_OVERRUN if payload of MESSAGE event is less than 4 bytes. Definition at line 76 of file Protocol.h.
Returns error message decoded standard error MESSAGE generated in response to a request message.
When a request to a service method results in an error, the error code an message are typically returned in a response message encoded in the following format:
[int32] error code [int16] error message length [chars] error message
This method extracts and returns the error message from a response MESSAGE event.
event | Pointer to MESSAGE event received in response to a request |
Definition at line 51 of file Protocol.cc.
Returns error message decoded from standard error MESSAGE generated in response to a request message.
When a request to a service method results in an error, the error code an message are typically returned in a response message encoded in the following format:
[int32] error code [int16] error message length [chars] error message
This method extracts and returns the error message from a response MESSAGE event.
event | Pointer to MESSAGE event received in response to a request |
Definition at line 112 of file Protocol.h.