1 /***************************************************************************/ 2 /* This code is part of WWW grabber called pavuk */ 3 /* Copyright (c) 1997 - 2001 Stefan Ondrejicka */ 4 /* Distributed under GPL 2 or later */ 5 /***************************************************************************/ 6 7 #ifndef _bufio_h_ 8 #define _bufio_h_ 9 10 typedef struct 11 { 12 int fd; 13 char *buf; 14 int buf_size; 15 int buf_start; 16 int buf_end; 17 int bufio_errno; 18 int eof; 19 int is_sock; 20 void *ssl_hook_data; 21 } bufio; 22 23 extern bufio *bufio_fdopen(int); 24 extern bufio *bufio_sock_fdopen(int); 25 extern bufio *bufio_open(const char *, int); 26 extern bufio *bufio_copen(const char *, int, int); 27 extern bufio *bufio_dupfd(int); 28 extern bufio *bufio_new_sslcon(bufio *, void *); 29 extern int bufio_read(bufio *, char *, size_t); 30 extern int bufio_nbfread(bufio *, char *, size_t); 31 extern int bufio_readln(bufio *, char *, size_t); 32 extern void bufio_unread(bufio *, char *, size_t); 33 extern int bufio_write(bufio *, char *, size_t); 34 extern int bufio_close(bufio *); 35 extern void bufio_free(bufio *); 36 extern void bufio_reset(bufio *); 37 38 #define bufio_sslread(d, b, l, s) _bufio_read(d, b, l) 39 #define bufio_sslnbfread(d, b, l, s) _bufio_nbfread(d, b, l) 40 #define bufio_sslreadln(d, b, l, s) _bufio_readln(d, b, l) 41 #define bufio_sslwrite(d, b, l, s) _bufio_write(d, b, l) 42 43 #define bufio_getfd(s) ((s)->fd) 44 #define bufio_is_sock(s) ((s)->is_sock) 45 #define bufio_get_ssl_hook_data(s) ((s)->ssl_hook_data) 46 47 #endif 48