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