sock: in listen_sock(), add debug message when socket() call failed.
[obnox/tinyproxy.git] / src / buffer.h
1 /* tinyproxy - A fast light-weight HTTP proxy
2  * Copyright (C) 1999 Robert James Kaes <rjkaes@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 /* See 'buffer.c' for detailed information. */
20
21 #ifndef _TINYPROXY_BUFFER_H_
22 #define _TINYPROXY_BUFFER_H_
23
24 /* Forward declaration */
25 struct buffer_s;
26
27 extern struct buffer_s *new_buffer (void);
28 extern void delete_buffer (struct buffer_s *buffptr);
29 extern size_t buffer_size (struct buffer_s *buffptr);
30
31 /*
32  * Add a new line to the given buffer. The data IS copied into the structure.
33  */
34 extern int add_to_buffer (struct buffer_s *buffptr, unsigned char *data,
35                           size_t length);
36
37 extern ssize_t read_buffer (int fd, struct buffer_s *buffptr);
38 extern ssize_t write_buffer (int fd, struct buffer_s *buffptr);
39
40 #endif /* __BUFFER_H_ */