64         int bufferSize = (int) raw.size();
    68         const unsigned char* 
buffer = raw.data();
    71         for (
int pre = 0; pre < bufferSize; ++pre)
    75                         JLTRACE(gJournal, 
"Preamble found at " << pre);
    79                         int remaining = bufferSize-pre; 
    83                                 JLTRACE(gJournal, 
"Not enough header data read");
    97                                         JLTRACE(gJournal, 
"Not enough extended header data read");
   114                         JLTRACE(gJournal, 
"Bytes in buffer=" << remaining << 
", full target = " << target);
   118                                 JLALERT(gJournal, 
"Invalid message length: " << target);
   123                         if (remaining < target)
   126                                 JLTRACE(gJournal, 
"Not enough data read: " << remaining << 
" / " << target);
   135                         if (rcv.loadFromString(msgStart, (
uint16_t)target))
   138                                                 "OK, size = " << (
int) rcv.getTotalMessageSize()
   139                                                 << std::hex << std::setfill(
'0')
   140                                                 << 
" First bytes " << std::setw(2) << (int) msgStart[0]
   141                                                 << 
" " << std::setw(2) << (int) msgStart[1]
   142                                                 << 
" " << std::setw(2) << (int) msgStart[2]
   143                                                 << 
" " << std::setw(2) << (int) msgStart[3]
   144                                                 << 
" " << std::setw(2) << (int) msgStart[4]
   145                                                 << std::dec << std::setfill(
' '));
   146                                 rv.
m_size = (int) rcv.getTotalMessageSize();
   158                                         << std::hex << std::setfill(
'0')
   159                                         << 
" First bytes " << std::setw(2) << (
int) msgStart[0]
   160                                         << 
" " << std::setw(2) << (
int) msgStart[1]
   161                                         << 
" " << std::setw(2) << (
int) msgStart[2]
   162                                         << 
" " << std::setw(2) << (
int) msgStart[3]
   163                                         << 
" " << std::setw(2) << (
int) msgStart[4]
   164                                         << std::dec << std::setfill(
' '));
   191         if (msg.getTotalMessageSize() < 5)      
   194         raw.assign(msg.getTotalMessageSize(), msg.getMessageStart());
   195         return (
int) raw.size();
 
unsigned __int16 uint16_t
 
struct XsByteArray XsByteArray
 
virtual ~ProtocolHandler()
Destructor. 
 
#define XS_LEN_MSGEXTHEADERCS
 
Stores the location of a message in a buffer using a start position and a size. 
 
Structure for storing a single message. 
 
int m_startPos
The offset of the first byte of the message or -1 if no message. 
 
virtual MessageLocation findMessage(XsMessage &rcv, const XsByteArray &raw) const
Find the first message in the raw byte stream. 
 
virtual int minimumMessageSize() const
Returns the minimum size of a valid message of this protocol including preambles and checksums...
 
static int composeMessage(XsByteArray &raw, const XsMessage &msg)
Compose a message for transmission. 
 
virtual int maximumMessageSize() const
Returns the maximum size of a valid message of this protocol including preambles and checksums...
 
int m_size
The size of the message, when less than 0 it indicates the expected message size. ...
 
int expectedMessageSize(const unsigned char *buffer, int sz)
Compute the expected message size given a possibly incomplete message. 
 
virtual int type() const
Returns the type of the protocol handler. 
 
#define XS_LEN_MSGHEADERCS
 
ProtocolHandler()
Default constructor. 
 
unsigned __int32 uint32_t