Use C99 uint32_t rather than u_int32_t
[onak.git] / charfuncs.h
1 /*
2  * charfuncs.h - Routines for dealing with character streams.
3  *
4  * Copyright 2002 Jonathan McDowell <noodles@earth.li>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 51
17  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __CHARFUNCS_H__
21 #define __CHARFUNCS_H__
22
23 #include <stdlib.h>
24
25 /**
26  *      buffer_ctx - Shared with CGI buffer stuff...
27  *      @buffer: The data buffer.
28  *      @offset: Our current position in the buffer.
29  *      @size: The size of the data buffer.
30  */
31 struct buffer_ctx {
32         char *buffer;
33         size_t offset;
34         size_t size;
35 };
36
37 /**
38  *      buffer_fetchchar - Fetches a char from a buffer.
39  *      @ctx: Our buffer context structure.
40  *      @count: The number of characters to get from the buffer.
41  *      @c: Where to put the characters retrieved.
42  */
43 int buffer_fetchchar(void *ctx, size_t count, void *c);
44
45 /**
46  *      buffer_putchar - Puts a char to a buffer.
47  *      @ctx: Our buffer context structure.
48  *      @count: The number of characters to put into the buffer.
49  *      @c: The characters to add to the buffer.
50  *
51  *      Adds characters to the buffer references by the buffer context. If we
52  *      fill it then we double the size of the current buffer and then add the
53  *      rest.
54  */
55 int buffer_putchar(void *ctx, size_t count, void *c);
56
57 /**
58  *      file_fetchchar - Fetches a char from a file.
59  */
60 int file_fetchchar(void *fd, size_t count, void *c);
61
62 /**
63  *      file_putchar - Puts a char to a file.
64  */
65 int file_putchar(void *fd, size_t count, void *c);
66
67 /**
68  *      stdin_getchar - Gets a char from stdin.
69  */
70 int stdin_getchar(void *ctx, size_t count, void *c);
71
72 /**
73  *      stdout_putchar - Puts a char to stdout.
74  */
75 int stdout_putchar(void *ctx, size_t count, void *c);
76
77 #endif /* __CHARFUNCS_H__ */