htpipe: Fixed simple initialization bug.
[ashd.git] / lib / bufio.h
... / ...
CommitLineData
1#ifndef _LIB_BUFIO_H
2#define _LIB_BUFIO_H
3
4struct bufioops {
5 ssize_t (*read)(void *pdata, void *buf, size_t len);
6 ssize_t (*write)(void *pdata, const void *buf, size_t len);
7 int (*close)(void *pdata);
8};
9
10struct bufio {
11 struct charbuf rbuf, wbuf;
12 size_t rh, wh, bufhint;
13 int err, eof;
14 void *pdata;
15 struct bufioops *ops;
16};
17
18struct bufio *bioopen(void *pdata, struct bufioops *ops);
19int bioclose(struct bufio *bio);
20
21size_t biordata(struct bufio *bio);
22size_t biorspace(struct bufio *bio);
23int bioeof(struct bufio *bio);
24ssize_t biorensure(struct bufio *bio, size_t bytes);
25ssize_t biofillsome(struct bufio *bio);
26int biogetc(struct bufio *bio);
27ssize_t bioreadsome(struct bufio *bio, void *buf, size_t len);
28
29size_t biowdata(struct bufio *bio);
30size_t biowspace(struct bufio *bio);
31int bioflush(struct bufio *bio);
32int bioflushsome(struct bufio *bio);
33ssize_t biowensure(struct bufio *bio, size_t bytes);
34int bioputc(struct bufio *bio, int c);
35ssize_t biowrite(struct bufio *bio, const void *data, size_t len);
36ssize_t biowritesome(struct bufio *bio, const void *data, size_t len);
37int bioprintf(struct bufio *bio, const char *format, ...);
38ssize_t biocopysome(struct bufio *dst, struct bufio *src);
39ssize_t biocopybuf(struct bufio *dst, struct bufio *src);
40
41#endif