1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2003, Ximian, Inc.
6 #ifndef SOUP_CONNECTION_H
7 #define SOUP_CONNECTION_H 1
9 #include "soup-types.h"
10 #include "soup-message-private.h"
11 #include "soup-misc.h"
15 #define SOUP_TYPE_CONNECTION (soup_connection_get_type ())
16 #define SOUP_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_CONNECTION, SoupConnection))
17 #define SOUP_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_CONNECTION, SoupConnectionClass))
18 #define SOUP_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_CONNECTION))
19 #define SOUP_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_CONNECTION))
20 #define SOUP_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_CONNECTION, SoupConnectionClass))
22 struct _SoupConnection {
28 GObjectClass parent_class;
31 void (*disconnected) (SoupConnection *);
33 } SoupConnectionClass;
35 GType soup_connection_get_type (void);
38 typedef void (*SoupConnectionCallback) (SoupConnection *conn,
42 #define SOUP_CONNECTION_REMOTE_ADDRESS "remote-address"
43 #define SOUP_CONNECTION_TUNNEL_ADDRESS "tunnel-address"
44 #define SOUP_CONNECTION_PROXY_URI "proxy-uri"
45 #define SOUP_CONNECTION_SSL_CREDENTIALS "ssl-creds"
46 #define SOUP_CONNECTION_SSL_STRICT "ssl-strict"
47 #define SOUP_CONNECTION_SSL_FALLBACK "ssl-fallback"
48 #define SOUP_CONNECTION_ASYNC_CONTEXT "async-context"
49 #define SOUP_CONNECTION_TIMEOUT "timeout"
50 #define SOUP_CONNECTION_IDLE_TIMEOUT "idle-timeout"
51 #define SOUP_CONNECTION_STATE "state"
52 #define SOUP_CONNECTION_MESSAGE "message"
54 SoupConnection *soup_connection_new (const char *propname1,
55 ...) G_GNUC_NULL_TERMINATED;
57 void soup_connection_connect_async (SoupConnection *conn,
58 GCancellable *cancellable,
59 SoupConnectionCallback callback,
61 guint soup_connection_connect_sync (SoupConnection *conn,
62 GCancellable *cancellable);
63 SoupAddress *soup_connection_get_tunnel_addr(SoupConnection *conn);
64 guint soup_connection_start_ssl_sync (SoupConnection *conn,
65 GCancellable *cancellable);
66 void soup_connection_start_ssl_async (SoupConnection *conn,
67 GCancellable *cancellable,
68 SoupConnectionCallback callback,
71 void soup_connection_disconnect (SoupConnection *conn);
73 SoupSocket *soup_connection_get_socket (SoupConnection *conn);
74 SoupURI *soup_connection_get_proxy_uri (SoupConnection *conn);
75 gboolean soup_connection_is_via_proxy (SoupConnection *conn);
77 SoupConnectionState soup_connection_get_state (SoupConnection *conn);
78 void soup_connection_set_state (SoupConnection *conn,
79 SoupConnectionState state);
81 gboolean soup_connection_get_ever_used (SoupConnection *conn);
83 void soup_connection_send_request (SoupConnection *conn,
84 SoupMessageQueueItem *item,
85 SoupMessageCompletionFn completion_cb,
88 gboolean soup_connection_get_ssl_fallback (SoupConnection *conn);
92 #endif /* SOUP_CONNECTION_H */