ibuf.h
#ifndef IO_BUF__IBUF__H__
#define IO_BUF__IBUF__H__
#include "iobuf_common.h"
typedef int (*ibuf_fn)(int, void*, unsigned long);
struct ibuf
{
iobuf io;
unsigned count;
ibuf_fn readfn;
};
typedef struct ibuf ibuf;
extern ibuf inbuf;
int ibuf_init(ibuf* in, int fd, ibuf_fn fn, unsigned flags, unsigned bufsize);
int ibuf_open(ibuf* in, const char* filename, unsigned bufsize);
int ibuf_eof(ibuf* in);
#define ibuf_close(in) iobuf_close(&((in)->io))
#define ibuf_closed(in) iobuf_closed(&((in)->io))
#define ibuf_error(in) iobuf_error(&((in)->io))
#define ibuf_timedout(in) iobuf_timedout(&((in)->io))
int ibuf_refill(ibuf* in);
int ibuf_read_large(ibuf* in, char* data, unsigned datalen);
int ibuf_read(ibuf* in, char* data, unsigned datalen);
unsigned ibuf_tell(ibuf* in);
int ibuf_seek(ibuf* in, unsigned offset);
#define ibuf_rewind(in) ibuf_seek(in,0)
#define ibuf_seekfwd(in,off) ibuf_seek(ibuf_tell(in)+(offset))
int ibuf_peek(ibuf* in, char* ch);
int ibuf_getc(ibuf* in, char* ch);
int ibuf_getu(ibuf* in, unsigned long* data);
int ibuf_gets(ibuf* in, char* data, unsigned datalen, char boundary);
int ibuf_getstr(ibuf* in, struct str* s, char boundary);
int ibuf_getstr_crlf(ibuf* in, struct str* s);
int ibuf_getnetstring(ibuf* in, struct str* s);
int ibuf_readall(ibuf* in, struct str* s);
int ibuf_openreadclose(const char* filename, struct str* s);
#endif
ibuf_eof
int ibuf_eof(ibuf *in)
Definition ibuf_status.c:4
ibuf_open
int ibuf_open(ibuf *in, const char *filename, unsigned bufsize)
Definition ibuf_open.c:5
ibuf_fn
int(* ibuf_fn)(int, void *, unsigned long)
Definition ibuf.h:16
inbuf
ibuf inbuf
Definition ibuf_stdin.c:7
ibuf_refill
int ibuf_refill(ibuf *in)
Definition ibuf_refill.c:11
ibuf_getstr_crlf
int ibuf_getstr_crlf(ibuf *in, struct str *s)
Definition ibuf_getstr_crlf.c:21
ibuf_getu
int ibuf_getu(ibuf *in, unsigned long *data)
Definition ibuf_getu.c:4
ibuf_getc
int ibuf_getc(ibuf *in, char *ch)
Definition ibuf_getc.c:4
ibuf_getstr
int ibuf_getstr(ibuf *in, struct str *s, char boundary)
Definition ibuf_getstr.c:5
ibuf_read
int ibuf_read(ibuf *in, char *data, unsigned datalen)
Definition ibuf_read.c:55
ibuf_gets
int ibuf_gets(ibuf *in, char *data, unsigned datalen, char boundary)
Definition ibuf_gets.c:4
ibuf_seek
int ibuf_seek(ibuf *in, unsigned offset)
Definition ibuf_seek.c:7
ibuf_tell
unsigned ibuf_tell(ibuf *in)
Definition ibuf_tell.c:4
ibuf_peek
int ibuf_peek(ibuf *in, char *ch)
Definition ibuf_peek.c:5
ibuf_read_large
int ibuf_read_large(ibuf *in, char *data, unsigned datalen)
Definition ibuf_read.c:13
ibuf_openreadclose
int ibuf_openreadclose(const char *filename, struct str *s)
Definition ibuf_openreadclose.c:5
ibuf_readall
int ibuf_readall(ibuf *in, struct str *s)
Definition ibuf_readall.c:5
ibuf_init
int ibuf_init(ibuf *in, int fd, ibuf_fn fn, unsigned flags, unsigned bufsize)
Definition ibuf_init.c:5
ibuf_getnetstring
int ibuf_getnetstring(ibuf *in, struct str *s)
Definition ibuf_getnetstring.c:10
ibuf
Definition ibuf.h:20
ibuf::readfn
ibuf_fn readfn
Definition ibuf.h:26
ibuf::count
unsigned count
Definition ibuf.h:24
ibuf::io
iobuf io
Definition ibuf.h:22
iobuf
Definition iobuf_common.h:49
str
Definition str.h:31