26 : m_state (start), m_max_size (size_), m_delimiter (delimiter_)
40 static const char* vmsg[] =
41 {
"start",
"waiting",
"complete",
"error",
"unknown state" };
44 return vmsg [
sizeof (vmsg)-1];
90 while (s_.
read (&c, 1) == 1)
A bucket for collecting character-based stream records of certain length or terminated by designated ...
An abstraction to message logging facility.
#define DL(X)
A macro for writing debug message to the Logger.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
A Hex/Ascii memory dump of similar to od(1) UNIX utility.
CharInBuffer is a bucket for the character-based streams/messages.
static const char * state_name(state_t state_)
Report the state name.
std::string m_buffer
Buffer to store the bytes received.
state_t m_state
Internal state of an object.
void chop()
Remove the delimiter from the end of the buffer.
CharInBuffer(size_t size_, const string &delimiter_)
Constructor.
std::string m_delimiter
Delimiter. Multibyte delimiter is allowed.
state_t
States: start, waiting, complete, error.
@ complete
matched end-of-record - full record
@ error
overflow or Socket I/O error
@ waiting
incomplete record is in the buffer
size_t m_max_size
Maximum allowable size (delimiter included) before overflow occurs.
state_t state() const
Report the current state of the object.
void dump() const
Write the state of an object to the log file.
static void dump_to_log(unsigned long mask_, const char *info_, const char *msg_, int len_)
Write hex/ascii dump of a memory region to log file.
virtual int read(char *buf_, const u_int size_)
Read expected number of bytes from the socket.
@ TRACE
Function call trace
@ CHARINBUF
Class CharInBuffer messages
Socket & operator>>(Socket &s_, CharInBuffer &b_)
Regardless of the delimeter size, which can be >1, add the character received to the buffer and compa...