1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Authors: Jeffrey Stedfast <fejj@ximian.com>
5 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
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.
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.
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.
23 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
24 #error "Only <camel/camel.h> can be included directly."
30 #include <camel/camel-object.h>
31 #include <camel/camel-service.h>
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))
54 typedef struct _CamelSasl CamelSasl;
55 typedef struct _CamelSaslClass CamelSaslClass;
56 typedef struct _CamelSaslPrivate CamelSaslPrivate;
60 CamelSaslPrivate *priv;
63 struct _CamelSaslClass {
64 CamelObjectClass parent_class;
66 /* Auth Mechanism Details */
67 CamelServiceAuthType *auth_type;
69 /* Synchronous I/O Methods */
70 gboolean (*try_empty_password_sync)
72 GCancellable *cancellable,
74 GByteArray * (*challenge_sync) (CamelSasl *sasl,
76 GCancellable *cancellable,
79 /* Asynchronous I/O Methods (all have defaults) */
80 void (*challenge) (CamelSasl *sasl,
83 GCancellable *cancellable,
84 GAsyncReadyCallback callback,
86 GByteArray * (*challenge_finish) (CamelSasl *sasl,
89 void (*try_empty_password) (CamelSasl *sasl,
91 GCancellable *cancellable,
92 GAsyncReadyCallback callback,
94 gboolean (*try_empty_password_finish)
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
106 GCancellable *cancellable,
108 void camel_sasl_try_empty_password (CamelSasl *sasl,
110 GCancellable *cancellable,
111 GAsyncReadyCallback callback,
113 gboolean camel_sasl_try_empty_password_finish
115 GAsyncResult *result,
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);
124 GByteArray * camel_sasl_challenge_sync (CamelSasl *sasl,
126 GCancellable *cancellable,
128 void camel_sasl_challenge (CamelSasl *sasl,
131 GCancellable *cancellable,
132 GAsyncReadyCallback callback,
134 GByteArray * camel_sasl_challenge_finish (CamelSasl *sasl,
135 GAsyncResult *result,
137 gchar * camel_sasl_challenge_base64_sync
140 GCancellable *cancellable,
142 void camel_sasl_challenge_base64 (CamelSasl *sasl,
145 GCancellable *cancellable,
146 GAsyncReadyCallback callback,
148 gchar * camel_sasl_challenge_base64_finish
150 GAsyncResult *result,
153 GList * camel_sasl_authtype_list (gboolean include_plain);
154 CamelServiceAuthType *
155 camel_sasl_authtype (const gchar *mechanism);
159 #endif /* CAMEL_SASL_H */