http-conn: pass all HTTP headers into callback function
[siplcs.git] / src / core / http-conn.h
blob9d1b8f7e293bb9d221f96b3ea2354d4390d22d03
1 /**
2 * @file http-conn.h
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2009 pier11 <pier11@operamail.com>
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 /* Forward declarations */
25 struct sipe_core_public;
27 #define HTTP_CONN_GET "GET"
28 #define HTTP_CONN_POST "POST"
30 #define HTTP_CONN_SSL SIPE_TRANSPORT_TLS
31 #define HTTP_CONN_TCP SIPE_TRANSPORT_TCP
33 #define HTTP_CONN_ALLOW_REDIRECT TRUE
34 #define HTTP_CONN_NO_REDIRECT FALSE
36 #define HTTP_CONN_ERROR -100
37 #define HTTP_CONN_ERROR_FATAL -200
40 struct http_conn_auth {
41 char *domain;
42 char *user;
43 char *password;
44 int use_negotiate;
46 typedef struct http_conn_auth HttpConnAuth;
48 struct http_conn_struct;
49 typedef struct http_conn_struct HttpConn;
50 typedef struct http_session_struct HttpSession;
52 /** callback */
53 typedef void (*HttpConnCallback) (int return_code, const char *body, GSList* headers,
54 HttpConn *conn, void *data);
56 /**
57 * Creates SSL connection and sends.
59 HttpConn *
60 http_conn_create(struct sipe_core_public *sipe_public,
61 HttpSession *http_session,
62 const char *method,
63 guint conn_type,
64 gboolean allow_redirect,
65 const char *full_url,
66 const char *body,
67 const char *content_type,
68 const gchar *additional_headers,
69 HttpConnAuth *auth,
70 HttpConnCallback callback,
71 void *data);
73 /**
74 * Sends on existing http_conn connection.
76 void
77 http_conn_send( HttpConn *http_conn,
78 const char *method,
79 const char *full_url,
80 const char *body,
81 const char *content_type,
82 HttpConnCallback callback,
83 void *data);
85 gboolean
86 http_conn_is_closed(HttpConn *http_conn);
88 /**
89 * Marks connection for close
91 void
92 http_conn_set_close(HttpConn* http_conn);
94 void
95 http_conn_free(HttpConn* http_conn);
97 HttpSession *
98 http_conn_session_create(void);
100 void
101 http_conn_session_free(HttpSession *http_session);