]> git.sur5r.net Git - openldap/blob - include/ldap.h
58a77304869a967f0cb2ea15d58ead9516660d29
[openldap] / include / ldap.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11 /* Portions
12  * Copyright (c) 1990 Regents of the University of Michigan.
13  * All rights reserved.
14  *
15  * Redistribution and use in source and binary forms are permitted
16  * provided that this notice is preserved and that due credit is given
17  * to the University of Michigan at Ann Arbor. The name of the University
18  * may not be used to endorse or promote products derived from this
19  * software without specific prior written permission. This software
20  * is provided ``as is'' without express or implied warranty.
21  */
22
23 #ifndef _LDAP_H
24 #define _LDAP_H
25
26 #include <ldap_cdefs.h>
27
28 /* draft spec requires ldap.h include lber declarations */
29 #include <lber.h>
30
31 LDAP_BEGIN_DECL
32
33 #define LDAP_VERSION1   1
34 #define LDAP_VERSION2   2
35 #define LDAP_VERSION3   3
36
37 #define LDAP_VERSION_MIN        LDAP_VERSION2
38 #define LDAP_VERSION            LDAP_VERSION2
39 #define LDAP_VERSION_MAX        LDAP_VERSION3
40
41 /*
42  * We'll use 2000+draft revision for our API version number
43  * As such, the number will be above the old RFC but below 
44  * whatever number does finally get assigned
45  */
46 #define LDAP_API_VERSION        2004
47 #define LDAP_VENDOR_NAME        "OpenLDAP"
48 /* We'll eventually release as 200 */
49 #define LDAP_VENDOR_VERSION     194
50
51 /* OpenLDAP API Features */
52 #define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION
53
54 /* include LDAP_API_FEATURE defines */
55 #include <ldap_features.h>
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 #define LDAP_PORT               389             /* ldap:///             default LDAP port */
71 #define LDAPS_PORT              636             /* ldaps:///    default LDAP over TLS port */
72
73 #define LDAP_ROOT_DSE                           ""
74 #define LDAP_NO_ATTRS                           "1.1"
75 #define LDAP_ALL_USER_ATTRIBUTES        "*"
76 #define LDAP_ALL_OPERATIONAL_ATTRIBUTES "+" /* OpenLDAP extension */
77
78 /*
79  * LDAP_OPTions defined by draft-ldapext-ldap-c-api-02
80  * 0x0000 - 0x0fff reserved for api options
81  * 0x1000 - 0x3fff reserved for api extended options
82  * 0x4000 - 0x7fff reserved for private and experimental options
83  */
84 #define LDAP_OPT_API_INFO                       0x0000
85 #define LDAP_OPT_DESC                           0x0001 /* deprecated */
86 #define LDAP_OPT_DEREF                          0x0002
87 #define LDAP_OPT_SIZELIMIT                      0x0003
88 #define LDAP_OPT_TIMELIMIT                      0x0004
89 /* 0x05 - 0x07 not defined by current draft */
90 #define LDAP_OPT_REFERRALS                      0x0008
91 #define LDAP_OPT_RESTART                        0x0009
92 /* 0x0a - 0x10 not defined by current draft */
93 #define LDAP_OPT_PROTOCOL_VERSION       0x0011
94 #define LDAP_OPT_SERVER_CONTROLS        0x0012
95 #define LDAP_OPT_CLIENT_CONTROLS        0x0013
96 /* 0x14 not defined by current draft */
97 #define LDAP_OPT_API_FEATURE_INFO       0x0015
98
99 /* 0x16 - 0x2f not defined by current draft */
100 #define LDAP_OPT_HOST_NAME                      0x0030
101 #define LDAP_OPT_ERROR_NUMBER           0x0031
102 #define LDAP_OPT_ERROR_STRING           0x0032
103 #define LDAP_OPT_MATCHED_DN                     0x0033
104
105 /* 0x34 - 0x0fff not defined by current draft */
106
107 /* extended options - none */
108
109 /* private and experimental options */
110 #define LDAP_OPT_DNS                            0x4001  /* use DN & DNS */
111
112 /* OpenLDAP specific options */
113 #define LDAP_OPT_DEBUG_LEVEL            0x5001  /* debug level */
114 #define LDAP_OPT_TIMEOUT                        0x5002  /* default timeout */
115 #define LDAP_OPT_REFHOPLIMIT            0x5003  /* ref hop limit */
116 #define LDAP_OPT_NETWORK_TIMEOUT        0x5005  /* socket level timeout */
117
118 /* TLS options */
119 #define LDAP_OPT_X_TLS_CACERTFILE       0x6001
120 #define LDAP_OPT_X_TLS_CACERTDIR        0x6002
121 #define LDAP_OPT_X_TLS_CERT             0x6003
122 #define LDAP_OPT_X_TLS_CERTFILE         0x6004
123 #define LDAP_OPT_X_TLS_KEYFILE          0x6005
124 #define LDAP_OPT_X_TLS_REQUIRE_CERT     0x6006
125 #define LDAP_OPT_X_TLS                  0x6007
126 #define LDAP_OPT_X_TLS_PROTOCOL         0x6008
127 #define LDAP_OPT_X_TLS_CIPHER_SUITE     0x6009
128
129 #define LDAP_OPT_X_TLS_NEVER            0
130 #define LDAP_OPT_X_TLS_HARD             1
131 #define LDAP_OPT_X_TLS_DEMAND           2
132 #define LDAP_OPT_X_TLS_ALLOW            3
133 #define LDAP_OPT_X_TLS_TRY              4
134
135 /* on/off values */
136 #define LDAP_OPT_ON             ((void *) 1)
137 #define LDAP_OPT_OFF    ((void *) 0)
138
139 #define LDAP_OPT_SUCCESS        0
140 #define LDAP_OPT_ERROR          (-1)
141
142 #define LDAP_API_INFO_VERSION   (1)
143 typedef struct ldapapiinfo {
144         int             ldapai_info_version;            /* version of LDAPAPIInfo (1) */
145         int             ldapai_api_version;                     /* revision of API supported */
146         int             ldapai_protocol_version;        /* highest LDAP version supported */
147         char    **ldapai_extensions;            /* names of API extensions */
148         char    *ldapai_vendor_name;            /* name of supplier */
149         int             ldapai_vendor_version;          /* supplier-specific version * 100 */
150 } LDAPAPIInfo;
151
152 #define LDAP_FEATURE_INFO_VERSION (1) /* version of api feature structure */
153 typedef struct ldap_apifeature_info {
154         int             ldapaif_info_version; /* version of this struct (1) */
155         char*   ldapaif_name;    /* matches LDAP_API_FEATURE_... less the prefix */
156         int             ldapaif_version; /* matches the value LDAP_API_FEATURE_... */
157 } LDAPAPIFeatureInfo;
158
159 typedef struct ldapcontrol {
160         char *                  ldctl_oid;
161         struct berval   ldctl_value;
162         char                    ldctl_iscritical;
163 } LDAPControl;
164
165 /* LDAP Controls */
166         /* chase referrals controls */
167 #define LDAP_CONTROL_REFERRALS  "1.2.840.113666.1.4.616"
168 #define LDAP_CHASE_SUBORDINATE_REFERRALS        0x0020U
169 #define LDAP_CHASE_EXTERNAL_REFERRALS   0x0040U
170
171 #define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2"
172
173 /* Experimental Controls */
174 #define LDAP_CONTROL_X_CHANGE_PASSWD "1.3.6.1.4.1.4203.666.5.1"
175
176
177 /* LDAP Unsolicited Notifications */
178 #define LDAP_NOTICE_OF_DISCONNECTION    "1.3.6.1.4.1.1466.20036"
179 #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION
180
181
182 /* LDAP Extended Operations */
183
184
185 /* 
186  * specific LDAP instantiations of BER types we know about
187  */
188
189 /* Overview of LBER tag construction
190  *
191  *      Bits
192  *      ______
193  *      8 7 | CLASS
194  *      0 0 = UNIVERSAL
195  *      0 1 = APPLICATION
196  *      1 0 = CONTEXT-SPECIFIC
197  *      1 1 = PRIVATE
198  *              _____
199  *              | 6 | DATA-TYPE
200  *                0 = PRIMITIVE
201  *                1 = CONSTRUCTED
202  *                      ___________
203  *                      | 5 ... 1 | TAG-NUMBER
204  */
205
206 /* general stuff */
207 #define LDAP_TAG_MESSAGE        ((ber_tag_t) 0x30U)     /* constructed + 16 */
208 #define LDAP_TAG_MSGID          ((ber_tag_t) 0x02U)     /* integer */
209 #define LDAP_TAG_LDAPDN         ((ber_tag_t) 0x04U)     /* octect string */
210 #define LDAP_TAG_LDAPCRED       ((ber_tag_t) 0x04U)     /* octect string */
211 #define LDAP_TAG_CONTROLS       ((ber_tag_t) 0xa0U)     /* context specific + constructed + 0 */
212 #define LDAP_TAG_REFERRAL       ((ber_tag_t) 0xa3U)     /* context specific + constructed + 3 */
213
214 #define LDAP_TAG_NEWSUPERIOR    ((ber_tag_t) 0x80U)     /* context-specific + primitive + 0 */
215
216 #define LDAP_TAG_EXOP_REQ_OID   ((ber_tag_t) 0x80U)     /* context specific + primitive */
217 #define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U)     /* context specific + primitive */
218 #define LDAP_TAG_EXOP_RES_OID   ((ber_tag_t) 0x8aU)     /* context specific + primitive */
219 #define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU)     /* context specific + primitive */
220
221 #define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U)     /* context specific + primitive */
222
223
224
225
226 /* possible operations a client can invoke */
227 #define LDAP_REQ_BIND                   ((ber_tag_t) 0x60U)     /* application + constructed */
228 #define LDAP_REQ_UNBIND                 ((ber_tag_t) 0x42U)     /* application + primitive   */
229 #define LDAP_REQ_SEARCH                 ((ber_tag_t) 0x63U)     /* application + constructed */
230 #define LDAP_REQ_MODIFY                 ((ber_tag_t) 0x66U)     /* application + constructed */
231 #define LDAP_REQ_ADD                    ((ber_tag_t) 0x68U)     /* application + constructed */
232 #define LDAP_REQ_DELETE                 ((ber_tag_t) 0x4aU)     /* application + primitive   */
233 #define LDAP_REQ_MODRDN                 ((ber_tag_t) 0x6cU)     /* application + constructed */
234 #define LDAP_REQ_MODDN                  LDAP_REQ_MODRDN 
235 #define LDAP_REQ_RENAME                 LDAP_REQ_MODRDN 
236 #define LDAP_REQ_COMPARE                ((ber_tag_t) 0x6eU)     /* application + constructed */
237 #define LDAP_REQ_ABANDON                ((ber_tag_t) 0x50U)     /* application + primitive   */
238 #define LDAP_REQ_EXTENDED               ((ber_tag_t) 0x77U)     /* application + constructed */
239
240 /* possible result types a server can return */
241 #define LDAP_RES_BIND                   ((ber_tag_t) 0x61U)     /* application + constructed */
242 #define LDAP_RES_SEARCH_ENTRY           ((ber_tag_t) 0x64U)     /* application + constructed */
243 #define LDAP_RES_SEARCH_REFERENCE       ((ber_tag_t) 0x73U)     /* V3: application + constructed */
244 #define LDAP_RES_SEARCH_RESULT          ((ber_tag_t) 0x65U)     /* application + constructed */
245 #define LDAP_RES_MODIFY                 ((ber_tag_t) 0x67U)     /* application + constructed */
246 #define LDAP_RES_ADD                    ((ber_tag_t) 0x69U)     /* application + constructed */
247 #define LDAP_RES_DELETE                 ((ber_tag_t) 0x6bU)     /* application + constructed */
248 #define LDAP_RES_MODRDN                 ((ber_tag_t) 0x6dU)     /* application + constructed */
249 #define LDAP_RES_MODDN                  LDAP_RES_MODRDN /* application + constructed */
250 #define LDAP_RES_RENAME                 LDAP_RES_MODRDN /* application + constructed */
251 #define LDAP_RES_COMPARE                ((ber_tag_t) 0x6fU)     /* application + constructed */
252 #define LDAP_RES_EXTENDED               ((ber_tag_t) 0x78U)     /* V3: application + constructed */
253
254 #define LDAP_RES_ANY                    ((ber_tag_t)(-1))
255 #define LDAP_RES_UNSOLICITED    ((ber_tag_t)(0))
256
257
258 /* sasl methods */
259 #define LDAP_SASL_SIMPLE                        NULL
260
261 /* authentication methods available */
262 #define LDAP_AUTH_NONE          ((ber_tag_t) 0x00U)     /* no authentication              */
263 #define LDAP_AUTH_SIMPLE        ((ber_tag_t) 0x80U)     /* context specific + primitive   */
264 #define LDAP_AUTH_SASL          ((ber_tag_t) 0xa3U)     /* context specific + primitive   */
265 #define LDAP_AUTH_KRBV4         ((ber_tag_t) 0xffU)     /* means do both of the following */
266 #define LDAP_AUTH_KRBV41        ((ber_tag_t) 0x81U)     /* context specific + primitive   */
267 #define LDAP_AUTH_KRBV42        ((ber_tag_t) 0x82U)     /* context specific + primitive   */
268
269
270 /* filter types */
271 #define LDAP_FILTER_AND         ((ber_tag_t) 0xa0U)     /* context specific + constructed */
272 #define LDAP_FILTER_OR          ((ber_tag_t) 0xa1U)     /* context specific + constructed */
273 #define LDAP_FILTER_NOT         ((ber_tag_t) 0xa2U)     /* context specific + constructed */
274 #define LDAP_FILTER_EQUALITY    ((ber_tag_t) 0xa3U)     /* context specific + constructed */
275 #define LDAP_FILTER_SUBSTRINGS  ((ber_tag_t) 0xa4U)     /* context specific + constructed */
276 #define LDAP_FILTER_GE          ((ber_tag_t) 0xa5U)     /* context specific + constructed */
277 #define LDAP_FILTER_LE          ((ber_tag_t) 0xa6U)     /* context specific + constructed */
278 #define LDAP_FILTER_PRESENT     ((ber_tag_t) 0x87U)     /* context specific + primitive   */
279 #define LDAP_FILTER_APPROX      ((ber_tag_t) 0xa8U)     /* context specific + constructed */
280 #define LDAP_FILTER_EXT         ((ber_tag_t) 0xa9U)     /* context specific + constructed */
281
282 /* extended filter component types */
283 #define LDAP_FILTER_EXT_OID     ((ber_tag_t) 0x81U)     /* context specific */
284 #define LDAP_FILTER_EXT_TYPE    ((ber_tag_t) 0x82U)     /* context specific */
285 #define LDAP_FILTER_EXT_VALUE   ((ber_tag_t) 0x83U)     /* context specific */
286 #define LDAP_FILTER_EXT_DNATTRS ((ber_tag_t) 0x84U)     /* context specific */
287
288 /* substring filter component types */
289 #define LDAP_SUBSTRING_INITIAL  ((ber_tag_t) 0x80U)     /* context specific */
290 #define LDAP_SUBSTRING_ANY      ((ber_tag_t) 0x81U)     /* context specific */
291 #define LDAP_SUBSTRING_FINAL    ((ber_tag_t) 0x82U)     /* context specific */
292
293 /* search scopes */
294 #define LDAP_SCOPE_BASE         ((ber_int_t) 0x0000)
295 #define LDAP_SCOPE_ONELEVEL     ((ber_int_t) 0x0001)
296 #define LDAP_SCOPE_SUBTREE      ((ber_int_t) 0x0002)
297
298 /* for modifications */
299 typedef struct ldapmod {
300         int             mod_op;
301
302 #define LDAP_MOD_ADD            ((ber_int_t) 0x0000)
303 #define LDAP_MOD_DELETE         ((ber_int_t) 0x0001)
304 #define LDAP_MOD_REPLACE        ((ber_int_t) 0x0002)
305 #define LDAP_MOD_BVALUES        ((ber_int_t) 0x0080)
306 /* IMPORTANT: do not use code 0x1000 (or above),
307  * it is used internally by the backends!
308  * (see ldap/servers/slapd/slap.h)
309  */
310
311         char            *mod_type;
312         union mod_vals_u {
313                 char            **modv_strvals;
314                 struct berval   **modv_bvals;
315         } mod_vals;
316 #define mod_values      mod_vals.modv_strvals
317 #define mod_bvalues     mod_vals.modv_bvals
318 } LDAPMod;
319
320 /* 
321  * possible error codes we can return
322  */
323
324 #define LDAP_RANGE(n,x,y)       (((x) <= (n)) && ((n) <= (y)))
325
326 #define LDAP_SUCCESS                    0x00
327 #define LDAP_OPERATIONS_ERROR           0x01
328 #define LDAP_PROTOCOL_ERROR             0x02
329 #define LDAP_TIMELIMIT_EXCEEDED         0x03
330 #define LDAP_SIZELIMIT_EXCEEDED         0x04
331 #define LDAP_COMPARE_FALSE              0x05
332 #define LDAP_COMPARE_TRUE               0x06
333 #define LDAP_AUTH_METHOD_NOT_SUPPORTED  0x07
334 #define LDAP_STRONG_AUTH_NOT_SUPPORTED  LDAP_AUTH_METHOD_NOT_SUPPORTED
335 #define LDAP_STRONG_AUTH_REQUIRED       0x08
336 #define LDAP_PARTIAL_RESULTS            0x09    /* not listed in v3 */
337
338 #define LDAP_REFERRAL                           0x0a /* LDAPv3 */
339 #define LDAP_ADMINLIMIT_EXCEEDED        0x0b /* LDAPv3 */
340 #define LDAP_UNAVAILABLE_CRITICAL_EXTENSION     0x0c /* LDAPv3 */
341 #define LDAP_CONFIDENTIALITY_REQUIRED   0x0d /* LDAPv3 */
342 #define LDAP_SASL_BIND_IN_PROGRESS      0x0e /* LDAPv3 */       
343
344 #define LDAP_ATTR_ERROR(n)      LDAP_RANGE((n),0x10,0x15) /* 16-21 */
345
346 #define LDAP_NO_SUCH_ATTRIBUTE          0x10
347 #define LDAP_UNDEFINED_TYPE             0x11
348 #define LDAP_INAPPROPRIATE_MATCHING     0x12
349 #define LDAP_CONSTRAINT_VIOLATION       0x13
350 #define LDAP_TYPE_OR_VALUE_EXISTS       0x14
351 #define LDAP_INVALID_SYNTAX             0x15
352
353 #define LDAP_NAME_ERROR(n)      LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
354
355 #define LDAP_NO_SUCH_OBJECT             0x20
356 #define LDAP_ALIAS_PROBLEM              0x21
357 #define LDAP_INVALID_DN_SYNTAX          0x22
358 #define LDAP_IS_LEAF                    0x23 /* not LDAPv3 */
359 #define LDAP_ALIAS_DEREF_PROBLEM        0x24
360
361 #define LDAP_SECURITY_ERROR(n)  LDAP_RANGE((n),0x30,0x32) /* 48-50 */
362
363 #define LDAP_INAPPROPRIATE_AUTH         0x30
364 #define LDAP_INVALID_CREDENTIALS        0x31
365 #define LDAP_INSUFFICIENT_ACCESS        0x32
366
367 #define LDAP_SERVICE_ERROR(n)   LDAP_RANGE((n),0x33,0x36) /* 51-54 */
368
369 #define LDAP_BUSY                       0x33
370 #define LDAP_UNAVAILABLE                0x34
371 #define LDAP_UNWILLING_TO_PERFORM       0x35
372 #define LDAP_LOOP_DETECT                0x36
373
374 #define LDAP_UPDATE_ERROR(n)    LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
375
376 #define LDAP_NAMING_VIOLATION           0x40
377 #define LDAP_OBJECT_CLASS_VIOLATION     0x41
378 #define LDAP_NOT_ALLOWED_ON_NONLEAF     0x42
379 #define LDAP_NOT_ALLOWED_ON_RDN         0x43
380 #define LDAP_ALREADY_EXISTS             0x44
381 #define LDAP_NO_OBJECT_CLASS_MODS       0x45
382 #define LDAP_RESULTS_TOO_LARGE          0x46 /* CLDAP */
383 #define LDAP_AFFECTS_MULTIPLE_DSAS      0x47 /* LDAPv3 */
384
385 #define LDAP_OTHER                      0x50
386
387 #define LDAP_API_ERROR(n)               LDAP_RANGE((n),0x51,0xff) /* 81+ */
388
389 #define LDAP_SERVER_DOWN                0x51
390 #define LDAP_LOCAL_ERROR                0x52
391 #define LDAP_ENCODING_ERROR             0x53
392 #define LDAP_DECODING_ERROR             0x54
393 #define LDAP_TIMEOUT                    0x55
394 #define LDAP_AUTH_UNKNOWN               0x56
395 #define LDAP_FILTER_ERROR               0x57
396 #define LDAP_USER_CANCELLED             0x58
397 #define LDAP_PARAM_ERROR                0x59
398 #define LDAP_NO_MEMORY                  0x5a
399
400 #define LDAP_CONNECT_ERROR                              0x5b    /* new */
401 #define LDAP_NOT_SUPPORTED                              0x5c    /* new */
402 #define LDAP_CONTROL_NOT_FOUND                  0x5d    /* new */
403 #define LDAP_NO_RESULTS_RETURNED                0x5e    /* new */
404 #define LDAP_MORE_RESULTS_TO_RETURN             0x5f    /* new */
405 #define LDAP_CLIENT_LOOP                                0x60    /* new */
406 #define LDAP_REFERRAL_LIMIT_EXCEEDED    0x61    /* new */
407
408 /*
409  * This structure represents both ldap messages and ldap responses.
410  * These are really the same, except in the case of search responses,
411  * where a response has multiple messages.
412  */
413
414 typedef struct ldapmsg LDAPMessage;
415
416 /*
417  * structures for ldap getfilter routines
418  */
419
420 typedef struct ldap_filt_info {
421         char                    *lfi_filter;
422         char                    *lfi_desc;
423         int                     lfi_scope;
424         int                     lfi_isexact;
425         struct ldap_filt_info   *lfi_next;
426 } LDAPFiltInfo;
427
428 typedef struct ldap_filt_list {
429     char                        *lfl_tag;
430     char                        *lfl_pattern;
431     char                        *lfl_delims;
432     LDAPFiltInfo                *lfl_ilist;
433     struct ldap_filt_list       *lfl_next;
434 } LDAPFiltList;
435
436
437 #define LDAP_FILT_MAXSIZ        1024
438
439 typedef struct ldap_filt_desc {
440         LDAPFiltList            *lfd_filtlist;
441         LDAPFiltInfo            *lfd_curfip;
442         LDAPFiltInfo            lfd_retfi;
443         char                    lfd_filter[ LDAP_FILT_MAXSIZ ];
444         char                    *lfd_curval;
445         char                    *lfd_curvalcopy;
446         char                    **lfd_curvalwords;
447         char                    *lfd_filtprefix;
448         char                    *lfd_filtsuffix;
449 } LDAPFiltDesc;
450
451
452 /*
453  * structure representing an ldap session which can
454  * encompass connections to multiple servers (in the
455  * face of referrals).
456  */
457 typedef struct ldap LDAP;
458
459 #define LDAP_DEREF_NEVER        0x00
460 #define LDAP_DEREF_SEARCHING    0x01
461 #define LDAP_DEREF_FINDING      0x02
462 #define LDAP_DEREF_ALWAYS       0x03
463
464 #define LDAP_NO_LIMIT           0
465
466 /* how many messages to retrieve results for */
467 #define LDAP_MSG_ONE            0x00
468 #define LDAP_MSG_ALL            0x01
469 #define LDAP_MSG_RECEIVED       0x02
470
471 /*
472  * structure for ldap friendly mapping routines
473  */
474
475 typedef struct ldap_friendly {
476         char    *lf_unfriendly;
477         char    *lf_friendly;
478 } LDAPFriendlyMap;
479
480 /*
481  * types for ldap URL handling
482  */
483 typedef struct ldap_url_desc {
484         int             lud_ldaps;
485     char        *lud_host;
486     int         lud_port;
487     char        *lud_dn;
488     char        **lud_attrs;
489     int         lud_scope;
490     char        *lud_filter;
491         char    **lud_exts;
492 } LDAPURLDesc;
493
494 #define LDAP_URL_SUCCESS                0x00    /* Success */
495 #define LDAP_URL_ERR_MEM                0x01    /* can't allocate memory space */
496 #define LDAP_URL_ERR_PARAM              0x02    /* parameter is bad */
497
498 #define LDAP_URL_ERR_NOTLDAP    0x03    /* URL doesn't begin with "ldap[s]://" */
499 #define LDAP_URL_ERR_BADENCLOSURE 0x04  /* URL is missing trailing ">" */
500 #define LDAP_URL_ERR_BADURL             0x05    /* URL is bad */
501 #define LDAP_URL_ERR_BADHOST    0x06    /* host port is bad */
502 #define LDAP_URL_ERR_BADATTRS   0x07    /* bad (or missing) attributes */
503 #define LDAP_URL_ERR_BADSCOPE   0x08    /* scope string is invalid (or missing) */
504 #define LDAP_URL_ERR_BADFILTER  0x09    /* bad or missing filter */
505 #define LDAP_URL_ERR_BADEXTS    0x0a    /* bad or missing extensions */
506
507 /*
508  * The API draft spec says we should declare (or cause to be declared)
509  * 'struct timeval'.   We don't.  See IETF LDAPext discussions.
510  */
511 struct timeval;
512
513 #ifdef __MINGW32__
514 #   undef LDAP_F_PRE
515 #   ifdef LIBLDAP_DECL
516 #       define LDAP_F_PRE       extern __declspec(LIBLDAP_DECL)
517 #   else
518 #       define LDAP_F_PRE       extern
519 #   endif
520 #endif
521
522 /*
523  * in options.c:
524  */
525 LDAP_F( int )
526 ldap_get_option LDAP_P((
527         LDAP *ld,
528         int option,
529         void *outvalue));
530
531 LDAP_F( int )
532 ldap_set_option LDAP_P((
533         LDAP *ld,
534         int option,
535         LDAP_CONST void *invalue));
536
537
538 /*
539  * in controls.c:
540  */
541 LDAP_F( void )
542 ldap_control_free LDAP_P((
543         LDAPControl *ctrl ));
544
545 LDAP_F( void )
546 ldap_controls_free LDAP_P((
547         LDAPControl **ctrls ));
548
549   
550 /*
551  * in extended.c:
552  */
553 LDAP_F( int )
554 ldap_extended_operation LDAP_P((
555         LDAP                    *ld,
556         LDAP_CONST char *reqoid,
557         struct berval   *reqdata,
558         LDAPControl             **serverctrls,
559         LDAPControl             **clientctrls,
560         int                             *msgidp ));
561
562 LDAP_F( int )
563 ldap_extended_operation_s LDAP_P((
564         LDAP                    *ld,
565         LDAP_CONST char *reqoid,
566         struct berval   *reqdata,
567         LDAPControl             **serverctrls,
568         LDAPControl             **clientctrls,
569         char                    **retoidp,
570         struct berval   **retdatap ));
571
572 LDAP_F( int )
573 ldap_parse_extended_result LDAP_P((
574         LDAP                    *ld,
575         LDAPMessage             *res,
576         char                    **retoidp,
577         struct berval   **retdatap,
578         int                             freeit ));
579
580 /*
581  * in abandon.c:
582  */
583 LDAP_F( int )
584 ldap_abandon LDAP_P((
585         LDAP *ld,
586         int msgid ));
587
588 LDAP_F( int )
589 ldap_abandon_ext LDAP_P((
590         LDAP                    *ld,
591         int                             msgid,
592         LDAPControl             **serverctrls,
593         LDAPControl             **clientctrls ));
594
595
596 /*
597  * in add.c:
598  */
599 LDAP_F( int )
600 ldap_add_ext LDAP_P((
601         LDAP                    *ld,
602         LDAP_CONST char *dn,
603         LDAPMod                 **attrs,
604         LDAPControl             **serverctrls,
605         LDAPControl             **clientctrls,
606         int                     *msgidp ));
607
608 LDAP_F( int )
609 ldap_add_ext_s LDAP_P((
610         LDAP                    *ld,
611         LDAP_CONST char *dn,
612         LDAPMod                 **attrs,
613         LDAPControl             **serverctrls,
614         LDAPControl             **clientctrls ));
615
616 LDAP_F( int )
617 ldap_add LDAP_P((
618         LDAP *ld,
619         LDAP_CONST char *dn,
620         LDAPMod **attrs ));
621
622 LDAP_F( int )
623 ldap_add_s LDAP_P((
624         LDAP *ld,
625         LDAP_CONST char *dn,
626         LDAPMod **attrs ));
627
628
629 /*
630  * in sasl.c:
631  */
632 LDAP_F( int )
633 ldap_sasl_bind LDAP_P((
634         LDAP                    *ld,
635         LDAP_CONST char *dn,
636         LDAP_CONST char *mechanism,
637         struct berval   *cred,
638         LDAPControl             **serverctrls,
639         LDAPControl             **clientctrls,
640         int                             *msgidp ));
641
642 LDAP_F( int )
643 ldap_sasl_bind_s LDAP_P((
644         LDAP                    *ld,
645         LDAP_CONST char *dn,
646         LDAP_CONST char *mechanism,
647         struct berval   *cred,
648         LDAPControl             **serverctrls,
649         LDAPControl             **clientctrls,
650         struct berval   **servercredp ));
651
652 LDAP_F( int )
653 ldap_parse_sasl_bind_result LDAP_P((
654         LDAP                    *ld,
655         LDAPMessage             *res,
656         struct berval   **servercredp,
657         int                             freeit ));
658
659 /*
660  * in bind.c:
661  *      (deprecated)
662  */
663 LDAP_F( int )
664 ldap_bind LDAP_P((
665         LDAP *ld,
666         LDAP_CONST char *who,
667         LDAP_CONST char *passwd,
668         int authmethod ));
669
670 LDAP_F( int )
671 ldap_bind_s LDAP_P((
672         LDAP *ld,
673         LDAP_CONST char *who,
674         LDAP_CONST char *cred,
675         int authmethod ));
676
677 LDAP_F( void )
678 ldap_set_rebind_proc LDAP_P((
679         LDAP *ld,
680         int (*rebindproc) LDAP_P((
681                 LDAP *ld,
682                 char **dnp,
683                 char **passwdp,
684                 int *authmethodp,
685                 int freeit ))));
686
687
688 /*
689  * in sbind.c:
690  */
691 LDAP_F( int )
692 ldap_simple_bind LDAP_P((
693         LDAP *ld,
694         LDAP_CONST char *who,
695         LDAP_CONST char *passwd ));
696
697 LDAP_F( int )
698 ldap_simple_bind_s LDAP_P((
699         LDAP *ld,
700         LDAP_CONST char *who,
701         LDAP_CONST char *passwd ));
702
703
704 /*
705  * in kbind.c:
706  *      (deprecated)
707  */
708 LDAP_F( int )
709 ldap_kerberos_bind_s LDAP_P((
710         LDAP *ld,
711         LDAP_CONST char *who ));
712
713 LDAP_F( int )
714 ldap_kerberos_bind1 LDAP_P((
715         LDAP *ld,
716         LDAP_CONST char *who ));
717
718 LDAP_F( int )
719 ldap_kerberos_bind1_s LDAP_P((
720         LDAP *ld,
721         LDAP_CONST char *who ));
722
723 LDAP_F( int )
724 ldap_kerberos_bind2 LDAP_P((
725         LDAP *ld,
726         LDAP_CONST char *who ));
727
728 LDAP_F( int )
729 ldap_kerberos_bind2_s LDAP_P((
730         LDAP *ld,
731         LDAP_CONST char *who ));
732
733 /*
734  * in cache.c
735  * (deprecated)
736  */
737 LDAP_F( int )
738 ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, ber_len_t maxmem ));
739
740 LDAP_F( void )
741 ldap_disable_cache LDAP_P(( LDAP *ld ));
742
743 LDAP_F( void )
744 ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts ));
745
746 LDAP_F( void )
747 ldap_destroy_cache LDAP_P(( LDAP *ld ));
748
749 LDAP_F( void )
750 ldap_flush_cache LDAP_P(( LDAP *ld ));
751
752 LDAP_F( void )
753 ldap_uncache_entry LDAP_P(( LDAP *ld, LDAP_CONST char *dn ));
754
755 LDAP_F( void )
756 ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
757
758
759 /*
760  * in compare.c:
761  */
762 LDAP_F( int )
763 ldap_compare_ext LDAP_P((
764         LDAP                    *ld,
765         LDAP_CONST char *dn,
766         LDAP_CONST char *attr,
767         struct berval   *bvalue,
768         LDAPControl             **serverctrls,
769         LDAPControl             **clientctrls,
770         int                     *msgidp ));
771
772 LDAP_F( int )
773 ldap_compare_ext_s LDAP_P((
774         LDAP                    *ld,
775         LDAP_CONST char *dn,
776         LDAP_CONST char *attr,
777         struct berval   *bvalue,
778         LDAPControl             **serverctrls,
779         LDAPControl             **clientctrls ));
780
781 LDAP_F( int )
782 ldap_compare LDAP_P((
783         LDAP *ld,
784         LDAP_CONST char *dn,
785         LDAP_CONST char *attr,
786         LDAP_CONST char *value ));
787
788 LDAP_F( int )
789 ldap_compare_s LDAP_P((
790         LDAP *ld,
791         LDAP_CONST char *dn,
792         LDAP_CONST char *attr,
793         LDAP_CONST char *value ));
794
795
796 /*
797  * in delete.c:
798  */
799 LDAP_F( int )
800 ldap_delete_ext LDAP_P((
801         LDAP                    *ld,
802         LDAP_CONST char *dn,
803         LDAPControl             **serverctrls,
804         LDAPControl             **clientctrls,
805         int                     *msgidp ));
806
807 LDAP_F( int )
808 ldap_delete_ext_s LDAP_P((
809         LDAP                    *ld,
810         LDAP_CONST char *dn,
811         LDAPControl             **serverctrls,
812         LDAPControl             **clientctrls ));
813
814 LDAP_F( int )
815 ldap_delete LDAP_P((
816         LDAP *ld,
817         LDAP_CONST char *dn ));
818
819 LDAP_F( int )
820 ldap_delete_s LDAP_P((
821         LDAP *ld,
822         LDAP_CONST char *dn ));
823
824
825 /*
826  * in error.c:
827  */
828 LDAP_F( int )
829 ldap_parse_result LDAP_P((
830         LDAP                    *ld,
831         LDAPMessage             *res,
832         int                             *errcodep,
833         char                    **matcheddnp,
834         char                    **errmsgp,
835         char                    ***referralsp,
836         LDAPControl             ***serverctrls,
837         int                             freeit ));
838
839 LDAP_F( char *)
840 ldap_err2string LDAP_P((
841         int err ));
842
843 LDAP_F( int )
844 ldap_result2error LDAP_P((      /* deprecated */
845         LDAP *ld,
846         LDAPMessage *r,
847         int freeit ));
848
849 LDAP_F( void )
850 ldap_perror LDAP_P((    /* deprecated */
851         LDAP *ld,
852         LDAP_CONST char *s ));
853
854
855 /*
856  * in modify.c:
857  */
858 LDAP_F( int )
859 ldap_modify_ext LDAP_P((
860         LDAP                    *ld,
861         LDAP_CONST char *dn,
862         LDAPMod                 **mods,
863         LDAPControl             **serverctrls,
864         LDAPControl             **clientctrls,
865         int                     *msgidp ));
866
867 LDAP_F( int )
868 ldap_modify_ext_s LDAP_P((
869         LDAP                    *ld,
870         LDAP_CONST char *dn,
871         LDAPMod                 **mods,
872         LDAPControl             **serverctrls,
873         LDAPControl             **clientctrls ));
874
875 LDAP_F( int )
876 ldap_modify LDAP_P((
877         LDAP *ld,
878         LDAP_CONST char *dn,
879         LDAPMod **mods ));
880
881 LDAP_F( int )
882 ldap_modify_s LDAP_P((
883         LDAP *ld,
884         LDAP_CONST char *dn,
885         LDAPMod **mods ));
886
887
888 /*
889  * in modrdn.c:
890  */
891 LDAP_F( int )
892 ldap_rename LDAP_P((
893         LDAP *ld,
894         LDAP_CONST char *dn,
895         LDAP_CONST char *newrdn,
896         int deleteoldrdn,
897         LDAP_CONST char *newSuperior,
898         LDAPControl **sctrls,
899         LDAPControl **cctrls,
900         int *msgidp ));
901
902 LDAP_F( int )
903 ldap_rename_s LDAP_P((
904         LDAP *ld,
905         LDAP_CONST char *dn,
906         LDAP_CONST char *newrdn,
907         int deleteoldrdn,
908         LDAP_CONST char *newSuperior,
909         LDAPControl **sctrls,
910         LDAPControl **cctrls ));
911
912 LDAP_F( int )
913 ldap_rename_ext LDAP_P((
914         LDAP                    *ld,
915         LDAP_CONST char *dn,
916         LDAP_CONST char *newrdn,
917         LDAP_CONST char *newparent,
918         int                             deleteoldrdn,
919         LDAPControl             **serverctrls,
920         LDAPControl             **clientctrls,
921         int                     *msgidp ));
922
923 LDAP_F( int )
924 ldap_rename_ext_s LDAP_P((
925         LDAP                    *ld,
926         LDAP_CONST char *dn,
927         LDAP_CONST char *newrdn,
928         LDAP_CONST char *newparent,
929         int                             deleteoldrdn,
930         LDAPControl             **serverctrls,
931         LDAPControl             **clientctrls ));
932
933 LDAP_F( int )
934 ldap_rename2 LDAP_P((
935         LDAP *ld,
936         LDAP_CONST char *dn,
937         LDAP_CONST char *newrdn,
938         int deleteoldrdn,
939         LDAP_CONST char *newSuperior ));
940
941 LDAP_F( int )
942 ldap_rename2_s LDAP_P((
943         LDAP *ld,
944         LDAP_CONST char *dn,
945         LDAP_CONST char *newrdn,
946         int deleteoldrdn,
947         LDAP_CONST char *newSuperior));
948
949 LDAP_F( int )
950 ldap_modrdn LDAP_P((
951         LDAP *ld,
952         LDAP_CONST char *dn,
953         LDAP_CONST char *newrdn ));
954
955 LDAP_F( int )
956 ldap_modrdn_s LDAP_P((
957         LDAP *ld,
958         LDAP_CONST char *dn,
959         LDAP_CONST char *newrdn ));
960
961 LDAP_F( int )
962 ldap_modrdn2 LDAP_P((
963         LDAP *ld,
964         LDAP_CONST char *dn,
965         LDAP_CONST char *newrdn,
966         int deleteoldrdn ));
967
968 LDAP_F( int )
969 ldap_modrdn2_s LDAP_P((
970         LDAP *ld,
971         LDAP_CONST char *dn,
972         LDAP_CONST char *newrdn,
973         int deleteoldrdn));
974
975
976 /*
977  * in open.c:
978  */
979 LDAP_F( LDAP *)
980 ldap_open LDAP_P((
981         LDAP_CONST char *host,
982         int port ));
983
984 LDAP_F( LDAP *)
985 ldap_init LDAP_P((
986         LDAP_CONST char *host,
987         int port ));
988
989
990 /*
991  * in messages.c:
992  */
993 LDAP_F( LDAPMessage *)
994 ldap_first_message LDAP_P((
995         LDAP *ld,
996         LDAPMessage *chain ));
997
998 LDAP_F( LDAPMessage *)
999 ldap_next_message LDAP_P((
1000         LDAP *ld,
1001         LDAPMessage *msg ));
1002
1003 LDAP_F( int )
1004 ldap_count_messages LDAP_P((
1005         LDAP *ld,
1006         LDAPMessage *chain ));
1007
1008
1009 /*
1010  * in references.c:
1011  */
1012 LDAP_F( LDAPMessage *)
1013 ldap_first_reference LDAP_P((
1014         LDAP *ld,
1015         LDAPMessage *chain ));
1016
1017 LDAP_F( LDAPMessage *)
1018 ldap_next_reference LDAP_P((
1019         LDAP *ld,
1020         LDAPMessage *ref ));
1021
1022 LDAP_F( int )
1023 ldap_count_references LDAP_P((
1024         LDAP *ld,
1025         LDAPMessage *chain ));
1026
1027 LDAP_F( int )
1028 ldap_parse_reference LDAP_P((
1029         LDAP                    *ld,
1030         LDAPMessage             *ref,
1031         char                    ***referralsp,
1032         LDAPControl             ***serverctrls,
1033         int                             freeit));
1034
1035
1036 /*
1037  * in getentry.c:
1038  */
1039 LDAP_F( LDAPMessage *)
1040 ldap_first_entry LDAP_P((
1041         LDAP *ld,
1042         LDAPMessage *chain ));
1043
1044 LDAP_F( LDAPMessage *)
1045 ldap_next_entry LDAP_P((
1046         LDAP *ld,
1047         LDAPMessage *entry ));
1048
1049 LDAP_F( int )
1050 ldap_count_entries LDAP_P((
1051         LDAP *ld,
1052         LDAPMessage *chain ));
1053
1054 LDAP_F( int )
1055 ldap_get_entry_controls LDAP_P((
1056         LDAP                    *ld,
1057         LDAPMessage             *entry,
1058         LDAPControl             ***serverctrls));
1059
1060
1061 /*
1062  * in addentry.c
1063  */
1064 LDAP_F( LDAPMessage *)
1065 ldap_delete_result_entry LDAP_P((
1066         LDAPMessage **list,
1067         LDAPMessage *e ));
1068
1069 LDAP_F( void )
1070 ldap_add_result_entry LDAP_P((
1071         LDAPMessage **list,
1072         LDAPMessage *e ));
1073
1074
1075 /*
1076  * in getdn.c
1077  */
1078 LDAP_F( char * )
1079 ldap_get_dn LDAP_P((
1080         LDAP *ld,
1081         LDAPMessage *entry ));
1082
1083 LDAP_F( char * )
1084 ldap_dn2ufn LDAP_P((
1085         LDAP_CONST char *dn ));
1086
1087 LDAP_F( char ** )
1088 ldap_explode_dn LDAP_P((
1089         LDAP_CONST char *dn,
1090         int notypes ));
1091
1092 LDAP_F( char ** )
1093 ldap_explode_rdn LDAP_P((
1094         LDAP_CONST char *rdn,
1095         int notypes ));
1096
1097 LDAP_F( char * )
1098 ldap_parent_dn LDAP_P((
1099         LDAP_CONST char *dn ));
1100
1101 LDAP_F( char * )
1102 ldap_relative_dn LDAP_P((
1103         LDAP_CONST char *dn ));
1104
1105 LDAP_F( char * )
1106 ldap_normalize_dn LDAP_P((
1107         LDAP_CONST char *dn ));
1108
1109 LDAP_F( char ** )
1110 ldap_explode_dns LDAP_P(( /* deprecated */
1111         LDAP_CONST char *dn ));
1112
1113 LDAP_F( int )
1114 ldap_is_dns_dn LDAP_P(( /* deprecated */
1115         LDAP_CONST char *dn ));
1116
1117
1118 /*
1119  * in getattr.c
1120  */
1121 LDAP_F( char *)
1122 ldap_first_attribute LDAP_P((                                                                    
1123         LDAP *ld,
1124         LDAPMessage *entry,
1125         BerElement **ber ));
1126
1127 LDAP_F( char *)
1128 ldap_next_attribute LDAP_P((
1129         LDAP *ld,
1130         LDAPMessage *entry,
1131         BerElement *ber ));
1132
1133
1134 /*
1135  * in getvalues.c
1136  */
1137 LDAP_F( char **)
1138 ldap_get_values LDAP_P((
1139         LDAP *ld,
1140         LDAPMessage *entry,
1141         LDAP_CONST char *target ));
1142
1143 LDAP_F( struct berval **)
1144 ldap_get_values_len LDAP_P((
1145         LDAP *ld,
1146         LDAPMessage *entry,
1147         LDAP_CONST char *target ));
1148
1149 LDAP_F( int )
1150 ldap_count_values LDAP_P((
1151         char **vals ));
1152
1153 LDAP_F( int )
1154 ldap_count_values_len LDAP_P((
1155         struct berval **vals ));
1156
1157 LDAP_F( void )
1158 ldap_value_free LDAP_P((
1159         char **vals ));
1160
1161 LDAP_F( void )
1162 ldap_value_free_len LDAP_P((
1163         struct berval **vals ));
1164
1165 /*
1166  * in result.c:
1167  */
1168 LDAP_F( int )
1169 ldap_result LDAP_P((
1170         LDAP *ld,
1171         int msgid,
1172         int all,
1173         struct timeval *timeout,
1174         LDAPMessage **result ));
1175
1176 LDAP_F( int )
1177 ldap_msgtype LDAP_P((
1178         LDAPMessage *lm ));
1179
1180 LDAP_F( int )
1181 ldap_msgid   LDAP_P((
1182         LDAPMessage *lm ));
1183
1184 LDAP_F( int )
1185 ldap_msgfree LDAP_P((
1186         LDAPMessage *lm ));
1187
1188 LDAP_F( int )
1189 ldap_msgdelete LDAP_P((
1190         LDAP *ld,
1191         int msgid ));
1192
1193
1194 /*
1195  * in search.c:
1196  */
1197 LDAP_F( int )
1198 ldap_search_ext LDAP_P((
1199         LDAP                    *ld,
1200         LDAP_CONST char *base,
1201         int                             scope,
1202         LDAP_CONST char *filter,
1203         char                    **attrs,
1204         int                             attrsonly,
1205         LDAPControl             **serverctrls,
1206         LDAPControl             **clientctrls,
1207         struct timeval  *timeout,
1208         int                             sizelimit,
1209         int                             *msgidp ));
1210
1211 LDAP_F( int )
1212 ldap_search_ext_s LDAP_P((
1213         LDAP                    *ld,
1214         LDAP_CONST char *base,
1215         int                             scope,
1216         LDAP_CONST char *filter,
1217         char                    **attrs,
1218         int                             attrsonly,
1219         LDAPControl             **serverctrls,
1220         LDAPControl             **clientctrls,
1221         struct timeval  *timeout,
1222         int                             sizelimit,
1223         LDAPMessage             **res ));
1224
1225 LDAP_F( int )
1226 ldap_search LDAP_P((
1227         LDAP *ld,
1228         LDAP_CONST char *base,
1229         int scope,
1230         LDAP_CONST char *filter,
1231         char **attrs,
1232         int attrsonly ));
1233
1234 LDAP_F( int )
1235 ldap_search_s LDAP_P((
1236         LDAP *ld,
1237         LDAP_CONST char *base,
1238         int scope,
1239         LDAP_CONST char *filter,
1240         char **attrs,
1241         int attrsonly,
1242         LDAPMessage **res ));
1243
1244 LDAP_F( int )
1245 ldap_search_st LDAP_P((                                                  
1246         LDAP *ld,
1247         LDAP_CONST char *base,
1248         int scope,
1249         LDAP_CONST char *filter,
1250     char **attrs,
1251         int attrsonly,
1252         struct timeval *timeout,
1253         LDAPMessage **res ));
1254
1255
1256 /*
1257  * in ufn.c
1258  */
1259 LDAP_F( int )
1260 ldap_ufn_search_c LDAP_P((
1261         LDAP *ld,
1262         LDAP_CONST char *ufn,
1263         char **attrs,
1264         int attrsonly,
1265         LDAPMessage **res,
1266         int (*cancelproc)( void *cl ),
1267         void *cancelparm ));
1268
1269 LDAP_F( int )
1270 ldap_ufn_search_ct LDAP_P((
1271         LDAP *ld,
1272         LDAP_CONST char *ufn,
1273         char **attrs,
1274         int attrsonly,
1275         LDAPMessage **res,
1276         int (*cancelproc)( void *cl ),
1277         void *cancelparm,
1278         char *tag1,
1279         char *tag2,
1280         char *tag3 ));
1281
1282 LDAP_F( int )
1283 ldap_ufn_search_s LDAP_P((
1284         LDAP *ld,
1285         LDAP_CONST char *ufn,
1286         char **attrs,
1287         int attrsonly,
1288         LDAPMessage **res ));
1289
1290 LDAP_F( LDAPFiltDesc *)
1291 ldap_ufn_setfilter LDAP_P((
1292         LDAP *ld,
1293         LDAP_CONST char *fname ));
1294
1295 LDAP_F( void )
1296 ldap_ufn_setprefix LDAP_P((
1297         LDAP *ld,
1298         LDAP_CONST char *prefix ));
1299
1300 LDAP_F( int )
1301 ldap_ufn_timeout LDAP_P((
1302         void *tvparam ));
1303
1304
1305 /*
1306  * in unbind.c
1307  */
1308 LDAP_F( int )
1309 ldap_unbind LDAP_P((
1310         LDAP *ld ));
1311
1312 LDAP_F( int )
1313 ldap_unbind_s LDAP_P((
1314         LDAP *ld ));
1315
1316 LDAP_F( int )
1317 ldap_unbind_ext LDAP_P((
1318         LDAP                    *ld,
1319         LDAPControl             **serverctrls,
1320         LDAPControl             **clientctrls));
1321
1322 LDAP_F( int )
1323 ldap_unbind_ext_s LDAP_P((
1324         LDAP                    *ld,
1325         LDAPControl             **serverctrls,
1326         LDAPControl             **clientctrls));
1327
1328 /*
1329  * in getfilter.c
1330  */
1331 LDAP_F( LDAPFiltDesc *)
1332 ldap_init_getfilter LDAP_P((
1333         LDAP_CONST char *fname ));
1334
1335 LDAP_F( LDAPFiltDesc *)
1336 ldap_init_getfilter_buf LDAP_P((
1337         /* LDAP_CONST */ char *buf,
1338         ber_len_t buflen ));
1339
1340 LDAP_F( LDAPFiltInfo *)
1341 ldap_getfirstfilter LDAP_P((
1342         LDAPFiltDesc *lfdp,
1343         /* LDAP_CONST */ char *tagpat,
1344         /* LDAP_CONST */ char *value ));
1345
1346 LDAP_F( LDAPFiltInfo *)
1347 ldap_getnextfilter LDAP_P((
1348         LDAPFiltDesc *lfdp ));
1349
1350 LDAP_F( void )
1351 ldap_setfilteraffixes LDAP_P((
1352         LDAPFiltDesc *lfdp,
1353         LDAP_CONST char *prefix,
1354         LDAP_CONST char *suffix ));
1355
1356 LDAP_F( void )
1357 ldap_build_filter LDAP_P((
1358         char *buf,
1359         ber_len_t buflen,
1360         LDAP_CONST char *pattern,
1361         LDAP_CONST char *prefix,
1362         LDAP_CONST char *suffix,
1363         LDAP_CONST char *attr,
1364         LDAP_CONST char *value,
1365         char **valwords ));
1366
1367
1368 /*
1369  * in free.c
1370  */
1371
1372 LDAP_F( void * )
1373 ldap_memalloc LDAP_P((
1374         ber_len_t s ));
1375
1376 LDAP_F( void * )
1377 ldap_memrealloc LDAP_P((
1378         void* p,
1379         ber_len_t s ));
1380
1381 LDAP_F( void * )
1382 ldap_memcalloc LDAP_P((
1383         ber_len_t n,
1384         ber_len_t s ));
1385
1386 LDAP_F( void )
1387 ldap_memfree LDAP_P((
1388         void* p ));
1389
1390 LDAP_F( void )
1391 ldap_memvfree LDAP_P((
1392         void** v ));
1393
1394 LDAP_F( char * )
1395 ldap_strdup LDAP_P((
1396         LDAP_CONST char * ));
1397
1398 LDAP_F( void )
1399 ldap_getfilter_free LDAP_P((
1400         LDAPFiltDesc *lfdp ));
1401
1402 LDAP_F( void )
1403 ldap_mods_free LDAP_P((
1404         LDAPMod **mods,
1405         int freemods ));
1406
1407
1408 /*
1409  * in friendly.c
1410  */
1411 LDAP_F( char * )
1412 ldap_friendly_name LDAP_P((
1413         LDAP_CONST char *filename,
1414         /* LDAP_CONST */ char *uname,
1415         LDAPFriendlyMap **map ));
1416
1417 LDAP_F( void )
1418 ldap_free_friendlymap LDAP_P((
1419         LDAPFriendlyMap **map ));
1420
1421
1422 /*
1423  * in cldap.c
1424  */
1425 LDAP_F( LDAP * )
1426 cldap_open LDAP_P((
1427         LDAP_CONST char *host,
1428         int port ));
1429
1430 LDAP_F( void )
1431 cldap_close LDAP_P((
1432         LDAP *ld ));
1433
1434 LDAP_F( int )
1435 cldap_search_s LDAP_P(( LDAP *ld,
1436         LDAP_CONST char *base,
1437         int scope,
1438         LDAP_CONST char *filter,
1439         char **attrs,
1440         int attrsonly,
1441         LDAPMessage **res,
1442         char *logdn ));
1443
1444 LDAP_F( void )
1445 cldap_setretryinfo LDAP_P((
1446         LDAP *ld,
1447         int tries,
1448         int timeout ));
1449
1450
1451 /*
1452  * in sort.c
1453  */
1454 LDAP_F( int )
1455 ldap_sort_entries LDAP_P(( LDAP *ld,
1456         LDAPMessage **chain,
1457         LDAP_CONST char *attr,
1458         int (*cmp) (LDAP_CONST char *, LDAP_CONST char *) ));
1459
1460 LDAP_F( int )
1461 ldap_sort_values LDAP_P((
1462         LDAP *ld,
1463         char **vals,
1464         int (*cmp) (LDAP_CONST void *, LDAP_CONST void *) ));
1465
1466 LDAP_F( int )
1467 ldap_sort_strcasecmp LDAP_P((
1468         LDAP_CONST void *a,
1469         LDAP_CONST void *b ));
1470
1471
1472 /*
1473  * in url.c
1474  *
1475  * need _ext varients
1476  */
1477 LDAP_F( int )
1478 ldap_is_ldap_url LDAP_P((
1479         LDAP_CONST char *url ));
1480
1481 LDAP_F( int )
1482 ldap_is_ldaps_url LDAP_P((
1483         LDAP_CONST char *url ));
1484
1485 LDAP_F( int )
1486 ldap_url_parse LDAP_P((
1487         LDAP_CONST char *url,
1488         LDAPURLDesc **ludpp ));
1489
1490 LDAP_F( void )
1491 ldap_free_urldesc LDAP_P((
1492         LDAPURLDesc *ludp ));
1493
1494 LDAP_F( int )
1495 ldap_url_search LDAP_P((
1496         LDAP *ld,
1497         LDAP_CONST char *url,
1498         int attrsonly ));
1499
1500 LDAP_F( int )
1501 ldap_url_search_s LDAP_P((
1502         LDAP *ld,
1503         LDAP_CONST char *url,
1504         int attrsonly,
1505         LDAPMessage **res ));
1506
1507 LDAP_F( int )
1508 ldap_url_search_st LDAP_P((
1509         LDAP *ld,
1510         LDAP_CONST char *url,
1511         int attrsonly,
1512         struct timeval *timeout,
1513         LDAPMessage **res ));
1514
1515
1516 /*
1517  * in charset.c
1518  *      DEPRECATED
1519  */
1520 LDAP_F( void )
1521 ldap_set_string_translators LDAP_P((
1522         LDAP *ld,
1523         BERTranslateProc encode_proc,
1524         BERTranslateProc decode_proc ));
1525
1526 LDAP_F( int )
1527 ldap_translate_from_t61 LDAP_P((
1528         LDAP *ld,
1529         char **bufp,
1530         ber_len_t *lenp,
1531         int free_input ));
1532
1533 LDAP_F( int )
1534 ldap_translate_to_t61 LDAP_P((
1535         LDAP *ld,
1536         char **bufp,
1537         ber_len_t *lenp,
1538         int free_input ));
1539
1540 LDAP_F( void )
1541 ldap_enable_translation LDAP_P((
1542         LDAP *ld,
1543         LDAPMessage *entry,
1544         int enable ));
1545
1546 LDAP_F( int )
1547 ldap_t61_to_8859 LDAP_P((
1548         char **bufp,
1549         ber_len_t *buflenp,
1550         int free_input ));
1551
1552 LDAP_F( int )
1553 ldap_8859_to_t61 LDAP_P((
1554         char **bufp,
1555         ber_len_t *buflenp,
1556         int free_input ));
1557
1558 LDAP_END_DECL
1559
1560 #endif /* _LDAP_H */