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