#include <message.h>
Public Types | |
enum | MsgType { M_Data = 0, M_Command = 1, M_Request = 2, M_Response = 3 } |
The type of message being dealt with. More... | |
enum | CmdCode { C_None = 0, C_Exit, C_Disconnected } |
For command and status messages, the command/information being sent. More... | |
enum | ReqVal { R_None = 0, R_Status, R_History } |
For request messages, what value/data is being requested? More... | |
Public Member Functions | |
Message (CmdCode) | |
Used for Commands. | |
Message (MsgType, ReqVal, u_char *, size_t) | |
Used for Request/Response. | |
virtual | ~Message () |
const MsgType | type (void) const |
const CmdCode | code (void) const |
const char * | name (void) const |
void | Lock (void) |
void | Unlock (void) |
Protected Member Functions | |
Message (const u_char *, size_t) | |
A special-purpse constructor only used by Data's constructors. | |
void | alloc_data (const size_t size) |
Allocate empty space of the specified size. | |
Protected Attributes | |
unsigned char * | privdata |
A block of data. | |
size_t | length |
The length of privdata. | |
Private Member Functions | |
Message (const Message &) | |
Message & | operator= (const Message &) |
Private Attributes | |
MsgType | msg_type |
CmdCode | cmd_code |
ReqVal | req_class |
pthread_mutex_t | mutex |
Static Private Attributes | |
static const char *const | MT_names [] |
String names to be used for display purposes. |
This class is meant to be allocated and referenced solely via Loki::SmartPtr so that the data does not have to be copied, and merely a reference-counted pointer to the data exists.
Definition at line 56 of file message.h.
enum Message::MsgType |
enum Message::CmdCode |
enum Message::ReqVal |
Message::Message | ( | CmdCode | code | ) |
Used for Commands.
Construct a M_Command type of Message (effectively NULLing the Blob data).
Definition at line 64 of file message.cc.
References Guard::initialize_mutex(), and mutex.
Used for Request/Response.
Definition at line 71 of file message.cc.
References Guard::initialize_mutex(), and mutex.
Message::~Message | ( | void | ) | [virtual] |
Definition at line 78 of file message.cc.
Message::Message | ( | const u_char * | data, | |
size_t | len | |||
) | [protected] |
A special-purpse constructor only used by Data's constructors.
Construct a M_Data type of Message, given data
and len
as the chunk of data.
Definition at line 56 of file message.cc.
References Guard::initialize_mutex(), and mutex.
Message::Message | ( | const Message & | ) | [private] |
const MsgType Message::type | ( | void | ) | const [inline] |
const CmdCode Message::code | ( | void | ) | const [inline] |
const char * Message::name | ( | void | ) | const |
Definition at line 88 of file message.cc.
References msg_type, and MT_names.
Referenced by Messageable::handle_message().
void Message::Lock | ( | void | ) |
void Message::Unlock | ( | void | ) |
void Message::alloc_data | ( | const size_t | size | ) | [protected] |
Allocate empty space of the specified size.
Definition at line 110 of file message.cc.
References length, and privdata.
Referenced by Data::Data().
MsgType Message::msg_type [private] |
CmdCode Message::cmd_code [private] |
ReqVal Message::req_class [private] |
unsigned char* Message::privdata [protected] |
A block of data.
Definition at line 101 of file message.h.
Referenced by alloc_data(), Data::Data(), and Data::data().
size_t Message::length [protected] |
The length of privdata.
Definition at line 102 of file message.h.
Referenced by alloc_data(), and Data::len().
pthread_mutex_t Message::mutex [private] |
const char *const Message::MT_names [static, private] |