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 ...
size_t m_max_size
Maximum allowable size (delimiter included) before overflow occurs.
matched end-of-record - full record
incomplete record is in the buffer
void chop()
Remove the delimiter from the end of the buffer.
state_t
States: start, waiting, complete, error.
#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.
std::string m_delimiter
Delimiter. Multibyte delimiter is allowed.
virtual int read(char *buf_, const u_int size_)
Read expected number of bytes from the socket.
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.
static const char * state_name(state_t state_)
Report the state name.
void dump() const
Write the state of an object to the log file.
An abstraction to message logging facility.
CharInBuffer is a bucket for the character-based streams/messages.
std::string m_buffer
Buffer to store the bytes received.
Class CharInBuffer messages.
A Hex/Ascii memory dump of similar to od(1) UNIX utility.
Socket & operator>>(Socket &s_, CharInBuffer &b_)
Regardless of the delimeter size, which can be >1, add the character received to the buffer and compa...
CharInBuffer(size_t size_, const string &delimiter_)
Constructor.
overflow or Socket I/O error
state_t state() const
Report the current state of the object.
state_t m_state
Internal state of an object.