1999-08-31 09:17:01 +08:00
|
|
|
/* $OpenLDAP$ */
|
2003-11-26 15:16:36 +08:00
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2004-01-02 03:15:16 +08:00
|
|
|
* Copyright 1998-2004 The OpenLDAP Foundation.
|
1998-12-29 03:51:35 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2001-05-29 11:29:53 +08:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
2003-11-26 15:16:36 +08:00
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
1998-12-29 03:51:35 +08:00
|
|
|
*/
|
2003-11-26 15:16:36 +08:00
|
|
|
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
1998-08-09 08:43:13 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted
|
|
|
|
* provided that this notice is preserved and that due credit is given
|
|
|
|
* to the University of Michigan at Ann Arbor. The name of the University
|
|
|
|
* may not be used to endorse or promote products derived from this
|
|
|
|
* software without specific prior written permission. This software
|
|
|
|
* is provided ``as is'' without express or implied warranty.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LDIF_H
|
|
|
|
#define _LDIF_H
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#include <ldap_cdefs.h>
|
|
|
|
|
|
|
|
LDAP_BEGIN_DECL
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1999-11-28 07:40:08 +08:00
|
|
|
/* This is NOT a bogus extern declaration (unlike ldap_debug) */
|
2000-06-20 11:53:12 +08:00
|
|
|
LDAP_LDIF_V (int) ldif_debug;
|
1998-12-22 09:34:01 +08:00
|
|
|
|
1999-03-09 08:50:41 +08:00
|
|
|
#define LDIF_LINE_WIDTH 76 /* maximum length of LDIF lines */
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Macro to calculate maximum number of bytes that the base64 equivalent
|
1999-07-31 07:00:02 +08:00
|
|
|
* of an item that is "len" bytes long will take up. Base64 encoding
|
1998-08-09 08:43:13 +08:00
|
|
|
* uses one byte for every six bits in the value plus up to two pad bytes.
|
|
|
|
*/
|
1999-07-31 07:00:02 +08:00
|
|
|
#define LDIF_BASE64_LEN(len) (((len) * 4 / 3 ) + 3)
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Macro to calculate maximum size that an LDIF-encoded type (length
|
|
|
|
* tlen) and value (length vlen) will take up: room for type + ":: " +
|
|
|
|
* first newline + base64 value + continued lines. Each continued line
|
|
|
|
* needs room for a newline and a leading space character.
|
|
|
|
*/
|
1999-07-31 07:00:02 +08:00
|
|
|
#define LDIF_SIZE_NEEDED(nlen,vlen) \
|
|
|
|
((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
|
|
|
|
+ ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / LDIF_LINE_WIDTH * 2 ))
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( int )
|
1999-05-19 09:12:33 +08:00
|
|
|
ldif_parse_line LDAP_P((
|
|
|
|
LDAP_CONST char *line,
|
1999-07-31 07:00:02 +08:00
|
|
|
char **name,
|
|
|
|
char **value,
|
1999-07-31 10:17:26 +08:00
|
|
|
ber_len_t *vlen ));
|
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( int )
|
1999-07-31 10:17:26 +08:00
|
|
|
ldif_fetch_url LDAP_P((
|
|
|
|
LDAP_CONST char *line,
|
|
|
|
char **value,
|
|
|
|
ber_len_t *vlen ));
|
1999-01-28 12:34:55 +08:00
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( char * )
|
1999-01-28 12:34:55 +08:00
|
|
|
ldif_getline LDAP_P(( char **next ));
|
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( int )
|
1999-08-18 03:00:59 +08:00
|
|
|
ldif_read_record LDAP_P((
|
|
|
|
FILE *fp,
|
|
|
|
int *lineno,
|
|
|
|
char **bufp,
|
|
|
|
int *buflen ));
|
|
|
|
|
|
|
|
|
1999-07-31 07:00:02 +08:00
|
|
|
#define LDIF_PUT_NOVALUE 0x0000 /* no value */
|
|
|
|
#define LDIF_PUT_VALUE 0x0001 /* value w/ auto detection */
|
|
|
|
#define LDIF_PUT_TEXT 0x0002 /* assume text */
|
|
|
|
#define LDIF_PUT_BINARY 0x0004 /* assume binary (convert to base64) */
|
|
|
|
#define LDIF_PUT_B64 0x0008 /* pre-converted base64 value */
|
|
|
|
|
|
|
|
#define LDIF_PUT_COMMENT 0x0010 /* comment */
|
|
|
|
#define LDIF_PUT_URL 0x0020 /* url */
|
|
|
|
#define LDIF_PUT_SEP 0x0040 /* separator */
|
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( void )
|
1999-07-31 07:00:02 +08:00
|
|
|
ldif_sput LDAP_P((
|
1999-05-19 09:12:33 +08:00
|
|
|
char **out,
|
1999-07-31 07:00:02 +08:00
|
|
|
int type,
|
|
|
|
LDAP_CONST char *name,
|
1999-05-19 09:12:33 +08:00
|
|
|
LDAP_CONST char *val,
|
1999-07-31 07:00:02 +08:00
|
|
|
ber_len_t vlen ));
|
1999-01-28 12:34:55 +08:00
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( char * )
|
1999-07-31 07:00:02 +08:00
|
|
|
ldif_put LDAP_P((
|
|
|
|
int type,
|
|
|
|
LDAP_CONST char *name,
|
1999-05-19 09:12:33 +08:00
|
|
|
LDAP_CONST char *val,
|
1999-07-31 07:00:02 +08:00
|
|
|
ber_len_t vlen ));
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2000-06-19 03:48:07 +08:00
|
|
|
LDAP_LDIF_F( int )
|
1999-07-31 07:00:02 +08:00
|
|
|
ldif_is_not_printable LDAP_P((
|
|
|
|
LDAP_CONST char *val,
|
|
|
|
ber_len_t vlen ));
|
1998-12-21 06:28:33 +08:00
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
LDAP_END_DECL
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
#endif /* _LDIF_H */
|