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 <time.h> |
---|
10 | |
---|
11 | #include <libsoup/soup-types.h> |
---|
12 | |
---|
13 | #define SOUP_TYPE_CONNECTION (soup_connection_get_type ()) |
---|
14 | #define SOUP_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_CONNECTION, SoupConnection)) |
---|
15 | #define SOUP_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_CONNECTION, SoupConnectionClass)) |
---|
16 | #define SOUP_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_CONNECTION)) |
---|
17 | #define SOUP_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_CONNECTION)) |
---|
18 | #define SOUP_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_CONNECTION, SoupConnectionClass)) |
---|
19 | |
---|
20 | typedef struct SoupConnectionPrivate SoupConnectionPrivate; |
---|
21 | |
---|
22 | struct SoupConnection { |
---|
23 | GObject parent; |
---|
24 | |
---|
25 | SoupConnectionPrivate *priv; |
---|
26 | }; |
---|
27 | |
---|
28 | typedef struct { |
---|
29 | GObjectClass parent_class; |
---|
30 | |
---|
31 | /* signals */ |
---|
32 | void (*connect_result) (SoupConnection *, guint); |
---|
33 | void (*disconnected) (SoupConnection *); |
---|
34 | |
---|
35 | void (*authenticate) (SoupConnection *, SoupMessage *, |
---|
36 | const char *auth_type, const char *auth_realm, |
---|
37 | char **username, char **password); |
---|
38 | void (*reauthenticate) (SoupConnection *, SoupMessage *, |
---|
39 | const char *auth_type, const char *auth_realm, |
---|
40 | char **username, char **password); |
---|
41 | |
---|
42 | /* methods */ |
---|
43 | void (*send_request) (SoupConnection *, SoupMessage *); |
---|
44 | } SoupConnectionClass; |
---|
45 | |
---|
46 | GType soup_connection_get_type (void); |
---|
47 | |
---|
48 | |
---|
49 | #define SOUP_CONNECTION_ORIGIN_URI "origin-uri" |
---|
50 | #define SOUP_CONNECTION_PROXY_URI "proxy-uri" |
---|
51 | #define SOUP_CONNECTION_SSL_CREDENTIALS "ssl-creds" |
---|
52 | #define SOUP_CONNECTION_MESSAGE_FILTER "message-filter" |
---|
53 | |
---|
54 | SoupConnection *soup_connection_new (const char *propname1, |
---|
55 | ...); |
---|
56 | |
---|
57 | typedef void (*SoupConnectionCallback) (SoupConnection *conn, |
---|
58 | guint status, |
---|
59 | gpointer data); |
---|
60 | |
---|
61 | void soup_connection_connect_async (SoupConnection *conn, |
---|
62 | SoupConnectionCallback callback, |
---|
63 | gpointer user_data); |
---|
64 | guint soup_connection_connect_sync (SoupConnection *conn); |
---|
65 | |
---|
66 | void soup_connection_disconnect (SoupConnection *conn); |
---|
67 | |
---|
68 | gboolean soup_connection_is_in_use (SoupConnection *conn); |
---|
69 | time_t soup_connection_last_used (SoupConnection *conn); |
---|
70 | |
---|
71 | void soup_connection_send_request (SoupConnection *conn, |
---|
72 | SoupMessage *req); |
---|
73 | |
---|
74 | void soup_connection_reserve (SoupConnection *conn); |
---|
75 | void soup_connection_release (SoupConnection *conn); |
---|
76 | |
---|
77 | /* protected */ |
---|
78 | void soup_connection_authenticate (SoupConnection *conn, |
---|
79 | SoupMessage *msg, |
---|
80 | const char *auth_type, |
---|
81 | const char *auth_realm, |
---|
82 | char **username, |
---|
83 | char **password); |
---|
84 | void soup_connection_reauthenticate (SoupConnection *conn, |
---|
85 | SoupMessage *msg, |
---|
86 | const char *auth_type, |
---|
87 | const char *auth_realm, |
---|
88 | char **username, |
---|
89 | char **password); |
---|
90 | |
---|
91 | |
---|
92 | #endif /* SOUP_CONNECTION_H */ |
---|