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