Haka: lib/haka/vbuffer.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

vbuffer.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef HAKA_VBUFFER_PRIVATE_H
6 #define HAKA_VBUFFER_PRIVATE_H
7
8 #include <haka/vbuffer.h>
9
10
11 struct vbuffer_chunk_flags {
12 bool end:1;
13 bool eof:1;
14 bool modified:1;
15 bool writable:1;
16 bool ctl:1;
17 };
18
19 struct vbuffer_chunk {
20 struct list2_elem list;
21 atomic_t ref;
22 struct vbuffer_chunk_flags flags;
23 struct vbuffer_data *data;
24 vbsize_t offset;
25 vbsize_t size;
26 };
27
28 void vbuffer_chunk_clear(struct vbuffer_chunk *chunk);
29 struct vbuffer_chunk *vbuffer_chunk_create(struct vbuffer_data *data, size_t offset, size_t length);
30 struct vbuffer_chunk *vbuffer_chunk_insert_ctl(struct vbuffer_chunk *ctl, struct vbuffer_data *data);
31 struct vbuffer_chunk *vbuffer_chunk_clone(struct vbuffer_chunk *chunk, bool copy);
32
33 struct list2 *vbuffer_chunk_list(const struct vbuffer *buf);
34 struct vbuffer_chunk *vbuffer_chunk_begin(const struct vbuffer *buf);
35 struct vbuffer_chunk *vbuffer_chunk_end(const struct vbuffer *buf);
36 struct vbuffer_chunk *vbuffer_chunk_next(struct vbuffer_chunk *chunk);
37 struct vbuffer_chunk *vbuffer_chunk_prev(struct vbuffer_chunk *chunk);
38 struct vbuffer_chunk *vbuffer_chunk_remove_ctl(struct vbuffer_chunk *chunk);
39
40 #define VBUFFER_FOR_EACH(buf, var) \
41 for (var = vbuffer_chunk_begin(buf); var; \
42 var = vbuffer_chunk_next(var))
43
44 void vbuffer_iterator_build(struct vbuffer_iterator *position, struct vbuffer_chunk *chunk, vbsize_t offset, vbsize_t meter);
45 void vbuffer_iterator_update(struct vbuffer_iterator *position, struct vbuffer_chunk *chunk, size_t offset);
46
47 #endif /* HAKA_VBUFFER_PRIVATE_H */
vbuffer_data
Definition: vbuffer.h:50
vbuffer
Definition: vbuffer.h:64
vbuffer_iterator
Definition: vbuffer.h:77
vbsize_t
uint32 vbsize_t
Definition: vbuffer.h:24
atomic_t
volatile uint32 atomic_t
Definition: thread.h:267