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