http: refactor connection data structure handling
[siplcs.git] / src / core / sipe-http-request.h
blobafc908d170455b2d87ebfb1403d4964bcd7fd87e
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 /**
42 * Is there pending request for HTTP connection?
44 * @param conn_public HTTP connection public data
46 gboolean sipe_http_request_pending(struct sipe_http_connection_public *conn_public);
48 /**
49 * HTTP connection is ready for next request
51 * @param conn_public HTTP connection public data
53 void sipe_http_request_next(struct sipe_http_connection_public *conn_public);
55 /**
56 * HTTP response received
58 * @param conn_public HTTP connection public data
59 * @param msg parsed message
61 void sipe_http_request_response(struct sipe_http_connection_public *conn_public,
62 struct sipmsg *msg);
64 /**
65 * HTTP connection shutdown
67 * @param conn_public HTTP connection public data
69 void sipe_http_request_shutdown(struct sipe_http_connection_public *conn_public);
71 /**
72 * Create new HTTP request (internal raw version)
74 * @param sipe_private SIPE core private data
75 * @param host name of the host to connect to
76 * @param port port number to connect to
77 * @param path relative path
78 * @param headers additional headers to add (may be @c NULL)
79 * @param body body (may be @c NULL)
80 * @param content_type MIME type for body (may be @c NULL if body is @c NULL)
81 * @param callback callback function
82 * @param callback_data callback data
84 * @return pointer to opaque HTTP request data structure
86 struct sipe_http_request *sipe_http_request_new(struct sipe_core_private *sipe_private,
87 const gchar *host,
88 guint32 port,
89 const gchar *path,
90 const gchar *headers,
91 const gchar *body,
92 const gchar *content_type,
93 sipe_http_response_callback *callback,
94 gpointer callback_data);