#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
struct buffer
{
struct buffer_data *data;
struct buffer_data *last;
int nonblocking;
int (*input) PROTO((void *closure, char *data, int need, int size,
int *got));
int (*output) PROTO((void *closure, const char *data, int have,
int *wrote));
int (*flush) PROTO((void *closure));
int (*block) PROTO ((void *closure, int block));
int (*shutdown) PROTO((struct buffer *));
void *closure;
void (*memory_error) PROTO((struct buffer *));
};
struct buffer_data
{
struct buffer_data *next;
char *bufp;
int size;
char *text;
};
#define BUFFER_DATA_SIZE (4096)
typedef void (*BUFMEMERRPROC) PROTO ((struct buffer *));
extern struct buffer *buf_initialize PROTO((int (*) (void *, char *, int,
int, int *),
int (*) (void *, const char *,
int, int *),
int (*) (void *),
int (*) (void *, int),
int (*) (struct buffer *),
void (*) (struct buffer *),
void *));
extern void buf_free PROTO((struct buffer *));
extern struct buffer *buf_nonio_initialize PROTO((void (*) (struct buffer *)));
extern struct buffer *stdio_buffer_initialize
PROTO((FILE *, int, int, void (*) (struct buffer *)));
extern FILE *stdio_buffer_get_file PROTO((struct buffer *));
extern struct buffer *compress_buffer_initialize
PROTO((struct buffer *, int, int, void (*) (struct buffer *)));
extern struct buffer *packetizing_buffer_initialize
PROTO((struct buffer *, int (*) (void *, const char *, char *, int),
int (*) (void *, const char *, char *, int, int *), void *,
void (*) (struct buffer *)));
extern int buf_empty PROTO((struct buffer *));
extern int buf_empty_p PROTO((struct buffer *));
extern void buf_output PROTO((struct buffer *, const char *, int));
extern void buf_output0 PROTO((struct buffer *, const char *));
extern void buf_append_char PROTO((struct buffer *, int));
extern int buf_send_output PROTO((struct buffer *));
extern int buf_flush PROTO((struct buffer *, int));
extern int set_nonblock PROTO((struct buffer *));
extern int set_block PROTO((struct buffer *));
extern int buf_send_counted PROTO((struct buffer *));
extern int buf_send_special_count PROTO((struct buffer *, int));
extern void buf_append_data PROTO((struct buffer *,
struct buffer_data *,
struct buffer_data *));
extern void buf_append_buffer PROTO((struct buffer *, struct buffer *));
extern int buf_read_file PROTO((FILE *, long, struct buffer_data **,
struct buffer_data **));
extern int buf_read_file_to_eof PROTO((FILE *, struct buffer_data **,
struct buffer_data **));
extern int buf_input_data PROTO((struct buffer *, int *));
extern int buf_read_line PROTO((struct buffer *, char **, int *));
extern int buf_read_data PROTO((struct buffer *, int, char **, int *));
extern void buf_copy_lines PROTO((struct buffer *, struct buffer *, int));
extern int buf_copy_counted PROTO((struct buffer *, struct buffer *, int *));
extern int buf_chain_length PROTO((struct buffer_data *));
extern int buf_length PROTO((struct buffer *));
extern int buf_shutdown PROTO((struct buffer *));
#ifdef SERVER_FLOWCONTROL
extern int buf_count_mem PROTO((struct buffer *));
#endif
#endif