]> git.sur5r.net Git - openldap/blob - libraries/libldap/ldap-int.h
Needs <ac/time.h>
[openldap] / libraries / libldap / ldap-int.h
1 /*  ldap-int.h - defines & prototypes internal to the LDAP library */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2007 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /*  Portions Copyright (c) 1995 Regents of the University of Michigan.
17  *  All rights reserved.
18  */
19
20 #ifndef _LDAP_INT_H
21 #define _LDAP_INT_H 1
22
23 #ifdef LDAP_R_COMPILE
24 #define LDAP_THREAD_SAFE 1
25 #endif
26
27 #include "../liblber/lber-int.h"
28
29 #ifdef LDAP_R_COMPILE
30 #include <ldap_pvt_thread.h>
31 #endif
32
33 #include <ac/time.h> /* for struct timeval */
34
35 #ifdef HAVE_CYRUS_SASL
36         /* the need for this should be removed */
37 #ifdef HAVE_SASL_SASL_H
38 #include <sasl/sasl.h>
39 #else
40 #include <sasl.h>
41 #endif
42
43 #define SASL_MAX_BUFF_SIZE      65536
44 #define SASL_MIN_BUFF_SIZE      4096
45 #endif
46
47 #undef TV2MILLISEC
48 #define TV2MILLISEC(tv) (((tv)->tv_sec * 1000) + ((tv)->tv_usec/1000))
49
50 /* 
51  * Support needed if the library is running in the kernel
52  */
53 #if LDAP_INT_IN_KERNEL
54         /* 
55          * Platform specific function to return a pointer to the
56          * process-specific global options. 
57          *
58          * This function should perform the following functions:
59          *  Allocate and initialize a global options struct on a per process basis
60          *  Use callers process identifier to return its global options struct
61          *  Note: Deallocate structure when the process exits
62          */
63 #       define LDAP_INT_GLOBAL_OPT() ldap_int_global_opt()
64         struct ldapoptions *ldap_int_global_opt(void);
65 #else
66 #       define LDAP_INT_GLOBAL_OPT() (&ldap_int_global_options)
67 #endif
68
69 #define ldap_debug      ((LDAP_INT_GLOBAL_OPT())->ldo_debug)
70
71 #include "ldap_log.h"
72
73 #undef Debug
74
75 #ifdef LDAP_DEBUG
76
77 #define Debug( level, fmt, arg1, arg2, arg3 ) \
78         do { if ( ldap_debug & level ) \
79         ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ); \
80         } while ( 0 )
81
82 #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 )\
83         ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) )
84
85 #else
86
87 #define Debug( level, fmt, arg1, arg2, arg3 )                 ((void)0)
88 #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 ) ((void)0)
89
90 #endif /* LDAP_DEBUG */
91
92 #define LDAP_DEPRECATED 1
93 #include "ldap.h"
94
95 #include "ldap_pvt.h"
96
97 LDAP_BEGIN_DECL
98
99 #define LDAP_URL_PREFIX         "ldap://"
100 #define LDAP_URL_PREFIX_LEN     STRLENOF(LDAP_URL_PREFIX)
101 #define LDAPS_URL_PREFIX        "ldaps://"
102 #define LDAPS_URL_PREFIX_LEN    STRLENOF(LDAPS_URL_PREFIX)
103 #define LDAPI_URL_PREFIX        "ldapi://"
104 #define LDAPI_URL_PREFIX_LEN    STRLENOF(LDAPI_URL_PREFIX)
105 #ifdef LDAP_CONNECTIONLESS
106 #define LDAPC_URL_PREFIX        "cldap://"
107 #define LDAPC_URL_PREFIX_LEN    STRLENOF(LDAPC_URL_PREFIX)
108 #endif
109 #define LDAP_URL_URLCOLON       "URL:"
110 #define LDAP_URL_URLCOLON_LEN   STRLENOF(LDAP_URL_URLCOLON)
111
112 #define LDAP_REF_STR            "Referral:\n"
113 #define LDAP_REF_STR_LEN        STRLENOF(LDAP_REF_STR)
114 #define LDAP_LDAP_REF_STR       LDAP_URL_PREFIX
115 #define LDAP_LDAP_REF_STR_LEN   LDAP_URL_PREFIX_LEN
116
117 #define LDAP_DEFAULT_REFHOPLIMIT 5
118
119 #define LDAP_BOOL_REFERRALS             0
120 #define LDAP_BOOL_RESTART               1
121 #define LDAP_BOOL_TLS                   3
122 #define LDAP_BOOL_CONNECT_ASYNC         4
123
124 #define LDAP_BOOLEANS   unsigned long
125 #define LDAP_BOOL(n)    ((LDAP_BOOLEANS)1 << (n))
126 #define LDAP_BOOL_GET(lo, bool) \
127         ((lo)->ldo_booleans & LDAP_BOOL(bool) ? -1 : 0)
128 #define LDAP_BOOL_SET(lo, bool) ((lo)->ldo_booleans |= LDAP_BOOL(bool))
129 #define LDAP_BOOL_CLR(lo, bool) ((lo)->ldo_booleans &= ~LDAP_BOOL(bool))
130 #define LDAP_BOOL_ZERO(lo) ((lo)->ldo_booleans = 0)
131
132 /*
133  * This structure represents both ldap messages and ldap responses.
134  * These are really the same, except in the case of search responses,
135  * where a response has multiple messages.
136  */
137
138 struct ldapmsg {
139         ber_int_t               lm_msgid;       /* the message id */
140         ber_tag_t               lm_msgtype;     /* the message type */
141         BerElement      *lm_ber;        /* the ber encoded message contents */
142         struct ldapmsg  *lm_chain;      /* for search - next msg in the resp */
143         struct ldapmsg  *lm_chain_tail;
144         struct ldapmsg  *lm_next;       /* next response */
145         time_t  lm_time;        /* used to maintain cache */
146 };
147
148 #ifdef HAVE_TLS
149 struct ldaptls {
150         char            *lt_certfile;
151         char            *lt_keyfile;
152         char            *lt_dhfile;
153         char            *lt_cacertfile;
154         char            *lt_cacertdir;
155         char            *lt_ciphersuite;
156 };
157 #endif
158
159 /*
160  * structure representing get/set'able options
161  * which have global defaults.
162  */
163 struct ldapoptions {
164         short ldo_valid;
165 #define LDAP_UNINITIALIZED      0x0
166 #define LDAP_INITIALIZED        0x1
167 #define LDAP_VALID_SESSION      0x2
168 #define LDAP_TRASHED_SESSION    0xFF
169         int   ldo_debug;
170 #ifdef LDAP_CONNECTIONLESS
171 #define LDAP_IS_UDP(ld)         ((ld)->ld_options.ldo_is_udp)
172         void*                   ldo_peer;       /* struct sockaddr* */
173         char*                   ldo_cldapdn;
174         int                     ldo_is_udp;
175 #endif
176
177         /* per API call timeout */
178         struct timeval          ldo_tm_api;
179         struct timeval          ldo_tm_net;
180
181         ber_int_t               ldo_version;
182         ber_int_t               ldo_deref;
183         ber_int_t               ldo_timelimit;
184         ber_int_t               ldo_sizelimit;
185
186 #ifdef HAVE_TLS
187         /* tls context */
188         void            *ldo_tls_ctx;
189         LDAP_TLS_CONNECT_CB     *ldo_tls_connect_cb;
190         void*                   ldo_tls_connect_arg;
191         struct ldaptls ldo_tls_info;
192 #define ldo_tls_certfile        ldo_tls_info.lt_certfile
193 #define ldo_tls_keyfile ldo_tls_info.lt_keyfile
194 #define ldo_tls_dhfile  ldo_tls_info.lt_dhfile
195 #define ldo_tls_cacertfile      ldo_tls_info.lt_cacertfile
196 #define ldo_tls_cacertdir       ldo_tls_info.lt_cacertdir
197 #define ldo_tls_ciphersuite     ldo_tls_info.lt_ciphersuite
198         int                     ldo_tls_mode;
199         int                     ldo_tls_require_cert;
200 #ifdef HAVE_OPENSSL_CRL
201         int                     ldo_tls_crlcheck;
202 #endif
203 #endif
204
205         LDAPURLDesc *ldo_defludp;
206         int             ldo_defport;
207         char*   ldo_defbase;
208         char*   ldo_defbinddn;  /* bind dn */
209
210 #ifdef HAVE_CYRUS_SASL
211         char*   ldo_def_sasl_mech;              /* SASL Mechanism(s) */
212         char*   ldo_def_sasl_realm;             /* SASL realm */
213         char*   ldo_def_sasl_authcid;   /* SASL authentication identity */
214         char*   ldo_def_sasl_authzid;   /* SASL authorization identity */
215
216         /* SASL Security Properties */
217         struct sasl_security_properties ldo_sasl_secprops;
218 #endif
219
220         int             ldo_refhoplimit;        /* limit on referral nesting */
221
222         /* LDAPv3 server and client controls */
223         LDAPControl     **ldo_sctrls;
224         LDAPControl **ldo_cctrls;
225
226         /* LDAP rebind callback function */
227         LDAP_REBIND_PROC *ldo_rebind_proc;
228         void *ldo_rebind_params;
229         LDAP_NEXTREF_PROC *ldo_nextref_proc;
230         void *ldo_nextref_params;
231         LDAP_URLLIST_PROC *ldo_urllist_proc;
232         void *ldo_urllist_params;
233
234         LDAP_BOOLEANS ldo_booleans;     /* boolean options */
235 };
236
237
238 /*
239  * structure for representing an LDAP server connection
240  */
241 typedef struct ldap_conn {
242         Sockbuf         *lconn_sb;
243 #ifdef HAVE_CYRUS_SASL
244         void            *lconn_sasl_authctx;    /* context for bind */
245         void            *lconn_sasl_sockctx;    /* for security layer */
246 #endif
247         int                     lconn_refcnt;
248         time_t          lconn_created;  /* time */
249         time_t          lconn_lastused; /* time */
250         int                     lconn_rebind_inprogress;        /* set if rebind in progress */
251         char            ***lconn_rebind_queue;          /* used if rebind in progress */
252         int                     lconn_status;
253 #define LDAP_CONNST_NEEDSOCKET          1
254 #define LDAP_CONNST_CONNECTING          2
255 #define LDAP_CONNST_CONNECTED           3
256         LDAPURLDesc             *lconn_server;
257         BerElement              *lconn_ber;     /* ber receiving on this conn. */
258
259         struct ldap_conn *lconn_next;
260 } LDAPConn;
261
262
263 /*
264  * structure used to track outstanding requests
265  */
266 typedef struct ldapreq {
267         ber_int_t       lr_msgid;       /* the message id */
268         int             lr_status;      /* status of request */
269 #define LDAP_REQST_COMPLETED    0
270 #define LDAP_REQST_INPROGRESS   1
271 #define LDAP_REQST_CHASINGREFS  2
272 #define LDAP_REQST_NOTCONNECTED 3
273 #define LDAP_REQST_WRITING      4
274         int             lr_refcnt;      /* count of references */
275         int             lr_outrefcnt;   /* count of outstanding referrals */
276         int             lr_abandoned;   /* the request has been abandoned */
277         ber_int_t       lr_origid;      /* original request's message id */
278         int             lr_parentcnt;   /* count of parent requests */
279         ber_tag_t       lr_res_msgtype; /* result message type */
280         ber_int_t       lr_res_errno;   /* result LDAP errno */
281         char            *lr_res_error;  /* result error string */
282         char            *lr_res_matched;/* result matched DN string */
283         BerElement      *lr_ber;        /* ber encoded request contents */
284         LDAPConn        *lr_conn;       /* connection used to send request */
285         struct berval   lr_dn;          /* DN of request, in lr_ber */
286         struct ldapreq  *lr_parent;     /* request that spawned this referral */
287         struct ldapreq  *lr_child;      /* first child request */
288         struct ldapreq  *lr_refnext;    /* next referral spawned */
289         struct ldapreq  *lr_prev;       /* previous request */
290         struct ldapreq  *lr_next;       /* next request */
291 } LDAPRequest;
292
293 /*
294  * structure for client cache
295  */
296 #define LDAP_CACHE_BUCKETS      31      /* cache hash table size */
297 typedef struct ldapcache {
298         LDAPMessage     *lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */
299         LDAPMessage     *lc_requests;                   /* unfulfilled reqs */
300         long            lc_timeout;                     /* request timeout */
301         ber_len_t               lc_maxmem;                      /* memory to use */
302         ber_len_t               lc_memused;                     /* memory in use */
303         int             lc_enabled;                     /* enabled? */
304         unsigned long   lc_options;                     /* options */
305 #define LDAP_CACHE_OPT_CACHENOERRS      0x00000001
306 #define LDAP_CACHE_OPT_CACHEALLERRS     0x00000002
307 }  LDAPCache;
308
309 /*
310  * structure containing referral request info for rebind procedure
311  */
312 typedef struct ldapreqinfo {
313         ber_len_t       ri_msgid;
314         int                     ri_request;
315         char            *ri_url;
316 } LDAPreqinfo;
317
318 /*
319  * structure representing an ldap connection
320  */
321
322 struct ldap {
323         Sockbuf         *ld_sb;         /* socket descriptor & buffer */
324
325         struct ldapoptions ld_options;
326
327 #define ld_valid                ld_options.ldo_valid
328 #define ld_debug                ld_options.ldo_debug
329
330 #define ld_deref                ld_options.ldo_deref
331 #define ld_timelimit    ld_options.ldo_timelimit
332 #define ld_sizelimit    ld_options.ldo_sizelimit
333
334 #define ld_defbinddn    ld_options.ldo_defbinddn
335 #define ld_defbase              ld_options.ldo_defbase
336 #define ld_defhost              ld_options.ldo_defhost
337 #define ld_defport              ld_options.ldo_defport
338
339 #define ld_refhoplimit  ld_options.ldo_refhoplimit
340
341 #define ld_sctrls               ld_options.ldo_sctrls
342 #define ld_cctrls               ld_options.ldo_cctrls
343 #define ld_rebind_proc          ld_options.ldo_rebind_proc
344 #define ld_rebind_params        ld_options.ldo_rebind_params
345 #define ld_nextref_proc         ld_options.ldo_nextref_proc
346 #define ld_nextref_params       ld_options.ldo_nextref_params
347 #define ld_urllist_proc         ld_options.ldo_urllist_proc
348 #define ld_urllist_params       ld_options.ldo_urllist_params
349
350 #define ld_version              ld_options.ldo_version
351
352         unsigned short  ld_lberoptions;
353
354         ber_int_t       ld_errno;
355         char    *ld_error;
356         char    *ld_matched;
357         char    **ld_referrals;
358         ber_len_t               ld_msgid;
359
360         /* do not mess with these */
361         LDAPRequest     *ld_requests;   /* list of outstanding requests */
362         LDAPMessage     *ld_responses;  /* list of outstanding responses */
363
364 #ifdef LDAP_R_COMPILE
365         ldap_pvt_thread_mutex_t ld_conn_mutex;
366         ldap_pvt_thread_mutex_t ld_req_mutex;
367         ldap_pvt_thread_mutex_t ld_res_mutex;
368 #endif
369
370         ber_len_t       ld_nabandoned;
371         ber_int_t       *ld_abandoned;  /* array of abandoned requests */
372
373         LDAPCache       *ld_cache;      /* non-null if cache is initialized */
374
375         /* do not mess with the rest though */
376
377         LDAPConn        *ld_defconn;    /* default connection */
378         LDAPConn        *ld_conns;      /* list of server connections */
379         void            *ld_selectinfo; /* platform specifics for select */
380 };
381 #define LDAP_VALID(ld)          ( (ld)->ld_valid == LDAP_VALID_SESSION )
382 #define LDAP_TRASHED(ld)        ( (ld)->ld_valid == LDAP_TRASHED_SESSION )
383 #define LDAP_TRASH(ld)          ( (ld)->ld_valid = LDAP_TRASHED_SESSION )
384
385 #ifdef LDAP_R_COMPILE
386 LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_resolv_mutex;
387
388 #ifdef HAVE_CYRUS_SASL
389 LDAP_V( ldap_pvt_thread_mutex_t ) ldap_int_sasl_mutex;
390 #endif
391 #endif
392
393 #ifdef LDAP_R_COMPILE
394 #define LDAP_NEXT_MSGID(ld, id) \
395         ldap_pvt_thread_mutex_lock( &(ld)->ld_req_mutex ); \
396         id = ++(ld)->ld_msgid; \
397         ldap_pvt_thread_mutex_unlock( &(ld)->ld_req_mutex )
398 #else
399 #define LDAP_NEXT_MSGID(ld, id) id = ++(ld)->ld_msgid
400 #endif
401
402 /*
403  * in abandon.c
404  */
405
406 LDAP_F (int)
407 ldap_int_bisect_find( ber_int_t *v, ber_len_t n, ber_int_t id, int *idxp );
408 LDAP_F (int)
409 ldap_int_bisect_insert( ber_int_t **vp, ber_len_t *np, int id, int idx );
410 LDAP_F (int)
411 ldap_int_bisect_delete( ber_int_t **vp, ber_len_t *np, int id, int idx );
412
413 /*
414  * in init.c
415  */
416
417 LDAP_V ( struct ldapoptions ) ldap_int_global_options;
418
419 LDAP_F ( void ) ldap_int_initialize LDAP_P((struct ldapoptions *, int *));
420 LDAP_F ( void ) ldap_int_initialize_global_options LDAP_P((
421         struct ldapoptions *, int *));
422
423 /* memory.c */
424         /* simple macros to realloc for now */
425 #define LDAP_MALLOC(s)          (ber_memalloc_x((s),NULL))
426 #define LDAP_CALLOC(n,s)        (ber_memcalloc_x((n),(s),NULL))
427 #define LDAP_REALLOC(p,s)       (ber_memrealloc_x((p),(s),NULL))
428 #define LDAP_FREE(p)            (ber_memfree_x((p),NULL))
429 #define LDAP_VFREE(v)           (ber_memvfree_x((void **)(v),NULL))
430 #define LDAP_STRDUP(s)          (ber_strdup_x((s),NULL))
431 #define LDAP_STRNDUP(s,l)       (ber_strndup_x((s),(l),NULL))
432
433 #define LDAP_MALLOCX(s,x)       (ber_memalloc_x((s),(x)))
434 #define LDAP_CALLOCX(n,s,x)     (ber_memcalloc_x((n),(s),(x)))
435 #define LDAP_REALLOCX(p,s,x)    (ber_memrealloc_x((p),(s),(x)))
436 #define LDAP_FREEX(p,x)         (ber_memfree_x((p),(x)))
437 #define LDAP_VFREEX(v,x)        (ber_memvfree_x((void **)(v),(x)))
438 #define LDAP_STRDUPX(s,x)       (ber_strdup_x((s),(x)))
439 #define LDAP_STRNDUPX(s,l,x)    (ber_strndup_x((s),(l),(x)))
440
441 /*
442  * in error.c
443  */
444 LDAP_F (void) ldap_int_error_init( void );
445
446 /*
447  * in unit-int.c
448  */
449 LDAP_F (void) ldap_int_utils_init LDAP_P(( void ));
450
451
452 /*
453  * in print.c
454  */
455 LDAP_F (int) ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...)) LDAP_GCCATTR((format(printf, 3, 4)));
456
457 /*
458  * in cache.c
459  */
460 LDAP_F (void) ldap_add_request_to_cache LDAP_P(( LDAP *ld, ber_tag_t msgtype,
461         BerElement *request ));
462 LDAP_F (void) ldap_add_result_to_cache LDAP_P(( LDAP *ld, LDAPMessage *result ));
463 LDAP_F (int) ldap_check_cache LDAP_P(( LDAP *ld, ber_tag_t msgtype, BerElement *request ));
464
465 /*
466  * in controls.c
467  */
468 LDAP_F (int) ldap_int_put_controls LDAP_P((
469         LDAP *ld,
470         LDAPControl *const *ctrls,
471         BerElement *ber ));
472
473 LDAP_F (int) ldap_int_client_controls LDAP_P((
474         LDAP *ld,
475         LDAPControl **ctrlp ));
476
477 /*
478  * in dsparse.c
479  */
480 LDAP_F (int) ldap_int_next_line_tokens LDAP_P(( char **bufp, ber_len_t *blenp, char ***toksp ));
481
482
483 /*
484  * in open.c
485  */
486 LDAP_F (int) ldap_open_defconn( LDAP *ld );
487 LDAP_F (int) ldap_int_open_connection( LDAP *ld,
488         LDAPConn *conn, LDAPURLDesc *srvlist, int async );
489
490 /*
491  * in os-ip.c
492  */
493 #ifndef HAVE_POLL
494 LDAP_V (int) ldap_int_tblsize;
495 LDAP_F (void) ldap_int_ip_init( void );
496 #endif
497
498 LDAP_F (int) ldap_int_timeval_dup( struct timeval **dest,
499         const struct timeval *tm );
500 LDAP_F (int) ldap_connect_to_host( LDAP *ld, Sockbuf *sb,
501         int proto, const char *host, int port, int async );
502 LDAP_F (int) ldap_int_poll( LDAP *ld, ber_socket_t s,
503         struct timeval *tvp );
504
505 #if defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
506 LDAP_V (char *) ldap_int_hostname;
507 LDAP_F (char *) ldap_host_connected_to( Sockbuf *sb,
508         const char *host );
509 #endif
510
511 LDAP_F (int) ldap_int_select( LDAP *ld, struct timeval *timeout );
512 LDAP_F (void *) ldap_new_select_info( void );
513 LDAP_F (void) ldap_free_select_info( void *sip );
514 LDAP_F (void) ldap_mark_select_write( LDAP *ld, Sockbuf *sb );
515 LDAP_F (void) ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
516 LDAP_F (void) ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
517 LDAP_F (int) ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
518 LDAP_F (int) ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
519
520 /*
521  * in os-local.c
522  */
523 #ifdef LDAP_PF_LOCAL
524 LDAP_F (int) ldap_connect_to_path( LDAP *ld, Sockbuf *sb,
525         const char *path, int async );
526 #endif /* LDAP_PF_LOCAL */
527
528 /*
529  * in request.c
530  */
531 LDAP_F (ber_int_t) ldap_send_initial_request( LDAP *ld, ber_tag_t msgtype,
532         const char *dn, BerElement *ber, ber_int_t msgid );
533 LDAP_F (BerElement *) ldap_alloc_ber_with_options( LDAP *ld );
534 LDAP_F (void) ldap_set_ber_options( LDAP *ld, BerElement *ber );
535
536 LDAP_F (int) ldap_send_server_request( LDAP *ld, BerElement *ber, ber_int_t msgid, LDAPRequest *parentreq, LDAPURLDesc **srvlist, LDAPConn *lc, LDAPreqinfo *bind );
537 LDAP_F (LDAPConn *) ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb, int connect, LDAPreqinfo *bind );
538 LDAP_F (LDAPRequest *) ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid );
539 LDAP_F (void) ldap_return_request( LDAP *ld, LDAPRequest *lr, int freeit );
540 LDAP_F (void) ldap_free_request( LDAP *ld, LDAPRequest *lr );
541 LDAP_F (void) ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
542 LDAP_F (void) ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
543 LDAP_F (void) ldap_dump_requests_and_responses( LDAP *ld );
544 LDAP_F (int) ldap_chase_referrals( LDAP *ld, LDAPRequest *lr,
545         char **errstrp, int sref, int *hadrefp );
546 LDAP_F (int) ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr,
547         char **refs, int sref, char **referralsp, int *hadrefp );
548 LDAP_F (int) ldap_append_referral( LDAP *ld, char **referralsp, char *s );
549 LDAP_F (int) ldap_int_flush_request( LDAP *ld, LDAPRequest *lr );
550
551 /*
552  * in result.c:
553  */
554 LDAP_F (const char *) ldap_int_msgtype2str( ber_tag_t tag );
555
556 /*
557  * in search.c
558  */
559 LDAP_F (BerElement *) ldap_build_search_req LDAP_P((
560         LDAP *ld,
561         const char *base,
562         ber_int_t scope,
563         const char *filter,
564         char **attrs,
565         ber_int_t attrsonly,
566         LDAPControl **sctrls,
567         LDAPControl **cctrls,
568         ber_int_t timelimit,
569         ber_int_t sizelimit,
570         ber_int_t *msgidp));
571
572
573 /*
574  * in unbind.c
575  */
576 LDAP_F (int) ldap_ld_free LDAP_P((
577         LDAP *ld,
578         int close,
579         LDAPControl **sctrls,
580         LDAPControl **cctrls ));
581
582 LDAP_F (int) ldap_send_unbind LDAP_P((
583         LDAP *ld,
584         Sockbuf *sb,
585         LDAPControl **sctrls,
586         LDAPControl **cctrls ));
587
588 /*
589  * in url.c
590  */
591 LDAP_F (LDAPURLDesc *) ldap_url_dup LDAP_P((
592         LDAPURLDesc *ludp ));
593
594 LDAP_F (LDAPURLDesc *) ldap_url_duplist LDAP_P((
595         LDAPURLDesc *ludlist ));
596
597 LDAP_F (int) ldap_url_parselist LDAP_P((
598         LDAPURLDesc **ludlist,
599         const char *url ));
600
601 LDAP_F (int) ldap_url_parsehosts LDAP_P((
602         LDAPURLDesc **ludlist,
603         const char *hosts,
604         int port ));
605
606 LDAP_F (char *) ldap_url_list2hosts LDAP_P((
607         LDAPURLDesc *ludlist ));
608
609 /*
610  * in cyrus.c
611  */
612
613 LDAP_F (int) ldap_int_sasl_init LDAP_P(( void ));
614
615 LDAP_F (int) ldap_int_sasl_open LDAP_P((
616         LDAP *ld, LDAPConn *conn,
617         const char* host ));
618 LDAP_F (int) ldap_int_sasl_close LDAP_P(( LDAP *ld, LDAPConn *conn ));
619
620 LDAP_F (int) ldap_int_sasl_external LDAP_P((
621         LDAP *ld, LDAPConn *conn,
622         const char* authid, ber_len_t ssf ));
623
624 LDAP_F (int) ldap_int_sasl_get_option LDAP_P(( LDAP *ld,
625         int option, void *arg ));
626 LDAP_F (int) ldap_int_sasl_set_option LDAP_P(( LDAP *ld,
627         int option, void *arg ));
628 LDAP_F (int) ldap_int_sasl_config LDAP_P(( struct ldapoptions *lo,
629         int option, const char *arg ));
630
631 LDAP_F (int) ldap_int_sasl_bind LDAP_P((
632         LDAP *ld,
633         const char *,
634         const char *,
635         LDAPControl **, LDAPControl **,
636
637         /* should be passed in client controls */
638         unsigned flags,
639         LDAP_SASL_INTERACT_PROC *interact,
640         void *defaults ));
641
642 /* in schema.c */
643 LDAP_F (char *) ldap_int_parse_numericoid LDAP_P((
644         const char **sp,
645         int *code,
646         const int flags ));
647
648 /*
649  * in tls.c
650  */
651 LDAP_F (int) ldap_int_tls_config LDAP_P(( LDAP *ld,
652         int option, const char *arg ));
653
654 LDAP_F (int) ldap_int_tls_start LDAP_P(( LDAP *ld,
655         LDAPConn *conn, LDAPURLDesc *srv ));
656
657 LDAP_F (void) ldap_int_tls_destroy LDAP_P(( struct ldapoptions *lo ));
658
659 /*
660  *      in getvalues.c
661  */
662 LDAP_F (char **) ldap_value_dup LDAP_P((
663         char *const *vals ));
664
665 LDAP_END_DECL
666
667 #endif /* _LDAP_INT_H */