Contains a data stream which can be sent and received by the Tcp classes.
More...
#include <TcpMessage.h>
Contains a data stream which can be sent and received by the Tcp classes.
The message data is preceded by a header consisting of
- an abbreviation "hja-tcp" (0-terminated); a simple, non-secure way to filter foreign messages.
- the size of the entire message, i.e. header plus message data (10 digits, 0-terminated), see m_nTransmitDataSize
- a message ID (0-terminated), see m_uiMessageID
- a ActionCode (0-terminated), see m_iActionCode
- an info (0-terminated), see m_strInfo
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ Message() [1/4]
tcp::Message::Message |
( |
| ) |
|
|
protected |
This constructor is not available.
◆ Message() [2/4]
tcp::Message::Message |
( |
char * | pszTransmitData, |
|
|
std::size_t | nTransmitDataSize ) |
A constructor that expects a data buffer and its size.
- Parameters
-
[in] | pszTransmitData | The data buffer to be transmitted including all required Information:
- the abbreviation "hja-tcp" (0-terminated) a simple non-secure way to filter foreign messages.
- the size of the entire message, i.e. header plus message data (0-terminated)
- A message ID (0-terminated)
- a ActionCode (0-terminated)
- an info (0-terminated)
- the message data of the message
|
[in] | nTransmitDataSize | The size or length of the data buffer to be sent. |
- Attention
- This object takes over the removal of the pszTransmitData from the memory.
- Exceptions
-
eut::ErrorNException | An exception is thrown if the attributes cannot be set from the data (e.g. because the header is incorrect). |
◆ Message() [3/4]
tcp::Message::Message |
( |
char * | pszRawMsg, |
|
|
std::size_t | nRawMsgSize, |
|
|
unsigned int | uiMessageID, |
|
|
int | iActionCode, |
|
|
const std::string & | rstrInfo ) |
A constructor that can build a message to be sent from the transferred data.
- Parameters
-
[in] | pszRawMsg | The message data. |
[in] | nRawMsgSize | The size or length of the message data. |
[in] | uiMessageID | A unique ID. |
[in] | iActionCode | The ActionCode, see m_iActionCode. |
[in] | rstrInfo | An additional text info |
- Attention
- This object removes the pszRawMsg from the memory
- Exceptions
-
◆ ~Message()
virtual tcp::Message::~Message |
( |
| ) |
|
|
virtual |
◆ Message() [4/4]
tcp::Message::Message |
( |
const Message & | | ) |
|
|
private |
The copy constructor is not available.
◆ getActionCode()
int tcp::Message::getActionCode |
( |
| ) |
const |
◆ getInfo()
std::string tcp::Message::getInfo |
( |
| ) |
const |
Liefert den Informationstext.
◆ getMsgID()
unsigned int tcp::Message::getMsgID |
( |
| ) |
const |
◆ getRawMsg()
std::size_t tcp::Message::getRawMsg |
( |
char *& | prszRawMsg, |
|
|
bool | bCopy = true ) |
Returns the message data.
- Parameters
-
[in,out] | prszRawMsg | Here the message data is delivered. |
[in] | bCopy | If set to true, memory is requested by this method for passed prszRawMsg, which must be released by the calling instance. |
- Returns
- The return value indicates the data size.
- Exceptions
-
◆ getRawMsgPt()
char * tcp::Message::getRawMsgPt |
( |
| ) |
|
Returns the message data.
◆ getRawMsgSize()
std::size_t tcp::Message::getRawMsgSize |
( |
| ) |
const |
Returns the size of the message data.
◆ getTransmitData()
std::size_t tcp::Message::getTransmitData |
( |
char *& | prszSendMsg, |
|
|
bool | bCopy = true ) |
Returns the transmission data.
- Parameters
-
[in,out] | prszSendMsg | Here the send data is delivered. |
[in] | bCopy | If set to true, memory is requested by this method for passed prszSendMsg, which must be released by the calling instance. |
- Returns
- The return value indicates the data size.
- Exceptions
-
◆ getTransmitDataPt()
char * tcp::Message::getTransmitDataPt |
( |
| ) |
|
Returns the transmission data.
◆ getTransmitDataSize()
std::size_t tcp::Message::getTransmitDataSize |
( |
| ) |
const |
Returns the size of the send data.
◆ initDataFromSendMsg()
int tcp::Message::initDataFromSendMsg |
( |
| ) |
|
|
private |
◆ initSendMsgFromData()
int tcp::Message::initSendMsgFromData |
( |
| ) |
|
|
private |
◆ operator=()
The assignment operator is not available.
◆ m_iActionCode
int tcp::Message::m_iActionCode |
|
private |
A code to signal a certain request if necessary.
- See also
- ActionCode
- Attention
- All numbers < 0 are reserved for error messages!
- See also
- ERRORS
◆ m_nRawMessageSize
std::size_t tcp::Message::m_nRawMessageSize |
|
private |
The size or length of the message data.
◆ m_nTransmitDataSize
std::size_t tcp::Message::m_nTransmitDataSize |
|
private |
The size or length of the send data (header plus message data).
◆ m_pszRawMessage
char* tcp::Message::m_pszRawMessage |
|
private |
◆ m_pszTransmitData
char* tcp::Message::m_pszTransmitData |
|
private |
The complete send data of the message including header.
◆ m_strInfo
std::string tcp::Message::m_strInfo |
|
private |
◆ m_uiMessageID
unsigned int tcp::Message::m_uiMessageID |
|
private |
The documentation for this class was generated from the following file: