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