10 #ifndef MSGPACK_VREFBUFFER_H 11 #define MSGPACK_VREFBUFFER_H 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);
76 static inline const struct iovec* msgpack_vrefbuffer_vec(
const msgpack_vrefbuffer* vref);
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) {
125 static inline const struct iovec* msgpack_vrefbuffer_vec(
const msgpack_vrefbuffer* vref)
132 return (
size_t)(vref->
tail - vref->
array);
struct iovec * tail
Definition: vrefbuffer.h:46
MSGPACK_DLLEXPORT int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer *vbuf, const char *buf, size_t len)
struct msgpack_vrefbuffer msgpack_vrefbuffer
Definition: vrefbuffer.h:39
MSGPACK_DLLEXPORT void msgpack_vrefbuffer_destroy(msgpack_vrefbuffer *vbuf)
#define MSGPACK_DLLEXPORT
Definition: sysdep.h:37
msgpack_vrefbuffer_inner_buffer inner_buffer
Definition: vrefbuffer.h:53
char * ptr
Definition: vrefbuffer.h:41
struct msgpack_vrefbuffer_chunk msgpack_vrefbuffer_chunk
Definition: vrefbuffer.h:37
Definition: vrefbuffer.h:45
struct iovec * array
Definition: vrefbuffer.h:48
size_t free
Definition: vrefbuffer.h:40
MSGPACK_DLLEXPORT bool msgpack_vrefbuffer_init(msgpack_vrefbuffer *vbuf, size_t ref_size, size_t chunk_size)
msgpack_vrefbuffer_chunk * head
Definition: vrefbuffer.h:42
MSGPACK_DLLEXPORT int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer *vbuf, msgpack_vrefbuffer *to)
const char * data
Definition: unpack_template.h:89
size_t chunk_size
Definition: vrefbuffer.h:50
const char size_t len
Definition: unpack_template.h:89
size_t ref_size
Definition: vrefbuffer.h:51
struct msgpack_vrefbuffer_inner_buffer msgpack_vrefbuffer_inner_buffer
struct iovec * end
Definition: vrefbuffer.h:47
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)