Upgrade to 2.62.2
[platform/upstream/libsoup.git] / libsoup / soup-connection.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2000-2003, Ximian, Inc.
4  */
5
6 #ifndef SOUP_CONNECTION_H
7 #define SOUP_CONNECTION_H 1
8
9 #include "soup-types.h"
10 #include "soup-message-private.h"
11 #include "soup-misc.h"
12
13 G_BEGIN_DECLS
14
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))
21
22 struct _SoupConnection {
23         GObject parent;
24
25 };
26
27 typedef struct {
28         GObjectClass parent_class;
29
30         /* signals */
31         void (*disconnected)    (SoupConnection *);
32
33 } SoupConnectionClass;
34
35 GType soup_connection_get_type (void);
36
37
38 #define SOUP_CONNECTION_REMOTE_URI        "remote-uri"
39 #define SOUP_CONNECTION_SOCKET_PROPERTIES "socket-properties"
40 #define SOUP_CONNECTION_STATE             "state"
41 #define SOUP_CONNECTION_SSL               "ssl"
42
43 void            soup_connection_connect_async    (SoupConnection       *conn,
44                                                   GCancellable         *cancellable,
45                                                   GAsyncReadyCallback   callback,
46                                                   gpointer              user_data);
47 gboolean        soup_connection_connect_finish   (SoupConnection       *conn,
48                                                   GAsyncResult         *result,
49                                                   GError              **error);
50 gboolean        soup_connection_connect_sync     (SoupConnection       *conn,
51                                                   GCancellable         *cancellable,
52                                                   GError              **error);
53 gboolean        soup_connection_start_ssl_sync   (SoupConnection       *conn,
54                                                   GCancellable         *cancellable,
55                                                   GError              **error);
56 void            soup_connection_start_ssl_async  (SoupConnection       *conn,
57                                                   GCancellable         *cancellable,
58                                                   GAsyncReadyCallback   callback,
59                                                   gpointer              user_data);
60 gboolean        soup_connection_start_ssl_finish (SoupConnection       *conn,
61                                                   GAsyncResult         *result,
62                                                   GError              **error);
63
64 void            soup_connection_disconnect     (SoupConnection   *conn);
65
66 SoupSocket     *soup_connection_get_socket     (SoupConnection   *conn);
67 SoupURI        *soup_connection_get_remote_uri (SoupConnection   *conn);
68 SoupURI        *soup_connection_get_proxy_uri  (SoupConnection   *conn);
69 gboolean        soup_connection_is_via_proxy   (SoupConnection   *conn);
70 gboolean        soup_connection_is_tunnelled   (SoupConnection   *conn);
71
72 SoupConnectionState soup_connection_get_state  (SoupConnection   *conn);
73 void                soup_connection_set_state  (SoupConnection   *conn,
74                                                 SoupConnectionState state);
75
76 gboolean        soup_connection_get_ever_used  (SoupConnection   *conn);
77
78 void            soup_connection_send_request   (SoupConnection          *conn,
79                                                 SoupMessageQueueItem    *item,
80                                                 SoupMessageCompletionFn  completion_cb,
81                                                 gpointer                 user_data);
82
83 G_END_DECLS
84
85 #endif /* SOUP_CONNECTION_H */