]> git.sur5r.net Git - openldap/blob - include/ldif.h
add wait macros. add LDAP_SIGCHLD. and other misc NT cleanups.
[openldap] / include / ldif.h
1 /*
2  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10 /* Portions
11  * Copyright (c) 1996 Regents of the University of Michigan.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms are permitted
15  * provided that this notice is preserved and that due credit is given
16  * to the University of Michigan at Ann Arbor. The name of the University
17  * may not be used to endorse or promote products derived from this
18  * software without specific prior written permission. This software
19  * is provided ``as is'' without express or implied warranty.
20  */
21
22 #ifndef _LDIF_H
23 #define _LDIF_H
24
25 #include <ldap_cdefs.h>
26
27 LDAP_BEGIN_DECL
28
29 extern int ldif_debug;
30
31 #define LDIF_LINE_WIDTH      76      /* maximum length of LDIF lines */
32
33 /*
34  * Macro to calculate maximum number of bytes that the base64 equivalent
35  * of an item that is "vlen" bytes long will take up.  Base64 encoding
36  * uses one byte for every six bits in the value plus up to two pad bytes.
37  */
38 #define LDIF_BASE64_LEN(vlen)   (((vlen) * 4 / 3 ) + 3)
39
40 /*
41  * Macro to calculate maximum size that an LDIF-encoded type (length
42  * tlen) and value (length vlen) will take up:  room for type + ":: " +
43  * first newline + base64 value + continued lines.  Each continued line
44  * needs room for a newline and a leading space character.
45  */
46 #define LDIF_SIZE_NEEDED(tlen,vlen) \
47     ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
48     + ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LDIF_LINE_WIDTH * 2 ))
49
50 LDAP_F int
51 ldif_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen));
52
53 LDAP_F char *
54 ldif_getline LDAP_P(( char **next ));
55
56 LDAP_F void
57 ldif_put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen ));
58
59 LDAP_F char
60 *ldif_type_and_value LDAP_P(( char *type, char *val, int vlen ));
61
62
63 LDAP_END_DECL
64
65 #endif /* _LDIF_H */