29 #ifndef AsyncComm_CommBuf_h
30 #define AsyncComm_CommBuf_h
40 #include <boost/shared_array.hpp>
91 data.
set(
new uint8_t [len], len,
true);
109 data.
set(
new uint8_t [len], len,
true);
128 boost::shared_array<uint8_t> &ext_buffer, uint32_t ext_len) :
131 data.
set(
new uint8_t [len], len,
true);
310 #endif // AsyncComm_CommBuf_h
A memory buffer of static size.
void set(uint8_t *data, uint32_t len, bool take_ownership=true)
Sets data pointer; the existing buffer is discarded and deleted.
std::string String
A String is simply a typedef to std::string.
I/O handler for datagram (UDP) sockets.
boost::shared_array< uint8_t > ext_shared_array
Smart pointer to extended buffer memory.
Po::typed_value< String > * str(String *v=0)
uint8_t ** get_data_ptr_address()
Returns address of the primary buffer internal data pointer.
void append_str16(const String &str)
Appends a String to the primary buffer.
void write_header_and_reset()
Encodes the header at the beginning of the primary buffer.
void encode_inet_addr(uint8_t **bufp, const InetAddr &addr)
Encode an InetAddr structure.
void append_vstr(const char *str)
Appends a c-style string to the primary buffer.
CommBuf(CommHeader &hdr, uint32_t len, StaticBuffer &buffer)
Constructor.
CommHeader header
Comm header.
Encapsulate an internet address.
StaticBuffer data
Primary data buffer.
std::shared_ptr< CommBuf > CommBufPtr
Smart pointer to CommBuf.
Logging routines and macros.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
void append_i16(uint16_t sval)
Appends a 16-bit integer to the primary buffer.
const uint8_t * ext_ptr
Write pointer into ext buffer.
void encode_i16(uint8_t **bufp, uint16_t val)
Encode a 16-bit integer in little-endian order.
void append_vstr(const String &str)
Appends a String to the primary buffer.
uint8_t * data_ptr
Write pointer into data buffer.
I/O handler for TCP sockets.
void encode_i64(uint8_t **bufp, uint64_t val)
Encode a 64-bit integer in little-endian order.
void * advance_data_ptr(size_t len)
Advance the primary buffer internal data pointer by len bytes.
void append_i32(uint32_t ival)
Appends a 32-bit integer to the primary buffer.
Functions to serialize/deserialize primitives to/from a memory buffer.
A memory buffer of static size.
CommBuf(CommHeader &hdr, uint32_t len, boost::shared_array< uint8_t > &ext_buffer, uint32_t ext_len)
Constructor.
StaticBuffer ext
Extended buffer.
void append_str16(const char *str)
Appends a c-style string to the primary buffer.
CommBuf(CommHeader &hdr, uint32_t len=0)
Constructor.
void append_i64(uint64_t lval)
Appends a 64-bit integer to the primary buffer.
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
void encode_bool(uint8_t **bufp, bool bval)
Encodes a boolean into the given buffer.
void append_bytes(const uint8_t *bytes, uint32_t len)
Appends a sequence of bytes to the primary buffer.
Internet address wrapper classes and utility functions.
Message buffer for holding data to be transmitted over a network.
void append_vstr(const void *str, uint32_t len)
Appends a variable sized string to the primary buffer.
A serializable ByteString.
void append_byte(uint8_t bval)
Appends a byte of data to the primary buffer.
void encode_str16(uint8_t **bufp, const void *str, uint16_t len)
Encodes a string buffer into the given buffer.
void * get_data_ptr()
Returns the primary buffer internal data pointer.
void append_inet_addr(const InetAddr &addr)
Appends an InetAddr structure to the primary buffer.
void append_bool(bool bval)
Appends a boolean value to the primary buffer.