chiark / gitweb /
wip make it compile; add warnings to Makefile
[inn-innduct.git] / include / inn / wire.h
1 /*  $Id: wire.h 6028 2002-12-24 05:10:39Z rra $
2 **
3 **  Wire format article utilities.
4 **
5 **  Originally written by Alex Kiernan (alex.kiernan@thus.net)
6 **
7 **  These routines manipulate wire format articles; in particular, they should
8 **  be safe in the presence of embedded NULs and UTF-8 characters.
9 */
10
11 #ifndef INN_WIRE_H
12 #define INN_WIRE_H 1
13
14 #include <inn/defines.h>
15
16 BEGIN_DECLS
17
18 /* Given a pointer to the start of an article, locate the first octet
19    of the body (which may be the octet beyond the end of the buffer if
20    your article is bodyless). */
21 char *wire_findbody(const char *, size_t);
22
23 /* Given a pointer into an article and a pointer to the end of the article,
24    find the start of the next line or return NULL if there are no more lines
25    remaining in the article. */
26 char *wire_nextline(const char *, const char *end);
27
28 /* Given a pointer to the start of an article and the name of a header, find
29    the beginning of the value of the given header (the returned pointer will
30    be after the name of the header and any initial whitespace).  Headers whose
31    only content is whitespace are ignored.  If the header isn't found, returns
32    NULL.
33
34    WARNING: This function does not comply with RFC 2822's idea of header
35    content, particularly in its skipping of initial whitespace. */
36 char *wire_findheader(const char *article, size_t, const char *header);
37
38 /* Given a pointer inside a header's value and a pointer to the end of the
39    article, returns a pointer to the end of the header value (the \n at the
40    end of the terminating \r\n with folding taken into account), or NULL if no
41    such terminator was found before the end of the article. */
42 char *wire_endheader(const char *header, const char *end);
43
44 END_DECLS
45
46 #endif /* INN_WIRE_H */