1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2003, Ximian, Inc.
6 #ifndef __SOUP_SESSION_H__
7 #define __SOUP_SESSION_H__ 1
9 #include <libsoup/soup-types.h>
10 #include <libsoup/soup-address.h>
11 #include <libsoup/soup-message.h>
12 #include <libsoup/soup-websocket-connection.h>
16 #define SOUP_TYPE_SESSION (soup_session_get_type ())
17 #define SOUP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SESSION, SoupSession))
18 #define SOUP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SESSION, SoupSessionClass))
19 #define SOUP_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SESSION))
20 #define SOUP_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SESSION))
21 #define SOUP_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SESSION, SoupSessionClass))
23 typedef void (*SoupSessionCallback) (SoupSession *session,
33 GObjectClass parent_class;
36 void (*request_started) (SoupSession *session, SoupMessage *msg,
38 void (*authenticate) (SoupSession *session, SoupMessage *msg,
39 SoupAuth *auth, gboolean retrying);
42 void (*queue_message) (SoupSession *session, SoupMessage *msg,
43 SoupSessionCallback callback,
45 void (*requeue_message) (SoupSession *session, SoupMessage *msg);
46 guint (*send_message) (SoupSession *session, SoupMessage *msg);
48 void (*cancel_message) (SoupSession *session, SoupMessage *msg,
51 void (*auth_required) (SoupSession *session, SoupMessage *msg,
52 SoupAuth *auth, gboolean retrying);
54 void (*flush_queue) (SoupSession *session);
56 void (*kick) (SoupSession *session);
58 /* Padding for future expansion */
59 void (*_libsoup_reserved4) (void);
62 SOUP_AVAILABLE_IN_2_42
63 GType soup_session_get_type (void);
65 #define SOUP_SESSION_LOCAL_ADDRESS "local-address"
66 #define SOUP_SESSION_PROXY_URI "proxy-uri"
67 #define SOUP_SESSION_PROXY_RESOLVER "proxy-resolver"
68 #define SOUP_SESSION_MAX_CONNS "max-conns"
69 #define SOUP_SESSION_MAX_CONNS_PER_HOST "max-conns-per-host"
70 #define SOUP_SESSION_USE_NTLM "use-ntlm"
71 #define SOUP_SESSION_SSL_CA_FILE "ssl-ca-file"
72 #define SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE "ssl-use-system-ca-file"
73 #define SOUP_SESSION_TLS_DATABASE "tls-database"
74 #define SOUP_SESSION_SSL_STRICT "ssl-strict"
75 #define SOUP_SESSION_TLS_INTERACTION "tls-interaction"
76 #define SOUP_SESSION_ASYNC_CONTEXT "async-context"
77 #define SOUP_SESSION_USE_THREAD_CONTEXT "use-thread-context"
78 #define SOUP_SESSION_TIMEOUT "timeout"
79 #define SOUP_SESSION_USER_AGENT "user-agent"
80 #define SOUP_SESSION_ACCEPT_LANGUAGE "accept-language"
81 #define SOUP_SESSION_ACCEPT_LANGUAGE_AUTO "accept-language-auto"
82 #define SOUP_SESSION_IDLE_TIMEOUT "idle-timeout"
83 #define SOUP_SESSION_ADD_FEATURE "add-feature"
84 #define SOUP_SESSION_ADD_FEATURE_BY_TYPE "add-feature-by-type"
85 #define SOUP_SESSION_REMOVE_FEATURE_BY_TYPE "remove-feature-by-type"
86 #define SOUP_SESSION_HTTP_ALIASES "http-aliases"
87 #define SOUP_SESSION_HTTPS_ALIASES "https-aliases"
89 SOUP_AVAILABLE_IN_2_42
90 SoupSession *soup_session_new (void);
92 SOUP_AVAILABLE_IN_2_42
93 SoupSession *soup_session_new_with_options (const char *optname1,
94 ...) G_GNUC_NULL_TERMINATED;
97 void soup_session_queue_message (SoupSession *session,
99 SoupSessionCallback callback,
101 SOUP_AVAILABLE_IN_2_4
102 void soup_session_requeue_message (SoupSession *session,
105 SOUP_AVAILABLE_IN_2_4
106 guint soup_session_send_message (SoupSession *session,
109 SOUP_AVAILABLE_IN_2_4
110 void soup_session_pause_message (SoupSession *session,
112 SOUP_AVAILABLE_IN_2_4
113 void soup_session_unpause_message (SoupSession *session,
116 SOUP_AVAILABLE_IN_2_4
117 void soup_session_cancel_message (SoupSession *session,
120 SOUP_AVAILABLE_IN_2_4
121 void soup_session_abort (SoupSession *session);
123 SOUP_AVAILABLE_IN_2_4
124 GMainContext *soup_session_get_async_context(SoupSession *session);
126 SOUP_AVAILABLE_IN_2_42
127 void soup_session_send_async (SoupSession *session,
129 GCancellable *cancellable,
130 GAsyncReadyCallback callback,
132 SOUP_AVAILABLE_IN_2_42
133 GInputStream *soup_session_send_finish (SoupSession *session,
134 GAsyncResult *result,
136 SOUP_AVAILABLE_IN_2_42
137 GInputStream *soup_session_send (SoupSession *session,
139 GCancellable *cancellable,
142 #ifndef SOUP_DISABLE_DEPRECATED
143 SOUP_AVAILABLE_IN_2_30
144 SOUP_DEPRECATED_IN_2_38_FOR (soup_session_prefetch_dns)
145 void soup_session_prepare_for_uri (SoupSession *session,
149 SOUP_AVAILABLE_IN_2_38
150 void soup_session_prefetch_dns (SoupSession *session,
151 const char *hostname,
152 GCancellable *cancellable,
153 SoupAddressCallback callback,
156 SOUP_AVAILABLE_IN_2_38
157 gboolean soup_session_would_redirect (SoupSession *session,
159 SOUP_AVAILABLE_IN_2_38
160 gboolean soup_session_redirect_message (SoupSession *session,
163 SOUP_AVAILABLE_IN_2_24
164 void soup_session_add_feature (SoupSession *session,
165 SoupSessionFeature *feature);
166 SOUP_AVAILABLE_IN_2_24
167 void soup_session_add_feature_by_type (SoupSession *session,
169 SOUP_AVAILABLE_IN_2_24
170 void soup_session_remove_feature (SoupSession *session,
171 SoupSessionFeature *feature);
172 SOUP_AVAILABLE_IN_2_24
173 void soup_session_remove_feature_by_type (SoupSession *session,
175 SOUP_AVAILABLE_IN_2_42
176 gboolean soup_session_has_feature (SoupSession *session,
178 SOUP_AVAILABLE_IN_2_26
179 GSList *soup_session_get_features (SoupSession *session,
181 SOUP_AVAILABLE_IN_2_26
182 SoupSessionFeature *soup_session_get_feature (SoupSession *session,
184 SOUP_AVAILABLE_IN_2_28
185 SoupSessionFeature *soup_session_get_feature_for_message(SoupSession *session,
189 SOUP_AVAILABLE_IN_2_42
190 SoupRequest *soup_session_request (SoupSession *session,
191 const char *uri_string,
193 SOUP_AVAILABLE_IN_2_42
194 SoupRequest *soup_session_request_uri (SoupSession *session,
197 SOUP_AVAILABLE_IN_2_42
198 SoupRequestHTTP *soup_session_request_http (SoupSession *session,
200 const char *uri_string,
202 SOUP_AVAILABLE_IN_2_42
203 SoupRequestHTTP *soup_session_request_http_uri (SoupSession *session,
208 SOUP_AVAILABLE_IN_2_42
209 GQuark soup_request_error_quark (void);
210 #define SOUP_REQUEST_ERROR soup_request_error_quark ()
213 SOUP_REQUEST_ERROR_BAD_URI,
214 SOUP_REQUEST_ERROR_UNSUPPORTED_URI_SCHEME,
215 SOUP_REQUEST_ERROR_PARSING,
216 SOUP_REQUEST_ERROR_ENCODING
219 SOUP_AVAILABLE_IN_2_50
220 GIOStream *soup_session_steal_connection (SoupSession *session,
223 SOUP_AVAILABLE_IN_2_50
224 void soup_session_websocket_connect_async (SoupSession *session,
228 GCancellable *cancellable,
229 GAsyncReadyCallback callback,
232 SOUP_AVAILABLE_IN_2_50
233 SoupWebsocketConnection *soup_session_websocket_connect_finish (SoupSession *session,
234 GAsyncResult *result,
237 typedef void (*SoupSessionConnectProgressCallback) (SoupSession *session,
238 GSocketClientEvent event,
239 GIOStream *connection,
242 SOUP_AVAILABLE_IN_2_62
243 void soup_session_connect_async (SoupSession *session,
245 GCancellable *cancellable,
246 SoupSessionConnectProgressCallback progress_callback,
247 GAsyncReadyCallback callback,
250 SOUP_AVAILABLE_IN_2_62
251 GIOStream *soup_session_connect_finish (SoupSession *session,
252 GAsyncResult *result,
257 #endif /* __SOUP_SESSION_H__ */