updated pt_BR.po
[claws.git] / src / syldap.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2001 Match Grun
4  *
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.
9  *
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.
14  *
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Definitions necessary to access LDAP servers.
22  */
23
24 #ifndef __SYLDAP_H__
25 #define __SYLDAP_H__
26
27 #ifdef USE_LDAP
28
29 #include <glib.h>
30 #include <pthread.h>
31
32 #include "mgutils.h"
33
34 #define SYLDAP_DFL_PORT        389
35 #define SYLDAP_MAX_ENTRIES     20
36 #define SYLDAP_DFL_TIMEOUT     30
37 #define SYLDAP_DFL_CRITERIA    "(&(mail=*)(cn=%s*))"
38         
39 #define SYLDAP_ATTR_DN         "dn"
40 #define SYLDAP_ATTR_COMMONNAME "cn"
41 #define SYLDAP_ATTR_GIVENNAME  "givenName"
42 #define SYLDAP_ATTR_SURNAME    "sn"
43 #define SYLDAP_ATTR_EMAIL      "mail"
44 #define SYLDAP_ATTR_UID        "uid"
45
46 // VCard object
47 typedef struct _SyldapServer SyldapServer;
48 struct _SyldapServer {
49         gchar *name;
50         gchar *hostName;
51         gint  port;
52         gchar *baseDN;
53         gchar *bindDN;
54         gchar *bindPass;
55         gchar *searchCriteria;
56         gchar *searchValue;
57         gint  entriesRead;
58         gint  maxEntries;
59         gint  timeOut;
60         gboolean newSearch;
61         AddressCache *addressCache;
62         gint  retVal;
63         pthread_t *thread;
64         gboolean busyFlag;
65         void (*callBack)( void * );
66 };
67
68 /* Function prototypes */
69 void syldap_set_name( SyldapServer* ldapServer, const gchar *value );
70 void syldap_set_host( SyldapServer* ldapServer, const gchar *value );
71 void syldap_set_port( SyldapServer* ldapServer, const gint value );
72 void syldap_set_base_dn( SyldapServer* ldapServer, const gchar *value );
73 void syldap_set_bind_dn( SyldapServer* ldapServer, const gchar *value );
74 void syldap_set_bind_password( SyldapServer* ldapServer, const gchar *value );
75 void syldap_set_search_criteria( SyldapServer* ldapServer, const gchar *value );
76 void syldap_set_search_value( SyldapServer* ldapServer, const gchar *value );
77 void syldap_set_max_entries( SyldapServer* ldapServer, const gint value );
78 void syldap_set_timeout( SyldapServer* ldapServer, const gint value );
79 void syldap_set_callback( SyldapServer *ldapServer, void *func );
80 void syldap_force_refresh( SyldapServer *ldapServer );
81 SyldapServer *syldap_create();
82 void syldap_free( SyldapServer *ldapServer );
83 void syldap_print_data( SyldapServer *ldapServer, FILE *stream );
84 gboolean syldap_check_search( SyldapServer *ldapServer );
85 gint syldap_read_data( SyldapServer *ldapServer );
86 gint syldap_read_data_th( SyldapServer *ldapServer );
87 void syldap_cancel_read( SyldapServer *ldapServer );
88 GList *syldap_get_address_list( const SyldapServer *ldapServer );
89 GList *syldap_read_basedn_s( const gchar *host, const gint port, const gchar *bindDN, const gchar *bindPW, const gint tov );
90 GList *syldap_read_basedn( SyldapServer *ldapServer );
91 gboolean syldap_test_connect_s( const gchar *host, const gint port );
92 gboolean syldap_test_connect( SyldapServer *ldapServer );
93 gboolean syldap_test_ldap_lib();
94
95 #endif  /* USE_LDAP */
96
97 #endif /* __SYLDAP_H__ */
98