Statistics
| Revision:

root / src / syldap.h @ 1254

History | View | Annotate | Download (4.1 kB)

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