2006-12-12 [paul] 2.6.1cvs21
[claws.git] / src / syldap.h
blobef4a1896a22d993a6ba244fcc9af6ddc01670cf9
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001-2006 Match Grun and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * Definitions necessary to access LDAP servers.
24 #ifndef __SYLDAP_H__
25 #define __SYLDAP_H__
27 #ifdef USE_LDAP
29 #include <glib.h>
30 #include <pthread.h>
32 #include "addritem.h"
33 #include "addrcache.h"
34 #include "adbookbase.h"
36 #define SYLDAP_DFL_PORT 389
37 #define SYLDAP_MAX_ENTRIES 20
38 #define SYLDAP_DFL_TIMEOUT 30
39 #define SYLDAP_DFL_CRITERIA "(&(mail=*)(cn=%s*))"
41 #define SYLDAP_ATTR_DN "dn"
42 #define SYLDAP_ATTR_COMMONNAME "cn"
43 #define SYLDAP_ATTR_GIVENNAME "givenName"
44 #define SYLDAP_ATTR_SURNAME "sn"
45 #define SYLDAP_ATTR_EMAIL "mail"
46 #define SYLDAP_ATTR_UID "uid"
48 #define MGU_LDAP_CONNECT -51
49 #define MGU_LDAP_INIT -52
50 #define MGU_LDAP_BIND -53
51 #define MGU_LDAP_SEARCH -54
52 #define MGU_LDAP_TIMEOUT -55
53 #define MGU_LDAP_CRITERIA -56
54 #define MGU_LDAP_NOENTRIES -57
56 typedef struct _SyldapServer SyldapServer;
57 struct _SyldapServer {
58 AddressBookType type;
59 AddressCache *addressCache;
60 gint retVal;
61 gchar *hostName;
62 gint port;
63 gchar *baseDN;
64 gchar *bindDN;
65 gchar *bindPass;
66 gchar *searchCriteria;
67 gchar *searchValue;
68 gint entriesRead;
69 gint maxEntries;
70 gint timeOut;
71 gboolean newSearch;
72 pthread_t *thread;
73 gboolean busyFlag;
74 void (*callBack)( void * );
75 guint idleId;
78 /* Function prototypes */
79 SyldapServer *syldap_create ( void );
80 void syldap_set_name ( SyldapServer* ldapServer, const gchar *value );
81 void syldap_set_host ( SyldapServer* ldapServer, const gchar *value );
82 void syldap_set_port ( SyldapServer* ldapServer, const gint value );
83 void syldap_set_base_dn ( SyldapServer* ldapServer, const gchar *value );
84 void syldap_set_bind_dn ( SyldapServer* ldapServer, const gchar *value );
85 void syldap_set_bind_password ( SyldapServer* ldapServer, const gchar *value );
86 void syldap_set_search_criteria ( SyldapServer* ldapServer, const gchar *value );
87 void syldap_set_search_value ( SyldapServer* ldapServer, const gchar *value );
88 void syldap_set_max_entries ( SyldapServer* ldapServer, const gint value );
89 void syldap_set_timeout ( SyldapServer* ldapServer, const gint value );
90 void syldap_set_callback ( SyldapServer *ldapServer, void *func );
91 void syldap_set_accessed ( SyldapServer *ldapServer, const gboolean value );
92 void syldap_force_refresh ( SyldapServer *ldapServer );
93 void syldap_free ( SyldapServer *ldapServer );
94 gint syldap_get_status ( SyldapServer *ldapServer );
95 gboolean syldap_get_accessed ( SyldapServer *ldapServer );
96 gchar *syldap_get_name ( SyldapServer *ldapServer );
97 gboolean syldap_get_modified ( SyldapServer *ldapServer );
98 void syldap_set_modified ( SyldapServer *ldapServer, const gboolean value );
100 void syldap_print_data ( SyldapServer *ldapServer, FILE *stream );
101 gboolean syldap_check_search ( SyldapServer *ldapServer );
102 gint syldap_read_data ( SyldapServer *ldapServer );
103 gint syldap_read_data_th ( SyldapServer *ldapServer );
104 void syldap_cancel_read ( SyldapServer *ldapServer );
106 ItemFolder *syldap_get_root_folder ( SyldapServer *ldapServer );
107 GList *syldap_get_list_person ( SyldapServer *ldapServer );
108 GList *syldap_get_list_folder ( SyldapServer *ldapServer );
110 GList *syldap_read_basedn_s ( const gchar *host, const gint port, const gchar *bindDN,
111 const gchar *bindPW, const gint tov );
112 GList *syldap_read_basedn ( SyldapServer *ldapServer );
113 gboolean syldap_test_connect_s ( const gchar *host, const gint port );
114 gboolean syldap_test_connect ( SyldapServer *ldapServer );
115 gboolean syldap_test_ldap_lib ( void );
117 #endif /* USE_LDAP */
119 #endif /* __SYLDAP_H__ */