Fix bug #3574: Template addressing
[claws.git] / src / ldapserver.h
blob4b68eae425e18e67f7fa9f79425e1ab4e7787eb7
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2003-2012 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 3 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, see <http://www.gnu.org/licenses/>.
21 * Definitions necessary to access LDAP servers.
24 #ifndef __LDAPSERVER_H__
25 #define __LDAPSERVER_H__
27 #ifdef USE_LDAP
29 #include <glib.h>
30 #ifdef G_OS_UNIX
31 #include <ldap.h>
32 #else
33 #include <stdio.h>
34 #include <string.h>
35 #include <stdarg.h>
36 #include <stdlib.h>
37 #include <ctype.h>
38 #include <errno.h>
39 #include <windows.h>
40 #include <winldap.h>
41 #include <winber.h>
42 #endif
44 #include "ldapctrl.h"
45 #include "addritem.h"
46 #include "addrcache.h"
47 #include "adbookbase.h"
48 #include "addrquery.h"
50 /* Error codes */
51 #define LDAPRC_SUCCESS 0
52 #define LDAPRC_CONNECT -1
53 #define LDAPRC_INIT -2
54 #define LDAPRC_BIND -3
55 #define LDAPRC_SEARCH -4
56 #define LDAPRC_TIMEOUT -5
57 #define LDAPRC_CRITERIA -6
58 #define LDAPRC_NOENTRIES -7
59 #define LDAPRC_STOP_FLAG -8
60 #define LDAPRC_TLS -9
61 #define LDAPRC_NODN -10
62 #define LDAPRC_NAMING_VIOLATION -11
63 #define LDAPRC_ALREADY_EXIST -12
64 #define LDAPRC_STRONG_AUTH -13
66 typedef struct _LdapServer LdapServer;
67 struct _LdapServer {
68 AddressBookType type;
69 AddressCache *addressCache;
70 gint retVal;
71 LdapControl *control;
72 gboolean searchFlag;
73 GList *listQuery;
76 /* Function prototypes */
77 LdapServer *ldapsvr_create_noctl( void );
78 LdapServer *ldapsvr_create ( void );
79 void ldapsvr_set_name ( LdapServer *server, const gchar *value );
80 void ldapsvr_set_accessed ( LdapServer *server, const gboolean value );
81 void ldapsvr_force_refresh ( LdapServer *server );
82 void ldapsvr_free_all_query ( LdapServer *server );
83 void ldapsvr_free ( LdapServer *server );
84 gint ldapsvr_get_status ( LdapServer *server );
85 gboolean ldapsvr_get_accessed ( LdapServer *server );
86 gchar *ldapsvr_get_name ( LdapServer *server );
87 gboolean ldapsvr_get_modified ( LdapServer *server );
88 void ldapsvr_set_modified ( LdapServer *server, const gboolean value );
89 gboolean ldapsvr_get_read_flag ( LdapServer *server );
90 gboolean ldapsvr_get_search_flag( LdapServer *server );
91 void ldapsvr_set_search_flag ( LdapServer *server, const gboolean value );
92 gint ldapsvr_read_data ( LdapServer *server );
94 void ldapsvr_print_data ( LdapServer *server, FILE *stream );
95 void ldapsvr_cancel_read ( LdapServer *server );
97 ItemFolder *ldapsvr_get_root_folder ( LdapServer *server );
98 GList *ldapsvr_get_list_person ( LdapServer *server );
99 GList *ldapsvr_get_list_folder ( LdapServer *server );
101 void ldapsvr_stop_query_id ( LdapServer *server, const gint queryID );
102 void ldapsvr_stop_all_query ( LdapServer *server );
103 void ldapsvr_cancel_all_query ( LdapServer *server );
104 void ldapsvr_retire_query ( LdapServer *server );
106 gboolean ldapsvr_reuse_previous ( const LdapServer *server,
107 const QueryRequest *req );
108 void ldapsrv_set_options (gint secs, LDAP *ld);
109 LDAP *ldapsvr_connect(LdapControl *ctl);
110 void ldapsvr_disconnect(LDAP *ld);
111 #endif /* USE_LDAP */
113 #endif /* __LDAPSERVER_H__ */