]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
Add OpenLDAP RCS Id
[openldap] / include / ldap_pvt.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998,1999 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 struct hostent; /* avoid pulling in <netdb.h> */
25
26 LDAP_F( char * )
27 ldap_pvt_ctime LDAP_P((
28         const time_t *tp,
29         char *buf ));
30
31 LDAP_F( int )
32 ldap_pvt_gethostbyname_a LDAP_P((
33         const char *name, 
34         struct hostent *resbuf,
35         char **buf,
36         struct hostent **result,
37         int *herrno_ptr ));
38
39 LDAP_F( int )
40 ldap_pvt_gethostbyaddr_a LDAP_P((
41         const char *addr,
42         int len,
43         int type,
44         struct hostent *resbuf,
45         char **buf,
46         struct hostent **result,
47         int *herrno_ptr ));
48
49
50 /* charray.c */
51
52 LDAP_F( int )
53 ldap_charray_add LDAP_P((
54     char        ***a,
55     char        *s ));
56
57 LDAP_F( int )
58 ldap_charray_merge LDAP_P((
59     char        ***a,
60     char        **s ));
61
62 LDAP_F( void )
63 ldap_charray_free LDAP_P(( char **a ));
64
65 LDAP_F( int )
66 ldap_charray_inlist LDAP_P((
67     char        **a,
68     char        *s ));
69
70 LDAP_F( char ** )
71 ldap_charray_dup LDAP_P(( char **a ));
72
73 LDAP_F( char ** )
74 ldap_str2charray LDAP_P((
75         char *str,
76         char *brkstr ));
77
78 /* url.c */
79 void ldap_pvt_hex_unescape LDAP_P(( char *s ));
80 int ldap_pvt_unhex( int c );
81
82 /* these macros assume 'x' is an ASCII x */
83 #define LDAP_DNSEPARATOR(c)     ((c) == ',' || (c) == ';')
84 #define LDAP_SEPARATOR(c)       ((c) == ',' || (c) == ';' || (c) == '+')
85 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\n')
86
87 #define LDAP_LOWER(c)           ( (c) >= 'a' && (c) <= 'z' )
88 #define LDAP_UPPER(c)           ( (c) >= 'A' && (c) <= 'Z' )
89 #define LDAP_ALPHA(c)           ( LDAP_LOWER(c) || LDAP_UPPER(c) )
90 #define LDAP_DIGIT(c)           ( (c) >= '0' && (c) <= '9' )
91 #define LDAP_ALNUM(c)           ( LDAP_ALPHA(c) || LDAP_DIGIT(c) )
92
93 #define LDAP_LEADKEYCHAR(c)     ( LDAP_ALPHA(c) )
94 #define LDAP_KEYCHAR(c)         ( LDAP_ALNUM(c) || (c) == '-' )
95 #define LDAP_LEADOIDCHAR(c)     ( LDAP_DIGIT(c) )
96 #define LDAP_OIDCHAR(c)         ( LDAP_DIGIT(c) || (c) == '.' )
97
98 #define LDAP_LEADATTRCHAR(c)    ( LDAP_LEADKEYCHAR(c) || LDAP_LEADOIDCHAR(c) )
99 #define LDAP_ATTRCHAR(c)                ( LDAP_KEYCHAR((c)) || (c) == '.' )
100
101 #define LDAP_NEEDSESCAPE(c)     ((c) == '\\' || (c) == '"')
102
103 /* search.c */
104 LDAP_F( char * )
105 ldap_pvt_find_wildcard LDAP_P(( char *s ));
106
107 LDAP_F( ber_slen_t )
108 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
109
110 /* string.c */
111 LDAP_F( char * )
112 ldap_pvt_str2upper LDAP_P(( char *str ));
113
114 LDAP_F( char * )
115 ldap_pvt_str2lower LDAP_P(( char *str ));
116
117 LDAP_END_DECL
118
119 #endif
120