summaryrefslogtreecommitdiff
path: root/apps/buffering.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/buffering.h')
-rw-r--r--apps/buffering.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/buffering.h b/apps/buffering.h
index f6a9f7883b..bc61ec5e6d 100644
--- a/apps/buffering.h
+++ b/apps/buffering.h
@@ -41,6 +41,7 @@ enum callback_event {
41 EVENT_HANDLE_REBUFFER, 41 EVENT_HANDLE_REBUFFER,
42 EVENT_HANDLE_CLOSED, 42 EVENT_HANDLE_CLOSED,
43 EVENT_HANDLE_MOVED, 43 EVENT_HANDLE_MOVED,
44 EVENT_HANDLE_FINISHED,
44}; 45};
45 46
46/* Error return values */ 47/* Error return values */
@@ -48,6 +49,7 @@ enum callback_event {
48#define ERR_BUFFER_FULL -2 49#define ERR_BUFFER_FULL -2
49#define ERR_INVALID_VALUE -3 50#define ERR_INVALID_VALUE -3
50#define ERR_FILE_ERROR -4 51#define ERR_FILE_ERROR -4
52#define ERR_HANDLE_NOT_DONE -5
51 53
52 54
53/* Initialise the buffering subsystem */ 55/* Initialise the buffering subsystem */
@@ -68,9 +70,12 @@ bool buffering_reset(char *buf, size_t buflen);
68 * bufadvance: Move handle reading index, relatively to current position 70 * bufadvance: Move handle reading index, relatively to current position
69 * bufread : Copy data from a handle to a buffer 71 * bufread : Copy data from a handle to a buffer
70 * bufgetdata: Obtain a pointer for linear access to a "size" amount of data 72 * bufgetdata: Obtain a pointer for linear access to a "size" amount of data
73 * bufgettail: Out-of-band get the last size bytes of a handle.
74 * bufcuttail: Out-of-band remove the trailing 'size' bytes of a handle.
71 * 75 *
72 * NOTE: bufread and bufgetdata will block the caller until the requested 76 * NOTE: bufread and bufgetdata will block the caller until the requested
73 * amount of data is ready (unless EOF is reached). 77 * amount of data is ready (unless EOF is reached).
78 * NOTE: Tail operations are only legal when the end of the file is buffered.
74 ****************************************************************************/ 79 ****************************************************************************/
75 80
76#define BUF_MAX_HANDLES 256 81#define BUF_MAX_HANDLES 256
@@ -82,6 +87,8 @@ int bufseek(int handle_id, size_t newpos);
82int bufadvance(int handle_id, off_t offset); 87int bufadvance(int handle_id, off_t offset);
83ssize_t bufread(int handle_id, size_t size, void *dest); 88ssize_t bufread(int handle_id, size_t size, void *dest);
84ssize_t bufgetdata(int handle_id, size_t size, void **data); 89ssize_t bufgetdata(int handle_id, size_t size, void **data);
90ssize_t bufgettail(int handle_id, size_t size, void **data);
91ssize_t bufcuttail(int handle_id, size_t size);
85 92
86 93
87/*************************************************************************** 94/***************************************************************************