Go to the documentation of this file.
10 #ifndef MSGPACK_VREFBUFFER_H
11 #define MSGPACK_VREFBUFFER_H
16 #if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__QNX__) || defined(__QNXTO__)
57 #ifndef MSGPACK_VREFBUFFER_REF_SIZE
58 #define MSGPACK_VREFBUFFER_REF_SIZE 32
61 #ifndef MSGPACK_VREFBUFFER_CHUNK_SIZE
62 #define MSGPACK_VREFBUFFER_CHUNK_SIZE 8192
67 size_t ref_size,
size_t chunk_size);
71 static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(
size_t ref_size,
size_t chunk_size);
74 static inline int msgpack_vrefbuffer_write(
void*
data,
const char* buf,
size_t len);
81 const char* buf,
size_t len);
85 const char* buf,
size_t len);
96 static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(
size_t ref_size,
size_t chunk_size)
99 if (vbuf == NULL)
return NULL;
109 if(vbuf == NULL) {
return; }
114 static inline int msgpack_vrefbuffer_write(
void*
data,
const char* buf,
size_t len)
118 if(len < vbuf->ref_size) {
132 return (
size_t)(vref->
tail - vref->
array);
struct msgpack_vrefbuffer msgpack_vrefbuffer
size_t chunk_size
Definition: vrefbuffer.h:50
char * ptr
Definition: vrefbuffer.h:41
#define MSGPACK_DLLEXPORT
Definition: sysdep.h:42
size_t ref_size
Definition: vrefbuffer.h:51
MSGPACK_DLLEXPORT int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer *vbuf, msgpack_vrefbuffer *to)
MSGPACK_DLLEXPORT bool msgpack_vrefbuffer_init(msgpack_vrefbuffer *vbuf, size_t ref_size, size_t chunk_size)
MSGPACK_DLLEXPORT int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer *vbuf, const char *buf, size_t len)
MSGPACK_DLLEXPORT void msgpack_vrefbuffer_clear(msgpack_vrefbuffer *vref)
msgpack_vrefbuffer_inner_buffer inner_buffer
Definition: vrefbuffer.h:53
struct msgpack_vrefbuffer_inner_buffer msgpack_vrefbuffer_inner_buffer
MSGPACK_DLLEXPORT int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer *vbuf, const char *buf, size_t len)
const char * data
Definition: unpack_template.h:89
size_t free
Definition: vrefbuffer.h:40
void * iov_base
Definition: vrefbuffer.h:20
struct iovec * array
Definition: vrefbuffer.h:48
MSGPACK_DLLEXPORT void msgpack_vrefbuffer_destroy(msgpack_vrefbuffer *vbuf)
Definition: vrefbuffer.h:19
size_t iov_len
Definition: vrefbuffer.h:21
msgpack_vrefbuffer_chunk * head
Definition: vrefbuffer.h:42
Definition: vrefbuffer.h:45
struct msgpack_vrefbuffer_chunk msgpack_vrefbuffer_chunk
Definition: vrefbuffer.h:37
Definition: vrefbuffer.h:39
struct iovec * tail
Definition: vrefbuffer.h:46
const char size_t len
Definition: unpack_template.h:89
struct iovec * end
Definition: vrefbuffer.h:47