]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
Move ldap_control_dup() to ldap_pvt.h
[openldap] / include / ldap_pvt.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2002 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
70 /* charray.c */
71
72 LDAP_F( int )
73 ldap_charray_add LDAP_P((
74     char        ***a,
75     char        *s ));
76
77 LDAP_F( int )
78 ldap_charray_merge LDAP_P((
79     char        ***a,
80     char        **s ));
81
82 LDAP_F( void )
83 ldap_charray_free LDAP_P(( char **a ));
84
85 LDAP_F( int )
86 ldap_charray_inlist LDAP_P((
87     char        **a,
88     char        *s ));
89
90 LDAP_F( char ** )
91 ldap_charray_dup LDAP_P(( char **a ));
92
93 LDAP_F( char ** )
94 ldap_str2charray LDAP_P((
95         const char *str,
96         const char *brkstr ));
97
98 LDAP_F( char * )
99 ldap_charray2str LDAP_P((
100         char **array, const char* sep ));
101
102 /* url.c */
103 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
104
105 /*
106  * these macros assume 'x' is an ASCII x
107  * and assume the "C" locale
108  */
109 #define LDAP_ASCII(c)           (!((c) & 0x80))
110 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\t' || (c) == '\n')
111 #define LDAP_DIGIT(c)           ((c) >= '0' && (c) <= '9')
112 #define LDAP_LOWER(c)           ((c) >= 'a' && (c) <= 'z')
113 #define LDAP_UPPER(c)           ((c) >= 'A' && (c) <= 'Z')
114 #define LDAP_ALPHA(c)           (LDAP_LOWER(c) || LDAP_UPPER(c))
115 #define LDAP_ALNUM(c)           (LDAP_ALPHA(c) || LDAP_DIGIT(c))
116
117 #define LDAP_LDH(c)                     (LDAP_ALNUM(c) || (c) == '-')
118
119 #define LDAP_HEXLOWER(c)        ((c) >= 'a' && (c) <= 'f')
120 #define LDAP_HEXUPPER(c)        ((c) >= 'A' && (c) <= 'F')
121 #define LDAP_HEX(c)                     (LDAP_DIGIT(c) || \
122                                                                 LDAP_HEXLOWER(c) || LDAP_HEXUPPER(c))
123
124 /* controls.c */
125 struct ldapcontrol;
126 LDAP_F (struct ldapcontrol *) ldap_control_dup LDAP_P((
127         const struct ldapcontrol *ctrl ));
128
129 LDAP_F (struct ldapcontrol **) ldap_controls_dup LDAP_P((
130         struct ldapcontrol *const *ctrls ));
131
132
133 #ifdef HAVE_CYRUS_SASL
134 /* cyrus.c */
135 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
136 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
137         const char *in,
138         struct sasl_security_properties *secprops ));
139
140 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
141 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
142 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
143 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
144
145 struct sockbuf; /* avoid pulling in <lber.h> */
146 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
147 #endif /* HAVE_CYRUS_SASL */
148
149 #define LDAP_PVT_SASL_LOCAL_SSF 71      /* SSF for Unix Domain Sockets */
150
151 struct ldap;
152
153 LDAP_F (int) ldap_open_internal_connection LDAP_P((
154         struct ldap **ldp, ber_socket_t *fdp ));
155
156 /* search.c */
157 LDAP_F( int ) ldap_pvt_put_filter LDAP_P((
158         BerElement *ber,
159         const char *str ));
160
161 LDAP_F( char * )
162 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
163
164 LDAP_F( ber_slen_t )
165 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
166
167 /* string.c */
168 LDAP_F( char * )
169 ldap_pvt_str2upper LDAP_P(( char *str ));
170
171 LDAP_F( char * )
172 ldap_pvt_str2lower LDAP_P(( char *str ));
173
174 LDAP_F( struct berval * )
175 ldap_pvt_str2upperbv LDAP_P(( char *str, struct berval *bv ));
176
177 LDAP_F( struct berval * )
178 ldap_pvt_str2lowerbv LDAP_P(( char *str, struct berval *bv ));
179
180 /* tls.c */
181 LDAP_F (int) ldap_int_tls_config LDAP_P(( struct ldap *ld,
182         int option, const char *arg ));
183 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldap *ld,
184         int option, void *arg ));
185 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldap *ld,
186         int option, void *arg ));
187
188 LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void ));
189 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
190 LDAP_F (int) ldap_pvt_tls_init_def_ctx LDAP_P(( void ));
191 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
192 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
193 LDAP_F (void *) ldap_pvt_tls_sb_ctx LDAP_P(( Sockbuf *sb ));
194
195 LDAP_F (int) ldap_pvt_tls_init_default_ctx LDAP_P(( void ));
196
197 typedef int LDAPDN_rewrite_dummy LDAP_P (( void *dn, unsigned flags ));
198
199 LDAP_F (int) ldap_pvt_tls_get_my_dn LDAP_P(( void *ctx, struct berval *dn,
200         LDAPDN_rewrite_dummy *func, unsigned flags ));
201 LDAP_F (int) ldap_pvt_tls_get_peer_dn LDAP_P(( void *ctx, struct berval *dn,
202         LDAPDN_rewrite_dummy *func, unsigned flags ));
203 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *ctx ));
204
205 LDAP_END_DECL
206
207 #include "ldap_pvt_uc.h"
208
209 #endif
210