3 * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
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.
12 * ldap-pvt.h - Header for ldap_pvt_ functions. These are meant to be used
13 * by the OpenLDAP distribution only.
19 #include <ldap_cdefs.h>
20 #include <lber.h> /* get ber_slen_t */
24 #define LDAP_PROTO_TCP 1 /* ldap:// */
25 #define LDAP_PROTO_UDP 2 /* reserved */
26 #define LDAP_PROTO_IPC 3 /* ldapi:// */
29 ldap_pvt_url_scheme2proto LDAP_P((
32 ldap_pvt_url_scheme2tls LDAP_P((
37 ldap_pvt_domain2dn LDAP_P((
38 LDAP_CONST char *domain,
41 struct hostent; /* avoid pulling in <netdb.h> */
44 ldap_pvt_ctime LDAP_P((
48 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
51 ldap_pvt_gethostbyname_a LDAP_P((
53 struct hostent *resbuf,
55 struct hostent **result,
59 ldap_pvt_gethostbyaddr_a LDAP_P((
63 struct hostent *resbuf,
65 struct hostent **result,
72 ldap_charray_add LDAP_P((
77 ldap_charray_merge LDAP_P((
82 ldap_charray_free LDAP_P(( char **a ));
85 ldap_charray_inlist LDAP_P((
90 ldap_charray_dup LDAP_P(( char **a ));
93 ldap_str2charray LDAP_P((
95 const char *brkstr ));
98 ldap_charray2str LDAP_P((
99 char **array, const char* sep ));
102 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
103 LDAP_F (int) ldap_pvt_unhex( int c );
105 /* these macros assume 'x' is an ASCII x */
106 #define LDAP_DNSEPARATOR(c) ((c) == ',' || (c) == ';')
107 #define LDAP_SEPARATOR(c) ((c) == ',' || (c) == ';' || (c) == '+')
108 #define LDAP_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
110 #define LDAP_LOWER(c) ( (c) >= 'a' && (c) <= 'z' )
111 #define LDAP_UPPER(c) ( (c) >= 'A' && (c) <= 'Z' )
112 #define LDAP_ALPHA(c) ( LDAP_LOWER(c) || LDAP_UPPER(c) )
113 #define LDAP_DIGIT(c) ( (c) >= '0' && (c) <= '9' )
114 #define LDAP_ALNUM(c) ( LDAP_ALPHA(c) || LDAP_DIGIT(c) )
116 #define LDAP_LEADKEYCHAR(c) ( LDAP_ALPHA(c) )
117 #define LDAP_KEYCHAR(c) ( LDAP_ALNUM(c) || (c) == '-' )
118 #define LDAP_LEADOIDCHAR(c) ( LDAP_DIGIT(c) )
119 #define LDAP_OIDCHAR(c) ( LDAP_DIGIT(c) || (c) == '.' )
121 #define LDAP_LEADATTRCHAR(c) ( LDAP_LEADKEYCHAR(c) || LDAP_LEADOIDCHAR(c) )
122 #define LDAP_ATTRCHAR(c) ( LDAP_KEYCHAR(c) || LDAP_OIDCHAR(c) )
124 #define LDAP_NEEDSESCAPE(c) ((c) == '\\' || (c) == '"')
126 #ifdef HAVE_CYRUS_SASL
128 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
129 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
131 struct sasl_security_properties *secprops ));
133 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
134 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
135 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
136 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
138 struct sockbuf; /* avoid pulling in <lber.h> */
139 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
140 #endif /* HAVE_CYRUS_SASL */
142 #define LDAP_PVT_SASL_LOCAL_SSF 71 /* SSF for Unix Domain Sockets */
146 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
149 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
153 ldap_pvt_str2upper LDAP_P(( char *str ));
156 ldap_pvt_str2lower LDAP_P(( char *str ));
162 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
163 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
164 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
165 LDAP_F (void *) ldap_pvt_tls_sb_handle LDAP_P(( Sockbuf *sb ));
166 LDAP_F (void *) ldap_pvt_tls_get_handle LDAP_P(( struct ldap *ld ));
167 LDAP_F (const char *) ldap_pvt_tls_get_peer LDAP_P(( void *handle ));
168 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *handle ));
169 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
170 LDAP_F (int) ldap_pvt_tls_start LDAP_P(( struct ldap *ld, Sockbuf *sb, void *ctx_arg ));
172 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
173 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldapoptions *lo, int option, void *arg ));
177 #include "ldap_pvt_uc.h"