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