]> git.sur5r.net Git - openldap/blobdiff - include/ldif.h
ITS#7739 fix for empty nested include
[openldap] / include / ldif.h
index 9ffb8ee2712088af2d38ba7c78b0dc800b4c2f41..e2b8a8e87a973ba90caa167d61a960a4112a8ea6 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2013 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,9 @@ LDAP_BEGIN_DECL
 /* This is NOT a bogus extern declaration (unlike ldap_debug) */
 LDAP_LDIF_V (int) ldif_debug;
 
-#define LDIF_LINE_WIDTH      76      /* maximum length of LDIF lines */
+#define LDIF_LINE_WIDTH      76      /* default maximum length of LDIF lines */
+#define LDIF_LINE_WIDTH_MAX  ((ber_len_t)-1) /* maximum length of LDIF lines */
+#define LDIF_LINE_WIDTH_WRAP(wrap) ((wrap) == 0 ? LDIF_LINE_WIDTH : (wrap))
 
 /*
  * Macro to calculate maximum number of bytes that the base64 equivalent
@@ -52,6 +54,11 @@ LDAP_LDIF_V (int) ldif_debug;
     ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
     + ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / LDIF_LINE_WIDTH * 2 ))
 
+#define LDIF_SIZE_NEEDED_WRAP(nlen,vlen,wrap) \
+    ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
+    + ((wrap) == 0 ? ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / ( LDIF_LINE_WIDTH ) * 2 ) : \
+       ((wrap) == LDIF_LINE_WIDTH_MAX ? 0 : ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / (wrap) * 2 ))))
+
 LDAP_LDIF_F( int )
 ldif_parse_line LDAP_P((
        LDAP_CONST char *line,
@@ -98,7 +105,7 @@ ldif_close LDAP_P(( LDIFFP * ));
 LDAP_LDIF_F( int )
 ldif_read_record LDAP_P((
        LDIFFP *fp,
-       int *lineno,
+       unsigned long *lineno,
        char **bufp,
        int *buflen ));
 
@@ -128,6 +135,15 @@ ldif_sput LDAP_P((
        LDAP_CONST char *val,
        ber_len_t vlen ));
 
+LDAP_LDIF_F( void )
+ldif_sput_wrap LDAP_P((
+       char **out,
+       int type,
+       LDAP_CONST char *name,
+       LDAP_CONST char *val,
+       ber_len_t vlen,
+        ber_len_t wrap ));
+
 LDAP_LDIF_F( char * )
 ldif_put LDAP_P((
        int type,
@@ -135,6 +151,14 @@ ldif_put LDAP_P((
        LDAP_CONST char *val,
        ber_len_t vlen ));
 
+LDAP_LDIF_F( char * )
+ldif_put_wrap LDAP_P((
+       int type,
+       LDAP_CONST char *name,
+       LDAP_CONST char *val,
+       ber_len_t vlen,
+       ber_len_t wrap ));
+
 LDAP_LDIF_F( int )
 ldif_is_not_printable LDAP_P((
        LDAP_CONST char *val,