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