Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / src / database / eldap.h
1 /* Definitions for the LDAP client interface for XEmacs.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3
4 This file is part of SXEmacs
5
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
18
19
20 #ifndef INCLUDED_eldap_h_
21 #define INCLUDED_eldap_h_
22
23 #include <lber.h>
24 #include <ldap.h>
25
26 /*
27  * The following structure records pertinent information about a
28  * LDAP connection.
29  */
30
31 struct Lisp_LDAP {
32         /* lcrecord header */
33         struct lcrecord_header header;
34         /* The LDAP connection handle used by the LDAP API */
35         LDAP *ld;
36         /* Name of the host we connected to */
37         Lisp_Object host;
38 };
39 typedef struct Lisp_LDAP Lisp_LDAP;
40
41 DECLARE_LRECORD(ldap, Lisp_LDAP);
42 #define XLDAP(x) XRECORD (x, ldap, Lisp_LDAP)
43 #define XSETLDAP(x, p) XSETRECORD (x, p, ldap)
44 #define LDAPP(x) RECORDP (x, ldap)
45 #define CHECK_LDAP(x) CHECK_RECORD (x, ldap)
46 #define CONCHECK_LDAP(x) CONCHECK_RECORD (x, ldap)
47
48 #define CHECK_LIVE_LDAP(ldap) do {                                      \
49   CHECK_LDAP (ldap);                                                    \
50   if (!XLDAP (ldap)->ld)                                                \
51     signal_simple_error ("Attempting to access closed LDAP connection", \
52                          ldap);                                         \
53 } while (0)
54
55 Lisp_Object Fldapp(Lisp_Object object);
56 Lisp_Object Fldap_host(Lisp_Object ldap);
57 Lisp_Object Fldap_status(Lisp_Object ldap);
58 Lisp_Object Fldap_open(Lisp_Object host, Lisp_Object ldap_plist);
59 Lisp_Object Fldap_close(Lisp_Object ldap);
60 Lisp_Object Fldap_search_basic(Lisp_Object ldap,
61                                Lisp_Object filter,
62                                Lisp_Object base,
63                                Lisp_Object scope,
64                                Lisp_Object attrs,
65                                Lisp_Object attrsonly,
66                                Lisp_Object withdn, Lisp_Object verbose);
67 Lisp_Object Fldap_add(Lisp_Object ldap, Lisp_Object dn, Lisp_Object entry);
68 Lisp_Object Fldap_modify(Lisp_Object ldap, Lisp_Object dn, Lisp_Object entry);
69 Lisp_Object Fldap_delete(Lisp_Object ldap, Lisp_Object dn);
70
71 #endif                          /* INCLUDED_eldap_h_ */