1.1 --- a/ucx/buffer.h Wed Oct 10 10:04:01 2012 +0200 1.2 +++ b/ucx/buffer.h Wed Oct 10 10:46:20 2012 +0200 1.3 @@ -1,6 +1,7 @@ 1.4 #ifndef BUFFER_H 1.5 #define BUFFER_H 1.6 1.7 +#include <sys/types.h> 1.8 #include <stdio.h> 1.9 1.10 #ifdef __cplusplus 1.11 @@ -18,6 +19,16 @@ 1.12 void ucx_buffer_free(UcxBuffer* buffer); 1.13 1.14 /* 1.15 + * the autofree flag is enforced for the new buffer 1.16 + * if length is zero, the whole remaining buffer shall be extracted 1.17 + * the position of the new buffer is set to zero 1.18 + */ 1.19 +UcxBuffer *ucx_buffer_extract(UcxBuffer *src, 1.20 + size_t start, size_t length, int flags); 1.21 +#define ucx_buffer_clone(src,flags) \ 1.22 + ucx_buffer_extract(src, 0, 0, flags) 1.23 + 1.24 +/* 1.25 * Moves the position of the buffer to a new position relative to whence. 1.26 * 1.27 * SEEK_SET marks the start of the buffer 1.28 @@ -31,6 +42,9 @@ 1.29 */ 1.30 int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); 1.31 size_t ucx_buffer_tell(UcxBuffer *buffer); 1.32 +size_t ucx_buffer_size(UcxBuffer *buffer); 1.33 +/* returns non-zero, if at least the specified flags are set */ 1.34 +int ucx_buffer_testflags(UcxBuffer *buffer, int flags); 1.35 1.36 /* 1.37 * returns non-zero, iff the current buffer position has exceeded the last