add a "GList *authtypes", so you can get the list of authtypes used by a
[platform/upstream/evolution-data-server.git] / camel / camel-service.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-service.h : Abstract class for an email service */
3
4 /* 
5  *
6  * Author : 
7  *  Bertrand Guiheneuf <bertrand@helixcode.com>
8  *
9  * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
10  *
11  * This program is free software; you can redistribute it and/or 
12  * modify it under the terms of the GNU General Public License as 
13  * published by the Free Software Foundation; either version 2 of the
14  * License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24  * USA
25  */
26
27
28 #ifndef CAMEL_SERVICE_H
29 #define CAMEL_SERVICE_H 1
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #pragma }
35 #endif /* __cplusplus }*/
36
37 #include <camel/camel-object.h>
38 #include <camel/camel-url.h>
39 #include <camel/camel-provider.h>
40 #include <netdb.h>
41
42 #define CAMEL_SERVICE_TYPE     (camel_service_get_type ())
43 #define CAMEL_SERVICE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
44 #define CAMEL_SERVICE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
45 #define CAMEL_IS_SERVICE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
46
47
48 struct _CamelService {
49         CamelObject parent_object;
50         struct _CamelServicePrivate *priv;
51
52         CamelSession *session;
53         CamelProvider *provider;
54         gboolean connected;
55         CamelURL *url;
56 };
57
58
59 typedef struct {
60         CamelObjectClass parent_class;
61
62         void      (*construct)         (CamelService *service,
63                                         CamelSession *session,
64                                         CamelProvider *provider,
65                                         CamelURL *url,
66                                         CamelException *ex);
67
68         gboolean  (*connect)           (CamelService *service, 
69                                         CamelException *ex);
70         gboolean  (*disconnect)        (CamelService *service,
71                                         gboolean clean,
72                                         CamelException *ex);
73
74         GList *   (*query_auth_types)  (CamelService *service,
75                                         CamelException *ex);
76
77         char *    (*get_name)          (CamelService *service,
78                                         gboolean brief);
79         char *    (*get_path)          (CamelService *service);
80
81 } CamelServiceClass;
82
83
84 /* query_auth_types returns a GList of these */
85 typedef struct {
86         char *name, *description, *authproto;
87         gboolean need_password;
88 } CamelServiceAuthType;
89
90
91 /* public methods */
92 void                camel_service_construct          (CamelService *service,
93                                                       CamelSession *session,
94                                                       CamelProvider *provider,
95                                                       CamelURL *url, 
96                                                       CamelException *ex);
97 gboolean            camel_service_connect            (CamelService *service, 
98                                                       CamelException *ex);
99 gboolean            camel_service_disconnect         (CamelService *service,
100                                                       gboolean clean,
101                                                       CamelException *ex);
102 char *              camel_service_get_url            (CamelService *service);
103 char *              camel_service_get_name           (CamelService *service,
104                                                       gboolean brief);
105 char *              camel_service_get_path           (CamelService *service);
106 CamelSession *      camel_service_get_session        (CamelService *service);
107 CamelProvider *     camel_service_get_provider       (CamelService *service);
108 GList *             camel_service_query_auth_types   (CamelService *service,
109                                                       CamelException *ex);
110
111 /* convenience functions */
112 struct hostent *    camel_service_gethost            (CamelService *service,
113                                                       CamelException *ex);
114
115
116 /* Standard Camel function */
117 CamelType camel_service_get_type (void);
118
119 #ifdef __cplusplus
120 }
121 #endif /* __cplusplus */
122
123 #endif /* CAMEL_SERVICE_H */
124