summaryrefslogtreecommitdiff
path: root/src/syldap.h
diff options
context:
space:
mode:
authorSimeon Simeonov2018-02-26 11:23:00 +0100
committerSimeon Simeonov2018-02-26 11:23:00 +0100
commit0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch)
treeaf916a30553c78ce9d4f2d8658656a175c5b6921 /src/syldap.h
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'src/syldap.h')
-rw-r--r--src/syldap.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/syldap.h b/src/syldap.h
new file mode 100644
index 0000000..f760dfa
--- /dev/null
+++ b/src/syldap.h
@@ -0,0 +1,111 @@
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 "addritem.h"
33#include "addrcache.h"
34
35#define SYLDAP_DFL_PORT 389
36#define SYLDAP_MAX_ENTRIES 20
37#define SYLDAP_DFL_TIMEOUT 30
38#define SYLDAP_DFL_CRITERIA "(&(mail=*)(cn=%s*))"
39
40#define SYLDAP_ATTR_DN "dn"
41#define SYLDAP_ATTR_COMMONNAME "cn"
42#define SYLDAP_ATTR_GIVENNAME "givenName"
43#define SYLDAP_ATTR_SURNAME "sn"
44#define SYLDAP_ATTR_EMAIL "mail"
45#define SYLDAP_ATTR_UID "uid"
46
47typedef struct _SyldapServer SyldapServer;
48struct _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 /* ItemFolder *rootFolder; */
63 gboolean accessFlag;
64 gint retVal;
65 pthread_t *thread;
66 gboolean busyFlag;
67 void (*callBack)( void * );
68 guint idleId;
69};
70
71/* Function prototypes */
72SyldapServer *syldap_create ( void );
73void syldap_set_name ( SyldapServer* ldapServer, const gchar *value );
74void syldap_set_host ( SyldapServer* ldapServer, const gchar *value );
75void syldap_set_port ( SyldapServer* ldapServer, const gint value );
76void syldap_set_base_dn ( SyldapServer* ldapServer, const gchar *value );
77void syldap_set_bind_dn ( SyldapServer* ldapServer, const gchar *value );
78void syldap_set_bind_password ( SyldapServer* ldapServer, const gchar *value );
79void syldap_set_search_criteria ( SyldapServer* ldapServer, const gchar *value );
80void syldap_set_search_value ( SyldapServer* ldapServer, const gchar *value );
81void syldap_set_max_entries ( SyldapServer* ldapServer, const gint value );
82void syldap_set_timeout ( SyldapServer* ldapServer, const gint value );
83void syldap_set_callback ( SyldapServer *ldapServer, void *func );
84void syldap_set_accessed ( SyldapServer *ldapServer, const gboolean value );
85void syldap_force_refresh ( SyldapServer *ldapServer );
86void syldap_free ( SyldapServer *ldapServer );
87gint syldap_get_status ( SyldapServer *ldapServer );
88gboolean syldap_get_accessed ( SyldapServer *ldapServer );
89gchar *syldap_get_name ( SyldapServer *ldapServer );
90
91void syldap_print_data ( SyldapServer *ldapServer, FILE *stream );
92gboolean syldap_check_search ( SyldapServer *ldapServer );
93gint syldap_read_data ( SyldapServer *ldapServer );
94gint syldap_read_data_th ( SyldapServer *ldapServer );
95void syldap_cancel_read ( SyldapServer *ldapServer );
96
97/* GList *syldap_get_address_list ( const SyldapServer *ldapServer ); */
98ItemFolder *syldap_get_root_folder ( SyldapServer *ldapServer );
99GList *syldap_get_list_person ( SyldapServer *ldapServer );
100GList *syldap_get_list_folder ( SyldapServer *ldapServer );
101
102GList *syldap_read_basedn_s ( const gchar *host, const gint port, const gchar *bindDN,
103 const gchar *bindPW, const gint tov );
104GList *syldap_read_basedn ( SyldapServer *ldapServer );
105gboolean syldap_test_connect_s ( const gchar *host, const gint port );
106gboolean syldap_test_connect ( SyldapServer *ldapServer );
107/* gboolean syldap_test_ldap_lib ( void ); */
108
109#endif /* USE_LDAP */
110
111#endif /* __SYLDAP_H__ */