purple: work around broken dbus-server.h
[siplcs.git] / src / core / sipe-http-request.h
blob59ef4d2e032ffe960398cf5c340337565b0dfe1c
1 /**
2 * @file sipe-http-request.h
4 * pidgin-sipe
6 * Copyright (C) 2013 SIPE Project <http://sipe.sourceforge.net/>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 /* Private interface between HTTP Public <-> Request <-> Transport layers */
25 #ifndef _SIPE_HTTP_PRIVATE_IF_REQUEST
26 #error "you are not allowed to include sipe-http-request.h!"
27 #endif
30 * Interface dependencies:
32 * <glib.h>
35 /* Forward declarations */
36 struct sipmsg;
37 struct sipe_core_private;
38 struct sipe_http_connection_public;
39 struct sipe_http_request;
41 struct sipe_http_parsed_uri {
42 gchar *host;
43 gchar *path;
44 guint port;
45 gboolean tls;
48 /**
49 * Parse URI
51 * @param uri text to parse
53 * @return pointer to parsed URI. Must be freed with @c sipe_http_parsed_uri_free()
55 struct sipe_http_parsed_uri *sipe_http_parse_uri(const gchar *uri);
57 /**
58 * Free parsed URI data structure
60 * @param pointer to parsed URI (may be @c NULL)
62 void sipe_http_parsed_uri_free(struct sipe_http_parsed_uri *parsed_uri);
65 /**
66 * Is there pending request for HTTP connection?
68 * @param conn_public HTTP connection public data
70 gboolean sipe_http_request_pending(struct sipe_http_connection_public *conn_public);
72 /**
73 * HTTP connection is ready for next request
75 * @param conn_public HTTP connection public data
77 void sipe_http_request_next(struct sipe_http_connection_public *conn_public);
79 /**
80 * HTTP response received
82 * @param conn_public HTTP connection public data
83 * @param msg parsed message
85 void sipe_http_request_response(struct sipe_http_connection_public *conn_public,
86 struct sipmsg *msg);
88 /**
89 * HTTP connection shutdown
91 * @param conn_public HTTP connection public data
92 * @param abort @c TRUE if HTTP stack is shutting down
94 void sipe_http_request_shutdown(struct sipe_http_connection_public *conn_public,
95 gboolean abort);
97 /**
98 * Create new HTTP request (internal raw version)
100 * @param sipe_private SIPE core private data
101 * @param parsed_uri pointer to parsed URI
102 * @param headers additional headers to add (may be @c NULL)
103 * @param body body (may be @c NULL)
104 * @param content_type MIME type for body (may be @c NULL if body is @c NULL)
105 * @param callback callback function
106 * @param callback_data callback data
108 * @return pointer to opaque HTTP request data structure
110 struct sipe_http_request *sipe_http_request_new(struct sipe_core_private *sipe_private,
111 const struct sipe_http_parsed_uri *parsed_uri,
112 const gchar *headers,
113 const gchar *body,
114 const gchar *content_type,
115 sipe_http_response_callback *callback,
116 gpointer callback_data);