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