1 /* mpdscribble (MPD Client)
2  * Copyright (C) 2008-2010 The Music Player Daemon Project
3  * Copyright (C) 2005-2008 Kuno Woudt <kuno@frob.nl>
4  * Project homepage: http://musicpd.org
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef HTTP_CLIENT_H
22 #define HTTP_CLIENT_H
23 
24 #include <glib.h>
25 
26 #include <stddef.h>
27 
28 struct http_client_handler {
29 	void (*response)(size_t length, const char *data, void *ctx);
30 	void (*error)(GError *error, void *ctx);
31 };
32 
33 /**
34  * Perform global initialization on the HTTP client library.
35  */
36 void
37 http_client_init(void);
38 
39 /**
40  * Global deinitializaton.
41  */
42 void
43 http_client_finish(void);
44 
45 /**
46  * Escapes URI parameters with '%'.  Free the return value with
47  * g_free().
48  */
49 char *
50 http_client_uri_escape(const char *src);
51 
52 void
53 http_client_request(const char *url, const char *post_data,
54 		    const struct http_client_handler *handler, void *ctx);
55 
56 #endif /* CONN_H */
57