]> git.sur5r.net Git - openldap/blob - include/ldap.h
First cut to truly async connect:
[openldap] / include / ldap.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  * 
4  * Copyright 1998-2007 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15 /* Portions Copyright (c) 1990 Regents of the University of Michigan.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms are permitted
19  * provided that this notice is preserved and that due credit is given
20  * to the University of Michigan at Ann Arbor. The name of the University
21  * may not be used to endorse or promote products derived from this
22  * software without specific prior written permission. This software
23  * is provided ``as is'' without express or implied warranty.
24  */
25
26 #ifndef _LDAP_H
27 #define _LDAP_H
28
29 /* pull in lber */
30 #include <lber.h>
31
32 /* include version and API feature defines */
33 #include <ldap_features.h>
34
35 LDAP_BEGIN_DECL
36
37 #define LDAP_VERSION1   1
38 #define LDAP_VERSION2   2
39 #define LDAP_VERSION3   3
40
41 #define LDAP_VERSION_MIN        LDAP_VERSION2
42 #define LDAP_VERSION            LDAP_VERSION2
43 #define LDAP_VERSION_MAX        LDAP_VERSION3
44
45 /*
46  * We use 3000+n here because it is above 1823 (for RFC 1823),
47  * above 2000+rev of IETF LDAPEXT draft (now quite dated),
48  * yet below allocations for new RFCs (just in case there is
49  * someday an RFC produced).
50  */
51 #define LDAP_API_VERSION        3001
52 #define LDAP_VENDOR_NAME        "OpenLDAP"
53
54 /* OpenLDAP API Features */
55 #define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION
56
57 #if defined( LDAP_API_FEATURE_X_OPENLDAP_REENTRANT ) || \
58         ( defined( LDAP_THREAD_SAFE ) && \
59                 defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) )
60         /* -lldap may or may not be thread safe */
61         /* -lldap_r, if available, is always thread safe */
62 #       define  LDAP_API_FEATURE_THREAD_SAFE 1
63 #endif
64 #if defined( LDAP_THREAD_SAFE ) && \
65         defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE )
66 /* #define LDAP_API_FEATURE_SESSION_SAFE        1       */
67 /* #define LDAP_API_OPERATION_SESSION_SAFE      1       */
68 #endif
69
70
71 #define LDAP_PORT               389             /* ldap:///             default LDAP port */
72 #define LDAPS_PORT              636             /* ldaps:///    default LDAP over TLS port */
73
74 #define LDAP_ROOT_DSE                           ""
75 #define LDAP_NO_ATTRS                           "1.1"
76 #define LDAP_ALL_USER_ATTRIBUTES        "*"
77 #define LDAP_ALL_OPERATIONAL_ATTRIBUTES "+" /* RFC 3673 */
78
79 /* RFC 4511:  maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */
80 #define LDAP_MAXINT (2147483647)
81
82 /*
83  * LDAP_OPTions
84  *      0x0000 - 0x0fff reserved for api options
85  *      0x1000 - 0x3fff reserved for api extended options
86  *      0x4000 - 0x7fff reserved for private and experimental options
87  */
88
89 #define LDAP_OPT_API_INFO                       0x0000
90 #define LDAP_OPT_DESC                           0x0001 /* historic */
91 #define LDAP_OPT_DEREF                          0x0002
92 #define LDAP_OPT_SIZELIMIT                      0x0003
93 #define LDAP_OPT_TIMELIMIT                      0x0004
94 /* 0x05 - 0x07 not defined */
95 #define LDAP_OPT_REFERRALS                      0x0008
96 #define LDAP_OPT_RESTART                        0x0009
97 /* 0x0a - 0x10 not defined */
98 #define LDAP_OPT_PROTOCOL_VERSION               0x0011
99 #define LDAP_OPT_SERVER_CONTROLS                0x0012
100 #define LDAP_OPT_CLIENT_CONTROLS                0x0013
101 /* 0x14 not defined */
102 #define LDAP_OPT_API_FEATURE_INFO               0x0015
103 /* 0x16 - 0x2f not defined */
104 #define LDAP_OPT_HOST_NAME                      0x0030
105 #define LDAP_OPT_RESULT_CODE                    0x0031
106 #define LDAP_OPT_ERROR_NUMBER                   LDAP_OPT_RESULT_CODE
107 #define LDAP_OPT_DIAGNOSTIC_MESSAGE             0x0032
108 #define LDAP_OPT_ERROR_STRING                   LDAP_OPT_DIAGNOSTIC_MESSAGE
109 #define LDAP_OPT_MATCHED_DN                     0x0033
110 /* 0x0034 - 0x3fff not defined */
111
112 /* API Extensions */
113 #define LDAP_OPT_API_EXTENSION_BASE 0x4000  /* API extensions */
114
115 /* private and experimental options */
116 /* OpenLDAP specific options */
117 #define LDAP_OPT_DEBUG_LEVEL            0x5001  /* debug level */
118 #define LDAP_OPT_TIMEOUT                        0x5002  /* default timeout */
119 #define LDAP_OPT_REFHOPLIMIT            0x5003  /* ref hop limit */
120 #define LDAP_OPT_NETWORK_TIMEOUT        0x5005  /* socket level timeout */
121 #define LDAP_OPT_URI                            0x5006
122 #define LDAP_OPT_REFERRAL_URLS      0x5007  /* Referral URLs */
123 #define LDAP_OPT_SOCKBUF            0x5008  /* sockbuf */
124 #define LDAP_OPT_DEFBASE                0x5009  /* searchbase */
125 #define LDAP_OPT_CONNECT_ASYNC          0x5010  /* create connections asynchronously */
126
127 /* OpenLDAP TLS options */
128 #define LDAP_OPT_X_TLS                          0x6000
129 #define LDAP_OPT_X_TLS_CTX                      0x6001  /* OpenSSL CTX */
130 #define LDAP_OPT_X_TLS_CACERTFILE       0x6002
131 #define LDAP_OPT_X_TLS_CACERTDIR        0x6003
132 #define LDAP_OPT_X_TLS_CERTFILE         0x6004
133 #define LDAP_OPT_X_TLS_KEYFILE          0x6005
134 #define LDAP_OPT_X_TLS_REQUIRE_CERT     0x6006
135 /* #define LDAP_OPT_X_TLS_PROTOCOL              0x6007 */
136 #define LDAP_OPT_X_TLS_CIPHER_SUITE     0x6008
137 #define LDAP_OPT_X_TLS_RANDOM_FILE      0x6009
138 #define LDAP_OPT_X_TLS_SSL_CTX          0x600a
139 #define LDAP_OPT_X_TLS_CRLCHECK         0x600b
140 #define LDAP_OPT_X_TLS_CONNECT_CB       0x600c
141 #define LDAP_OPT_X_TLS_CONNECT_ARG      0x600d
142 #define LDAP_OPT_X_TLS_DHFILE           0x600e
143 #define LDAP_OPT_X_TLS_NEWCTX           0x600f
144
145 #define LDAP_OPT_X_TLS_NEVER    0
146 #define LDAP_OPT_X_TLS_HARD             1
147 #define LDAP_OPT_X_TLS_DEMAND   2
148 #define LDAP_OPT_X_TLS_ALLOW    3
149 #define LDAP_OPT_X_TLS_TRY              4
150
151 #define LDAP_OPT_X_TLS_CRL_NONE 0
152 #define LDAP_OPT_X_TLS_CRL_PEER 1
153 #define LDAP_OPT_X_TLS_CRL_ALL  2
154
155 /* OpenLDAP SASL options */
156 #define LDAP_OPT_X_SASL_MECH                    0x6100
157 #define LDAP_OPT_X_SASL_REALM                   0x6101
158 #define LDAP_OPT_X_SASL_AUTHCID                 0x6102
159 #define LDAP_OPT_X_SASL_AUTHZID                 0x6103
160 #define LDAP_OPT_X_SASL_SSF                             0x6104 /* read-only */
161 #define LDAP_OPT_X_SASL_SSF_EXTERNAL    0x6105 /* write-only */
162 #define LDAP_OPT_X_SASL_SECPROPS                0x6106 /* write-only */
163 #define LDAP_OPT_X_SASL_SSF_MIN                 0x6107
164 #define LDAP_OPT_X_SASL_SSF_MAX                 0x6108
165 #define LDAP_OPT_X_SASL_MAXBUFSIZE              0x6109
166
167 /* Private API Extensions -- reserved for application use */
168 #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x7000  /* Private API inclusive */
169
170 /*
171  * ldap_get_option() and ldap_set_option() return values.
172  * As later versions may return other values indicating
173  * failure, current applications should only compare returned
174  * value against LDAP_OPT_SUCCESS.
175  */
176 #define LDAP_OPT_SUCCESS        0
177 #define LDAP_OPT_ERROR          (-1)
178
179 /* option on/off values */
180 #define LDAP_OPT_ON             ((void *) &ber_pvt_opt_on)
181 #define LDAP_OPT_OFF    ((void *) 0)
182
183 typedef struct ldapapiinfo {
184         int             ldapai_info_version;            /* version of LDAPAPIInfo */
185 #define LDAP_API_INFO_VERSION   (1)
186         int             ldapai_api_version;                     /* revision of API supported */
187         int             ldapai_protocol_version;        /* highest LDAP version supported */
188         char    **ldapai_extensions;            /* names of API extensions */
189         char    *ldapai_vendor_name;            /* name of supplier */
190         int             ldapai_vendor_version;          /* supplier-specific version * 100 */
191 } LDAPAPIInfo;
192
193 typedef struct ldap_apifeature_info {
194         int             ldapaif_info_version;           /* version of LDAPAPIFeatureInfo */
195 #define LDAP_FEATURE_INFO_VERSION (1)   /* apifeature_info struct version */
196         char*   ldapaif_name;                           /* LDAP_API_FEATURE_* (less prefix) */
197         int             ldapaif_version;                        /* value of LDAP_API_FEATURE_... */
198 } LDAPAPIFeatureInfo;
199
200 /*
201  * LDAP Control structure
202  */
203 typedef struct ldapcontrol {
204         char *                  ldctl_oid;                      /* numericoid of control */
205         struct berval   ldctl_value;            /* encoded value of control */
206         char                    ldctl_iscritical;       /* criticality */
207 } LDAPControl;
208
209 /* LDAP Controls */
210 /*      standard track controls */
211 #define LDAP_CONTROL_MANAGEDSAIT        "2.16.840.1.113730.3.4.2"  /* RFC 3296 */
212 #define LDAP_CONTROL_PROXY_AUTHZ        "2.16.840.1.113730.3.4.18" /* RFC 4370 */
213 #define LDAP_CONTROL_SUBENTRIES         "1.3.6.1.4.1.4203.1.10.1"  /* RFC 3672 */
214
215 #define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.3344810.2.3"/* RFC 3876 */
216
217 #define LDAP_CONTROL_ASSERT                             "1.3.6.1.1.12"                  /* RFC 4528 */
218 #define LDAP_CONTROL_PRE_READ                   "1.3.6.1.1.13.1"                /* RFC 4527 */
219 #define LDAP_CONTROL_POST_READ                  "1.3.6.1.1.13.2"                /* RFC 4527 */
220
221 /*  standard track - not implemented in slapd(8) */
222 #define LDAP_CONTROL_SORTREQUEST    "1.2.840.113556.1.4.473" /* RFC 2891 */
223 #define LDAP_CONTROL_SORTRESPONSE       "1.2.840.113556.1.4.474" /* RFC 2891 */
224
225 /*      non-standard track controls */
226 #define LDAP_CONTROL_PAGEDRESULTS       "1.2.840.113556.1.4.319"   /* RFC 2696 */
227
228 /* LDAP Content Synchronization Operation -- RFC 4533 */
229 #define LDAP_SYNC_OID                   "1.3.6.1.4.1.4203.1.9.1"
230 #define LDAP_CONTROL_SYNC               LDAP_SYNC_OID ".1"
231 #define LDAP_CONTROL_SYNC_STATE LDAP_SYNC_OID ".2"
232 #define LDAP_CONTROL_SYNC_DONE  LDAP_SYNC_OID ".3"
233 #define LDAP_SYNC_INFO                  LDAP_SYNC_OID ".4"
234
235 #define LDAP_SYNC_NONE                                  0x00
236 #define LDAP_SYNC_REFRESH_ONLY                  0x01
237 #define LDAP_SYNC_RESERVED                              0x02
238 #define LDAP_SYNC_REFRESH_AND_PERSIST   0x03
239
240 #define LDAP_SYNC_REFRESH_PRESENTS              0
241 #define LDAP_SYNC_REFRESH_DELETES               1
242
243 #define LDAP_TAG_SYNC_NEW_COOKIE                ((ber_tag_t) 0x80U)
244 #define LDAP_TAG_SYNC_REFRESH_DELETE    ((ber_tag_t) 0xa1U)
245 #define LDAP_TAG_SYNC_REFRESH_PRESENT   ((ber_tag_t) 0xa2U)
246 #define LDAP_TAG_SYNC_ID_SET                    ((ber_tag_t) 0xa3U)
247
248 #define LDAP_TAG_SYNC_COOKIE                    ((ber_tag_t) 0x04U)
249 #define LDAP_TAG_REFRESHDELETES                 ((ber_tag_t) 0x01U)
250 #define LDAP_TAG_REFRESHDONE                    ((ber_tag_t) 0x01U)
251 #define LDAP_TAG_RELOAD_HINT                    ((ber_tag_t) 0x01U)
252
253 #define LDAP_SYNC_PRESENT                               0
254 #define LDAP_SYNC_ADD                                   1
255 #define LDAP_SYNC_MODIFY                                2
256 #define LDAP_SYNC_DELETE                                3
257
258
259 /* Password policy Controls *//* work in progress */
260 /* ITS#3458: released; disabled by default */
261 #define LDAP_CONTROL_PASSWORDPOLICYREQUEST      "1.3.6.1.4.1.42.2.27.8.5.1"
262 #define LDAP_CONTROL_PASSWORDPOLICYRESPONSE     "1.3.6.1.4.1.42.2.27.8.5.1"
263
264 /* various works in progress */
265 #define LDAP_CONTROL_NOOP                               "1.3.6.1.4.1.4203.666.5.2"
266 #define LDAP_CONTROL_NO_SUBORDINATES    "1.3.6.1.4.1.4203.666.5.11"
267 #define LDAP_CONTROL_RELAX                              "1.3.6.1.4.1.4203.666.5.12"
268 #define LDAP_CONTROL_MANAGEDIT                  LDAP_CONTROL_RELAX
269 #define LDAP_CONTROL_SLURP                              "1.3.6.1.4.1.4203.666.5.13"
270 #define LDAP_CONTROL_VALSORT                    "1.3.6.1.4.1.4203.666.5.14"
271 #define LDAP_CONTROL_DONTUSECOPY                "1.3.6.1.4.1.4203.666.5.15"
272
273
274 /* LDAP Chaining Behavior Control *//* work in progress */
275 /* <draft-sermersheim-ldap-chaining>;
276  * see also LDAP_NO_REFERRALS_FOUND, LDAP_CANNOT_CHAIN */
277 #define LDAP_CONTROL_X_CHAINING_BEHAVIOR        "1.3.6.1.4.1.4203.666.11.3"
278
279 #define LDAP_CHAINING_PREFERRED                         0
280 #define LDAP_CHAINING_REQUIRED                          1
281 #define LDAP_REFERRALS_PREFERRED                        2
282 #define LDAP_REFERRALS_REQUIRED                         3
283
284 /* MS Active Directory controls (for compatibility) */
285 #define LDAP_CONTROL_X_INCREMENTAL_VALUES       "1.2.840.113556.1.4.802"
286 #define LDAP_CONTROL_X_DOMAIN_SCOPE                     "1.2.840.113556.1.4.1339"
287 #define LDAP_CONTROL_X_PERMISSIVE_MODIFY        "1.2.840.113556.1.4.1413"
288 #define LDAP_CONTROL_X_SEARCH_OPTIONS           "1.2.840.113556.1.4.1340"
289 #define LDAP_SEARCH_FLAG_DOMAIN_SCOPE 1 /* do not generate referrals */
290 #define LDAP_SEARCH_FLAG_PHANTOM_ROOT 2 /* search all subordinate NCs */
291
292 /* MS Active Directory controls - not implemented in slapd(8) */
293 #define LDAP_CONTROL_X_TREE_DELETE              "1.2.840.113556.1.4.805"
294 #define LDAP_CONTROL_X_EXTENDED_DN              "1.2.840.113556.1.4.529"
295
296 /* various expired works */
297 /* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */
298 #define LDAP_CONTROL_DUPENT_REQUEST             "2.16.840.1.113719.1.27.101.1"
299 #define LDAP_CONTROL_DUPENT_RESPONSE    "2.16.840.1.113719.1.27.101.2"
300 #define LDAP_CONTROL_DUPENT_ENTRY               "2.16.840.1.113719.1.27.101.3"
301 #define LDAP_CONTROL_DUPENT     LDAP_CONTROL_DUPENT_REQUEST
302
303 /* LDAP Persistent Search Control *//* not implemented in slapd(8) */
304 #define LDAP_CONTROL_PERSIST_REQUEST                            "2.16.840.1.113730.3.4.3"
305 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE        "2.16.840.1.113730.3.4.7"
306 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_ADD           0x1
307 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_DELETE        0x2
308 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_MODIFY        0x4
309 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_RENAME        0x8
310
311 /* LDAP VLV *//* not implemented in slapd(8) */
312 #define LDAP_CONTROL_VLVREQUEST         "2.16.840.1.113730.3.4.9"
313 #define LDAP_CONTROL_VLVRESPONSE    "2.16.840.1.113730.3.4.10"
314
315
316 /* LDAP Unsolicited Notifications */
317 #define LDAP_NOTICE_OF_DISCONNECTION    "1.3.6.1.4.1.1466.20036" /* RFC 4511 */
318 #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION
319
320 /* LDAP Extended Operations */
321 #define LDAP_EXOP_START_TLS             "1.3.6.1.4.1.1466.20037"        /* RFC 4511 */
322
323 #define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"       /* RFC 3062 */
324 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID  ((ber_tag_t) 0x80U)
325 #define LDAP_TAG_EXOP_MODIFY_PASSWD_OLD ((ber_tag_t) 0x81U)
326 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U)
327 #define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U)
328
329 #define LDAP_EXOP_CANCEL                "1.3.6.1.1.8"                                   /* RFC 3909 */
330 #define LDAP_EXOP_X_CANCEL              LDAP_EXOP_CANCEL
331
332 #define LDAP_EXOP_REFRESH               "1.3.6.1.4.1.1466.101.119.1"    /* RFC 2589 */
333 #define LDAP_TAG_EXOP_REFRESH_REQ_DN    ((ber_tag_t) 0x80U)
334 #define LDAP_TAG_EXOP_REFRESH_REQ_TTL   ((ber_tag_t) 0x81U)
335 #define LDAP_TAG_EXOP_REFRESH_RES_TTL   ((ber_tag_t) 0x80U)
336
337 #define LDAP_EXOP_WHO_AM_I              "1.3.6.1.4.1.4203.1.11.3"               /* RFC 4532 */
338 #define LDAP_EXOP_X_WHO_AM_I    LDAP_EXOP_WHO_AM_I
339
340 /* various works in progress */
341 #define LDAP_EXOP_TURN          "1.3.6.1.1.19"                          /* RFC 4531 */
342 #define LDAP_EXOP_X_TURN        LDAP_EXOP_TURN
343
344 /* LDAP Distributed Procedures <draft-sermersheim-ldap-distproc> */
345 /* a work in progress */
346 #define LDAP_X_DISTPROC_BASE            "1.3.6.1.4.1.4203.666.11.6"
347 #define LDAP_EXOP_X_CHAINEDREQUEST      LDAP_X_DISTPROC_BASE ".1"
348 #define LDAP_FEATURE_X_CANCHAINOPS      LDAP_X_DISTPROC_BASE ".2"
349 #define LDAP_CONTROL_X_RETURNCONTREF    LDAP_X_DISTPROC_BASE ".3"
350 #define LDAP_URLEXT_X_LOCALREFOID       LDAP_X_DISTPROC_BASE ".4"
351 #define LDAP_URLEXT_X_REFTYPEOID        LDAP_X_DISTPROC_BASE ".5"
352 #define LDAP_URLEXT_X_SEARCHEDSUBTREEOID \
353                                         LDAP_X_DISTPROC_BASE ".6"
354 #define LDAP_URLEXT_X_FAILEDNAMEOID     LDAP_X_DISTPROC_BASE ".7"
355 #define LDAP_URLEXT_X_LOCALREF          "x-localReference"
356 #define LDAP_URLEXT_X_REFTYPE           "x-referenceType"
357 #define LDAP_URLEXT_X_SEARCHEDSUBTREE   "x-searchedSubtree"
358 #define LDAP_URLEXT_X_FAILEDNAME        "x-failedName"
359
360 #ifdef LDAP_DEVEL
361 #define LDAP_X_TXN                                              "1.3.6.1.4.1.4203.666.11.7" /* tmp */
362 #define LDAP_EXOP_X_TXN_START                   LDAP_X_TXN ".1"
363 #define LDAP_CONTROL_X_TXN_SPEC                 LDAP_X_TXN ".2"
364 #define LDAP_EXOP_X_TXN_END                             LDAP_X_TXN ".3"
365 #define LDAP_EXOP_X_TXN_ABORTED_NOTICE  LDAP_X_TXN ".4"
366 #endif
367
368 /* LDAP Features */
369 #define LDAP_FEATURE_ALL_OP_ATTRS       "1.3.6.1.4.1.4203.1.5.1"        /* RFC 3673 */
370 #define LDAP_FEATURE_OBJECTCLASS_ATTRS \
371         "1.3.6.1.4.1.4203.1.5.2" /*  @objectClass - new number to be assigned */
372 #define LDAP_FEATURE_ABSOLUTE_FILTERS "1.3.6.1.4.1.4203.1.5.3"  /* (&) (|) */
373 #define LDAP_FEATURE_LANGUAGE_TAG_OPTIONS "1.3.6.1.4.1.4203.1.5.4"
374 #define LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS "1.3.6.1.4.1.4203.1.5.5"
375 #define LDAP_FEATURE_MODIFY_INCREMENT "1.3.6.1.1.14"
376
377 /* LDAP Experimental (works in progress) Features */
378 #define LDAP_FEATURE_SUBORDINATE_SCOPE \
379         "1.3.6.1.4.1.4203.666.8.1" /* "children" */
380 #define LDAP_FEATURE_CHILDREN_SCOPE LDAP_FEATURE_SUBORDINATE_SCOPE
381
382 /*
383  * specific LDAP instantiations of BER types we know about
384  */
385
386 /* Overview of LBER tag construction
387  *
388  *      Bits
389  *      ______
390  *      8 7 | CLASS
391  *      0 0 = UNIVERSAL
392  *      0 1 = APPLICATION
393  *      1 0 = CONTEXT-SPECIFIC
394  *      1 1 = PRIVATE
395  *              _____
396  *              | 6 | DATA-TYPE
397  *                0 = PRIMITIVE
398  *                1 = CONSTRUCTED
399  *                      ___________
400  *                      | 5 ... 1 | TAG-NUMBER
401  */
402
403 /* general stuff */
404 #define LDAP_TAG_MESSAGE        ((ber_tag_t) 0x30U)     /* constructed + 16 */
405 #define LDAP_TAG_MSGID          ((ber_tag_t) 0x02U)     /* integer */
406
407 #define LDAP_TAG_LDAPDN         ((ber_tag_t) 0x04U)     /* octet string */
408 #define LDAP_TAG_LDAPCRED       ((ber_tag_t) 0x04U)     /* octet string */
409
410 #define LDAP_TAG_CONTROLS       ((ber_tag_t) 0xa0U)     /* context specific + constructed + 0 */
411 #define LDAP_TAG_REFERRAL       ((ber_tag_t) 0xa3U)     /* context specific + constructed + 3 */
412
413 #define LDAP_TAG_NEWSUPERIOR    ((ber_tag_t) 0x80U)     /* context-specific + primitive + 0 */
414
415 #define LDAP_TAG_EXOP_REQ_OID   ((ber_tag_t) 0x80U)     /* context specific + primitive */
416 #define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U)     /* context specific + primitive */
417 #define LDAP_TAG_EXOP_RES_OID   ((ber_tag_t) 0x8aU)     /* context specific + primitive */
418 #define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU)     /* context specific + primitive */
419
420 #define LDAP_TAG_IM_RES_OID   ((ber_tag_t) 0x80U)       /* context specific + primitive */
421 #define LDAP_TAG_IM_RES_VALUE ((ber_tag_t) 0x81U)       /* context specific + primitive */
422
423 #define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U)     /* context specific + primitive */
424
425 /* LDAP Request Messages */
426 #define LDAP_REQ_BIND           ((ber_tag_t) 0x60U)     /* application + constructed */
427 #define LDAP_REQ_UNBIND         ((ber_tag_t) 0x42U)     /* application + primitive   */
428 #define LDAP_REQ_SEARCH         ((ber_tag_t) 0x63U)     /* application + constructed */
429 #define LDAP_REQ_MODIFY         ((ber_tag_t) 0x66U)     /* application + constructed */
430 #define LDAP_REQ_ADD            ((ber_tag_t) 0x68U)     /* application + constructed */
431 #define LDAP_REQ_DELETE         ((ber_tag_t) 0x4aU)     /* application + primitive   */
432 #define LDAP_REQ_MODDN          ((ber_tag_t) 0x6cU)     /* application + constructed */
433 #define LDAP_REQ_MODRDN         LDAP_REQ_MODDN
434 #define LDAP_REQ_RENAME         LDAP_REQ_MODDN
435 #define LDAP_REQ_COMPARE        ((ber_tag_t) 0x6eU)     /* application + constructed */
436 #define LDAP_REQ_ABANDON        ((ber_tag_t) 0x50U)     /* application + primitive   */
437 #define LDAP_REQ_EXTENDED       ((ber_tag_t) 0x77U)     /* application + constructed */
438
439 /* LDAP Response Messages */
440 #define LDAP_RES_BIND           ((ber_tag_t) 0x61U)     /* application + constructed */
441 #define LDAP_RES_SEARCH_ENTRY   ((ber_tag_t) 0x64U)     /* application + constructed */
442 #define LDAP_RES_SEARCH_REFERENCE       ((ber_tag_t) 0x73U)     /* V3: application + constructed */
443 #define LDAP_RES_SEARCH_RESULT  ((ber_tag_t) 0x65U)     /* application + constructed */
444 #define LDAP_RES_MODIFY         ((ber_tag_t) 0x67U)     /* application + constructed */
445 #define LDAP_RES_ADD            ((ber_tag_t) 0x69U)     /* application + constructed */
446 #define LDAP_RES_DELETE         ((ber_tag_t) 0x6bU)     /* application + constructed */
447 #define LDAP_RES_MODDN          ((ber_tag_t) 0x6dU)     /* application + constructed */
448 #define LDAP_RES_MODRDN         LDAP_RES_MODDN  /* application + constructed */
449 #define LDAP_RES_RENAME         LDAP_RES_MODDN  /* application + constructed */
450 #define LDAP_RES_COMPARE        ((ber_tag_t) 0x6fU)     /* application + constructed */
451 #define LDAP_RES_EXTENDED       ((ber_tag_t) 0x78U)     /* V3: application + constructed */
452 #define LDAP_RES_INTERMEDIATE   ((ber_tag_t) 0x79U) /* V3+: application + constructed */
453
454 #define LDAP_RES_ANY                    (-1)
455 #define LDAP_RES_UNSOLICITED    (0)
456
457
458 /* sasl methods */
459 #define LDAP_SASL_SIMPLE        ((char*)0)
460 #define LDAP_SASL_NULL          ("")
461
462
463 /* authentication methods available */
464 #define LDAP_AUTH_NONE   ((ber_tag_t) 0x00U) /* no authentication */
465 #define LDAP_AUTH_SIMPLE ((ber_tag_t) 0x80U) /* context specific + primitive */
466 #define LDAP_AUTH_SASL   ((ber_tag_t) 0xa3U) /* context specific + constructed */
467 #define LDAP_AUTH_KRBV4  ((ber_tag_t) 0xffU) /* means do both of the following */
468 #define LDAP_AUTH_KRBV41 ((ber_tag_t) 0x81U) /* context specific + primitive */
469 #define LDAP_AUTH_KRBV42 ((ber_tag_t) 0x82U) /* context specific + primitive */
470
471
472 /* filter types */
473 #define LDAP_FILTER_AND ((ber_tag_t) 0xa0U)     /* context specific + constructed */
474 #define LDAP_FILTER_OR  ((ber_tag_t) 0xa1U)     /* context specific + constructed */
475 #define LDAP_FILTER_NOT ((ber_tag_t) 0xa2U)     /* context specific + constructed */
476 #define LDAP_FILTER_EQUALITY ((ber_tag_t) 0xa3U) /* context specific + constructed */
477 #define LDAP_FILTER_SUBSTRINGS ((ber_tag_t) 0xa4U) /* context specific + constructed */
478 #define LDAP_FILTER_GE ((ber_tag_t) 0xa5U) /* context specific + constructed */
479 #define LDAP_FILTER_LE ((ber_tag_t) 0xa6U) /* context specific + constructed */
480 #define LDAP_FILTER_PRESENT ((ber_tag_t) 0x87U) /* context specific + primitive   */
481 #define LDAP_FILTER_APPROX ((ber_tag_t) 0xa8U)  /* context specific + constructed */
482 #define LDAP_FILTER_EXT ((ber_tag_t) 0xa9U)     /* context specific + constructed */
483
484 /* extended filter component types */
485 #define LDAP_FILTER_EXT_OID             ((ber_tag_t) 0x81U)     /* context specific */
486 #define LDAP_FILTER_EXT_TYPE    ((ber_tag_t) 0x82U)     /* context specific */
487 #define LDAP_FILTER_EXT_VALUE   ((ber_tag_t) 0x83U)     /* context specific */
488 #define LDAP_FILTER_EXT_DNATTRS ((ber_tag_t) 0x84U)     /* context specific */
489
490 /* substring filter component types */
491 #define LDAP_SUBSTRING_INITIAL  ((ber_tag_t) 0x80U)     /* context specific */
492 #define LDAP_SUBSTRING_ANY              ((ber_tag_t) 0x81U)     /* context specific */
493 #define LDAP_SUBSTRING_FINAL    ((ber_tag_t) 0x82U)     /* context specific */
494
495 /* search scopes */
496 #define LDAP_SCOPE_BASE                 ((ber_int_t) 0x0000)
497 #define LDAP_SCOPE_BASEOBJECT   LDAP_SCOPE_BASE
498 #define LDAP_SCOPE_ONELEVEL             ((ber_int_t) 0x0001)
499 #define LDAP_SCOPE_ONE                  LDAP_SCOPE_ONELEVEL
500 #define LDAP_SCOPE_SUBTREE              ((ber_int_t) 0x0002)
501 #define LDAP_SCOPE_SUB                  LDAP_SCOPE_SUBTREE
502 #define LDAP_SCOPE_SUBORDINATE  ((ber_int_t) 0x0003) /* OpenLDAP extension */
503 #define LDAP_SCOPE_CHILDREN             LDAP_SCOPE_SUBORDINATE
504 #define LDAP_SCOPE_DEFAULT              ((ber_int_t) -1)         /* OpenLDAP extension */
505
506 /* substring filter component types */
507 #define LDAP_SUBSTRING_INITIAL  ((ber_tag_t) 0x80U)     /* context specific */
508 #define LDAP_SUBSTRING_ANY              ((ber_tag_t) 0x81U)     /* context specific */
509 #define LDAP_SUBSTRING_FINAL    ((ber_tag_t) 0x82U)     /* context specific */
510
511 /*
512  * LDAP Result Codes
513  */
514 #define LDAP_SUCCESS                            0x00
515
516 #define LDAP_RANGE(n,x,y)       (((x) <= (n)) && ((n) <= (y)))
517
518 #define LDAP_OPERATIONS_ERROR           0x01
519 #define LDAP_PROTOCOL_ERROR                     0x02
520 #define LDAP_TIMELIMIT_EXCEEDED         0x03
521 #define LDAP_SIZELIMIT_EXCEEDED         0x04
522 #define LDAP_COMPARE_FALSE                      0x05
523 #define LDAP_COMPARE_TRUE                       0x06
524 #define LDAP_AUTH_METHOD_NOT_SUPPORTED  0x07
525 #define LDAP_STRONG_AUTH_NOT_SUPPORTED  LDAP_AUTH_METHOD_NOT_SUPPORTED
526 #define LDAP_STRONG_AUTH_REQUIRED       0x08
527 #define LDAP_STRONGER_AUTH_REQUIRED     LDAP_STRONG_AUTH_REQUIRED
528 #define LDAP_PARTIAL_RESULTS            0x09    /* LDAPv2+ (not LDAPv3) */
529
530 #define LDAP_REFERRAL                           0x0a /* LDAPv3 */
531 #define LDAP_ADMINLIMIT_EXCEEDED        0x0b /* LDAPv3 */
532 #define LDAP_UNAVAILABLE_CRITICAL_EXTENSION     0x0c /* LDAPv3 */
533 #define LDAP_CONFIDENTIALITY_REQUIRED   0x0d /* LDAPv3 */
534 #define LDAP_SASL_BIND_IN_PROGRESS      0x0e /* LDAPv3 */
535
536 #define LDAP_ATTR_ERROR(n)      LDAP_RANGE((n),0x10,0x15) /* 16-21 */
537
538 #define LDAP_NO_SUCH_ATTRIBUTE          0x10
539 #define LDAP_UNDEFINED_TYPE                     0x11
540 #define LDAP_INAPPROPRIATE_MATCHING     0x12
541 #define LDAP_CONSTRAINT_VIOLATION       0x13
542 #define LDAP_TYPE_OR_VALUE_EXISTS       0x14
543 #define LDAP_INVALID_SYNTAX                     0x15
544
545 #define LDAP_NAME_ERROR(n)      LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
546
547 #define LDAP_NO_SUCH_OBJECT                     0x20
548 #define LDAP_ALIAS_PROBLEM                      0x21
549 #define LDAP_INVALID_DN_SYNTAX          0x22
550 #define LDAP_IS_LEAF                            0x23 /* not LDAPv3 */
551 #define LDAP_ALIAS_DEREF_PROBLEM        0x24
552
553 #define LDAP_SECURITY_ERROR(n)  LDAP_RANGE((n),0x2F,0x32) /* 47-50 */
554
555 #define LDAP_X_PROXY_AUTHZ_FAILURE      0x2F /* LDAPv3 proxy authorization */
556 #define LDAP_INAPPROPRIATE_AUTH         0x30
557 #define LDAP_INVALID_CREDENTIALS        0x31
558 #define LDAP_INSUFFICIENT_ACCESS        0x32
559
560 #define LDAP_SERVICE_ERROR(n)   LDAP_RANGE((n),0x33,0x36) /* 51-54 */
561
562 #define LDAP_BUSY                                       0x33
563 #define LDAP_UNAVAILABLE                        0x34
564 #define LDAP_UNWILLING_TO_PERFORM       0x35
565 #define LDAP_LOOP_DETECT                        0x36
566
567 #define LDAP_UPDATE_ERROR(n)    LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
568
569 #define LDAP_NAMING_VIOLATION           0x40
570 #define LDAP_OBJECT_CLASS_VIOLATION     0x41
571 #define LDAP_NOT_ALLOWED_ON_NONLEAF     0x42
572 #define LDAP_NOT_ALLOWED_ON_RDN         0x43
573 #define LDAP_ALREADY_EXISTS                     0x44
574 #define LDAP_NO_OBJECT_CLASS_MODS       0x45
575 #define LDAP_RESULTS_TOO_LARGE          0x46 /* CLDAP */
576 #define LDAP_AFFECTS_MULTIPLE_DSAS      0x47
577
578 #define LDAP_OTHER                                      0x50
579
580 /* LCUP operation codes (113-117) - not implemented */
581 #define LDAP_CUP_RESOURCES_EXHAUSTED    0x71
582 #define LDAP_CUP_SECURITY_VIOLATION             0x72
583 #define LDAP_CUP_INVALID_DATA                   0x73
584 #define LDAP_CUP_UNSUPPORTED_SCHEME             0x74
585 #define LDAP_CUP_RELOAD_REQUIRED                0x75
586
587 /* Cancel operation codes (118-121) */
588 #define LDAP_CANCELLED                          0x76
589 #define LDAP_NO_SUCH_OPERATION          0x77
590 #define LDAP_TOO_LATE                           0x78
591 #define LDAP_CANNOT_CANCEL                      0x79
592
593 /* Assertion control (122) */ 
594 #define LDAP_ASSERTION_FAILED           0x7A
595
596 /* Proxied Authorization Denied (123) */ 
597 #define LDAP_PROXIED_AUTHORIZATION_DENIED               0x7B
598
599 /* Experimental result codes */
600 #define LDAP_E_ERROR(n) LDAP_RANGE((n),0x1000,0x3FFF)
601
602 /* LDAP Sync (4096) */
603 #define LDAP_SYNC_REFRESH_REQUIRED              0x1000
604
605
606 /* Private Use result codes */
607 #define LDAP_X_ERROR(n) LDAP_RANGE((n),0x4000,0xFFFF)
608
609 #define LDAP_X_SYNC_REFRESH_REQUIRED    0x4100 /* defunct */
610 #define LDAP_X_ASSERTION_FAILED                 0x410f /* defunct */
611
612 /* for the LDAP No-Op control */
613 #define LDAP_X_NO_OPERATION                             0x410e
614
615 /* for the Chaining Behavior control (consecutive result codes requested;
616  * see <draft-sermersheim-ldap-chaining> ) */
617 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
618 #define LDAP_X_NO_REFERRALS_FOUND               0x4110
619 #define LDAP_X_CANNOT_CHAIN                     0x4111
620 #endif
621
622 /* for Distributed Procedures (see <draft-sermersheim-ldap-distproc>) */
623 #ifdef LDAP_X_DISTPROC_BASE
624 #define LDAP_X_INVALIDREFERENCE                 0x4112
625 #endif
626
627 #ifdef LDAP_X_TXN
628 #define LDAP_X_TXN_SPECIFY_OKAY         0x4120
629 #define LDAP_X_TXN_ID_INVALID           0x4121
630 #endif
631
632 /* API Error Codes
633  *
634  * Based on draft-ietf-ldap-c-api-xx
635  * but with new negative code values
636  */
637 #define LDAP_API_ERROR(n)               ((n)<0)
638 #define LDAP_API_RESULT(n)              ((n)<=0)
639
640 #define LDAP_SERVER_DOWN                                (-1)
641 #define LDAP_LOCAL_ERROR                                (-2)
642 #define LDAP_ENCODING_ERROR                             (-3)
643 #define LDAP_DECODING_ERROR                             (-4)
644 #define LDAP_TIMEOUT                                    (-5)
645 #define LDAP_AUTH_UNKNOWN                               (-6)
646 #define LDAP_FILTER_ERROR                               (-7)
647 #define LDAP_USER_CANCELLED                             (-8)
648 #define LDAP_PARAM_ERROR                                (-9)
649 #define LDAP_NO_MEMORY                                  (-10)
650 #define LDAP_CONNECT_ERROR                              (-11)
651 #define LDAP_NOT_SUPPORTED                              (-12)
652 #define LDAP_CONTROL_NOT_FOUND                  (-13)
653 #define LDAP_NO_RESULTS_RETURNED                (-14)
654 #define LDAP_MORE_RESULTS_TO_RETURN             (-15)   /* Obsolete */
655 #define LDAP_CLIENT_LOOP                                (-16)
656 #define LDAP_REFERRAL_LIMIT_EXCEEDED    (-17)
657 #define LDAP_X_CONNECTING                       (-18)
658
659
660 /*
661  * This structure represents both ldap messages and ldap responses.
662  * These are really the same, except in the case of search responses,
663  * where a response has multiple messages.
664  */
665
666 typedef struct ldapmsg LDAPMessage;
667
668 /* for modifications */
669 typedef struct ldapmod {
670         int             mod_op;
671
672 #define LDAP_MOD_OP                     (0x0007)
673 #define LDAP_MOD_ADD            (0x0000)
674 #define LDAP_MOD_DELETE         (0x0001)
675 #define LDAP_MOD_REPLACE        (0x0002)
676 #define LDAP_MOD_INCREMENT      (0x0003) /* OpenLDAP extension */
677 #define LDAP_MOD_BVALUES        (0x0080)
678 /* IMPORTANT: do not use code 0x1000 (or above),
679  * it is used internally by the backends!
680  * (see ldap/servers/slapd/slap.h)
681  */
682
683         char            *mod_type;
684         union mod_vals_u {
685                 char            **modv_strvals;
686                 struct berval   **modv_bvals;
687         } mod_vals;
688 #define mod_values      mod_vals.modv_strvals
689 #define mod_bvalues     mod_vals.modv_bvals
690 } LDAPMod;
691
692 /*
693  * structure representing an ldap session which can
694  * encompass connections to multiple servers (in the
695  * face of referrals).
696  */
697 typedef struct ldap LDAP;
698
699 #define LDAP_DEREF_NEVER                0x00
700 #define LDAP_DEREF_SEARCHING    0x01
701 #define LDAP_DEREF_FINDING              0x02
702 #define LDAP_DEREF_ALWAYS               0x03
703
704 #define LDAP_NO_LIMIT                   0
705
706 /* how many messages to retrieve results for */
707 #define LDAP_MSG_ONE                    0x00
708 #define LDAP_MSG_ALL                    0x01
709 #define LDAP_MSG_RECEIVED               0x02
710
711 /*
712  * types for ldap URL handling
713  */
714 typedef struct ldap_url_desc {
715         struct ldap_url_desc *lud_next;
716         char    *lud_scheme;
717         char    *lud_host;
718         int             lud_port;
719         char    *lud_dn;
720         char    **lud_attrs;
721         int             lud_scope;
722         char    *lud_filter;
723         char    **lud_exts;
724         int             lud_crit_exts;
725 } LDAPURLDesc;
726
727 #define LDAP_URL_SUCCESS                0x00    /* Success */
728 #define LDAP_URL_ERR_MEM                0x01    /* can't allocate memory space */
729 #define LDAP_URL_ERR_PARAM              0x02    /* parameter is bad */
730
731 #define LDAP_URL_ERR_BADSCHEME  0x03    /* URL doesn't begin with "ldap[si]://" */
732 #define LDAP_URL_ERR_BADENCLOSURE 0x04  /* URL is missing trailing ">" */
733 #define LDAP_URL_ERR_BADURL             0x05    /* URL is bad */
734 #define LDAP_URL_ERR_BADHOST    0x06    /* host port is bad */
735 #define LDAP_URL_ERR_BADATTRS   0x07    /* bad (or missing) attributes */
736 #define LDAP_URL_ERR_BADSCOPE   0x08    /* scope string is invalid (or missing) */
737 #define LDAP_URL_ERR_BADFILTER  0x09    /* bad or missing filter */
738 #define LDAP_URL_ERR_BADEXTS    0x0a    /* bad or missing extensions */
739
740 /*
741  * LDAP sync (RFC4533) API
742  */
743
744 typedef struct ldap_sync_t ldap_sync_t;
745
746 typedef enum {
747         /* these are private - the client should never see them */
748         LDAP_SYNC_CAPI_NONE             = -1,
749
750         LDAP_SYNC_CAPI_PHASE_FLAG       = 0x10U,
751         LDAP_SYNC_CAPI_IDSET_FLAG       = 0x20U,
752         LDAP_SYNC_CAPI_DONE_FLAG        = 0x40U,
753
754         /* these are passed to ls_search_entry() */
755         LDAP_SYNC_CAPI_PRESENT          = LDAP_SYNC_PRESENT,
756         LDAP_SYNC_CAPI_ADD              = LDAP_SYNC_ADD,
757         LDAP_SYNC_CAPI_MODIFY           = LDAP_SYNC_MODIFY,
758         LDAP_SYNC_CAPI_DELETE           = LDAP_SYNC_DELETE,
759
760         /* these are passed to ls_intermediate() */
761         LDAP_SYNC_CAPI_PRESENTS         = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_PRESENT ),
762         LDAP_SYNC_CAPI_DELETES          = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_DELETE ),
763
764         LDAP_SYNC_CAPI_PRESENTS_IDSET   = ( LDAP_SYNC_CAPI_PRESENTS | LDAP_SYNC_CAPI_IDSET_FLAG ),
765         LDAP_SYNC_CAPI_DELETES_IDSET    = ( LDAP_SYNC_CAPI_DELETES | LDAP_SYNC_CAPI_IDSET_FLAG ),
766
767         LDAP_SYNC_CAPI_DONE             = ( LDAP_SYNC_CAPI_DONE_FLAG | LDAP_SYNC_CAPI_PRESENTS )
768 } ldap_sync_refresh_t;
769
770 /*
771  * Called when an entry is returned by ldap_result().
772  * If phase is LDAP_SYNC_CAPI_ADD or LDAP_SYNC_CAPI_MODIFY,
773  * the entry has been either added or modified, and thus
774  * the complete view of the entry should be in the LDAPMessage.
775  * If phase is LDAP_SYNC_CAPI_PRESENT or LDAP_SYNC_CAPI_DELETE,
776  * only the DN should be in the LDAPMessage.
777  */
778 typedef int (*ldap_sync_search_entry_f) LDAP_P((
779         ldap_sync_t                     *ls,
780         LDAPMessage                     *msg,
781         struct berval                   *entryUUID,
782         ldap_sync_refresh_t             phase ));
783
784 /*
785  * Called when a reference is returned; the client should know 
786  * what to do with it.
787  */
788 typedef int (*ldap_sync_search_reference_f) LDAP_P((
789         ldap_sync_t                     *ls,
790         LDAPMessage                     *msg ));
791
792 /*
793  * Called when specific intermediate/final messages are returned.
794  * If phase is LDAP_SYNC_CAPI_PRESENTS or LDAP_SYNC_CAPI_DELETES,
795  * a "presents" or "deletes" phase begins.
796  * If phase is LDAP_SYNC_CAPI_DONE, a special "presents" phase
797  * with refreshDone set to "TRUE" has been returned, to indicate
798  * that the refresh phase of a refreshAndPersist is complete.
799  * In the above cases, syncUUIDs is NULL.
800  *
801  * If phase is LDAP_SYNC_CAPI_PRESENTS_IDSET or 
802  * LDAP_SYNC_CAPI_DELETES_IDSET, syncUUIDs is an array of UUIDs
803  * that are either present or have been deleted.
804  */
805 typedef int (*ldap_sync_intermediate_f) LDAP_P((
806         ldap_sync_t                     *ls,
807         LDAPMessage                     *msg,
808         BerVarray                       syncUUIDs,
809         ldap_sync_refresh_t             phase ));
810
811 /*
812  * Called when a searchResultDone is returned.  In refreshAndPersist,
813  * this can only occur if the search for any reason is being terminated
814  * by the server.
815  */
816 typedef int (*ldap_sync_search_result_f) LDAP_P((
817         ldap_sync_t                     *ls,
818         LDAPMessage                     *msg,
819         int                             refreshDeletes ));
820
821 /*
822  * This structure contains all information about the persistent search;
823  * the caller is responsible for connecting, setting version, binding, tls...
824  */
825 struct ldap_sync_t {
826         /* conf search params */
827         char                            *ls_base;
828         int                             ls_scope;
829         char                            *ls_filter;
830         char                            **ls_attrs;
831         int                             ls_timelimit;
832         int                             ls_sizelimit;
833
834         /* poll timeout */
835         int                             ls_timeout;
836
837         /* helpers - add as appropriate */
838         ldap_sync_search_entry_f        ls_search_entry;
839         ldap_sync_search_reference_f    ls_search_reference;
840         ldap_sync_intermediate_f        ls_intermediate;
841         ldap_sync_search_result_f       ls_search_result;
842
843         /* set by the caller as appropriate */
844         void                            *ls_private;
845
846         /* conn stuff */
847         LDAP                            *ls_ld;
848
849         /* --- the parameters below are private - do not modify --- */
850
851         /* FIXME: make the structure opaque, and provide an interface
852          * to modify the public values? */
853
854         /* result stuff */
855         int                             ls_msgid;
856
857         /* sync stuff */
858         /* needed by refreshOnly */
859         int                             ls_reloadHint;
860
861         /* opaque - need to pass between sessions, updated by the API */
862         struct berval                   ls_cookie;
863
864         /* state variable - do not modify */
865         ldap_sync_refresh_t             ls_refreshPhase;
866 };
867
868 /*
869  * End of LDAP sync (RFC4533) API
870  */
871
872 /*
873  * The API draft spec says we should declare (or cause to be declared)
874  * 'struct timeval'.   We don't.  See IETF LDAPext discussions.
875  */
876 struct timeval;
877
878 /*
879  * in options.c:
880  */
881 LDAP_F( int )
882 ldap_get_option LDAP_P((
883         LDAP *ld,
884         int option,
885         void *outvalue));
886
887 LDAP_F( int )
888 ldap_set_option LDAP_P((
889         LDAP *ld,
890         int option,
891         LDAP_CONST void *invalue));
892
893 /* V3 REBIND Function Callback Prototype */
894 typedef int (LDAP_REBIND_PROC) LDAP_P((
895         LDAP *ld, LDAP_CONST char *url,
896         ber_tag_t request, ber_int_t msgid,
897         void *params ));
898
899 LDAP_F( int )
900 ldap_set_rebind_proc LDAP_P((
901         LDAP *ld,
902         LDAP_REBIND_PROC *rebind_proc,
903         void *params ));
904
905 /* V3 referral selection Function Callback Prototype */
906 typedef int (LDAP_NEXTREF_PROC) LDAP_P((
907         LDAP *ld, char ***refsp, int *cntp,
908         void *params ));
909
910 LDAP_F( int )
911 ldap_set_nextref_proc LDAP_P((
912         LDAP *ld,
913         LDAP_NEXTREF_PROC *nextref_proc,
914         void *params ));
915
916 /* V3 URLLIST Function Callback Prototype */
917 typedef int (LDAP_URLLIST_PROC) LDAP_P((
918         LDAP *ld, 
919         LDAPURLDesc **urllist,
920         LDAPURLDesc **url,
921         void *params ));
922
923 LDAP_F( int )
924 ldap_set_urllist_proc LDAP_P((
925         LDAP *ld,
926         LDAP_URLLIST_PROC *urllist_proc,
927         void *params ));
928
929 /*
930  * in controls.c:
931  */
932 LDAP_F( int )
933 ldap_create_control LDAP_P((
934         LDAP_CONST char *requestOID,
935         BerElement *ber,
936         int iscritical,
937         LDAPControl **ctrlp ));
938
939 LDAP_F( LDAPControl * )
940 ldap_find_control LDAP_P((
941         LDAP_CONST char *oid,
942         LDAPControl **ctrls ));
943
944 LDAP_F( void )
945 ldap_control_free LDAP_P((
946         LDAPControl *ctrl ));
947
948 LDAP_F( void )
949 ldap_controls_free LDAP_P((
950         LDAPControl **ctrls ));
951
952 /*
953  * in dnssrv.c:
954  */
955 LDAP_F( int )
956 ldap_domain2dn LDAP_P((
957         LDAP_CONST char* domain,
958         char** dn ));
959
960 LDAP_F( int )
961 ldap_dn2domain LDAP_P((
962         LDAP_CONST char* dn,
963         char** domain ));
964
965 LDAP_F( int )
966 ldap_domain2hostlist LDAP_P((
967         LDAP_CONST char *domain,
968         char** hostlist ));
969
970 /*
971  * in extended.c:
972  */
973 LDAP_F( int )
974 ldap_extended_operation LDAP_P((
975         LDAP                    *ld,
976         LDAP_CONST char *reqoid,
977         struct berval   *reqdata,
978         LDAPControl             **serverctrls,
979         LDAPControl             **clientctrls,
980         int                             *msgidp ));
981
982 LDAP_F( int )
983 ldap_extended_operation_s LDAP_P((
984         LDAP                    *ld,
985         LDAP_CONST char *reqoid,
986         struct berval   *reqdata,
987         LDAPControl             **serverctrls,
988         LDAPControl             **clientctrls,
989         char                    **retoidp,
990         struct berval   **retdatap ));
991
992 LDAP_F( int )
993 ldap_parse_extended_result LDAP_P((
994         LDAP                    *ld,
995         LDAPMessage             *res,
996         char                    **retoidp,
997         struct berval   **retdatap,
998         int                             freeit ));
999
1000 LDAP_F( int )
1001 ldap_parse_intermediate LDAP_P((
1002         LDAP                    *ld,
1003         LDAPMessage             *res,
1004         char                    **retoidp,
1005         struct berval   **retdatap,
1006         LDAPControl             ***serverctrls,
1007         int                             freeit ));
1008
1009
1010 /*
1011  * in abandon.c:
1012  */
1013 LDAP_F( int )
1014 ldap_abandon_ext LDAP_P((
1015         LDAP                    *ld,
1016         int                             msgid,
1017         LDAPControl             **serverctrls,
1018         LDAPControl             **clientctrls ));
1019
1020 #if LDAP_DEPRECATED     
1021 LDAP_F( int )
1022 ldap_abandon LDAP_P((   /* deprecated, use ldap_abandon_ext */
1023         LDAP *ld,
1024         int msgid ));
1025 #endif
1026
1027 /*
1028  * in add.c:
1029  */
1030 LDAP_F( int )
1031 ldap_add_ext LDAP_P((
1032         LDAP                    *ld,
1033         LDAP_CONST char *dn,
1034         LDAPMod                 **attrs,
1035         LDAPControl             **serverctrls,
1036         LDAPControl             **clientctrls,
1037         int                     *msgidp ));
1038
1039 LDAP_F( int )
1040 ldap_add_ext_s LDAP_P((
1041         LDAP                    *ld,
1042         LDAP_CONST char *dn,
1043         LDAPMod                 **attrs,
1044         LDAPControl             **serverctrls,
1045         LDAPControl             **clientctrls ));
1046
1047 #if LDAP_DEPRECATED
1048 LDAP_F( int )
1049 ldap_add LDAP_P((       /* deprecated, use ldap_add_ext */
1050         LDAP *ld,
1051         LDAP_CONST char *dn,
1052         LDAPMod **attrs ));
1053
1054 LDAP_F( int )
1055 ldap_add_s LDAP_P((     /* deprecated, use ldap_add_ext_s */
1056         LDAP *ld,
1057         LDAP_CONST char *dn,
1058         LDAPMod **attrs ));
1059 #endif
1060
1061
1062 /*
1063  * in sasl.c:
1064  */
1065 LDAP_F( int )
1066 ldap_sasl_bind LDAP_P((
1067         LDAP                    *ld,
1068         LDAP_CONST char *dn,
1069         LDAP_CONST char *mechanism,
1070         struct berval   *cred,
1071         LDAPControl             **serverctrls,
1072         LDAPControl             **clientctrls,
1073         int                             *msgidp ));
1074
1075 /* Interaction flags (should be passed about in a control)
1076  *  Automatic (default): use defaults, prompt otherwise
1077  *  Interactive: prompt always
1078  *  Quiet: never prompt
1079  */
1080 #define LDAP_SASL_AUTOMATIC             0U
1081 #define LDAP_SASL_INTERACTIVE   1U
1082 #define LDAP_SASL_QUIET                 2U
1083
1084 /*
1085  * V3 SASL Interaction Function Callback Prototype
1086  *      when using Cyrus SASL, interact is pointer to sasl_interact_t
1087  *  should likely passed in a control (and provided controls)
1088  */
1089 typedef int (LDAP_SASL_INTERACT_PROC) LDAP_P((
1090         LDAP *ld, unsigned flags, void* defaults, void *interact ));
1091
1092 LDAP_F( int )
1093 ldap_sasl_interactive_bind_s LDAP_P((
1094         LDAP *ld,
1095         LDAP_CONST char *dn, /* usually NULL */
1096         LDAP_CONST char *saslMechanism,
1097         LDAPControl **serverControls,
1098         LDAPControl **clientControls,
1099
1100         /* should be client controls */
1101         unsigned flags,
1102         LDAP_SASL_INTERACT_PROC *proc,
1103         void *defaults ));
1104
1105 LDAP_F( int )
1106 ldap_sasl_bind_s LDAP_P((
1107         LDAP                    *ld,
1108         LDAP_CONST char *dn,
1109         LDAP_CONST char *mechanism,
1110         struct berval   *cred,
1111         LDAPControl             **serverctrls,
1112         LDAPControl             **clientctrls,
1113         struct berval   **servercredp ));
1114
1115 LDAP_F( int )
1116 ldap_parse_sasl_bind_result LDAP_P((
1117         LDAP                    *ld,
1118         LDAPMessage             *res,
1119         struct berval   **servercredp,
1120         int                             freeit ));
1121
1122 #if LDAP_DEPRECATED
1123 /*
1124  * in bind.c:
1125  *      (deprecated)
1126  */
1127 LDAP_F( int )
1128 ldap_bind LDAP_P((      /* deprecated, use ldap_sasl_bind */
1129         LDAP *ld,
1130         LDAP_CONST char *who,
1131         LDAP_CONST char *passwd,
1132         int authmethod ));
1133
1134 LDAP_F( int )
1135 ldap_bind_s LDAP_P((    /* deprecated, use ldap_sasl_bind_s */
1136         LDAP *ld,
1137         LDAP_CONST char *who,
1138         LDAP_CONST char *cred,
1139         int authmethod ));
1140
1141 /*
1142  * in sbind.c:
1143  */
1144 LDAP_F( int )
1145 ldap_simple_bind LDAP_P(( /* deprecated, use ldap_sasl_bind */
1146         LDAP *ld,
1147         LDAP_CONST char *who,
1148         LDAP_CONST char *passwd ));
1149
1150 LDAP_F( int )
1151 ldap_simple_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */
1152         LDAP *ld,
1153         LDAP_CONST char *who,
1154         LDAP_CONST char *passwd ));
1155
1156
1157 /*
1158  * in kbind.c:
1159  *      (deprecated - use SASL instead)
1160  */
1161 LDAP_F( int )
1162 ldap_kerberos_bind_s LDAP_P((   /* deprecated */
1163         LDAP *ld,
1164         LDAP_CONST char *who ));
1165
1166 LDAP_F( int )
1167 ldap_kerberos_bind1 LDAP_P((    /* deprecated */
1168         LDAP *ld,
1169         LDAP_CONST char *who ));
1170
1171 LDAP_F( int )
1172 ldap_kerberos_bind1_s LDAP_P((  /* deprecated */
1173         LDAP *ld,
1174         LDAP_CONST char *who ));
1175
1176 LDAP_F( int )
1177 ldap_kerberos_bind2 LDAP_P((    /* deprecated */
1178         LDAP *ld,
1179         LDAP_CONST char *who ));
1180
1181 LDAP_F( int )
1182 ldap_kerberos_bind2_s LDAP_P((  /* deprecated */
1183         LDAP *ld,
1184         LDAP_CONST char *who ));
1185 #endif
1186
1187
1188 /*
1189  * in compare.c:
1190  */
1191 LDAP_F( int )
1192 ldap_compare_ext LDAP_P((
1193         LDAP                    *ld,
1194         LDAP_CONST char *dn,
1195         LDAP_CONST char *attr,
1196         struct berval   *bvalue,
1197         LDAPControl             **serverctrls,
1198         LDAPControl             **clientctrls,
1199         int                     *msgidp ));
1200
1201 LDAP_F( int )
1202 ldap_compare_ext_s LDAP_P((
1203         LDAP                    *ld,
1204         LDAP_CONST char *dn,
1205         LDAP_CONST char *attr,
1206         struct berval   *bvalue,
1207         LDAPControl             **serverctrls,
1208         LDAPControl             **clientctrls ));
1209
1210 #if LDAP_DEPRECATED
1211 LDAP_F( int )
1212 ldap_compare LDAP_P((   /* deprecated, use ldap_compare_ext */
1213         LDAP *ld,
1214         LDAP_CONST char *dn,
1215         LDAP_CONST char *attr,
1216         LDAP_CONST char *value ));
1217
1218 LDAP_F( int )
1219 ldap_compare_s LDAP_P(( /* deprecated, use ldap_compare_ext_s */
1220         LDAP *ld,
1221         LDAP_CONST char *dn,
1222         LDAP_CONST char *attr,
1223         LDAP_CONST char *value ));
1224 #endif
1225
1226
1227 /*
1228  * in delete.c:
1229  */
1230 LDAP_F( int )
1231 ldap_delete_ext LDAP_P((
1232         LDAP                    *ld,
1233         LDAP_CONST char *dn,
1234         LDAPControl             **serverctrls,
1235         LDAPControl             **clientctrls,
1236         int                     *msgidp ));
1237
1238 LDAP_F( int )
1239 ldap_delete_ext_s LDAP_P((
1240         LDAP                    *ld,
1241         LDAP_CONST char *dn,
1242         LDAPControl             **serverctrls,
1243         LDAPControl             **clientctrls ));
1244
1245 #if LDAP_DEPRECATED
1246 LDAP_F( int )
1247 ldap_delete LDAP_P((    /* deprecated, use ldap_delete_ext */
1248         LDAP *ld,
1249         LDAP_CONST char *dn ));
1250
1251 LDAP_F( int )
1252 ldap_delete_s LDAP_P((  /* deprecated, use ldap_delete_ext_s */
1253         LDAP *ld,
1254         LDAP_CONST char *dn ));
1255 #endif
1256
1257
1258 /*
1259  * in error.c:
1260  */
1261 LDAP_F( int )
1262 ldap_parse_result LDAP_P((
1263         LDAP                    *ld,
1264         LDAPMessage             *res,
1265         int                             *errcodep,
1266         char                    **matcheddnp,
1267         char                    **errmsgp,
1268         char                    ***referralsp,
1269         LDAPControl             ***serverctrls,
1270         int                             freeit ));
1271
1272 LDAP_F( char * )
1273 ldap_err2string LDAP_P((
1274         int err ));
1275
1276 #if LDAP_DEPRECATED
1277 LDAP_F( int )
1278 ldap_result2error LDAP_P((      /* deprecated, use ldap_parse_result */
1279         LDAP *ld,
1280         LDAPMessage *r,
1281         int freeit ));
1282
1283 LDAP_F( void )
1284 ldap_perror LDAP_P((    /* deprecated, use ldap_err2string */
1285         LDAP *ld,
1286         LDAP_CONST char *s ));
1287 #endif
1288
1289
1290 /*
1291  * in modify.c:
1292  */
1293 LDAP_F( int )
1294 ldap_modify_ext LDAP_P((
1295         LDAP                    *ld,
1296         LDAP_CONST char *dn,
1297         LDAPMod                 **mods,
1298         LDAPControl             **serverctrls,
1299         LDAPControl             **clientctrls,
1300         int                     *msgidp ));
1301
1302 LDAP_F( int )
1303 ldap_modify_ext_s LDAP_P((
1304         LDAP                    *ld,
1305         LDAP_CONST char *dn,
1306         LDAPMod                 **mods,
1307         LDAPControl             **serverctrls,
1308         LDAPControl             **clientctrls ));
1309
1310 #if LDAP_DEPRECATED
1311 LDAP_F( int )
1312 ldap_modify LDAP_P((    /* deprecated, use ldap_modify_ext */
1313         LDAP *ld,
1314         LDAP_CONST char *dn,
1315         LDAPMod **mods ));
1316
1317 LDAP_F( int )
1318 ldap_modify_s LDAP_P((  /* deprecated, use ldap_modify_ext_s */
1319         LDAP *ld,
1320         LDAP_CONST char *dn,
1321         LDAPMod **mods ));
1322 #endif
1323
1324
1325 /*
1326  * in modrdn.c:
1327  */
1328 LDAP_F( int )
1329 ldap_rename LDAP_P((
1330         LDAP *ld,
1331         LDAP_CONST char *dn,
1332         LDAP_CONST char *newrdn,
1333         LDAP_CONST char *newSuperior,
1334         int deleteoldrdn,
1335         LDAPControl **sctrls,
1336         LDAPControl **cctrls,
1337         int *msgidp ));
1338
1339 LDAP_F( int )
1340 ldap_rename_s LDAP_P((
1341         LDAP *ld,
1342         LDAP_CONST char *dn,
1343         LDAP_CONST char *newrdn,
1344         LDAP_CONST char *newSuperior,
1345         int deleteoldrdn,
1346         LDAPControl **sctrls,
1347         LDAPControl **cctrls ));
1348
1349 #if LDAP_DEPRECATED
1350 LDAP_F( int )
1351 ldap_rename2 LDAP_P((   /* deprecated, use ldap_rename */
1352         LDAP *ld,
1353         LDAP_CONST char *dn,
1354         LDAP_CONST char *newrdn,
1355         LDAP_CONST char *newSuperior,
1356         int deleteoldrdn ));
1357
1358 LDAP_F( int )
1359 ldap_rename2_s LDAP_P(( /* deprecated, use ldap_rename_s */
1360         LDAP *ld,
1361         LDAP_CONST char *dn,
1362         LDAP_CONST char *newrdn,
1363         LDAP_CONST char *newSuperior,
1364         int deleteoldrdn ));
1365
1366 LDAP_F( int )
1367 ldap_modrdn LDAP_P((    /* deprecated, use ldap_rename */
1368         LDAP *ld,
1369         LDAP_CONST char *dn,
1370         LDAP_CONST char *newrdn ));
1371
1372 LDAP_F( int )
1373 ldap_modrdn_s LDAP_P((  /* deprecated, use ldap_rename_s */
1374         LDAP *ld,
1375         LDAP_CONST char *dn,
1376         LDAP_CONST char *newrdn ));
1377
1378 LDAP_F( int )
1379 ldap_modrdn2 LDAP_P((   /* deprecated, use ldap_rename */
1380         LDAP *ld,
1381         LDAP_CONST char *dn,
1382         LDAP_CONST char *newrdn,
1383         int deleteoldrdn ));
1384
1385 LDAP_F( int )
1386 ldap_modrdn2_s LDAP_P(( /* deprecated, use ldap_rename_s */
1387         LDAP *ld,
1388         LDAP_CONST char *dn,
1389         LDAP_CONST char *newrdn,
1390         int deleteoldrdn));
1391 #endif
1392
1393
1394 /*
1395  * in open.c:
1396  */
1397 #if LDAP_DEPRECATED
1398 LDAP_F( LDAP * )
1399 ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */
1400         LDAP_CONST char *host,
1401         int port ));
1402
1403 LDAP_F( LDAP * )
1404 ldap_open LDAP_P((      /* deprecated, use ldap_create or ldap_initialize */
1405         LDAP_CONST char *host,
1406         int port ));
1407 #endif
1408
1409 LDAP_F( int )
1410 ldap_create LDAP_P((
1411         LDAP **ldp ));
1412
1413 LDAP_F( int )
1414 ldap_initialize LDAP_P((
1415         LDAP **ldp,
1416         LDAP_CONST char *url ));
1417
1418 /*
1419  * in tls.c
1420  */
1421
1422 LDAP_F( int )
1423 ldap_tls_inplace LDAP_P((
1424         LDAP *ld ));
1425
1426 LDAP_F( int )
1427 ldap_start_tls LDAP_P((
1428         LDAP *ld,
1429         LDAPControl **serverctrls,
1430         LDAPControl **clientctrls,
1431         int *msgidp ));
1432
1433 LDAP_F( int )
1434 ldap_install_tls LDAP_P((
1435         LDAP *ld ));
1436
1437 LDAP_F( int )
1438 ldap_start_tls_s LDAP_P((
1439         LDAP *ld,
1440         LDAPControl **serverctrls,
1441         LDAPControl **clientctrls ));
1442
1443 /*
1444  * in messages.c:
1445  */
1446 LDAP_F( LDAPMessage * )
1447 ldap_first_message LDAP_P((
1448         LDAP *ld,
1449         LDAPMessage *chain ));
1450
1451 LDAP_F( LDAPMessage * )
1452 ldap_next_message LDAP_P((
1453         LDAP *ld,
1454         LDAPMessage *msg ));
1455
1456 LDAP_F( int )
1457 ldap_count_messages LDAP_P((
1458         LDAP *ld,
1459         LDAPMessage *chain ));
1460
1461 /*
1462  * in references.c:
1463  */
1464 LDAP_F( LDAPMessage * )
1465 ldap_first_reference LDAP_P((
1466         LDAP *ld,
1467         LDAPMessage *chain ));
1468
1469 LDAP_F( LDAPMessage * )
1470 ldap_next_reference LDAP_P((
1471         LDAP *ld,
1472         LDAPMessage *ref ));
1473
1474 LDAP_F( int )
1475 ldap_count_references LDAP_P((
1476         LDAP *ld,
1477         LDAPMessage *chain ));
1478
1479 LDAP_F( int )
1480 ldap_parse_reference LDAP_P((
1481         LDAP                    *ld,
1482         LDAPMessage             *ref,
1483         char                    ***referralsp,
1484         LDAPControl             ***serverctrls,
1485         int                             freeit));
1486
1487
1488 /*
1489  * in getentry.c:
1490  */
1491 LDAP_F( LDAPMessage * )
1492 ldap_first_entry LDAP_P((
1493         LDAP *ld,
1494         LDAPMessage *chain ));
1495
1496 LDAP_F( LDAPMessage * )
1497 ldap_next_entry LDAP_P((
1498         LDAP *ld,
1499         LDAPMessage *entry ));
1500
1501 LDAP_F( int )
1502 ldap_count_entries LDAP_P((
1503         LDAP *ld,
1504         LDAPMessage *chain ));
1505
1506 LDAP_F( int )
1507 ldap_get_entry_controls LDAP_P((
1508         LDAP                    *ld,
1509         LDAPMessage             *entry,
1510         LDAPControl             ***serverctrls));
1511
1512
1513 /*
1514  * in addentry.c
1515  */
1516 LDAP_F( LDAPMessage * )
1517 ldap_delete_result_entry LDAP_P((
1518         LDAPMessage **list,
1519         LDAPMessage *e ));
1520
1521 LDAP_F( void )
1522 ldap_add_result_entry LDAP_P((
1523         LDAPMessage **list,
1524         LDAPMessage *e ));
1525
1526
1527 /*
1528  * in getdn.c
1529  */
1530 LDAP_F( char * )
1531 ldap_get_dn LDAP_P((
1532         LDAP *ld,
1533         LDAPMessage *entry ));
1534
1535 typedef struct ldap_ava {
1536         struct berval la_attr;
1537         struct berval la_value;
1538         unsigned la_flags;
1539 #define LDAP_AVA_NULL                           0x0000U
1540 #define LDAP_AVA_STRING                         0x0001U
1541 #define LDAP_AVA_BINARY                         0x0002U
1542 #define LDAP_AVA_NONPRINTABLE           0x0004U
1543 #define LDAP_AVA_FREE_ATTR                      0x0010U
1544 #define LDAP_AVA_FREE_VALUE                     0x0020U
1545
1546         void *la_private;
1547 } LDAPAVA;
1548
1549 typedef LDAPAVA** LDAPRDN;
1550 typedef LDAPRDN* LDAPDN;
1551
1552 /* DN formats */
1553 #define LDAP_DN_FORMAT_LDAP                     0x0000U
1554 #define LDAP_DN_FORMAT_LDAPV3           0x0010U
1555 #define LDAP_DN_FORMAT_LDAPV2           0x0020U
1556 #define LDAP_DN_FORMAT_DCE                      0x0030U
1557 #define LDAP_DN_FORMAT_UFN                      0x0040U /* dn2str only */
1558 #define LDAP_DN_FORMAT_AD_CANONICAL     0x0050U /* dn2str only */
1559 #define LDAP_DN_FORMAT_LBER                     0x00F0U /* for testing only */
1560 #define LDAP_DN_FORMAT_MASK                     0x00F0U
1561
1562 /* DN flags */
1563 #define LDAP_DN_PRETTY                          0x0100U
1564 #define LDAP_DN_SKIP                            0x0200U
1565 #define LDAP_DN_P_NOLEADTRAILSPACES     0x1000U
1566 #define LDAP_DN_P_NOSPACEAFTERRDN       0x2000U
1567 #define LDAP_DN_PEDANTIC                        0xF000U
1568
1569 LDAP_F( void ) ldap_rdnfree LDAP_P(( LDAPRDN rdn ));
1570 LDAP_F( void ) ldap_dnfree LDAP_P(( LDAPDN dn ));
1571
1572 LDAP_F( int )
1573 ldap_bv2dn LDAP_P(( 
1574         struct berval *bv, 
1575         LDAPDN *dn, 
1576         unsigned flags ));
1577
1578 LDAP_F( int )
1579 ldap_str2dn LDAP_P((
1580         LDAP_CONST char *str,
1581         LDAPDN *dn,
1582         unsigned flags ));
1583
1584 LDAP_F( int )
1585 ldap_dn2bv LDAP_P((
1586         LDAPDN dn,
1587         struct berval *bv,
1588         unsigned flags ));
1589
1590 LDAP_F( int )
1591 ldap_dn2str LDAP_P((
1592         LDAPDN dn,
1593         char **str,
1594         unsigned flags ));
1595
1596 LDAP_F( int )
1597 ldap_bv2rdn LDAP_P((
1598         struct berval *bv,
1599         LDAPRDN *rdn,
1600         char **next,
1601         unsigned flags ));
1602
1603 LDAP_F( int )
1604 ldap_str2rdn LDAP_P((
1605         LDAP_CONST char *str,
1606         LDAPRDN *rdn,
1607         char **next,
1608         unsigned flags ));
1609
1610 LDAP_F( int )
1611 ldap_rdn2bv LDAP_P((
1612         LDAPRDN rdn,
1613         struct berval *bv,
1614         unsigned flags ));
1615
1616 LDAP_F( int )
1617 ldap_rdn2str LDAP_P((
1618         LDAPRDN rdn,
1619         char **str,
1620         unsigned flags ));
1621
1622 LDAP_F( int )
1623 ldap_dn_normalize LDAP_P((
1624         LDAP_CONST char *in, unsigned iflags,
1625         char **out, unsigned oflags ));
1626
1627 LDAP_F( char * )
1628 ldap_dn2ufn LDAP_P(( /* deprecated, use ldap_str2dn/dn2str */
1629         LDAP_CONST char *dn ));
1630
1631 LDAP_F( char ** )
1632 ldap_explode_dn LDAP_P(( /* deprecated, ldap_str2dn */
1633         LDAP_CONST char *dn,
1634         int notypes ));
1635
1636 LDAP_F( char ** )
1637 ldap_explode_rdn LDAP_P(( /* deprecated, ldap_str2rdn */
1638         LDAP_CONST char *rdn,
1639         int notypes ));
1640
1641 typedef int LDAPDN_rewrite_func
1642         LDAP_P(( LDAPDN dn, unsigned flags, void *ctx ));
1643
1644 LDAP_F( int )
1645 ldap_X509dn2bv LDAP_P(( void *x509_name, struct berval *dn,
1646         LDAPDN_rewrite_func *func, unsigned flags ));
1647
1648 LDAP_F( char * )
1649 ldap_dn2dcedn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
1650         LDAP_CONST char *dn ));
1651
1652 LDAP_F( char * )
1653 ldap_dcedn2dn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
1654         LDAP_CONST char *dce ));
1655
1656 LDAP_F( char * )
1657 ldap_dn2ad_canonical LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
1658         LDAP_CONST char *dn ));
1659
1660 LDAP_F( int )
1661 ldap_get_dn_ber LDAP_P((
1662         LDAP *ld, LDAPMessage *e, BerElement **berout, struct berval *dn ));
1663
1664 LDAP_F( int )
1665 ldap_get_attribute_ber LDAP_P((
1666         LDAP *ld, LDAPMessage *e, BerElement *ber, struct berval *attr,
1667         struct berval **vals ));
1668
1669 /*
1670  * in getattr.c
1671  */
1672 LDAP_F( char * )
1673 ldap_first_attribute LDAP_P((
1674         LDAP *ld,
1675         LDAPMessage *entry,
1676         BerElement **ber ));
1677
1678 LDAP_F( char * )
1679 ldap_next_attribute LDAP_P((
1680         LDAP *ld,
1681         LDAPMessage *entry,
1682         BerElement *ber ));
1683
1684
1685 /*
1686  * in getvalues.c
1687  */
1688 LDAP_F( struct berval ** )
1689 ldap_get_values_len LDAP_P((
1690         LDAP *ld,
1691         LDAPMessage *entry,
1692         LDAP_CONST char *target ));
1693
1694 LDAP_F( int )
1695 ldap_count_values_len LDAP_P((
1696         struct berval **vals ));
1697
1698 LDAP_F( void )
1699 ldap_value_free_len LDAP_P((
1700         struct berval **vals ));
1701
1702 #if LDAP_DEPRECATED
1703 LDAP_F( char ** )
1704 ldap_get_values LDAP_P((        /* deprecated, use ldap_get_values_len */
1705         LDAP *ld,
1706         LDAPMessage *entry,
1707         LDAP_CONST char *target ));
1708
1709 LDAP_F( int )
1710 ldap_count_values LDAP_P((      /* deprecated, use ldap_count_values_len */
1711         char **vals ));
1712
1713 LDAP_F( void )
1714 ldap_value_free LDAP_P((        /* deprecated, use ldap_values_free_len */
1715         char **vals ));
1716 #endif
1717
1718 /*
1719  * in result.c:
1720  */
1721 LDAP_F( int )
1722 ldap_result LDAP_P((
1723         LDAP *ld,
1724         int msgid,
1725         int all,
1726         struct timeval *timeout,
1727         LDAPMessage **result ));
1728
1729 LDAP_F( int )
1730 ldap_msgtype LDAP_P((
1731         LDAPMessage *lm ));
1732
1733 LDAP_F( int )
1734 ldap_msgid   LDAP_P((
1735         LDAPMessage *lm ));
1736
1737 LDAP_F( int )
1738 ldap_msgfree LDAP_P((
1739         LDAPMessage *lm ));
1740
1741 LDAP_F( int )
1742 ldap_msgdelete LDAP_P((
1743         LDAP *ld,
1744         int msgid ));
1745
1746
1747 /*
1748  * in search.c:
1749  */
1750 LDAP_F( int )
1751 ldap_bv2escaped_filter_value LDAP_P(( 
1752         struct berval *in, 
1753         struct berval *out ));
1754
1755 LDAP_F( int )
1756 ldap_search_ext LDAP_P((
1757         LDAP                    *ld,
1758         LDAP_CONST char *base,
1759         int                             scope,
1760         LDAP_CONST char *filter,
1761         char                    **attrs,
1762         int                             attrsonly,
1763         LDAPControl             **serverctrls,
1764         LDAPControl             **clientctrls,
1765         struct timeval  *timeout,
1766         int                             sizelimit,
1767         int                             *msgidp ));
1768
1769 LDAP_F( int )
1770 ldap_search_ext_s LDAP_P((
1771         LDAP                    *ld,
1772         LDAP_CONST char *base,
1773         int                             scope,
1774         LDAP_CONST char *filter,
1775         char                    **attrs,
1776         int                             attrsonly,
1777         LDAPControl             **serverctrls,
1778         LDAPControl             **clientctrls,
1779         struct timeval  *timeout,
1780         int                             sizelimit,
1781         LDAPMessage             **res ));
1782
1783 #if LDAP_DEPRECATED
1784 LDAP_F( int )
1785 ldap_search LDAP_P((    /* deprecated, use ldap_search_ext */
1786         LDAP *ld,
1787         LDAP_CONST char *base,
1788         int scope,
1789         LDAP_CONST char *filter,
1790         char **attrs,
1791         int attrsonly ));
1792
1793 LDAP_F( int )
1794 ldap_search_s LDAP_P((  /* deprecated, use ldap_search_ext_s */
1795         LDAP *ld,
1796         LDAP_CONST char *base,
1797         int scope,
1798         LDAP_CONST char *filter,
1799         char **attrs,
1800         int attrsonly,
1801         LDAPMessage **res ));
1802
1803 LDAP_F( int )
1804 ldap_search_st LDAP_P(( /* deprecated, use ldap_search_ext_s */
1805         LDAP *ld,
1806         LDAP_CONST char *base,
1807         int scope,
1808         LDAP_CONST char *filter,
1809     char **attrs,
1810         int attrsonly,
1811         struct timeval *timeout,
1812         LDAPMessage **res ));
1813 #endif
1814
1815 /*
1816  * in unbind.c
1817  */
1818 LDAP_F( int )
1819 ldap_unbind_ext LDAP_P((
1820         LDAP                    *ld,
1821         LDAPControl             **serverctrls,
1822         LDAPControl             **clientctrls));
1823
1824 LDAP_F( int )
1825 ldap_unbind_ext_s LDAP_P((
1826         LDAP                    *ld,
1827         LDAPControl             **serverctrls,
1828         LDAPControl             **clientctrls));
1829
1830 #if LDAP_DEPRECATED
1831 LDAP_F( int )
1832 ldap_unbind LDAP_P(( /* deprecated, use ldap_unbind_ext */
1833         LDAP *ld ));
1834
1835 LDAP_F( int )
1836 ldap_unbind_s LDAP_P(( /* deprecated, use ldap_unbind_ext_s */
1837         LDAP *ld ));
1838 #endif
1839
1840 /*
1841  * in filter.c
1842  */
1843 LDAP_F( int )
1844 ldap_put_vrFilter LDAP_P((
1845         BerElement *ber,
1846         const char *vrf ));
1847
1848 /*
1849  * in free.c
1850  */
1851
1852 LDAP_F( void * )
1853 ldap_memalloc LDAP_P((
1854         ber_len_t s ));
1855
1856 LDAP_F( void * )
1857 ldap_memrealloc LDAP_P((
1858         void* p,
1859         ber_len_t s ));
1860
1861 LDAP_F( void * )
1862 ldap_memcalloc LDAP_P((
1863         ber_len_t n,
1864         ber_len_t s ));
1865
1866 LDAP_F( void )
1867 ldap_memfree LDAP_P((
1868         void* p ));
1869
1870 LDAP_F( void )
1871 ldap_memvfree LDAP_P((
1872         void** v ));
1873
1874 LDAP_F( char * )
1875 ldap_strdup LDAP_P((
1876         LDAP_CONST char * ));
1877
1878 LDAP_F( void )
1879 ldap_mods_free LDAP_P((
1880         LDAPMod **mods,
1881         int freemods ));
1882
1883
1884 #if LDAP_DEPRECATED
1885 /*
1886  * in sort.c (deprecated, use custom code instead)
1887  */
1888 typedef int (LDAP_SORT_AD_CMP_PROC) LDAP_P(( /* deprecated */
1889         LDAP_CONST char *left,
1890         LDAP_CONST char *right ));
1891
1892 typedef int (LDAP_SORT_AV_CMP_PROC) LDAP_P(( /* deprecated */
1893         LDAP_CONST void *left,
1894         LDAP_CONST void *right ));
1895
1896 LDAP_F( int )   /* deprecated */
1897 ldap_sort_entries LDAP_P(( LDAP *ld,
1898         LDAPMessage **chain,
1899         LDAP_CONST char *attr,
1900         LDAP_SORT_AD_CMP_PROC *cmp ));
1901
1902 LDAP_F( int )   /* deprecated */
1903 ldap_sort_values LDAP_P((
1904         LDAP *ld,
1905         char **vals,
1906         LDAP_SORT_AV_CMP_PROC *cmp ));
1907
1908 LDAP_F( int ) /* deprecated */
1909 ldap_sort_strcasecmp LDAP_P((
1910         LDAP_CONST void *a,
1911         LDAP_CONST void *b ));
1912 #endif
1913
1914 /*
1915  * in url.c
1916  */
1917 LDAP_F( int )
1918 ldap_is_ldap_url LDAP_P((
1919         LDAP_CONST char *url ));
1920
1921 LDAP_F( int )
1922 ldap_is_ldaps_url LDAP_P((
1923         LDAP_CONST char *url ));
1924
1925 LDAP_F( int )
1926 ldap_is_ldapi_url LDAP_P((
1927         LDAP_CONST char *url ));
1928
1929 LDAP_F( int )
1930 ldap_url_parse LDAP_P((
1931         LDAP_CONST char *url,
1932         LDAPURLDesc **ludpp ));
1933
1934 LDAP_F( char * )
1935 ldap_url_desc2str LDAP_P((
1936         LDAPURLDesc *ludp ));
1937
1938 LDAP_F( void )
1939 ldap_free_urldesc LDAP_P((
1940         LDAPURLDesc *ludp ));
1941
1942
1943 /*
1944  * LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
1945  *  in cancel.c
1946  */
1947 #define LDAP_API_FEATURE_CANCEL 1000
1948
1949 LDAP_F( int )
1950 ldap_cancel LDAP_P(( LDAP *ld,
1951         int cancelid,
1952         LDAPControl             **sctrls,
1953         LDAPControl             **cctrls,
1954         int                             *msgidp ));
1955
1956 LDAP_F( int )
1957 ldap_cancel_s LDAP_P(( LDAP *ld,
1958         int cancelid,
1959         LDAPControl **sctrl,
1960         LDAPControl **cctrl ));
1961
1962 /*
1963  * LDAP Turn Extended Operation <draft-zeilenga-ldap-turn-xx.txt>
1964  *  in turn.c
1965  */
1966 #define LDAP_API_FEATURE_TURN 1000
1967
1968 LDAP_F( int )
1969 ldap_turn LDAP_P(( LDAP *ld,
1970         int mutual,
1971         LDAP_CONST char* identifier,
1972         LDAPControl             **sctrls,
1973         LDAPControl             **cctrls,
1974         int                             *msgidp ));
1975
1976 LDAP_F( int )
1977 ldap_turn_s LDAP_P(( LDAP *ld,
1978         int mutual,
1979         LDAP_CONST char* identifier,
1980         LDAPControl **sctrl,
1981         LDAPControl **cctrl ));
1982
1983 /*
1984  * LDAP Paged Results
1985  *      in pagectrl.c
1986  */
1987 #define LDAP_API_FEATURE_PAGED_RESULTS 2000
1988
1989 LDAP_F( int )
1990 ldap_create_page_control_value LDAP_P((
1991         LDAP *ld,
1992         ber_int_t pagesize,
1993         struct berval *cookie,
1994         struct berval *value ));
1995
1996 LDAP_F( int )
1997 ldap_create_page_control LDAP_P((
1998         LDAP *ld,
1999         ber_int_t pagesize,
2000         struct berval *cookie,
2001         int iscritical,
2002         LDAPControl **ctrlp ));
2003
2004 #if LDAP_DEPRECATED
2005 LDAP_F( int )
2006 ldap_parse_page_control LDAP_P((
2007         /* deprecated, use ldap_parse_pageresponse_control */
2008         LDAP *ld,
2009         LDAPControl **ctrls,
2010         ber_int_t *count,
2011         struct berval **cookie ));
2012 #endif
2013
2014 LDAP_F( int )
2015 ldap_parse_pageresponse_control LDAP_P((
2016         LDAP *ld,
2017         LDAPControl *ctrl,
2018         ber_int_t *count,
2019         struct berval *cookie ));
2020
2021 /*
2022  * LDAP Server Side Sort
2023  *      in sortctrl.c
2024  */
2025 #define LDAP_API_FEATURE_SERVER_SIDE_SORT 2000
2026
2027 /* structure for a sort-key */
2028 typedef struct ldapsortkey {
2029         char *attributeType;
2030         char *orderingRule;
2031         int reverseOrder;
2032 } LDAPSortKey;
2033
2034 LDAP_F( int )
2035 ldap_create_sort_keylist LDAP_P((
2036         LDAPSortKey ***sortKeyList,
2037         char *keyString ));
2038
2039 LDAP_F( void )
2040 ldap_free_sort_keylist LDAP_P((
2041         LDAPSortKey **sortkeylist ));
2042
2043 LDAP_F( int )
2044 ldap_create_sort_control_value LDAP_P((
2045         LDAP *ld,
2046         LDAPSortKey **keyList,
2047         struct berval *value ));
2048
2049 LDAP_F( int )
2050 ldap_create_sort_control LDAP_P((
2051         LDAP *ld,
2052         LDAPSortKey **keyList,
2053         int iscritical,
2054         LDAPControl **ctrlp ));
2055
2056 LDAP_F( int )
2057 ldap_parse_sortresponse_control LDAP_P((
2058         LDAP *ld,
2059         LDAPControl *ctrl,
2060         ber_int_t *result,
2061         char **attribute ));
2062
2063 /*
2064  * LDAP Virtual List View
2065  *      in vlvctrl.c
2066  */
2067 #define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 2000
2068
2069 /* structure for virtual list */
2070 typedef struct ldapvlvinfo {
2071         ber_int_t ldvlv_version;
2072     ber_int_t ldvlv_before_count;
2073     ber_int_t ldvlv_after_count;
2074     ber_int_t ldvlv_offset;
2075     ber_int_t ldvlv_count;
2076     struct berval *     ldvlv_attrvalue;
2077     struct berval *     ldvlv_context;
2078     void *                      ldvlv_extradata;
2079 } LDAPVLVInfo;
2080
2081 LDAP_F( int )
2082 ldap_create_vlv_control_value LDAP_P((
2083         LDAP *ld,
2084         LDAPVLVInfo *ldvlistp,
2085         struct berval *value));
2086
2087 LDAP_F( int )
2088 ldap_create_vlv_control LDAP_P((
2089         LDAP *ld,
2090         LDAPVLVInfo *ldvlistp,
2091         LDAPControl **ctrlp ));
2092
2093 LDAP_F( int )
2094 ldap_parse_vlvresponse_control LDAP_P((
2095         LDAP          *ld,
2096         LDAPControl   *ctrls,
2097         ber_int_t *target_posp,
2098         ber_int_t *list_countp,
2099         struct berval **contextp,
2100         int           *errcodep ));
2101
2102 /*
2103  * LDAP Who Am I?
2104  *      in whoami.c
2105  */
2106 #define LDAP_API_FEATURE_WHOAMI 1000
2107
2108 LDAP_F( int )
2109 ldap_parse_whoami LDAP_P((
2110         LDAP *ld,
2111         LDAPMessage *res,
2112         struct berval **authzid ));
2113
2114 LDAP_F( int )
2115 ldap_whoami LDAP_P(( LDAP *ld,
2116         LDAPControl             **sctrls,
2117         LDAPControl             **cctrls,
2118         int                             *msgidp ));
2119
2120 LDAP_F( int )
2121 ldap_whoami_s LDAP_P((
2122         LDAP *ld,
2123         struct berval **authzid,
2124         LDAPControl **sctrls,
2125         LDAPControl **cctrls ));
2126
2127 /*
2128  * LDAP Password Modify
2129  *      in passwd.c
2130  */
2131 #define LDAP_API_FEATURE_PASSWD_MODIFY 1000
2132
2133 LDAP_F( int )
2134 ldap_parse_passwd LDAP_P((
2135         LDAP *ld,
2136         LDAPMessage *res,
2137         struct berval *newpasswd ));
2138
2139 LDAP_F( int )
2140 ldap_passwd LDAP_P(( LDAP *ld,
2141         struct berval   *user,
2142         struct berval   *oldpw,
2143         struct berval   *newpw,
2144         LDAPControl             **sctrls,
2145         LDAPControl             **cctrls,
2146         int                             *msgidp ));
2147
2148 LDAP_F( int )
2149 ldap_passwd_s LDAP_P((
2150         LDAP *ld,
2151         struct berval   *user,
2152         struct berval   *oldpw,
2153         struct berval   *newpw,
2154         struct berval *newpasswd,
2155         LDAPControl **sctrls,
2156         LDAPControl **cctrls ));
2157
2158 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
2159 /*
2160  * LDAP Password Policy controls
2161  *      in ppolicy.c
2162  */
2163 #define LDAP_API_FEATURE_PASSWORD_POLICY 1000
2164
2165 typedef enum passpolicyerror_enum {
2166        PP_passwordExpired = 0,
2167        PP_accountLocked = 1,
2168        PP_changeAfterReset = 2,
2169        PP_passwordModNotAllowed = 3,
2170        PP_mustSupplyOldPassword = 4,
2171        PP_insufficientPasswordQuality = 5,
2172        PP_passwordTooShort = 6,
2173        PP_passwordTooYoung = 7,
2174        PP_passwordInHistory = 8,
2175        PP_noError = 65535
2176 } LDAPPasswordPolicyError;
2177
2178 LDAP_F( int )
2179 ldap_create_passwordpolicy_control LDAP_P((
2180         LDAP *ld,
2181         LDAPControl **ctrlp ));
2182
2183 LDAP_F( int )
2184 ldap_parse_passwordpolicy_control LDAP_P((
2185         LDAP *ld,
2186         LDAPControl *ctrl,
2187         ber_int_t *expirep,
2188         ber_int_t *gracep,
2189         LDAPPasswordPolicyError *errorp ));
2190
2191 LDAP_F( const char * )
2192 ldap_passwordpolicy_err2txt LDAP_P(( LDAPPasswordPolicyError ));
2193 #endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */
2194
2195 /*
2196  * LDAP Dynamic Directory Services Refresh -- RFC 2589
2197  *      in dds.c
2198  */
2199 #define LDAP_API_FEATURE_REFRESH 1000
2200
2201 LDAP_F( int )
2202 ldap_parse_refresh LDAP_P((
2203         LDAP *ld,
2204         LDAPMessage *res,
2205         ber_int_t *newttl ));
2206
2207 LDAP_F( int )
2208 ldap_refresh LDAP_P(( LDAP *ld,
2209         struct berval   *dn,
2210         ber_int_t ttl,
2211         LDAPControl             **sctrls,
2212         LDAPControl             **cctrls,
2213         int                             *msgidp ));
2214
2215 LDAP_F( int )
2216 ldap_refresh_s LDAP_P((
2217         LDAP *ld,
2218         struct berval   *dn,
2219         ber_int_t ttl,
2220         ber_int_t *newttl,
2221         LDAPControl **sctrls,
2222         LDAPControl **cctrls ));
2223
2224 /*
2225  * LDAP Transactions
2226  */
2227 #ifdef LDAP_X_TXN
2228 LDAP_F( int )
2229 ldap_txn_start LDAP_P(( LDAP *ld,
2230         LDAPControl             **sctrls,
2231         LDAPControl             **cctrls,
2232         int                             *msgidp ));
2233
2234 LDAP_F( int )
2235 ldap_txn_start_s LDAP_P(( LDAP *ld,
2236         LDAPControl **sctrl,
2237         LDAPControl **cctrl,
2238         struct berval **rettxnid ));
2239
2240 LDAP_F( int )
2241 ldap_txn_end LDAP_P(( LDAP *ld,
2242         int     commit,
2243         struct berval   *txnid,
2244         LDAPControl             **sctrls,
2245         LDAPControl             **cctrls,
2246         int                             *msgidp ));
2247
2248 LDAP_F( int )
2249 ldap_txn_end_s LDAP_P(( LDAP *ld,
2250         int     commit,
2251         struct berval *txnid,
2252         LDAPControl **sctrl,
2253         LDAPControl **cctrl,
2254         int *retidp ));
2255 #endif
2256
2257 /*
2258  * in ldap_sync.c
2259  */
2260
2261 /*
2262  * initialize the persistent search structure
2263  */
2264 LDAP_F( ldap_sync_t * )
2265 ldap_sync_initialize LDAP_P((
2266         ldap_sync_t     *ls ));
2267
2268 /*
2269  * destroy the persistent search structure
2270  */
2271 LDAP_F( void )
2272 ldap_sync_destroy LDAP_P((
2273         ldap_sync_t     *ls,
2274         int             freeit ));
2275
2276 /*
2277  * initialize a refreshOnly sync
2278  */
2279 LDAP_F( int )
2280 ldap_sync_init LDAP_P((
2281         ldap_sync_t     *ls,
2282         int             mode ));
2283
2284 /*
2285  * initialize a refreshOnly sync
2286  */
2287 LDAP_F( int )
2288 ldap_sync_init_refresh_only LDAP_P((
2289         ldap_sync_t     *ls ));
2290
2291 /*
2292  * initialize a refreshAndPersist sync
2293  */
2294 LDAP_F( int )
2295 ldap_sync_init_refresh_and_persist LDAP_P((
2296         ldap_sync_t     *ls ));
2297
2298 /*
2299  * poll for new responses
2300  */
2301 LDAP_F( int )
2302 ldap_sync_poll LDAP_P((
2303         ldap_sync_t     *ls ));
2304
2305 LDAP_END_DECL
2306 #endif /* _LDAP_H */