]> git.sur5r.net Git - openldap/blob - include/lutil.h
ba9e055ca4c1ee51af1e6fd1e2e789be55fd5936
[openldap] / include / lutil.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 #ifndef _LUTIL_H
13 #define _LUTIL_H 1
14
15 #include <ldap_cdefs.h>
16 #include <lber_types.h>
17
18 /*
19  * Include file for LDAP utility routine
20  */
21
22 LDAP_BEGIN_DECL
23
24 #ifdef __MINGW32__
25 #   undef LDAP_F_PRE
26 #   ifdef LIBLUTIL_DECL
27 #       define LDAP_F_PRE       extern __declspec(LIBLUTIL_DECL)
28 #   else
29 #       define LDAP_F_PRE       extern
30 #   endif
31 #endif
32
33 /* n octets encode into ceiling(n/3) * 4 bytes */
34 /* Avoid floating point math by through extra padding */
35
36 #define LUTIL_BASE64_ENCODE_LEN(n)      ((n)/3 * 4 + 4)
37 #define LUTIL_BASE64_DECODE_LEN(n)      ((n)/4 * 3)
38
39 /* ISC Base64 Routines */
40 /* base64.c */
41
42 LDAP_F( int )
43 lutil_b64_ntop LDAP_P((
44         unsigned char const *,
45         size_t,
46         char *,
47         size_t));
48
49 LDAP_F( int )
50 lutil_b64_pton LDAP_P((
51         char const *,
52         unsigned char *,
53         size_t));
54
55 /* detach.c */
56 LDAP_F( void )
57 lutil_detach LDAP_P((
58         int debug,
59         int do_close));
60
61 /* entropy.c */
62 LDAP_F( int )
63 lutil_entropy LDAP_P((
64         char *buf,
65         int nbytes ));
66
67 /* passwd.c */
68 LDAP_F( int )
69 lutil_passwd LDAP_P((
70         const char *cred,
71         const char *passwd,
72         const char **methods ));
73
74 extern const char* lutil_passwd_schemes[];
75
76 LDAP_F( int )
77 lutil_passwd_scheme LDAP_P((char *scheme));
78
79 /* utils.c */
80 LDAP_F( char* )
81 lutil_progname LDAP_P((
82         const char* name,
83         int argc,
84         char *argv[] ));
85
86 /* sockpair.c */
87 LDAP_F( int )
88 lutil_pair( LBER_SOCKET_T sd[2] );
89
90 LDAP_END_DECL
91
92 #endif /* _LUTIL_H */