Cosmetic fixes
[vcard2ldap.git] / include / v2l_conn.h
blob5b63a12e744203c5cacd263316371224a3ba91a8
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #ifndef __V2L_CONN_H
18 #define __V2L_CONN_H
20 #include <ldap.h>
21 #include <time.h>
23 #include <v2l_config.h>
25 typedef struct v2l_LdapConn
27 pool p;
28 LDAP *ld;
29 time_t creation_time;
30 char *binddn; /* complete dn */
31 char *entry; /* short dn */
32 char *user; /* username */
33 int exists;
34 struct v2l_LdapConn *next;
35 } v2l_LdapConn;
37 /* to store LDAP request to be executed after having retrieved vCard data */
38 typedef struct v2l_LdapRequest
40 LDAPMod *attr;
41 struct v2l_LdapRequest *next;
42 } v2l_LdapRequest;
44 /* For retrieve results from asynchronous requests */
45 typedef struct v2l_LdapEvt
47 LDAP *ld;
48 int msgid;
49 int rc;
50 LDAPMessage *result;
51 } v2l_LdapEvt;
53 extern v2l_LdapConn *v2l_get_conn (v2l_Config *self, const char *user);
54 extern v2l_LdapConn *v2l_get_master_conn (v2l_Config *self);
55 extern void v2l_free_allconn ();
56 extern void v2l_ldap_sync (v2l_LdapEvt *evt_res); /* wait for LDAP results */
57 extern int v2l_ldap_search (char *dn, char *suffix, char **attrs, int subtree,
58 v2l_LdapEvt *evt_res);
59 extern int v2l_ldap_modify (char *dn, LDAPMod **attrs, v2l_LdapEvt *evt_res);
60 extern int v2l_request_record (v2l_Config *self, v2l_LdapConn * curr_conn,
61 v2l_LdapRequest *req);
62 extern v2l_LdapRequest *v2l_add_attr_str (v2l_LdapRequest *req,
63 const char *attr, const char *str);
64 #endif