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