]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
Add ldap_url_parse_ext() prototype. Routine should likely be renamed
[openldap] / include / ldap_pvt.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11 /*
12  * ldap-pvt.h - Header for ldap_pvt_ functions. These are meant to be used
13  *              by the OpenLDAP distribution only.
14  */
15
16 #ifndef _LDAP_PVT_H
17 #define _LDAP_PVT_H 1
18
19 #include <ldap_cdefs.h>
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 LDAP_F( int )
36 ldap_url_parse_ext LDAP_P((
37         LDAP_CONST char *url,
38         LDAPURLDesc **ludpp ));
39
40 LDAP_F ( int )
41 ldap_pvt_domain2dn LDAP_P((
42         LDAP_CONST char *domain,
43         char **dn ));
44
45 struct hostent; /* avoid pulling in <netdb.h> */
46
47 LDAP_F( char * )
48 ldap_pvt_ctime LDAP_P((
49         const time_t *tp,
50         char *buf ));
51
52 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
53
54 LDAP_F( int )
55 ldap_pvt_gethostbyname_a LDAP_P((
56         const char *name, 
57         struct hostent *resbuf,
58         char **buf,
59         struct hostent **result,
60         int *herrno_ptr ));
61
62 LDAP_F( int )
63 ldap_pvt_gethostbyaddr_a LDAP_P((
64         const char *addr,
65         int len,
66         int type,
67         struct hostent *resbuf,
68         char **buf,
69         struct hostent **result,
70         int *herrno_ptr ));
71
72
73 /* charray.c */
74
75 LDAP_F( int )
76 ldap_charray_add LDAP_P((
77     char        ***a,
78     char        *s ));
79
80 LDAP_F( int )
81 ldap_charray_merge LDAP_P((
82     char        ***a,
83     char        **s ));
84
85 LDAP_F( void )
86 ldap_charray_free LDAP_P(( char **a ));
87
88 LDAP_F( int )
89 ldap_charray_inlist LDAP_P((
90     char        **a,
91     char        *s ));
92
93 LDAP_F( char ** )
94 ldap_charray_dup LDAP_P(( char **a ));
95
96 LDAP_F( char ** )
97 ldap_str2charray LDAP_P((
98         const char *str,
99         const char *brkstr ));
100
101 LDAP_F( char * )
102 ldap_charray2str LDAP_P((
103         char **array, const char* sep ));
104
105 /* url.c */
106 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
107 LDAP_F (int) ldap_pvt_unhex( int c );
108
109 /* these macros assume 'x' is an ASCII x */
110 #define LDAP_DNSEPARATOR(c)     ((c) == ',' || (c) == ';')
111 #define LDAP_SEPARATOR(c)       ((c) == ',' || (c) == ';' || (c) == '+')
112 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\t' || (c) == '\n')
113
114 #define LDAP_LOWER(c)           ( (c) >= 'a' && (c) <= 'z' )
115 #define LDAP_UPPER(c)           ( (c) >= 'A' && (c) <= 'Z' )
116 #define LDAP_ALPHA(c)           ( LDAP_LOWER(c) || LDAP_UPPER(c) )
117 #define LDAP_DIGIT(c)           ( (c) >= '0' && (c) <= '9' )
118 #define LDAP_ALNUM(c)           ( LDAP_ALPHA(c) || LDAP_DIGIT(c) )
119
120 #define LDAP_LEADKEYCHAR(c)     ( LDAP_ALPHA(c) )
121 #define LDAP_KEYCHAR(c)         ( LDAP_ALNUM(c) || (c) == '-' )
122 #define LDAP_LEADOIDCHAR(c)     ( LDAP_DIGIT(c) )
123 #define LDAP_OIDCHAR(c)         ( LDAP_DIGIT(c) || (c) == '.' )
124
125 #define LDAP_LEADATTRCHAR(c)    ( LDAP_LEADKEYCHAR(c) || LDAP_LEADOIDCHAR(c) )
126 #define LDAP_ATTRCHAR(c)                ( LDAP_KEYCHAR(c) || LDAP_OIDCHAR(c) )
127
128 #define LDAP_NEEDSESCAPE(c)     ((c) == '\\' || (c) == '"')
129
130 #ifdef HAVE_CYRUS_SASL
131 /* cyrus.c */
132 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
133 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
134         const char *in,
135         struct sasl_security_properties *secprops ));
136
137 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
138 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
139 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
140 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
141
142 struct sockbuf; /* avoid pulling in <lber.h> */
143 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
144 #endif /* HAVE_CYRUS_SASL */
145
146 #define LDAP_PVT_SASL_LOCAL_SSF 71      /* SSF for Unix Domain Sockets */
147
148 struct ldap;
149 LDAP_F (int) ldap_open_internal_connection LDAP_P((
150         struct ldap **ldp, ber_socket_t *fdp ));
151
152 /* search.c */
153 LDAP_F( char * )
154 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
155
156 LDAP_F( ber_slen_t )
157 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
158
159 /* string.c */
160 LDAP_F( char * )
161 ldap_pvt_str2upper LDAP_P(( char *str ));
162
163 LDAP_F( char * )
164 ldap_pvt_str2lower LDAP_P(( char *str ));
165
166 /* tls.c */
167 struct ldapoptions;
168 struct ldap;
169
170 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
171 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
172 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
173 LDAP_F (void *) ldap_pvt_tls_sb_handle LDAP_P(( Sockbuf *sb ));
174 LDAP_F (void *) ldap_pvt_tls_get_handle LDAP_P(( struct ldap *ld ));
175 LDAP_F (const char *) ldap_pvt_tls_get_peer LDAP_P(( void *handle ));
176 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *handle ));
177 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
178 LDAP_F (int) ldap_pvt_tls_start LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
179
180 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
181 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
182
183 LDAP_END_DECL
184
185 #include "ldap_pvt_uc.h"
186
187 #endif
188