http: implement stack shutdown flag
[siplcs.git] / src / core / sipe-http-transport.h
blobfd0bfcf80b4a994ce74a60667a7c5b3ebac4d454
1 /**
2 * @file sipe-http-transport.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 Request <-> Transport layers */
25 #ifndef _SIPE_HTTP_PRIVATE_IF_TRANSPORT
26 #error "you are not allowed to include sipe-http-transport.h!"
27 #endif
30 * Interface dependencies:
32 * <glib.h>
35 /* Forward declarations */
36 struct sipe_core_private;
37 struct sip_sec_context;
39 struct sipe_http_connection_public {
40 struct sipe_core_private *sipe_private;
42 GSList *pending_requests; /* handled by sipe-http-request.c */
43 struct sip_sec_context *context; /* handled by sipe-http-request.c */
45 gchar *host;
46 guint32 port;
47 gboolean connected;
50 /**
51 * Check if we're shutting down the HTTP stack
53 * @param sipe_private SIPE core private data
55 * @return return @c TRUE if HTTP stack is shutting down
57 gboolean sipe_http_shutting_down(struct sipe_core_private *sipe_private);
59 /**
60 * Initiate HTTP connection
62 * If a connection to this host/port already exists it will be reused.
64 * @param sipe_private SIPE core private data
65 * @param host name of the host to connect to
66 * @param port port number to connect to
68 * @return HTTP connection public data
70 struct sipe_http_connection_public *sipe_http_transport_new(struct sipe_core_private *sipe_private,
71 const gchar *host,
72 guint32 port);
74 /**
75 * Send HTTP request
77 * @param conn_public HTTP connection public data
78 * @param header HTTP header
79 * @param body HTTP body (may be @c NULL)
81 void sipe_http_transport_send(struct sipe_http_connection_public *conn_public,
82 const gchar *header,
83 const gchar *body);