diff -r fb07a0ab9a17 -r 6814aea8462d ucx/buffer.h --- a/ucx/buffer.h Wed Oct 10 10:04:01 2012 +0200 +++ b/ucx/buffer.h Wed Oct 10 10:46:20 2012 +0200 @@ -1,6 +1,7 @@ #ifndef BUFFER_H #define BUFFER_H +#include #include #ifdef __cplusplus @@ -18,6 +19,16 @@ void ucx_buffer_free(UcxBuffer* buffer); /* + * the autofree flag is enforced for the new buffer + * if length is zero, the whole remaining buffer shall be extracted + * the position of the new buffer is set to zero + */ +UcxBuffer *ucx_buffer_extract(UcxBuffer *src, + size_t start, size_t length, int flags); +#define ucx_buffer_clone(src,flags) \ + ucx_buffer_extract(src, 0, 0, flags) + +/* * Moves the position of the buffer to a new position relative to whence. * * SEEK_SET marks the start of the buffer @@ -31,6 +42,9 @@ */ int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); size_t ucx_buffer_tell(UcxBuffer *buffer); +size_t ucx_buffer_size(UcxBuffer *buffer); +/* returns non-zero, if at least the specified flags are set */ +int ucx_buffer_testflags(UcxBuffer *buffer, int flags); /* * returns non-zero, iff the current buffer position has exceeded the last