493c078d1dd23af765093f716a94196646440499
[siplcs.git] / src / core / sipe-http-request.h
blob493c078d1dd23af765093f716a94196646440499
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;
47 /**
48 * Parse URI
50 * @param uri text to parse
52 * @return pointer to parsed URI. Must be freed with @c sipe_http_parsed_uri_free()
54 struct sipe_http_parsed_uri *sipe_http_parse_uri(const gchar *uri);
56 /**
57 * Free parsed URI data structure
59 * @param pointer to parsed URI.
61 void sipe_http_parsed_uri_free(struct sipe_http_parsed_uri *parsed_uri);
64 /**
65 * Is there pending request for HTTP connection?
67 * @param conn_public HTTP connection public data
69 gboolean sipe_http_request_pending(struct sipe_http_connection_public *conn_public);
71 /**
72 * HTTP connection is ready for next request
74 * @param conn_public HTTP connection public data
76 void sipe_http_request_next(struct sipe_http_connection_public *conn_public);
78 /**
79 * HTTP response received
81 * @param conn_public HTTP connection public data
82 * @param msg parsed message
84 void sipe_http_request_response(struct sipe_http_connection_public *conn_public,
85 struct sipmsg *msg);
87 /**
88 * HTTP connection shutdown
90 * @param conn_public HTTP connection public data
92 void sipe_http_request_shutdown(struct sipe_http_connection_public *conn_public);
94 /**
95 * Create new HTTP request (internal raw version)
97 * @param sipe_private SIPE core private data
98 * @param parsed_uri pointer to parsed URI
99 * @param headers additional headers to add (may be @c NULL)
100 * @param body body (may be @c NULL)
101 * @param content_type MIME type for body (may be @c NULL if body is @c NULL)
102 * @param callback callback function
103 * @param callback_data callback data
105 * @return pointer to opaque HTTP request data structure
107 struct sipe_http_request *sipe_http_request_new(struct sipe_core_private *sipe_private,
108 const struct sipe_http_parsed_uri *parsed_uri,
109 const gchar *headers,
110 const gchar *body,
111 const gchar *content_type,
112 sipe_http_response_callback *callback,
113 gpointer callback_data);