libassa
3.5.1
|
#include <xdrIOBuffer.h>
Public Types | |
enum | state_t { waiting , xmitted , parsed , error } |
Public Member Functions | |
xdrIOBuffer (u_int len_) | |
Constructor. More... | |
~xdrIOBuffer () | |
Destructor. More... | |
xdrIOBuffer (const xdrIOBuffer &rhs_) | |
Copy constructor. More... | |
xdrIOBuffer & | operator= (const xdrIOBuffer &rhs_) |
Assign operator. More... | |
xdrIOBuffer & | operator>> (std::string &) |
Read and XDR-decode STL string from the buffer. More... | |
xdrIOBuffer & | operator>> (int &) |
Read and XDR-decode an integer from the buffer. More... | |
xdrIOBuffer & | operator>> (float &) |
Read and XDR-decode a float from the buffer. More... | |
operator void * () const | |
Convertion to void* (for testing where bool is required). More... | |
string | get_state () const |
Give verbal interpretation of object's state. More... | |
int | size () const |
Return number of bytes in xdrIOBuffer. More... | |
int | buffer_size () const |
Return buffer (maximum expected/allowable) size. More... | |
const char * | str () const |
Return pointer to the first byte of xdrIOBuffer. More... | |
void | reset () |
Clear up the internal buffer and reset state to waiting. More... | |
void | dump () const |
Dump object's internal state to the log file. More... | |
Protected Member Functions | |
void | copy (const xdrIOBuffer &) |
Copy object from argument. More... | |
Private Attributes | |
char * | m_buf |
Buffer. More... | |
int | m_sz |
Buffer size and maximum expected size. More... | |
char * | m_ptr |
Pointer for next I/O operation into the buffer More... | |
state_t | m_state |
Object state. More... | |
Friends | |
Socket & | operator>> (Socket &src_, xdrIOBuffer &dest_) |
Read raw data from Socket nonblocking and store into internal buffer. More... | |
Definition at line 55 of file xdrIOBuffer.h.
xdrIOBuffer::xdrIOBuffer | ( | u_int | len_ | ) |
Constructor.
Definition at line 78 of file xdrIOBuffer.cpp.
References DL, dump(), m_buf, m_ptr, m_sz, trace_with_mask, ASSA::XDRBUF, and ASSA::XDRBUFTRACE.
xdrIOBuffer::~xdrIOBuffer | ( | ) |
Destructor.
Definition at line 92 of file xdrIOBuffer.cpp.
References DL, m_buf, trace_with_mask, and ASSA::XDRBUFTRACE.
|
inline |
Copy constructor.
Definition at line 150 of file xdrIOBuffer.h.
References copy(), trace_with_mask, and ASSA::XDRBUFTRACE.
|
inline |
Return buffer (maximum expected/allowable) size.
Definition at line 177 of file xdrIOBuffer.h.
References m_sz.
|
protected |
Copy object from argument.
Definition at line 112 of file xdrIOBuffer.cpp.
References m_buf, m_ptr, m_state, m_sz, size(), trace_with_mask, and ASSA::XDRBUFTRACE.
Referenced by operator=(), and xdrIOBuffer().
void xdrIOBuffer::dump | ( | void | ) | const |
Dump object's internal state to the log file.
Definition at line 224 of file xdrIOBuffer.cpp.
References DL, get_state(), ASSA::MemDump::getMemDump(), m_buf, m_ptr, m_state, m_sz, size(), trace_with_mask, ASSA::XDRBUFTRACE, and xmitted.
Referenced by xdrIOBuffer().
string xdrIOBuffer::get_state | ( | ) | const |
Give verbal interpretation of object's state.
Definition at line 209 of file xdrIOBuffer.cpp.
References error, m_state, parsed, waiting, and xmitted.
Referenced by dump(), and operator>>().
|
inline |
Convertion to void* (for testing where bool is required).
Definition at line 159 of file xdrIOBuffer.h.
References trace_with_mask, and ASSA::XDRBUFTRACE.
xdrIOBuffer & xdrIOBuffer::operator= | ( | const xdrIOBuffer & | rhs_ | ) |
Assign operator.
Definition at line 102 of file xdrIOBuffer.cpp.
References copy(), m_buf, trace_with_mask, and ASSA::XDRBUFTRACE.
xdrIOBuffer & xdrIOBuffer::operator>> | ( | float & | n_ | ) |
Read and XDR-decode a float from the buffer.
Definition at line 174 of file xdrIOBuffer.cpp.
References ASSA::ASSAERR, EL, get_state(), m_ptr, m_state, m_sz, parsed, size(), trace_with_mask, ASSA::XDRBUFTRACE, and xmitted.
xdrIOBuffer & xdrIOBuffer::operator>> | ( | int & | n_ | ) |
Read and XDR-decode an integer from the buffer.
Definition at line 125 of file xdrIOBuffer.cpp.
References ASSA::ASSAERR, EL, get_state(), m_ptr, m_state, m_sz, parsed, size(), trace_with_mask, ASSA::XDRBUFTRACE, and xmitted.
xdrIOBuffer & xdrIOBuffer::operator>> | ( | std::string & | s_ | ) |
Read and XDR-decode STL string from the buffer.
XDR format for STL string is described in Socket::operator<< comments.
Definition at line 147 of file xdrIOBuffer.cpp.
References ASSA::ASSAERR, EL, get_state(), m_ptr, m_state, m_sz, parsed, size(), trace_with_mask, ASSA::Socket::xdr_length(), ASSA::XDRBUFTRACE, and xmitted.
void xdrIOBuffer::reset | ( | ) |
Clear up the internal buffer and reset state to waiting.
Definition at line 199 of file xdrIOBuffer.cpp.
References m_buf, m_ptr, m_state, m_sz, trace_with_mask, waiting, and ASSA::XDRBUFTRACE.
|
inline |
Return number of bytes in xdrIOBuffer.
In waiting state it's bytes transmitted so far. In xmitted state, number of bytes left to decode.
Definition at line 170 of file xdrIOBuffer.h.
Referenced by copy(), dump(), and operator>>().
|
inline |
Return pointer to the first byte of xdrIOBuffer.
Definition at line 184 of file xdrIOBuffer.h.
References m_buf.
|
friend |
Read raw data from Socket nonblocking and store into internal buffer.
Definition at line 25 of file xdrIOBuffer.cpp.
|
private |
Buffer.
Definition at line 137 of file xdrIOBuffer.h.
Referenced by copy(), dump(), operator=(), reset(), size(), str(), xdrIOBuffer(), and ~xdrIOBuffer().
|
private |
Pointer for next I/O operation into the buffer
Definition at line 143 of file xdrIOBuffer.h.
Referenced by copy(), dump(), operator>>(), reset(), size(), and xdrIOBuffer().
|
private |
Object state.
Definition at line 146 of file xdrIOBuffer.h.
Referenced by copy(), dump(), get_state(), operator>>(), and reset().
|
private |
Buffer size and maximum expected size.
Definition at line 140 of file xdrIOBuffer.h.
Referenced by buffer_size(), copy(), dump(), operator>>(), reset(), and xdrIOBuffer().