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