Extending test-client-custom-summary to try e_book_client_get_contacts_uids()
[platform/upstream/evolution-data-server.git] / camel / camel-sasl.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  *  Authors: Jeffrey Stedfast <fejj@ximian.com>
4  *
5  *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22
23 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
24 #error "Only <camel/camel.h> can be included directly."
25 #endif
26
27 #ifndef CAMEL_SASL_H
28 #define CAMEL_SASL_H
29
30 #include <camel/camel-object.h>
31 #include <camel/camel-service.h>
32
33 /* Standard GObject macros */
34 #define CAMEL_TYPE_SASL \
35         (camel_sasl_get_type ())
36 #define CAMEL_SASL(obj) \
37         (G_TYPE_CHECK_INSTANCE_CAST \
38         ((obj), CAMEL_TYPE_SASL, CamelSasl))
39 #define CAMEL_SASL_CLASS(cls) \
40         (G_TYPE_CHECK_CLASS_CAST \
41         ((cls), CAMEL_TYPE_SASL, CamelSaslClass))
42 #define CAMEL_IS_SASL(obj) \
43         (G_TYPE_CHECK_INSTANCE_TYPE \
44         ((obj), CAMEL_TYPE_SASL))
45 #define CAMEL_IS_SASL_CLASS(cls) \
46         (G_TYPE_CHECK_CLASS_TYPE \
47         ((cls), CAMEL_TYPE_SASL))
48 #define CAMEL_SASL_GET_CLASS(obj) \
49         (G_TYPE_INSTANCE_GET_CLASS \
50         ((obj), CAMEL_TYPE_SASL, CamelSaslClass))
51
52 G_BEGIN_DECLS
53
54 typedef struct _CamelSasl CamelSasl;
55 typedef struct _CamelSaslClass CamelSaslClass;
56 typedef struct _CamelSaslPrivate CamelSaslPrivate;
57
58 struct _CamelSasl {
59         CamelObject parent;
60         CamelSaslPrivate *priv;
61 };
62
63 struct _CamelSaslClass {
64         CamelObjectClass parent_class;
65
66         /* Auth Mechanism Details */
67         CamelServiceAuthType *auth_type;
68
69         /* Synchronous I/O Methods */
70         gboolean        (*try_empty_password_sync)
71                                                 (CamelSasl *sasl,
72                                                  GCancellable *cancellable,
73                                                  GError **error);
74         GByteArray *    (*challenge_sync)       (CamelSasl *sasl,
75                                                  GByteArray *token,
76                                                  GCancellable *cancellable,
77                                                  GError **error);
78
79         /* Asynchronous I/O Methods (all have defaults) */
80         void            (*challenge)            (CamelSasl *sasl,
81                                                  GByteArray *token,
82                                                  gint io_priority,
83                                                  GCancellable *cancellable,
84                                                  GAsyncReadyCallback callback,
85                                                  gpointer user_data);
86         GByteArray *    (*challenge_finish)     (CamelSasl *sasl,
87                                                  GAsyncResult *result,
88                                                  GError **error);
89         void            (*try_empty_password)   (CamelSasl *sasl,
90                                                  gint io_priority,
91                                                  GCancellable *cancellable,
92                                                  GAsyncReadyCallback callback,
93                                                  gpointer user_data);
94         gboolean        (*try_empty_password_finish)
95                                                 (CamelSasl *sasl,
96                                                  GAsyncResult *result,
97                                                  GError **error);
98 };
99
100 GType           camel_sasl_get_type             (void);
101 CamelSasl *     camel_sasl_new                  (const gchar *service_name,
102                                                  const gchar *mechanism,
103                                                  CamelService *service);
104 gboolean        camel_sasl_try_empty_password_sync
105                                                 (CamelSasl *sasl,
106                                                  GCancellable *cancellable,
107                                                  GError **error);
108 void            camel_sasl_try_empty_password   (CamelSasl *sasl,
109                                                  gint io_priority,
110                                                  GCancellable *cancellable,
111                                                  GAsyncReadyCallback callback,
112                                                  gpointer user_data);
113 gboolean        camel_sasl_try_empty_password_finish
114                                                 (CamelSasl *sasl,
115                                                  GAsyncResult *result,
116                                                  GError **error);
117 gboolean        camel_sasl_get_authenticated    (CamelSasl *sasl);
118 void            camel_sasl_set_authenticated    (CamelSasl *sasl,
119                                                  gboolean authenticated);
120 const gchar *   camel_sasl_get_mechanism        (CamelSasl *sasl);
121 CamelService *  camel_sasl_get_service          (CamelSasl *sasl);
122 const gchar *   camel_sasl_get_service_name     (CamelSasl *sasl);
123
124 GByteArray *    camel_sasl_challenge_sync       (CamelSasl *sasl,
125                                                  GByteArray *token,
126                                                  GCancellable *cancellable,
127                                                  GError **error);
128 void            camel_sasl_challenge            (CamelSasl *sasl,
129                                                  GByteArray *token,
130                                                  gint io_priority,
131                                                  GCancellable *cancellable,
132                                                  GAsyncReadyCallback callback,
133                                                  gpointer user_data);
134 GByteArray *    camel_sasl_challenge_finish     (CamelSasl *sasl,
135                                                  GAsyncResult *result,
136                                                  GError **error);
137 gchar *         camel_sasl_challenge_base64_sync
138                                                 (CamelSasl *sasl,
139                                                  const gchar *token,
140                                                  GCancellable *cancellable,
141                                                  GError **error);
142 void            camel_sasl_challenge_base64     (CamelSasl *sasl,
143                                                  const gchar *token,
144                                                  gint io_priority,
145                                                  GCancellable *cancellable,
146                                                  GAsyncReadyCallback callback,
147                                                  gpointer user_data);
148 gchar *         camel_sasl_challenge_base64_finish
149                                                 (CamelSasl *sasl,
150                                                  GAsyncResult *result,
151                                                  GError **error);
152
153 GList *         camel_sasl_authtype_list        (gboolean include_plain);
154 CamelServiceAuthType *
155                 camel_sasl_authtype             (const gchar *mechanism);
156
157 G_END_DECLS
158
159 #endif /* CAMEL_SASL_H */