chiark / gitweb /
Web UI nonces are now base64-encoded, and have a shorter key.
[disorder] / lib / mime.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder
39d4aa6b 3 * Copyright (C) 2005, 2007 Richard Kettlewell
460b9539 4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
39d4aa6b
RK
20/** @file lib/mime.h
21 * @brief Support for MIME and allied protocols
22 */
460b9539 23
24#ifndef MIME_H
25#define MIME_H
26
9bce81d1 27struct kvp;
28
460b9539 29int mime_content_type(const char *s,
30 char **typep,
9bce81d1 31 struct kvp **parametersp);
460b9539 32
33const char *mime_parse(const char *s,
34 int (*callback)(const char *name, const char *value,
35 void *u),
36 void *u);
37/* Parse a MIME message. Calls CALLBACK for each header field, then returns a
38 * pointer to the decoded body (might or might not point back into the original
39 * string). */
40
41int mime_multipart(const char *s,
42 int (*callback)(const char *s, void *u),
43 const char *boundary,
44 void *u);
45/* call CALLBACK with each part of multipart document [s,s+n) */
46
47int mime_rfc2388_content_disposition(const char *s,
48 char **dispositionp,
49 char **parameternamep,
50 char **parametervaluep);
51/* Parse an RFC2388-style content-disposition field */
52
53char *mime_qp(const char *s);
460b9539 54
36bde473 55/** @brief Parsed form of an HTTP Cookie: header field
56 *
57 * See <a href="http://tools.ietf.org/html/rfc2109">RFC 2109</a>.
58 */
39d4aa6b
RK
59struct cookiedata {
60 /** @brief @c $Version or NULL if not set */
61 char *version;
62
63 /** @brief List of cookies */
64 struct cookie *cookies;
65
66 /** @brief Number of cookies */
67 int ncookies;
68};
69
36bde473 70/** @brief A parsed cookie
71 *
72 * See <a href="http://tools.ietf.org/html/rfc2109">RFC 2109</a> and @ref
73 * cookiedata.
74 */
39d4aa6b
RK
75struct cookie {
76 /** @brief Cookie name */
77 char *name;
78
79 /** @brief Cookie value */
80 char *value;
81
82 /** @brief Cookie path */
83 char *path;
84
85 /** @brief Cookie domain */
86 char *domain;
87
88};
89
90int parse_cookie(const char *s,
91 struct cookiedata *cd);
92const struct cookie *find_cookie(const struct cookiedata *cd,
93 const char *name);
36bde473 94char *quote822(const char *s, int force);
bb6ae3fb 95char *mime_to_qp(const char *text);
96const char *mime_encode_text(const char *text,
97 const char **charsetp,
98 const char **encodingp);
39d4aa6b 99
460b9539 100#endif /* MIME_H */
101
102/*
103Local Variables:
104c-basic-offset:2
105comment-column:40
106fill-column:79
107End:
108*/