]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
Sync with HEAD
[openldap] / include / ldap_pvt.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted only as authorized by the OpenLDAP
8  * Public License.  A copy of this license is available at
9  * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10  * top-level directory of the distribution.
11  */
12 /*
13  * ldap-pvt.h - Header for ldap_pvt_ functions. These are meant to be used
14  *              by the OpenLDAP distribution only.
15  */
16
17 #ifndef _LDAP_PVT_H
18 #define _LDAP_PVT_H 1
19
20 #include <lber.h>                               /* get ber_slen_t */
21
22 LDAP_BEGIN_DECL
23
24 #define LDAP_PROTO_TCP 1 /* ldap://  */
25 #define LDAP_PROTO_UDP 2 /* reserved */
26 #define LDAP_PROTO_IPC 3 /* ldapi:// */
27
28 LDAP_F ( int )
29 ldap_pvt_url_scheme2proto LDAP_P((
30         const char * ));
31 LDAP_F ( int )
32 ldap_pvt_url_scheme2tls LDAP_P((
33         const char * ));
34
35 struct ldap_url_desc; /* avoid pulling in <ldap.h> */
36
37 LDAP_F( int )
38 ldap_url_parse_ext LDAP_P((
39         LDAP_CONST char *url,
40         struct ldap_url_desc **ludpp ));
41
42 LDAP_F( char * )
43 ldap_pvt_ctime LDAP_P((
44         const time_t *tp,
45         char *buf ));
46
47 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
48
49 struct hostent; /* avoid pulling in <netdb.h> */
50
51 LDAP_F( int )
52 ldap_pvt_gethostbyname_a LDAP_P((
53         const char *name,
54         struct hostent *resbuf,
55         char **buf,
56         struct hostent **result,
57         int *herrno_ptr ));
58
59 LDAP_F( int )
60 ldap_pvt_gethostbyaddr_a LDAP_P((
61         const char *addr,
62         int len,
63         int type,
64         struct hostent *resbuf,
65         char **buf,
66         struct hostent **result,
67         int *herrno_ptr ));
68
69 struct sockaddr;
70
71 LDAP_F( int )
72 ldap_pvt_get_hname LDAP_P((
73         const struct sockaddr * sa,
74         int salen,
75         char *name,
76         int namelen,
77         char **herr ));
78
79
80 /* charray.c */
81
82 LDAP_F( int )
83 ldap_charray_add LDAP_P((
84     char        ***a,
85     const char *s ));
86
87 LDAP_F( int )
88 ldap_charray_merge LDAP_P((
89     char        ***a,
90     char        **s ));
91
92 LDAP_F( void )
93 ldap_charray_free LDAP_P(( char **a ));
94
95 LDAP_F( int )
96 ldap_charray_inlist LDAP_P((
97     char        **a,
98     const char *s ));
99
100 LDAP_F( char ** )
101 ldap_charray_dup LDAP_P(( char **a ));
102
103 LDAP_F( char ** )
104 ldap_str2charray LDAP_P((
105         const char *str,
106         const char *brkstr ));
107
108 LDAP_F( char * )
109 ldap_charray2str LDAP_P((
110         char **array, const char* sep ));
111
112 /* getdn.c */
113
114 #ifdef LDAP_AVA_NULL    /* in ldap.h */
115 LDAP_F( void ) ldap_rdnfree_x LDAP_P(( LDAPRDN rdn, void *ctx ));
116 LDAP_F( void ) ldap_dnfree_x LDAP_P(( LDAPDN dn, void *ctx ));
117
118 LDAP_F( int ) ldap_bv2dn_x LDAP_P(( 
119         struct berval *bv, LDAPDN *dn, unsigned flags, void *ctx ));
120 LDAP_F( int ) ldap_dn2bv_x LDAP_P(( 
121         LDAPDN dn, struct berval *bv, unsigned flags, void *ctx ));
122 LDAP_F( int ) ldap_bv2rdn_x LDAP_P(( 
123         struct berval *, LDAPRDN *, char **, unsigned flags, void *ctx ));
124 LDAP_F( int ) ldap_rdn2bv_x LDAP_P(( 
125         LDAPRDN rdn, struct berval *bv, unsigned flags, void *ctx ));
126 #endif
127
128 /* url.c */
129 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
130
131 /*
132  * these macros assume 'x' is an ASCII x
133  * and assume the "C" locale
134  */
135 #define LDAP_ASCII(c)           (!((c) & 0x80))
136 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\t' || (c) == '\n')
137 #define LDAP_DIGIT(c)           ((c) >= '0' && (c) <= '9')
138 #define LDAP_LOWER(c)           ((c) >= 'a' && (c) <= 'z')
139 #define LDAP_UPPER(c)           ((c) >= 'A' && (c) <= 'Z')
140 #define LDAP_ALPHA(c)           (LDAP_LOWER(c) || LDAP_UPPER(c))
141 #define LDAP_ALNUM(c)           (LDAP_ALPHA(c) || LDAP_DIGIT(c))
142
143 #define LDAP_LDH(c)                     (LDAP_ALNUM(c) || (c) == '-')
144
145 #define LDAP_HEXLOWER(c)        ((c) >= 'a' && (c) <= 'f')
146 #define LDAP_HEXUPPER(c)        ((c) >= 'A' && (c) <= 'F')
147 #define LDAP_HEX(c)                     (LDAP_DIGIT(c) || \
148                                                                 LDAP_HEXLOWER(c) || LDAP_HEXUPPER(c))
149
150 /* controls.c */
151 struct ldapcontrol;
152 LDAP_F (struct ldapcontrol *) ldap_control_dup LDAP_P((
153         const struct ldapcontrol *ctrl ));
154
155 LDAP_F (struct ldapcontrol **) ldap_controls_dup LDAP_P((
156         struct ldapcontrol *const *ctrls ));
157
158 LDAP_F (int) ldap_int_get_controls LDAP_P((
159         BerElement *be,
160         struct ldapcontrol ***ctrlsp));
161
162 #ifdef HAVE_CYRUS_SASL
163 /* cyrus.c */
164 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
165 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
166         const char *in,
167         struct sasl_security_properties *secprops ));
168
169 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
170 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
171 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
172 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
173
174 struct sockbuf; /* avoid pulling in <lber.h> */
175 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
176 LDAP_F (void) ldap_pvt_sasl_remove LDAP_P(( struct sockbuf * ));
177 #endif /* HAVE_CYRUS_SASL */
178
179 #define LDAP_PVT_SASL_LOCAL_SSF 71      /* SSF for Unix Domain Sockets */
180
181 struct ldap;
182 struct ldapmsg;
183
184 LDAP_F (int) ldap_open_internal_connection LDAP_P((
185         struct ldap **ldp, ber_socket_t *fdp ));
186
187 /* messages.c */
188 LDAP_F( BerElement * )
189 ldap_get_message_ber LDAP_P((
190         struct ldapmsg * ));
191
192 /* search.c */
193 LDAP_F( int ) ldap_pvt_put_filter LDAP_P((
194         BerElement *ber,
195         const char *str ));
196
197 LDAP_F( char * )
198 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
199
200 LDAP_F( ber_slen_t )
201 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
202
203 /* string.c */
204 LDAP_F( char * )
205 ldap_pvt_str2upper LDAP_P(( char *str ));
206
207 LDAP_F( char * )
208 ldap_pvt_str2lower LDAP_P(( char *str ));
209
210 LDAP_F( struct berval * )
211 ldap_pvt_str2upperbv LDAP_P(( char *str, struct berval *bv ));
212
213 LDAP_F( struct berval * )
214 ldap_pvt_str2lowerbv LDAP_P(( char *str, struct berval *bv ));
215
216 /* tls.c */
217 LDAP_F (int) ldap_int_tls_config LDAP_P(( struct ldap *ld,
218         int option, const char *arg ));
219 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldap *ld,
220         int option, void *arg ));
221 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldap *ld,
222         int option, void *arg ));
223
224 LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void ));
225 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
226 LDAP_F (int) ldap_pvt_tls_init_def_ctx LDAP_P(( void ));
227 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
228 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
229 LDAP_F (void *) ldap_pvt_tls_sb_ctx LDAP_P(( Sockbuf *sb ));
230
231 LDAP_F (int) ldap_pvt_tls_init_default_ctx LDAP_P(( void ));
232
233 typedef int LDAPDN_rewrite_dummy LDAP_P (( void *dn, unsigned flags ));
234
235 LDAP_F (int) ldap_pvt_tls_get_my_dn LDAP_P(( void *ctx, struct berval *dn,
236         LDAPDN_rewrite_dummy *func, unsigned flags ));
237 LDAP_F (int) ldap_pvt_tls_get_peer_dn LDAP_P(( void *ctx, struct berval *dn,
238         LDAPDN_rewrite_dummy *func, unsigned flags ));
239 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *ctx ));
240
241 LDAP_END_DECL
242
243 #include "ldap_pvt_uc.h"
244
245 #endif
246