http: implement 401 response handling
[siplcs.git] / src / core / sipe-http-transport.h
blob2832a7285763bcf320fe24a2b77f2d7be1f37761
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 * Initiate HTTP connection
53 * If a connection to this host/port already exists it will be reused.
55 * @param sipe_private SIPE core private data
56 * @param host name of the host to connect to
57 * @param port port number to connect to
59 * @return HTTP connection public data
61 struct sipe_http_connection_public *sipe_http_transport_new(struct sipe_core_private *sipe_private,
62 const gchar *host,
63 guint32 port);
65 /**
66 * Send HTTP request
68 * @param conn_public HTTP connection public data
69 * @param header HTTP header
70 * @param body HTTP body (may be @c NULL)
72 void sipe_http_transport_send(struct sipe_http_connection_public *conn_public,
73 const gchar *header,
74 const gchar *body);