]> git.sur5r.net Git - openldap/blob - include/ldap.h
0996e98d8ae234ade079221c452909790095647f
[openldap] / include / ldap.h
1 /*
2  * Copyright (c) 1990 Regents of the University of Michigan.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 #ifndef _LDAP_H
14 #define _LDAP_H
15
16 #include <ldap_cdefs.h>
17
18 LDAP_BEGIN_DECL
19
20 #define LDAP_PORT       389
21
22 #define LDAP_VERSION1   1
23 #define LDAP_VERSION2   2
24 #define LDAP_VERSION3   3
25
26 #define LDAP_VERSION            LDAP_VERSION2
27 #define LDAP_VERSION_MIN        LDAP_VERSION2
28 #define LDAP_VERSION_MAX        LDAP_VERSION2
29
30 /*
31  * We'll use 2000+draft revision for our API version number
32  * As such, the number will be above the old RFC but below 
33  * whatever number does finally get assigned
34  */
35 #define LDAP_API_VERSION        2001
36 #define LDAP_VENDOR_NAME        "OpenLDAP"
37 /* We'll eventually release as 200 */
38 #define LDAP_VENDOR_VERSION     190
39
40 /* include LDAP_API_FEATURE defines */
41 #include <ldap_features.h>
42
43 #if defined( LDAP_API_FEATURE_X_OPENLDAP_REENTRANT ) || \
44         ( defined( LDAP_THREAD_SAFE ) && \
45                 defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) )
46         /* -lldap may or may not be thread safe */
47         /* -lldap_r, if available, is always thread safe */
48 #       define  LDAP_API_FEATURE_THREAD_SAFE 1
49 #endif
50 #if defined( LDAP_THREAD_SAFE ) && \
51         defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE )
52 /* #define LDAP_API_FEATURE_SESSION_SAFE        1       */
53 /* #define LDAP_API_OPERATION_SESSION_SAFE      1       */
54 #endif
55
56 #define LDAP_COMPAT20
57 #define LDAP_COMPAT30
58 #if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
59 #define LDAP_COMPAT
60 #endif
61
62 /* LDAP_OPTions defined by draft-ldapext-ldap-c-api-01 */
63 #define LDAP_OPT_API_INFO                       0x0000
64 #define LDAP_OPT_DESC                           0x0001
65 #define LDAP_OPT_DEREF                          0x0002
66 #define LDAP_OPT_SIZELIMIT                      0x0003
67 #define LDAP_OPT_TIMELIMIT                      0x0004
68 /* 0x05 - 0x07 not defined by current draft */
69 #define LDAP_OPT_REFERRALS                      0x0008
70 #define LDAP_OPT_RESTART                        0x0009
71 /* 0x0a - 0x10 not defined by current draft */
72 #define LDAP_OPT_PROTOCOL_VERSION       0x0011
73 #define LDAP_OPT_SERVER_CONTROLS        0x0012
74 #define LDAP_OPT_CLIENT_CONTROLS        0x0013
75 /* 0x14 - 0x2f not defined by current draft */
76 #define LDAP_OPT_HOST_NAME                      0x0030
77 #define LDAP_OPT_ERROR_NUMBER           0x0031
78 #define LDAP_OPT_ERROR_STRING           0x0032
79
80 /* not defined by current draft */
81 /*      for LDAPv2 compatibility */
82 #define LDAP_OPT_DNS                            0x1001  /* use DN & DNS */
83
84 /* on/off values */
85 #define LDAP_OPT_ON             ((void *) 1)
86 #define LDAP_OPT_OFF    ((void *) 0)
87
88 #define LDAP_OPT_SUCCESS        0
89 #define LDAP_OPT_ERROR          (-1)
90
91 #ifdef LDAP_DEBUG
92 extern int ldap_debug;
93 #endif
94
95 #define LDAP_API_INFO_VERSION   1
96 typedef struct ldapapiinfo {
97         int             ldapai_info_version;            /* version of LDAPAPIInfo (1) */
98         int             ldapai_api_version;                     /* revision of API supported */
99         int             ldapai_protocol_version;        /* highest LDAP version supported */
100         char    **ldapai_extensions;            /* names of API extensions */
101         char    *ldapai_vendor_name;            /* name of supplier */
102         int             ldapai_vendor_version;          /* supplier-specific version * 100 */
103 } LDAPAPIInfo;
104
105 typedef struct ldapcontrol {
106         char                    *ldctl_oid;
107         struct berval   ldctl_value;
108         char                    ldctl_iscritical;
109 } LDAPControl, *PLDAPControl;
110
111 #define LDAP_MAX_ATTR_LEN       100
112
113 /* 
114  * specific LDAP instantiations of BER types we know about
115  */
116
117 /* general stuff */
118 #define LDAP_TAG_MESSAGE        0x30L   /* tag is 16 + constructed bit */
119 #define OLD_LDAP_TAG_MESSAGE    0x10L   /* forgot the constructed bit  */
120 #define LDAP_TAG_MSGID          0x02L
121
122 /* possible operations a client can invoke */
123 #define LDAP_REQ_BIND                   0x60L   /* application + constructed */
124 #define LDAP_REQ_UNBIND                 0x42L   /* application + primitive   */
125 #define LDAP_REQ_SEARCH                 0x63L   /* application + constructed */
126 #define LDAP_REQ_MODIFY                 0x66L   /* application + constructed */
127 #define LDAP_REQ_ADD                    0x68L   /* application + constructed */
128 #define LDAP_REQ_DELETE                 0x4aL   /* application + primitive   */
129 #define LDAP_REQ_MODRDN                 0x6cL   /* application + constructed */
130 #define LDAP_REQ_COMPARE                0x6eL   /* application + constructed */
131 #define LDAP_REQ_ABANDON                0x50L   /* application + primitive   */
132
133 /* version 3.0 compatibility stuff */
134 #define LDAP_REQ_UNBIND_30              0x62L
135 #define LDAP_REQ_DELETE_30              0x6aL
136 #define LDAP_REQ_ABANDON_30             0x70L
137
138 /* 
139  * old broken stuff for backwards compatibility - forgot application tag
140  * and constructed/primitive bit
141  */
142 #define OLD_LDAP_REQ_BIND               0x00L
143 #define OLD_LDAP_REQ_UNBIND             0x02L
144 #define OLD_LDAP_REQ_SEARCH             0x03L
145 #define OLD_LDAP_REQ_MODIFY             0x06L
146 #define OLD_LDAP_REQ_ADD                0x08L
147 #define OLD_LDAP_REQ_DELETE             0x0aL
148 #define OLD_LDAP_REQ_MODRDN             0x0cL
149 #define OLD_LDAP_REQ_COMPARE            0x0eL
150 #define OLD_LDAP_REQ_ABANDON            0x10L
151
152 /* possible result types a server can return */
153 #define LDAP_RES_BIND                   0x61L   /* application + constructed */
154 #define LDAP_RES_SEARCH_ENTRY           0x64L   /* application + constructed */
155 #define LDAP_RES_SEARCH_REFERENCE       0x73L   /* V3: application + constructed */
156 #define LDAP_RES_SEARCH_RESULT          0x65L   /* application + constructed */
157 #define LDAP_RES_MODIFY                 0x67L   /* application + constructed */
158 #define LDAP_RES_ADD                    0x69L   /* application + constructed */
159 #define LDAP_RES_DELETE                 0x6bL   /* application + constructed */
160 #define LDAP_RES_MODRDN                 0x6dL   /* application + constructed */
161 #define LDAP_RES_COMPARE                0x6fL   /* application + constructed */
162 #define LDAP_RES_EXTENDED               0x78L   /* V3: application + constructed */
163 #define LDAP_RES_ANY                    (-1L)
164
165 /* old broken stuff for backwards compatibility */
166 #define OLD_LDAP_RES_BIND               0x01L
167 #define OLD_LDAP_RES_SEARCH_ENTRY       0x04L
168 #define OLD_LDAP_RES_SEARCH_RESULT      0x05L
169 #define OLD_LDAP_RES_MODIFY             0x07L
170 #define OLD_LDAP_RES_ADD                0x09L
171 #define OLD_LDAP_RES_DELETE             0x0bL
172 #define OLD_LDAP_RES_MODRDN             0x0dL
173 #define OLD_LDAP_RES_COMPARE            0x0fL
174
175 /* authentication methods available */
176 #define LDAP_AUTH_NONE          0x00L   /* no authentication              */
177 #define LDAP_AUTH_SIMPLE        0x80L   /* context specific + primitive   */
178 #define LDAP_AUTH_KRBV4         0xffL   /* means do both of the following */
179 #define LDAP_AUTH_KRBV41        0x81L   /* context specific + primitive   */
180 #define LDAP_AUTH_KRBV42        0x82L   /* context specific + primitive   */
181
182 /* 3.0 compatibility auth methods */
183 #define LDAP_AUTH_SIMPLE_30     0xa0L   /* context specific + constructed */
184 #define LDAP_AUTH_KRBV41_30     0xa1L   /* context specific + constructed */
185 #define LDAP_AUTH_KRBV42_30     0xa2L   /* context specific + constructed */
186
187 /* old broken stuff */
188 #define OLD_LDAP_AUTH_SIMPLE    0x00L
189 #define OLD_LDAP_AUTH_KRBV4     0x01L
190 #define OLD_LDAP_AUTH_KRBV42    0x02L
191
192 /* filter types */
193 #define LDAP_FILTER_AND         0xa0L   /* context specific + constructed */
194 #define LDAP_FILTER_OR          0xa1L   /* context specific + constructed */
195 #define LDAP_FILTER_NOT         0xa2L   /* context specific + constructed */
196 #define LDAP_FILTER_EQUALITY    0xa3L   /* context specific + constructed */
197 #define LDAP_FILTER_SUBSTRINGS  0xa4L   /* context specific + constructed */
198 #define LDAP_FILTER_GE          0xa5L   /* context specific + constructed */
199 #define LDAP_FILTER_LE          0xa6L   /* context specific + constructed */
200 #define LDAP_FILTER_PRESENT     0x87L   /* context specific + primitive   */
201 #define LDAP_FILTER_APPROX      0xa8L   /* context specific + constructed */
202
203 /* 3.0 compatibility filter types */
204 #define LDAP_FILTER_PRESENT_30  0xa7L   /* context specific + constructed */
205
206 /* old broken stuff */
207 #define OLD_LDAP_FILTER_AND             0x00L
208 #define OLD_LDAP_FILTER_OR              0x01L
209 #define OLD_LDAP_FILTER_NOT             0x02L
210 #define OLD_LDAP_FILTER_EQUALITY        0x03L
211 #define OLD_LDAP_FILTER_SUBSTRINGS      0x04L
212 #define OLD_LDAP_FILTER_GE              0x05L
213 #define OLD_LDAP_FILTER_LE              0x06L
214 #define OLD_LDAP_FILTER_PRESENT         0x07L
215 #define OLD_LDAP_FILTER_APPROX          0x08L
216
217 /* substring filter component types */
218 #define LDAP_SUBSTRING_INITIAL  0x80L   /* context specific */
219 #define LDAP_SUBSTRING_ANY      0x81L   /* context specific */
220 #define LDAP_SUBSTRING_FINAL    0x82L   /* context specific */
221
222 /* 3.0 compatibility substring filter component types */
223 #define LDAP_SUBSTRING_INITIAL_30       0xa0L   /* context specific */
224 #define LDAP_SUBSTRING_ANY_30           0xa1L   /* context specific */
225 #define LDAP_SUBSTRING_FINAL_30         0xa2L   /* context specific */
226
227 /* old broken stuff */
228 #define OLD_LDAP_SUBSTRING_INITIAL      0x00L
229 #define OLD_LDAP_SUBSTRING_ANY          0x01L
230 #define OLD_LDAP_SUBSTRING_FINAL        0x02L
231
232 /* search scopes */
233 #define LDAP_SCOPE_BASE         0x00
234 #define LDAP_SCOPE_ONELEVEL     0x01
235 #define LDAP_SCOPE_SUBTREE      0x02
236
237 /* for modifications */
238 typedef struct ldapmod {
239         int             mod_op;
240 #define LDAP_MOD_ADD            0x00
241 #define LDAP_MOD_DELETE         0x01
242 #define LDAP_MOD_REPLACE        0x02
243 #define LDAP_MOD_BVALUES        0x80
244         char            *mod_type;
245         union {
246                 char            **modv_strvals;
247                 struct berval   **modv_bvals;
248         } mod_vals;
249 #define mod_values      mod_vals.modv_strvals
250 #define mod_bvalues     mod_vals.modv_bvals
251 } LDAPMod;
252
253 /* 
254  * possible error codes we can return
255  */
256
257 #define LDAP_SUCCESS                    0x00
258 #define LDAP_OPERATIONS_ERROR           0x01
259 #define LDAP_PROTOCOL_ERROR             0x02
260 #define LDAP_TIMELIMIT_EXCEEDED         0x03
261 #define LDAP_SIZELIMIT_EXCEEDED         0x04
262 #define LDAP_COMPARE_FALSE              0x05
263 #define LDAP_COMPARE_TRUE               0x06
264 #define LDAP_STRONG_AUTH_NOT_SUPPORTED  0x07
265 #define LDAP_STRONG_AUTH_REQUIRED       0x08
266 #define LDAP_PARTIAL_RESULTS            0x09
267 #define LDAP_REFERRAL           0x0a /* LDAPv3 */
268 #define LDAP_ADMINLIMIT_EXCEEDED        0x0b /* LDAPv3 */
269 #define LDAP_UNAVAILABLE_CRITICIAL_EXTENSION    0x0c /* LDAPv3 */
270 #define LDAP_CONFIDENTIALITY_REQUIRED   0x0d /* LDAPv3 */
271 #define LDAP_SASL_BIND_IN_PROGRESS      0x0e /* LDAPv3 */       
272
273 #define LDAP_NO_SUCH_ATTRIBUTE          0x10
274 #define LDAP_UNDEFINED_TYPE             0x11
275 #define LDAP_INAPPROPRIATE_MATCHING     0x12
276 #define LDAP_CONSTRAINT_VIOLATION       0x13
277 #define LDAP_TYPE_OR_VALUE_EXISTS       0x14
278 #define LDAP_INVALID_SYNTAX             0x15
279
280 #define LDAP_NO_SUCH_OBJECT             0x20
281 #define LDAP_ALIAS_PROBLEM              0x21
282 #define LDAP_INVALID_DN_SYNTAX          0x22
283 #define LDAP_IS_LEAF                    0x23 /* not LDAPv3 */
284 #define LDAP_ALIAS_DEREF_PROBLEM        0x24
285
286 #define NAME_ERROR(n)   ((n & 0xf0) == 0x20)
287
288 #define LDAP_INAPPROPRIATE_AUTH         0x30
289 #define LDAP_INVALID_CREDENTIALS        0x31
290 #define LDAP_INSUFFICIENT_ACCESS        0x32
291 #define LDAP_BUSY                       0x33
292 #define LDAP_UNAVAILABLE                0x34
293 #define LDAP_UNWILLING_TO_PERFORM       0x35
294 #define LDAP_LOOP_DETECT                0x36
295
296 #define LDAP_NAMING_VIOLATION           0x40
297 #define LDAP_OBJECT_CLASS_VIOLATION     0x41
298 #define LDAP_NOT_ALLOWED_ON_NONLEAF     0x42
299 #define LDAP_NOT_ALLOWED_ON_RDN         0x43
300 #define LDAP_ALREADY_EXISTS             0x44
301 #define LDAP_NO_OBJECT_CLASS_MODS       0x45
302 #define LDAP_RESULTS_TOO_LARGE          0x46 /* CLDAP */
303 #define LDAP_AFFECTS_MULTIPLE_DSAS      0x47 /* LDAPv3 */
304
305 #define LDAP_OTHER                      0x50
306 #define LDAP_SERVER_DOWN                0x51
307 #define LDAP_LOCAL_ERROR                0x52
308 #define LDAP_ENCODING_ERROR             0x53
309 #define LDAP_DECODING_ERROR             0x54
310 #define LDAP_TIMEOUT                    0x55
311 #define LDAP_AUTH_UNKNOWN               0x56
312 #define LDAP_FILTER_ERROR               0x57
313 #define LDAP_USER_CANCELLED             0x58
314 #define LDAP_PARAM_ERROR                0x59
315 #define LDAP_NO_MEMORY                  0x5a
316
317
318 /* default limit on nesting of referrals */
319 #define LDAP_DEFAULT_REFHOPLIMIT        5
320
321 /*
322  * This structure represents both ldap messages and ldap responses.
323  * These are really the same, except in the case of search responses,
324  * where a response has multiple messages.
325  */
326
327 typedef struct ldapmsg LDAPMessage;
328 #define NULLMSG ((LDAPMessage *) NULL)
329
330
331 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
332 /*
333  * structure for tracking LDAP server host, ports, DNs, etc.
334  */
335 typedef struct ldap_server {
336         char                    *lsrv_host;
337         char                    *lsrv_dn;       /* if NULL, use default */
338         int                     lsrv_port;
339         struct ldap_server      *lsrv_next;
340 } LDAPServer;
341
342
343 /*
344  * structure for representing an LDAP server connection
345  */
346 typedef struct ldap_conn {
347         Sockbuf                 *lconn_sb;
348         int                     lconn_refcnt;
349         time_t          lconn_lastused; /* time */
350         int                     lconn_status;
351 #define LDAP_CONNST_NEEDSOCKET          1
352 #define LDAP_CONNST_CONNECTING          2
353 #define LDAP_CONNST_CONNECTED           3
354         LDAPServer              *lconn_server;
355         char                    *lconn_krbinstance;
356         struct ldap_conn        *lconn_next;
357 } LDAPConn;
358
359
360 /*
361  * structure used to track outstanding requests
362  */
363 typedef struct ldapreq {
364         int             lr_msgid;       /* the message id */
365         int             lr_status;      /* status of request */
366 #define LDAP_REQST_INPROGRESS   1
367 #define LDAP_REQST_CHASINGREFS  2
368 #define LDAP_REQST_NOTCONNECTED 3
369 #define LDAP_REQST_WRITING      4
370         int             lr_outrefcnt;   /* count of outstanding referrals */
371         int             lr_origid;      /* original request's message id */
372         int             lr_parentcnt;   /* count of parent requests */
373         int             lr_res_msgtype; /* result message type */
374         int             lr_res_errno;   /* result LDAP errno */
375         char            *lr_res_error;  /* result error string */
376         char            *lr_res_matched;/* result matched DN string */
377         BerElement      *lr_ber;        /* ber encoded request contents */
378         LDAPConn        *lr_conn;       /* connection used to send request */
379         struct ldapreq  *lr_parent;     /* request that spawned this referral */
380         struct ldapreq  *lr_refnext;    /* next referral spawned */
381         struct ldapreq  *lr_prev;       /* previous request */
382         struct ldapreq  *lr_next;       /* next request */
383 } LDAPRequest;
384 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
385
386
387 /*
388  * structure for client cache
389  */
390 #define LDAP_CACHE_BUCKETS      31      /* cache hash table size */
391 typedef struct ldapcache {
392         LDAPMessage     *lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */
393         LDAPMessage     *lc_requests;                   /* unfulfilled reqs */
394         long            lc_timeout;                     /* request timeout */
395         long            lc_maxmem;                      /* memory to use */
396         long            lc_memused;                     /* memory in use */
397         int             lc_enabled;                     /* enabled? */
398         unsigned long   lc_options;                     /* options */
399 #define LDAP_CACHE_OPT_CACHENOERRS      0x00000001
400 #define LDAP_CACHE_OPT_CACHEALLERRS     0x00000002
401 }  LDAPCache;
402 #define NULLLDCACHE ((LDAPCache *)NULL)
403
404 /*
405  * structures for ldap getfilter routines
406  */
407
408 typedef struct ldap_filt_info {
409         char                    *lfi_filter;
410         char                    *lfi_desc;
411         int                     lfi_scope;      /* LDAP_SCOPE_BASE, etc */
412         int                     lfi_isexact;    /* exact match filter? */
413         struct ldap_filt_info   *lfi_next;
414 } LDAPFiltInfo;
415
416 typedef struct ldap_filt_list {
417     char                        *lfl_tag;
418     char                        *lfl_pattern;
419     char                        *lfl_delims;
420     LDAPFiltInfo                *lfl_ilist;
421     struct ldap_filt_list       *lfl_next;
422 } LDAPFiltList;
423
424
425 #define LDAP_FILT_MAXSIZ        1024
426
427 typedef struct ldap_filt_desc {
428         LDAPFiltList            *lfd_filtlist;
429         LDAPFiltInfo            *lfd_curfip;
430         LDAPFiltInfo            lfd_retfi;
431         char                    lfd_filter[ LDAP_FILT_MAXSIZ ];
432         char                    *lfd_curval;
433         char                    *lfd_curvalcopy;
434         char                    **lfd_curvalwords;
435         char                    *lfd_filtprefix;
436         char                    *lfd_filtsuffix;
437 } LDAPFiltDesc;
438
439
440 /*
441  * structure representing an ldap connection
442  */
443
444 typedef struct ldap LDAP;
445
446 #define LDAP_DEREF_NEVER        0x00
447 #define LDAP_DEREF_SEARCHING    0x01
448 #define LDAP_DEREF_FINDING      0x02
449 #define LDAP_DEREF_ALWAYS       0x03
450
451 #define LDAP_NO_LIMIT           0
452
453
454 /*
455  * structure for ldap friendly mapping routines
456  */
457
458 typedef struct ldap_friendly {
459         char    *lf_unfriendly;
460         char    *lf_friendly;
461 } LDAPFriendlyMap;
462
463
464 /*
465  * handy macro to check whether LDAP struct is set up for CLDAP or not
466  */
467 #define LDAP_IS_CLDAP( ld )     ( (ld)->ld_sb.sb_naddr > 0 )
468
469
470 /*
471  * types for ldap URL handling
472  */
473 typedef struct ldap_url_desc {
474     char        *lud_host;
475     int         lud_port;
476     char        *lud_dn;
477     char        **lud_attrs;
478     int         lud_scope;
479     char        *lud_filter;
480     char        *lud_string;    /* for internal use only */
481 } LDAPURLDesc;
482 #define NULLLDAPURLDESC ((LDAPURLDesc *)NULL)
483
484 #define LDAP_URL_ERR_NOTLDAP    1       /* URL doesn't begin with "ldap://" */
485 #define LDAP_URL_ERR_NODN       2       /* URL has no DN (required) */
486 #define LDAP_URL_ERR_BADSCOPE   3       /* URL scope string is invalid */
487 #define LDAP_URL_ERR_MEM        4       /* can't allocate memory space */
488
489 /* avoid pulling in headers */
490 struct timeval;
491
492 /*
493  * in options.c:
494  */
495 LDAP_F int ldap_get_option LDAP_P((LDAP *ld, int option, void *outvalue));
496 LDAP_F int ldap_set_option LDAP_P((LDAP *ld, int option, void *invalue));
497
498 /* Not yet */
499 LDAP_F void ldap_control_free LDAP_P(( LDAPControl *ctrl ));
500 LDAP_F void ldap_controls_free LDAP_P(( LDAPControl **ctrls ));
501   
502 /*
503  * in abandon.c:
504  */
505 LDAP_F int ldap_abandon LDAP_P(( LDAP *ld, int msgid ));
506
507 /*
508  * in add.c:
509  */
510 LDAP_F int ldap_add LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs ));
511 LDAP_F int ldap_add_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs ));
512
513 /*
514  * in bind.c:
515  */
516 LDAP_F int ldap_bind LDAP_P(( LDAP *ld, char *who, char *passwd, int authmethod ));
517 LDAP_F int ldap_bind_s LDAP_P(( LDAP *ld, char *who, char *cred, int method ));
518 LDAP_F void ldap_set_rebind_proc LDAP_P(( LDAP *ld,
519         int (*rebindproc) LDAP_P(( LDAP *ld, char **dnp, char **passwdp, int *authmethodp, int freeit ))
520 ));
521
522 /*
523  * in sbind.c:
524  */
525 LDAP_F int ldap_simple_bind LDAP_P(( LDAP *ld, char *who, char *passwd ));
526 LDAP_F int ldap_simple_bind_s LDAP_P(( LDAP *ld, char *who, char *passwd ));
527
528 /*
529  * in kbind.c:
530  */
531 LDAP_F int ldap_kerberos_bind_s LDAP_P(( LDAP *ld, char *who ));
532 LDAP_F int ldap_kerberos_bind1 LDAP_P(( LDAP *ld, char *who ));
533 LDAP_F int ldap_kerberos_bind1_s LDAP_P(( LDAP *ld, char *who ));
534 LDAP_F int ldap_kerberos_bind2 LDAP_P(( LDAP *ld, char *who ));
535 LDAP_F int ldap_kerberos_bind2_s LDAP_P(( LDAP *ld, char *who ));
536  
537
538 /*
539  * in cache.c
540  */
541 LDAP_F int ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem ));
542 LDAP_F void ldap_disable_cache LDAP_P(( LDAP *ld ));
543 LDAP_F void ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts ));
544 LDAP_F void ldap_destroy_cache LDAP_P(( LDAP *ld ));
545 LDAP_F void ldap_flush_cache LDAP_P(( LDAP *ld ));
546 LDAP_F void ldap_uncache_entry LDAP_P(( LDAP *ld, char *dn ));
547 LDAP_F void ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
548
549 /*
550  * in compare.c:
551  */
552 LDAP_F int ldap_compare LDAP_P(( LDAP *ld, char *dn, char *attr, char *value ));
553 LDAP_F int ldap_compare_s LDAP_P(( LDAP *ld, char *dn, char *attr, char *value ));
554
555 /*
556  * in delete.c:
557  */
558 LDAP_F int ldap_delete LDAP_P(( LDAP *ld, char *dn ));
559 LDAP_F int ldap_delete_s LDAP_P(( LDAP *ld, char *dn ));
560
561 /*
562  * in error.c:
563  */
564 LDAP_F int ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit ));
565 LDAP_F char *ldap_err2string LDAP_P(( int err ));
566 LDAP_F void ldap_perror LDAP_P(( LDAP *ld, char *s ));
567 LDAP_F int ldap_get_lderrno LDAP_P((LDAP *ld, char **matched, char **msg));
568
569 /*
570  * in modify.c:
571  */
572 LDAP_F int ldap_modify LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods ));
573 LDAP_F int ldap_modify_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods ));
574
575 /*
576  * in modrdn.c:
577  */
578 LDAP_F int ldap_modrdn LDAP_P(( LDAP *ld, char *dn, char *newrdn ));
579 LDAP_F int ldap_modrdn_s LDAP_P(( LDAP *ld, char *dn, char *newrdn ));
580 LDAP_F int ldap_modrdn2 LDAP_P(( LDAP *ld, char *dn, char *newrdn,
581         int deleteoldrdn ));
582 LDAP_F int ldap_modrdn2_s LDAP_P(( LDAP *ld, char *dn, char *newrdn,
583         int deleteoldrdn));
584
585 /*
586  * in open.c:
587  */
588 LDAP_F LDAP *ldap_open LDAP_P(( char *host, int port ));
589 LDAP_F LDAP *ldap_init LDAP_P(( char *defhost, int defport ));
590
591 /*
592  * in getentry.c:
593  */
594 LDAP_F LDAPMessage *ldap_first_entry LDAP_P(( LDAP *ld, LDAPMessage *chain ));
595 LDAP_F LDAPMessage *ldap_next_entry LDAP_P(( LDAP *ld, LDAPMessage *entry ));
596 LDAP_F int ldap_count_entries LDAP_P(( LDAP *ld, LDAPMessage *chain ));
597
598 /*
599  * in addentry.c
600  */
601 LDAP_F LDAPMessage *ldap_delete_result_entry LDAP_P(( LDAPMessage **list,
602         LDAPMessage *e ));
603 LDAP_F void ldap_add_result_entry LDAP_P(( LDAPMessage **list, LDAPMessage *e ));
604
605 /*
606  * in getdn.c
607  */
608 LDAP_F char *ldap_get_dn LDAP_P(( LDAP *ld, LDAPMessage *entry ));
609 LDAP_F char *ldap_dn2ufn LDAP_P(( char *dn ));
610 LDAP_F char **ldap_explode_dn LDAP_P(( char *dn, int notypes ));
611 LDAP_F char **ldap_explode_rdn LDAP_P(( char *rdn, int notypes ));
612 LDAP_F char **ldap_explode_dns LDAP_P(( char *dn ));
613 LDAP_F int ldap_is_dns_dn LDAP_P(( char *dn ));
614
615 /*
616  * in getattr.c
617  */
618 LDAP_F char *ldap_first_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry,
619         BerElement **ber ));
620 LDAP_F char *ldap_next_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry,
621         BerElement *ber ));
622
623 /*
624  * in getvalues.c
625  */
626 LDAP_F char **ldap_get_values LDAP_P(( LDAP *ld, LDAPMessage *entry, char *target ));
627 LDAP_F struct berval **ldap_get_values_len LDAP_P(( LDAP *ld, LDAPMessage *entry,
628         char *target ));
629 LDAP_F int ldap_count_values LDAP_P(( char **vals ));
630 LDAP_F int ldap_count_values_len LDAP_P(( struct berval **vals ));
631 LDAP_F void ldap_value_free LDAP_P(( char **vals ));
632 LDAP_F void ldap_value_free_len LDAP_P(( struct berval **vals ));
633
634 /*
635  * in result.c:
636  */
637 LDAP_F int ldap_result LDAP_P(( LDAP *ld, int msgid, int all,
638         struct timeval *timeout, LDAPMessage **result ));
639 LDAP_F int ldap_msgtype LDAP_P(( LDAPMessage *lm ));
640 LDAP_F int ldap_msgid   LDAP_P(( LDAPMessage *lm ));
641 LDAP_F int ldap_msgfree LDAP_P(( LDAPMessage *lm ));
642 LDAP_F int ldap_msgdelete LDAP_P(( LDAP *ld, int msgid ));
643
644 /*
645  * in search.c:
646  */
647 LDAP_F int ldap_search LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
648         char **attrs, int attrsonly ));
649 LDAP_F int ldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
650         char **attrs, int attrsonly, LDAPMessage **res ));
651 LDAP_F int ldap_search_st LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
652     char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res ));
653
654 /*
655  * in ufn.c
656  */
657 LDAP_F int ldap_ufn_search_c LDAP_P(( LDAP *ld, char *ufn, char **attrs,
658         int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ),
659         void *cancelparm ));
660 LDAP_F int ldap_ufn_search_ct LDAP_P(( LDAP *ld, char *ufn, char **attrs,
661         int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ),
662         void *cancelparm, char *tag1, char *tag2, char *tag3 ));
663 LDAP_F int ldap_ufn_search_s LDAP_P(( LDAP *ld, char *ufn, char **attrs,
664         int attrsonly, LDAPMessage **res ));
665 LDAP_F LDAPFiltDesc *ldap_ufn_setfilter LDAP_P(( LDAP *ld, char *fname ));
666 LDAP_F void ldap_ufn_setprefix LDAP_P(( LDAP *ld, char *prefix ));
667 LDAP_F int ldap_ufn_timeout LDAP_P(( void *tvparam ));
668
669
670 /*
671  * in unbind.c
672  */
673 LDAP_F int ldap_unbind LDAP_P(( LDAP *ld ));
674 LDAP_F int ldap_unbind_s LDAP_P(( LDAP *ld ));
675
676
677 /*
678  * in getfilter.c
679  */
680 LDAP_F LDAPFiltDesc *ldap_init_getfilter LDAP_P(( char *fname ));
681 LDAP_F LDAPFiltDesc *ldap_init_getfilter_buf LDAP_P(( char *buf, long buflen ));
682 LDAP_F LDAPFiltInfo *ldap_getfirstfilter LDAP_P(( LDAPFiltDesc *lfdp, char *tagpat,
683         char *value ));
684 LDAP_F LDAPFiltInfo *ldap_getnextfilter LDAP_P(( LDAPFiltDesc *lfdp ));
685 LDAP_F void ldap_setfilteraffixes LDAP_P(( LDAPFiltDesc *lfdp, char *prefix, char *suffix ));
686 LDAP_F void ldap_build_filter LDAP_P(( char *buf, unsigned long buflen,
687         char *pattern, char *prefix, char *suffix, char *attr,
688         char *value, char **valwords ));
689
690 /*
691  * in free.c
692  */
693 LDAP_F void ldap_getfilter_free LDAP_P(( LDAPFiltDesc *lfdp ));
694 LDAP_F void ldap_mods_free LDAP_P(( LDAPMod **mods, int freemods ));
695
696 /*
697  * in friendly.c
698  */
699 LDAP_F char *ldap_friendly_name LDAP_P(( char *filename, char *uname,
700         LDAPFriendlyMap **map ));
701 LDAP_F void ldap_free_friendlymap LDAP_P(( LDAPFriendlyMap **map ));
702
703
704 /*
705  * in cldap.c
706  */
707 LDAP_F LDAP *cldap_open LDAP_P(( char *host, int port ));
708 LDAP_F void cldap_close LDAP_P(( LDAP *ld ));
709 LDAP_F int cldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
710         char **attrs, int attrsonly, LDAPMessage **res, char *logdn ));
711 LDAP_F void cldap_setretryinfo LDAP_P(( LDAP *ld, int tries, int timeout ));
712
713
714 /*
715  * in sort.c
716  */
717 LDAP_F int ldap_sort_entries LDAP_P(( LDAP *ld,
718         LDAPMessage **chain, char *attr,
719         int (*cmp) (const char *, const char *) ));
720 LDAP_F int ldap_sort_values LDAP_P(( LDAP *ld,
721         char **vals, int (*cmp) (const void *, const void *) ));
722 LDAP_F int ldap_sort_strcasecmp LDAP_P(( const void *a, const void *b ));
723
724
725 /*
726  * in url.c
727  */
728 LDAP_F int ldap_is_ldap_url LDAP_P(( char *url ));
729 LDAP_F int ldap_url_parse LDAP_P(( char *url, LDAPURLDesc **ludpp ));
730 LDAP_F void ldap_free_urldesc LDAP_P(( LDAPURLDesc *ludp ));
731 LDAP_F int ldap_url_search LDAP_P(( LDAP *ld, char *url, int attrsonly ));
732 LDAP_F int ldap_url_search_s LDAP_P(( LDAP *ld, char *url, int attrsonly,
733         LDAPMessage **res ));
734 LDAP_F int ldap_url_search_st LDAP_P(( LDAP *ld, char *url, int attrsonly,
735         struct timeval *timeout, LDAPMessage **res ));
736
737
738 /*
739  * in charset.c
740  */
741 LDAP_F void ldap_set_string_translators LDAP_P(( LDAP *ld,
742         BERTranslateProc encode_proc, BERTranslateProc decode_proc ));
743 LDAP_F int ldap_translate_from_t61 LDAP_P(( LDAP *ld, char **bufp,
744         unsigned long *lenp, int free_input ));
745 LDAP_F int ldap_translate_to_t61 LDAP_P(( LDAP *ld, char **bufp,
746         unsigned long *lenp, int free_input ));
747 LDAP_F void ldap_enable_translation LDAP_P(( LDAP *ld, LDAPMessage *entry,
748         int enable ));
749
750 LDAP_F int ldap_t61_to_8859 LDAP_P(( char **bufp, unsigned long *buflenp,
751         int free_input ));
752 LDAP_F int ldap_8859_to_t61 LDAP_P(( char **bufp, unsigned long *buflenp,
753         int free_input ));
754
755
756 /*
757  * in msdos/winsock/wsa.c
758  */
759 LDAP_F void ldap_memfree LDAP_P(( void *p ));
760
761 LDAP_END_DECL
762
763 #endif /* _LDAP_H */