File indexing completed on 2025-01-17 09:55:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef _LDIF_H
0027 #define _LDIF_H
0028
0029 #include <ldap_cdefs.h>
0030
0031 LDAP_BEGIN_DECL
0032
0033
0034 LDAP_LDIF_V (int) ldif_debug;
0035
0036 #define LDIF_LINE_WIDTH 78
0037 #define LDIF_LINE_WIDTH_MAX ((ber_len_t)-1)
0038 #define LDIF_LINE_WIDTH_WRAP(wrap) ((wrap) == 0 ? LDIF_LINE_WIDTH : (wrap))
0039
0040
0041
0042
0043
0044
0045 #define LDIF_BASE64_LEN(len) (((len) * 4 / 3 ) + 3)
0046
0047
0048
0049
0050
0051
0052
0053 #define LDIF_SIZE_NEEDED(nlen,vlen) LDIF_SIZE_NEEDED_WRAP(nlen, vlen, 0)
0054
0055 #define LDIF_SIZE_NEEDED_WRAP(nlen,vlen,wrap) \
0056 ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
0057 + ((wrap) == 0 ? ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / ( LDIF_LINE_WIDTH-1 ) * 2 ) : \
0058 ((wrap) == LDIF_LINE_WIDTH_MAX ? 0 : ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / (wrap-1) * 2 ))))
0059
0060 LDAP_LDIF_F( int )
0061 ldif_parse_line LDAP_P((
0062 LDAP_CONST char *line,
0063 char **name,
0064 char **value,
0065 ber_len_t *vlen ));
0066
0067 LDAP_LDIF_F( int )
0068 ldif_parse_line2 LDAP_P((
0069 char *line,
0070 struct berval *type,
0071 struct berval *value,
0072 int *freeval ));
0073
0074 LDAP_LDIF_F( FILE * )
0075 ldif_open_url LDAP_P(( LDAP_CONST char *urlstr ));
0076
0077 LDAP_LDIF_F( int )
0078 ldif_fetch_url LDAP_P((
0079 LDAP_CONST char *line,
0080 char **value,
0081 ber_len_t *vlen ));
0082
0083 LDAP_LDIF_F( char * )
0084 ldif_getline LDAP_P(( char **next ));
0085
0086 LDAP_LDIF_F( int )
0087 ldif_countlines LDAP_P(( LDAP_CONST char *line ));
0088
0089
0090
0091
0092 typedef struct LDIFFP {
0093 FILE *fp;
0094 struct LDIFFP *prev;
0095 } LDIFFP;
0096
0097 LDAP_LDIF_F( LDIFFP * )
0098 ldif_open LDAP_P(( LDAP_CONST char *file, LDAP_CONST char *mode ));
0099
0100
0101 LDAP_LDIF_F( LDIFFP * )
0102 ldif_open_mem LDAP_P(( char *ldif, size_t size, LDAP_CONST char *mode ));
0103
0104 LDAP_LDIF_F( void )
0105 ldif_close LDAP_P(( LDIFFP * ));
0106
0107 LDAP_LDIF_F( int )
0108 ldif_read_record LDAP_P((
0109 LDIFFP *fp,
0110 unsigned long *lineno,
0111 char **bufp,
0112 int *buflen ));
0113
0114 LDAP_LDIF_F( int )
0115 ldif_must_b64_encode_register LDAP_P((
0116 LDAP_CONST char *name,
0117 LDAP_CONST char *oid ));
0118
0119 LDAP_LDIF_F( void )
0120 ldif_must_b64_encode_release LDAP_P(( void ));
0121
0122 #define LDIF_PUT_NOVALUE 0x0000
0123 #define LDIF_PUT_VALUE 0x0001
0124 #define LDIF_PUT_TEXT 0x0002
0125 #define LDIF_PUT_BINARY 0x0004
0126 #define LDIF_PUT_B64 0x0008
0127
0128 #define LDIF_PUT_COMMENT 0x0010
0129 #define LDIF_PUT_URL 0x0020
0130 #define LDIF_PUT_SEP 0x0040
0131
0132 LDAP_LDIF_F( void )
0133 ldif_sput LDAP_P((
0134 char **out,
0135 int type,
0136 LDAP_CONST char *name,
0137 LDAP_CONST char *val,
0138 ber_len_t vlen ));
0139
0140 LDAP_LDIF_F( void )
0141 ldif_sput_wrap LDAP_P((
0142 char **out,
0143 int type,
0144 LDAP_CONST char *name,
0145 LDAP_CONST char *val,
0146 ber_len_t vlen,
0147 ber_len_t wrap ));
0148
0149 LDAP_LDIF_F( char * )
0150 ldif_put LDAP_P((
0151 int type,
0152 LDAP_CONST char *name,
0153 LDAP_CONST char *val,
0154 ber_len_t vlen ));
0155
0156 LDAP_LDIF_F( char * )
0157 ldif_put_wrap LDAP_P((
0158 int type,
0159 LDAP_CONST char *name,
0160 LDAP_CONST char *val,
0161 ber_len_t vlen,
0162 ber_len_t wrap ));
0163
0164 LDAP_LDIF_F( int )
0165 ldif_is_not_printable LDAP_P((
0166 LDAP_CONST char *val,
0167 ber_len_t vlen ));
0168
0169 LDAP_END_DECL
0170
0171 #endif