]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
ITS#955: update cosine schema based upon X.500 recommendations
[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 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 ( int )
43 ldap_pvt_domain2dn LDAP_P((
44         LDAP_CONST char *domain,
45         char **dn ));
46
47 struct hostent; /* avoid pulling in <netdb.h> */
48
49 LDAP_F( char * )
50 ldap_pvt_ctime LDAP_P((
51         const time_t *tp,
52         char *buf ));
53
54 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
55
56 LDAP_F( int )
57 ldap_pvt_gethostbyname_a LDAP_P((
58         const char *name, 
59         struct hostent *resbuf,
60         char **buf,
61         struct hostent **result,
62         int *herrno_ptr ));
63
64 LDAP_F( int )
65 ldap_pvt_gethostbyaddr_a LDAP_P((
66         const char *addr,
67         int len,
68         int type,
69         struct hostent *resbuf,
70         char **buf,
71         struct hostent **result,
72         int *herrno_ptr ));
73
74
75 /* charray.c */
76
77 LDAP_F( int )
78 ldap_charray_add LDAP_P((
79     char        ***a,
80     char        *s ));
81
82 LDAP_F( int )
83 ldap_charray_merge LDAP_P((
84     char        ***a,
85     char        **s ));
86
87 LDAP_F( void )
88 ldap_charray_free LDAP_P(( char **a ));
89
90 LDAP_F( int )
91 ldap_charray_inlist LDAP_P((
92     char        **a,
93     char        *s ));
94
95 LDAP_F( char ** )
96 ldap_charray_dup LDAP_P(( char **a ));
97
98 LDAP_F( char ** )
99 ldap_str2charray LDAP_P((
100         const char *str,
101         const char *brkstr ));
102
103 LDAP_F( char * )
104 ldap_charray2str LDAP_P((
105         char **array, const char* sep ));
106
107 /* url.c */
108 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
109 LDAP_F (int) ldap_pvt_unhex( int c );
110
111 /* these macros assume 'x' is an ASCII x */
112 #define LDAP_DNSEPARATOR(c)     ((c) == ',' || (c) == ';')
113 #define LDAP_SEPARATOR(c)       ((c) == ',' || (c) == ';' || (c) == '+')
114 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\t' || (c) == '\n')
115
116 #define LDAP_LOWER(c)           ( (c) >= 'a' && (c) <= 'z' )
117 #define LDAP_UPPER(c)           ( (c) >= 'A' && (c) <= 'Z' )
118 #define LDAP_ALPHA(c)           ( LDAP_LOWER(c) || LDAP_UPPER(c) )
119 #define LDAP_DIGIT(c)           ( (c) >= '0' && (c) <= '9' )
120 #define LDAP_ALNUM(c)           ( LDAP_ALPHA(c) || LDAP_DIGIT(c) )
121
122 #define LDAP_LEADKEYCHAR(c)     ( LDAP_ALPHA(c) )
123 #define LDAP_KEYCHAR(c)         ( LDAP_ALNUM(c) || (c) == '-' )
124 #define LDAP_LEADOIDCHAR(c)     ( LDAP_DIGIT(c) )
125 #define LDAP_OIDCHAR(c)         ( LDAP_DIGIT(c) || (c) == '.' )
126
127 #define LDAP_LEADATTRCHAR(c)    ( LDAP_LEADKEYCHAR(c) || LDAP_LEADOIDCHAR(c) )
128 #define LDAP_ATTRCHAR(c)                ( LDAP_KEYCHAR(c) || LDAP_OIDCHAR(c) )
129
130 #define LDAP_NEEDSESCAPE(c)     ((c) == '\\' || (c) == '"')
131
132 #ifdef HAVE_CYRUS_SASL
133 /* cyrus.c */
134 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
135 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
136         const char *in,
137         struct sasl_security_properties *secprops ));
138
139 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
140 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
141 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
142 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
143
144 struct sockbuf; /* avoid pulling in <lber.h> */
145 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
146 #endif /* HAVE_CYRUS_SASL */
147
148 #define LDAP_PVT_SASL_LOCAL_SSF 71      /* SSF for Unix Domain Sockets */
149
150 struct ldap;
151 LDAP_F (int) ldap_open_internal_connection LDAP_P((
152         struct ldap **ldp, ber_socket_t *fdp ));
153
154 /* search.c */
155 LDAP_F( char * )
156 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
157
158 LDAP_F( ber_slen_t )
159 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
160
161 /* string.c */
162 LDAP_F( char * )
163 ldap_pvt_str2upper LDAP_P(( char *str ));
164
165 LDAP_F( char * )
166 ldap_pvt_str2lower LDAP_P(( char *str ));
167
168 /* tls.c */
169 struct ldapoptions;
170 struct ldap;
171
172 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
173 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
174 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
175 LDAP_F (void *) ldap_pvt_tls_sb_handle LDAP_P(( Sockbuf *sb ));
176 LDAP_F (void *) ldap_pvt_tls_get_handle LDAP_P(( struct ldap *ld ));
177 LDAP_F (const char *) ldap_pvt_tls_get_peer LDAP_P(( void *handle ));
178 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *handle ));
179 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
180 LDAP_F (int) ldap_pvt_tls_start LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
181
182 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
183 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
184
185 LDAP_END_DECL
186
187 #include "ldap_pvt_uc.h"
188
189 #endif
190