]> git.sur5r.net Git - openldap/blob - include/ldap.h
For ITS#157: Added LDAP backend for slapd, which also required adding
[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         char            *mod_type;
323         union mod_vals_u {
324                 char            **modv_strvals;
325                 struct berval   **modv_bvals;
326         } mod_vals;
327 #define mod_values      mod_vals.modv_strvals
328 #define mod_bvalues     mod_vals.modv_bvals
329 } LDAPMod;
330
331 /* 
332  * possible error codes we can return
333  */
334
335 #define LDAP_SUCCESS                    0x00
336 #define LDAP_OPERATIONS_ERROR           0x01
337 #define LDAP_PROTOCOL_ERROR             0x02
338 #define LDAP_TIMELIMIT_EXCEEDED         0x03
339 #define LDAP_SIZELIMIT_EXCEEDED         0x04
340 #define LDAP_COMPARE_FALSE              0x05
341 #define LDAP_COMPARE_TRUE               0x06
342 #define LDAP_STRONG_AUTH_NOT_SUPPORTED  0x07
343 #define LDAP_AUTH_METHOD_NOT_SUPPORTED LDAP_STRONG_AUTH_NOT_SUPPORTED
344 #define LDAP_STRONG_AUTH_REQUIRED       0x08
345 #define LDAP_PARTIAL_RESULTS            0x09    /* not listed in v3 */
346
347 #define LDAP_REFERRAL                           0x0a /* LDAPv3 */
348 #define LDAP_ADMINLIMIT_EXCEEDED        0x0b /* LDAPv3 */
349 #define LDAP_UNAVAILABLE_CRITICIAL_EXTENSION    0x0c /* LDAPv3 */
350 #define LDAP_CONFIDENTIALITY_REQUIRED   0x0d /* LDAPv3 */
351 #define LDAP_SASL_BIND_IN_PROGRESS      0x0e /* LDAPv3 */       
352
353 #define LDAP_NO_SUCH_ATTRIBUTE          0x10
354 #define LDAP_UNDEFINED_TYPE             0x11
355 #define LDAP_INAPPROPRIATE_MATCHING     0x12
356 #define LDAP_CONSTRAINT_VIOLATION       0x13
357 #define LDAP_TYPE_OR_VALUE_EXISTS       0x14
358 #define LDAP_INVALID_SYNTAX             0x15
359
360 #define LDAP_NO_SUCH_OBJECT             0x20
361 #define LDAP_ALIAS_PROBLEM              0x21
362 #define LDAP_INVALID_DN_SYNTAX          0x22
363 #define LDAP_IS_LEAF                    0x23 /* not LDAPv3 */
364 #define LDAP_ALIAS_DEREF_PROBLEM        0x24
365
366 #define LDAP_NAME_ERROR(n)      (((int)(n) & 0x00f0) == 0x0020)
367
368 #define LDAP_INAPPROPRIATE_AUTH         0x30
369 #define LDAP_INVALID_CREDENTIALS        0x31
370 #define LDAP_INSUFFICIENT_ACCESS        0x32
371 #define LDAP_BUSY                       0x33
372 #define LDAP_UNAVAILABLE                0x34
373 #define LDAP_UNWILLING_TO_PERFORM       0x35
374 #define LDAP_LOOP_DETECT                0x36
375
376 #define LDAP_NAMING_VIOLATION           0x40
377 #define LDAP_OBJECT_CLASS_VIOLATION     0x41
378 #define LDAP_NOT_ALLOWED_ON_NONLEAF     0x42
379 #define LDAP_NOT_ALLOWED_ON_RDN         0x43
380 #define LDAP_ALREADY_EXISTS             0x44
381 #define LDAP_NO_OBJECT_CLASS_MODS       0x45
382 #define LDAP_RESULTS_TOO_LARGE          0x46 /* CLDAP */
383 #define LDAP_AFFECTS_MULTIPLE_DSAS      0x47 /* LDAPv3 */
384
385 #define LDAP_OTHER                      0x50
386 #define LDAP_SERVER_DOWN                0x51
387 #define LDAP_LOCAL_ERROR                0x52
388 #define LDAP_ENCODING_ERROR             0x53
389 #define LDAP_DECODING_ERROR             0x54
390 #define LDAP_TIMEOUT                    0x55
391 #define LDAP_AUTH_UNKNOWN               0x56
392 #define LDAP_FILTER_ERROR               0x57
393 #define LDAP_USER_CANCELLED             0x58
394 #define LDAP_PARAM_ERROR                0x59
395 #define LDAP_NO_MEMORY                  0x5a
396
397 #define LDAP_CONNECT_ERROR                              0x5b    /* new */
398 #define LDAP_NOT_SUPPORTED                              0x5c    /* new */
399 #define LDAP_CONTROL_NOT_FOUND                  0x5d    /* new */
400 #define LDAP_NO_RESULTS_RETURNED                0x5e    /* new */
401 #define LDAP_MORE_RESULTS_TO_RETURN             0x5f    /* new */
402 #define LDAP_CLIENT_LOOP                                0x60    /* new */
403 #define LDAP_REFERRAL_LIMIT_EXCEEDED    0x61    /* new */
404
405 /*
406  * This structure represents both ldap messages and ldap responses.
407  * These are really the same, except in the case of search responses,
408  * where a response has multiple messages.
409  */
410
411 typedef struct ldapmsg LDAPMessage;
412
413 /*
414  * structures for ldap getfilter routines
415  */
416
417 typedef struct ldap_filt_info {
418         char                    *lfi_filter;
419         char                    *lfi_desc;
420         int                     lfi_scope;      /* LDAP_SCOPE_BASE, etc */
421         int                     lfi_isexact;    /* exact match filter? */
422         struct ldap_filt_info   *lfi_next;
423 } LDAPFiltInfo;
424
425 typedef struct ldap_filt_list {
426     char                        *lfl_tag;
427     char                        *lfl_pattern;
428     char                        *lfl_delims;
429     LDAPFiltInfo                *lfl_ilist;
430     struct ldap_filt_list       *lfl_next;
431 } LDAPFiltList;
432
433
434 #define LDAP_FILT_MAXSIZ        1024
435
436 typedef struct ldap_filt_desc {
437         LDAPFiltList            *lfd_filtlist;
438         LDAPFiltInfo            *lfd_curfip;
439         LDAPFiltInfo            lfd_retfi;
440         char                    lfd_filter[ LDAP_FILT_MAXSIZ ];
441         char                    *lfd_curval;
442         char                    *lfd_curvalcopy;
443         char                    **lfd_curvalwords;
444         char                    *lfd_filtprefix;
445         char                    *lfd_filtsuffix;
446 } LDAPFiltDesc;
447
448
449 /*
450  * structure representing an ldap connection
451  */
452
453 typedef struct ldap LDAP;
454
455 #define LDAP_DEREF_NEVER        0x00
456 #define LDAP_DEREF_SEARCHING    0x01
457 #define LDAP_DEREF_FINDING      0x02
458 #define LDAP_DEREF_ALWAYS       0x03
459
460 #define LDAP_NO_LIMIT           0
461
462 /* how many messages to retrieve results for */
463 #define LDAP_MSG_ONE            0x00
464 #define LDAP_MSG_ALL            0x01
465 #define LDAP_MSG_RECEIVED       0x02
466
467 /*
468  * structure for ldap friendly mapping routines
469  */
470
471 typedef struct ldap_friendly {
472         char    *lf_unfriendly;
473         char    *lf_friendly;
474 } LDAPFriendlyMap;
475
476 /*
477  * types for ldap URL handling
478  */
479 typedef struct ldap_url_desc {
480     char        *lud_host;
481     int         lud_port;
482     char        *lud_dn;
483     char        **lud_attrs;
484     int         lud_scope;
485     char        *lud_filter;
486     char        *lud_string;    /* for internal use only */
487 } LDAPURLDesc;
488
489 #define LDAP_URL_ERR_NOTLDAP    0x01    /* URL doesn't begin with "ldap://" */
490 #define LDAP_URL_ERR_NODN               0x02    /* URL has no DN (required) */
491 #define LDAP_URL_ERR_BADSCOPE   0x03    /* URL scope string is invalid */
492 #define LDAP_URL_ERR_MEM                0x04    /* can't allocate memory space */
493
494 /*
495  * The API draft spec says we should declare (or cause to be declared)
496  * 'struct timeval'.   We don't.  See LDAPext discussions.
497  */
498 struct timeval;
499
500 /*
501  * in options.c:
502  */
503 LDAP_F( int )
504 ldap_get_option LDAP_P((
505         LDAP *ld,
506         int option,
507         void *outvalue));
508
509 LDAP_F( int )
510 ldap_set_option LDAP_P((
511         LDAP *ld,
512         int option,
513         LDAP_CONST void *invalue));
514
515
516 /*
517  * in controls.c:
518  */
519 LDAP_F( void )
520 ldap_control_free LDAP_P((
521         LDAPControl *ctrl ));
522
523 LDAP_F( void )
524 ldap_controls_free LDAP_P((
525         LDAPControl **ctrls ));
526
527   
528 /*
529  * in extended.c:
530  */
531 LDAP_F( int )
532 ldap_extended_operation LDAP_P((
533         LDAP                    *ld,
534         LDAP_CONST char *exoid,
535         struct berval   *exdata,
536         LDAPControl             **serverctrls,
537         LDAPControl             **clientctrls,
538         int                             *msgidp ));
539
540 LDAP_F( int )
541 ldap_extended_operation_s LDAP_P((
542         LDAP                    *ld,
543         LDAP_CONST char *exoid,
544         struct berval   *exdata,
545         LDAPControl             **serverctrls,
546         LDAPControl             **clientctrls,
547         char                    **retoidp,
548         struct berval   **retdatap ));
549
550 LDAP_F( int )
551 ldap_parse_extended_result LDAP_P((
552         LDAP                    *ld,
553         LDAPMessage             *res,
554         char                    **retoidp,
555         struct berval   **retdatap,
556         int                             freeit ));
557
558 /*
559  * in abandon.c:
560  */
561 LDAP_F( int )
562 ldap_abandon LDAP_P((
563         LDAP *ld,
564         int msgid ));
565
566 LDAP_F( int )
567 ldap_abandon_ext LDAP_P((
568         LDAP                    *ld,
569         int                             msgid,
570         LDAPControl             **serverctrls,
571         LDAPControl             **clientctrls ));
572
573
574 /*
575  * in add.c:
576  */
577 LDAP_F( int )
578 ldap_add_ext LDAP_P((
579         LDAP                    *ld,
580         LDAP_CONST char *dn,
581         LDAPMod                 **attrs,
582         LDAPControl             **serverctrls,
583         LDAPControl             **clientctrls,
584         int                     *msgidp ));
585
586 LDAP_F( int )
587 ldap_add_ext_s LDAP_P((
588         LDAP                    *ld,
589         LDAP_CONST char *dn,
590         LDAPMod                 **attrs,
591         LDAPControl             **serverctrls,
592         LDAPControl             **clientctrls ));
593
594 LDAP_F( int )
595 ldap_add LDAP_P((
596         LDAP *ld,
597         LDAP_CONST char *dn,
598         LDAPMod **attrs ));
599
600 LDAP_F( int )
601 ldap_add_s LDAP_P((
602         LDAP *ld,
603         LDAP_CONST char *dn,
604         LDAPMod **attrs ));
605
606
607 /*
608  * in saslbind.c:
609  */
610 LDAP_F( int )
611 ldap_sasl_bind LDAP_P((
612         LDAP                    *ld,
613         LDAP_CONST char *dn,
614         LDAP_CONST char *mechanism,
615         struct berval   *cred,
616         LDAPControl             **serverctrls,
617         LDAPControl             **clientctrls,
618         int                             msgidp ));
619
620 LDAP_F( int )
621 ldap_sasl_bind_s LDAP_P((
622         LDAP                    *ld,
623         LDAP_CONST char *dn,
624         LDAP_CONST char *mechanism,
625         struct berval   *cred,
626         LDAPControl             **serverctrls,
627         LDAPControl             **clientctrls,
628         struct berval   **servercredp ));
629
630 LDAP_F( int )
631 ldap_parse_sasl_bind_result LDAP_P((
632         LDAP                    *ld,
633         LDAPMessage             *res,
634         struct berval   **servercredp,
635         int                             freeit ));
636
637 /*
638  * in bind.c:
639  *      (deprecated)
640  */
641 LDAP_F( int )
642 ldap_bind LDAP_P((
643         LDAP *ld,
644         LDAP_CONST char *who,
645         LDAP_CONST char *passwd,
646         int authmethod ));
647
648 LDAP_F( int )
649 ldap_bind_s LDAP_P((
650         LDAP *ld,
651         LDAP_CONST char *who,
652         LDAP_CONST char *cred,
653         int authmethod ));
654
655 LDAP_F( void )
656 ldap_set_rebind_proc LDAP_P((
657         LDAP *ld,
658         int (*rebindproc) LDAP_P((
659                 LDAP *ld,
660                 char **dnp,
661                 char **passwdp,
662                 int *authmethodp,
663                 int freeit ))));
664
665
666 /*
667  * in sbind.c:
668  */
669 LDAP_F( int )
670 ldap_simple_bind LDAP_P((
671         LDAP *ld,
672         LDAP_CONST char *who,
673         LDAP_CONST char *passwd ));
674
675 LDAP_F( int )
676 ldap_simple_bind_s LDAP_P((
677         LDAP *ld,
678         LDAP_CONST char *who,
679         LDAP_CONST char *passwd ));
680
681
682 /*
683  * in kbind.c:
684  *      (deprecated)
685  */
686 LDAP_F( int )
687 ldap_kerberos_bind_s LDAP_P((
688         LDAP *ld,
689         LDAP_CONST char *who ));
690
691 LDAP_F( int )
692 ldap_kerberos_bind1 LDAP_P((
693         LDAP *ld,
694         LDAP_CONST char *who ));
695
696 LDAP_F( int )
697 ldap_kerberos_bind1_s LDAP_P((
698         LDAP *ld,
699         LDAP_CONST char *who ));
700
701 LDAP_F( int )
702 ldap_kerberos_bind2 LDAP_P((
703         LDAP *ld,
704         LDAP_CONST char *who ));
705
706 LDAP_F( int )
707 ldap_kerberos_bind2_s LDAP_P((
708         LDAP *ld,
709         LDAP_CONST char *who ));
710
711 /*
712  * in cache.c
713  * (deprecated)
714  */
715 LDAP_F( int )
716 ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem ));
717
718 LDAP_F( void )
719 ldap_disable_cache LDAP_P(( LDAP *ld ));
720
721 LDAP_F( void )
722 ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts ));
723
724 LDAP_F( void )
725 ldap_destroy_cache LDAP_P(( LDAP *ld ));
726
727 LDAP_F( void )
728 ldap_flush_cache LDAP_P(( LDAP *ld ));
729
730 LDAP_F( void )
731 ldap_uncache_entry LDAP_P(( LDAP *ld, LDAP_CONST char *dn ));
732
733 LDAP_F( void )
734 ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
735
736
737 /*
738  * in compare.c:
739  */
740 LDAP_F( int )
741 ldap_compare_ext LDAP_P((
742         LDAP                    *ld,
743         LDAP_CONST char *dn,
744         LDAP_CONST char *attr,
745         struct berval   *bvalue,
746         LDAPControl             **serverctrls,
747         LDAPControl             **clientctrls,
748         int                     *msgidp ));
749
750 LDAP_F( int )
751 ldap_compare_ext_s LDAP_P((
752         LDAP                    *ld,
753         LDAP_CONST char *dn,
754         LDAP_CONST char *attr,
755         struct berval   *bvalue,
756         LDAPControl             **serverctrls,
757         LDAPControl             **clientctrls ));
758
759 LDAP_F( int )
760 ldap_compare LDAP_P((
761         LDAP *ld,
762         LDAP_CONST char *dn,
763         LDAP_CONST char *attr,
764         LDAP_CONST char *value ));
765
766 LDAP_F( int )
767 ldap_compare_s LDAP_P((
768         LDAP *ld,
769         LDAP_CONST char *dn,
770         LDAP_CONST char *attr,
771         LDAP_CONST char *value ));
772
773
774 /*
775  * in delete.c:
776  */
777 LDAP_F( int )
778 ldap_delete_ext LDAP_P((
779         LDAP                    *ld,
780         LDAP_CONST char *dn,
781         LDAPControl             **serverctrls,
782         LDAPControl             **clientctrls,
783         int                     *msgidp ));
784
785 LDAP_F( int )
786 ldap_delete_ext_s LDAP_P((
787         LDAP                    *ld,
788         LDAP_CONST char *dn,
789         LDAPControl             **serverctrls,
790         LDAPControl             **clientctrls ));
791
792 LDAP_F( int )
793 ldap_delete LDAP_P((
794         LDAP *ld,
795         LDAP_CONST char *dn ));
796
797 LDAP_F( int )
798 ldap_delete_s LDAP_P((
799         LDAP *ld,
800         LDAP_CONST char *dn ));
801
802
803 /*
804  * in error.c:
805  */
806 LDAP_F( int )
807 ldap_result2error LDAP_P((      /* deprecated */
808         LDAP *ld,
809         LDAPMessage *r,
810         int freeit ));
811
812 LDAP_F( char *)
813 ldap_err2string LDAP_P((
814         int err ));
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_parse_result LDAP_P((
1124         LDAP                    *ld,
1125         LDAPMessage             *res,
1126         int                             *errcodep,
1127         char                    **matcheddnp,
1128         char                    **errmsgp,
1129         char                    ***referralsp,
1130         LDAPControl             ***serverctrls,
1131         int                             freeit ));
1132
1133 LDAP_F( int )
1134 ldap_msgtype LDAP_P((
1135         LDAPMessage *lm ));
1136
1137 LDAP_F( int )
1138 ldap_msgid   LDAP_P((
1139         LDAPMessage *lm ));
1140
1141 LDAP_F( int )
1142 ldap_msgfree LDAP_P((
1143         LDAPMessage *lm ));
1144
1145 LDAP_F( int )
1146 ldap_msgdelete LDAP_P((
1147         LDAP *ld,
1148         int msgid ));
1149
1150
1151 /*
1152  * in search.c:
1153  */
1154 LDAP_F( int )
1155 ldap_search_ext LDAP_P((
1156         LDAP                    *ld,
1157         LDAP_CONST char *base,
1158         int                             scope,
1159         LDAP_CONST char *filter,
1160         char                    **attrs,
1161         int                             attrsonly,
1162         LDAPControl             **serverctrls,
1163         LDAPControl             **clientctrls,
1164         struct timeval  *timeout,
1165         int                             sizelimit,
1166         int                             *msgidp ));
1167
1168 LDAP_F( int )
1169 ldap_search_ext_s LDAP_P((
1170         LDAP                    *ld,
1171         LDAP_CONST char *base,
1172         int                             scope,
1173         LDAP_CONST char *filter,
1174         char                    **attrs,
1175         int                             attrsonly,
1176         LDAPControl             **serverctrls,
1177         LDAPControl             **clientctrls,
1178         struct timeval  *timeout,
1179         int                             sizelimit,
1180         LDAPMessage             **res ));
1181
1182 LDAP_F( int )
1183 ldap_search LDAP_P((
1184         LDAP *ld,
1185         LDAP_CONST char *base,
1186         int scope,
1187         LDAP_CONST char *filter,
1188         char **attrs,
1189         int attrsonly ));
1190
1191 LDAP_F( int )
1192 ldap_search_s LDAP_P((
1193         LDAP *ld,
1194         LDAP_CONST char *base,
1195         int scope,
1196         LDAP_CONST char *filter,
1197         char **attrs,
1198         int attrsonly,
1199         LDAPMessage **res ));
1200
1201 LDAP_F( int )
1202 ldap_search_st LDAP_P((                                                  
1203         LDAP *ld,
1204         LDAP_CONST char *base,
1205         int scope,
1206         LDAP_CONST char *filter,
1207     char **attrs,
1208         int attrsonly,
1209         struct timeval *timeout,
1210         LDAPMessage **res ));
1211
1212
1213 /*
1214  * in ufn.c
1215  */
1216 LDAP_F( int )
1217 ldap_ufn_search_c LDAP_P((
1218         LDAP *ld,
1219         LDAP_CONST char *ufn,
1220         char **attrs,
1221         int attrsonly,
1222         LDAPMessage **res,
1223         int (*cancelproc)( void *cl ),
1224         void *cancelparm ));
1225
1226 LDAP_F( int )
1227 ldap_ufn_search_ct LDAP_P((
1228         LDAP *ld,
1229         LDAP_CONST char *ufn,
1230         char **attrs,
1231         int attrsonly,
1232         LDAPMessage **res,
1233         int (*cancelproc)( void *cl ),
1234         void *cancelparm,
1235         char *tag1,
1236         char *tag2,
1237         char *tag3 ));
1238
1239 LDAP_F( int )
1240 ldap_ufn_search_s LDAP_P((
1241         LDAP *ld,
1242         LDAP_CONST char *ufn,
1243         char **attrs,
1244         int attrsonly,
1245         LDAPMessage **res ));
1246
1247 LDAP_F( LDAPFiltDesc *)
1248 ldap_ufn_setfilter LDAP_P((
1249         LDAP *ld,
1250         LDAP_CONST char *fname ));
1251
1252 LDAP_F( void )
1253 ldap_ufn_setprefix LDAP_P((
1254         LDAP *ld,
1255         LDAP_CONST char *prefix ));
1256
1257 LDAP_F( int )
1258 ldap_ufn_timeout LDAP_P((
1259         void *tvparam ));
1260
1261
1262 /*
1263  * in unbind.c
1264  */
1265 LDAP_F( int )
1266 ldap_unbind LDAP_P((
1267         LDAP *ld ));
1268
1269 LDAP_F( int )
1270 ldap_unbind_s LDAP_P((
1271         LDAP *ld ));
1272
1273 LDAP_F( int )
1274 ldap_unbind_ext LDAP_P((
1275         LDAP                    *ld,
1276         LDAPControl             **serverctrls,
1277         LDAPControl             **clientctrls));
1278
1279 LDAP_F( int )
1280 ldap_unbind_ext_s LDAP_P((
1281         LDAP                    *ld,
1282         LDAPControl             **serverctrls,
1283         LDAPControl             **clientctrls));
1284
1285 /*
1286  * in getfilter.c
1287  */
1288 LDAP_F( LDAPFiltDesc *)
1289 ldap_init_getfilter LDAP_P((
1290         LDAP_CONST char *fname ));
1291
1292 LDAP_F( LDAPFiltDesc *)
1293 ldap_init_getfilter_buf LDAP_P((
1294         /* LDAP_CONST */ char *buf,
1295         long buflen ));
1296
1297 LDAP_F( LDAPFiltInfo *)
1298 ldap_getfirstfilter LDAP_P((
1299         LDAPFiltDesc *lfdp,
1300         /* LDAP_CONST */ char *tagpat,
1301         /* LDAP_CONST */ char *value ));
1302
1303 LDAP_F( LDAPFiltInfo *)
1304 ldap_getnextfilter LDAP_P((
1305         LDAPFiltDesc *lfdp ));
1306
1307 LDAP_F( void )
1308 ldap_setfilteraffixes LDAP_P((
1309         LDAPFiltDesc *lfdp,
1310         LDAP_CONST char *prefix,
1311         LDAP_CONST char *suffix ));
1312
1313 LDAP_F( void )
1314 ldap_build_filter LDAP_P((
1315         char *buf,
1316         unsigned long buflen,
1317         LDAP_CONST char *pattern,
1318         LDAP_CONST char *prefix,
1319         LDAP_CONST char *suffix,
1320         LDAP_CONST char *attr,
1321         LDAP_CONST char *value,
1322         char **valwords ));
1323
1324
1325 /*
1326  * in free.c
1327  */
1328
1329 LDAP_F( void )
1330 ldap_memfree LDAP_P((
1331         void *p ));
1332
1333 LDAP_F( void )
1334 ldap_getfilter_free LDAP_P((
1335         LDAPFiltDesc *lfdp ));
1336
1337 LDAP_F( void )
1338 ldap_mods_free LDAP_P((
1339         LDAPMod **mods,
1340         int freemods ));
1341
1342
1343 /*
1344  * in friendly.c
1345  */
1346 LDAP_F( char * )
1347 ldap_friendly_name LDAP_P((
1348         LDAP_CONST char *filename,
1349         /* LDAP_CONST */ char *uname,
1350         LDAPFriendlyMap **map ));
1351
1352 LDAP_F( void )
1353 ldap_free_friendlymap LDAP_P((
1354         LDAPFriendlyMap **map ));
1355
1356
1357 /*
1358  * in cldap.c
1359  */
1360 LDAP_F( LDAP * )
1361 cldap_open LDAP_P((
1362         LDAP_CONST char *host,
1363         int port ));
1364
1365 LDAP_F( void )
1366 cldap_close LDAP_P((
1367         LDAP *ld ));
1368
1369 LDAP_F( int )
1370 cldap_search_s LDAP_P(( LDAP *ld,
1371         LDAP_CONST char *base,
1372         int scope,
1373         LDAP_CONST char *filter,
1374         char **attrs,
1375         int attrsonly,
1376         LDAPMessage **res,
1377         char *logdn ));
1378
1379 LDAP_F( void )
1380 cldap_setretryinfo LDAP_P((
1381         LDAP *ld,
1382         int tries,
1383         int timeout ));
1384
1385
1386 /*
1387  * in sort.c
1388  */
1389 LDAP_F( int )
1390 ldap_sort_entries LDAP_P(( LDAP *ld,
1391         LDAPMessage **chain,
1392         LDAP_CONST char *attr,
1393         int (*cmp) (LDAP_CONST char *, LDAP_CONST char *) ));
1394
1395 LDAP_F( int )
1396 ldap_sort_values LDAP_P((
1397         LDAP *ld,
1398         char **vals,
1399         int (*cmp) (LDAP_CONST void *, LDAP_CONST void *) ));
1400
1401 LDAP_F( int )
1402 ldap_sort_strcasecmp LDAP_P((
1403         LDAP_CONST void *a,
1404         LDAP_CONST void *b ));
1405
1406
1407 /*
1408  * in url.c
1409  *
1410  * need _ext varients
1411  */
1412 LDAP_F( int )
1413 ldap_is_ldap_url LDAP_P((
1414         LDAP_CONST char *url ));
1415
1416 LDAP_F( int )
1417 ldap_url_parse LDAP_P((
1418         LDAP_CONST char *url,
1419         LDAPURLDesc **ludpp ));
1420
1421 LDAP_F( void )
1422 ldap_free_urldesc LDAP_P((
1423         LDAPURLDesc *ludp ));
1424
1425 LDAP_F( int )
1426 ldap_url_search LDAP_P((
1427         LDAP *ld,
1428         LDAP_CONST char *url,
1429         int attrsonly ));
1430
1431 LDAP_F( int )
1432 ldap_url_search_s LDAP_P((
1433         LDAP *ld,
1434         LDAP_CONST char *url,
1435         int attrsonly,
1436         LDAPMessage **res ));
1437
1438 LDAP_F( int )
1439 ldap_url_search_st LDAP_P((
1440         LDAP *ld,
1441         LDAP_CONST char *url,
1442         int attrsonly,
1443         struct timeval *timeout,
1444         LDAPMessage **res ));
1445
1446
1447 /*
1448  * in charset.c
1449  *      DEPRECATED
1450  */
1451 LDAP_F( void )
1452 ldap_set_string_translators LDAP_P((
1453         LDAP *ld,
1454         BERTranslateProc encode_proc,
1455         BERTranslateProc decode_proc ));
1456
1457 LDAP_F( int )
1458 ldap_translate_from_t61 LDAP_P((
1459         LDAP *ld,
1460         char **bufp,
1461         unsigned long *lenp,
1462         int free_input ));
1463
1464 LDAP_F( int )
1465 ldap_translate_to_t61 LDAP_P((
1466         LDAP *ld,
1467         char **bufp,
1468         unsigned long *lenp, int free_input ));
1469
1470 LDAP_F( void )
1471 ldap_enable_translation LDAP_P((
1472         LDAP *ld,
1473         LDAPMessage *entry,
1474         int enable ));
1475
1476 LDAP_F( int )
1477 ldap_t61_to_8859 LDAP_P((
1478         char **bufp,
1479         unsigned long *buflenp,
1480         int free_input ));
1481
1482 LDAP_F( int )
1483 ldap_8859_to_t61 LDAP_P((
1484         char **bufp,
1485         unsigned long *buflenp,
1486         int free_input ));
1487
1488 LDAP_END_DECL
1489
1490 #endif /* _LDAP_H */