#include <ldap_cdefs.h>
+/* draft spec requires ldap.h include lber declarations */
+#include <lber.h>
+
LDAP_BEGIN_DECL
#define LDAP_VERSION1 1
#define LDAP_VERSION2 2
#define LDAP_VERSION3 3
-#define LDAP_VERSION LDAP_VERSION2
#define LDAP_VERSION_MIN LDAP_VERSION2
-#define LDAP_VERSION_MAX LDAP_VERSION2
+#define LDAP_VERSION LDAP_VERSION2
+#define LDAP_VERSION_MAX LDAP_VERSION3
/*
* We'll use 2000+draft revision for our API version number
#define LDAP_NO_ATTRS "1.1"
#define LDAP_ALL_USER_ATTRIBUTES "*"
-#define LDAP_COMPAT20
-#define LDAP_COMPAT30
-#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
-#define LDAP_COMPAT
-#endif
-
-/* LDAP_OPTions defined by draft-ldapext-ldap-c-api-02 */
+/*
+ * LDAP_OPTions defined by draft-ldapext-ldap-c-api-02
+ * 0x0000 - 0x0fff reserved for api options
+ * 0x1000 - 0x3fff reserved for api extended options
+ * 0x4000 - 0x7fff reserved for private and experimental options
+ */
#define LDAP_OPT_API_INFO 0x0000
#define LDAP_OPT_DESC 0x0001
#define LDAP_OPT_DEREF 0x0002
#define LDAP_OPT_ERROR_NUMBER 0x0031
#define LDAP_OPT_ERROR_STRING 0x0032
-/* not defined by current draft */
-/* for LDAPv2 compatibility */
-#define LDAP_OPT_DNS 0x1001 /* use DN & DNS */
+/* 0x33 - 0x0fff not defined by current draft */
+
+/* extended options - none */
+
+/* private and experimental options */
+#define LDAP_OPT_DNS 0x4001 /* use DN & DNS */
/* OpenLDAP specific options */
-#define LDAP_OPT_DEBUG_LEVEL 0x4001 /* OpenLDAP - debug level */
+#define LDAP_OPT_DEBUG_LEVEL 0x5001 /* debug level */
+#define LDAP_OPT_TIMEOUT 0x5002 /* default timeout */
+#define LDAP_OPT_REFHOPLIMIT 0x5003 /* ref hop limit */
+#define LDAP_OPT_MATCHED_DN 0x5004 /* should have been in draft */
/* on/off values */
#define LDAP_OPT_ON ((void *) 1)
#define LDAP_OPT_SUCCESS 0
#define LDAP_OPT_ERROR (-1)
-#define LDAP_API_INFO_VERSION 1
+#define LDAP_API_INFO_VERSION (1)
typedef struct ldapapiinfo {
int ldapai_info_version; /* version of LDAPAPIInfo (1) */
int ldapai_api_version; /* revision of API supported */
int ldapai_vendor_version; /* supplier-specific version * 100 */
} LDAPAPIInfo;
-#define LDAP_FEATURE_INFO_VERSION 1 /* version of api feature structure */
+#define LDAP_FEATURE_INFO_VERSION (1) /* version of api feature structure */
typedef struct ldap_apifeature_info {
int ldapaif_info_version; /* version of this struct (1) */
char* ldapaif_name; /* matches LDAP_API_FEATURE_... less the prefix */
char * ldctl_oid;
struct berval ldctl_value;
char ldctl_iscritical;
-} LDAPControl, *PLDAPControl;
+} LDAPControl;
+
+/* LDAP "Standard" Controls */
+
+ /* chase referrals controls */
+#define LDAP_CONTROL_REFERRALS "1.2.840.113666.1.4.616"
+#define LDAP_CHASE_SUBORDINATE_REFERRALS 0x0020
+#define LDAP_CHASE_EXTERNAL_REFERRALS 0x0040
+
+/* LDAP "Extension" Controls */
+
+/* LDAP "Private/Experiemental" Controls */
-#define LDAP_MAX_ATTR_LEN 100
/*
* specific LDAP instantiations of BER types we know about
#define LDAP_TAG_LDAPDN 0x04UL /* octect string */
#define LDAP_TAG_CONTROLS 0xa0UL /* context specific + constructed + 0 */
#define LDAP_TAG_REFERRAL 0xa3UL /* context specific + constructed + 3 */
+
#define LDAP_TAG_NEWSUPERIOR 0x80UL /* context-specific + primitive + 0 */
+#define LDAP_TAG_EXOP_REQ_OID 0x80UL /* context specific + primitive */
+#define LDAP_TAG_EXOP_REQ_VALUE 0x81UL /* context specific + primitive */
+#define LDAP_TAG_EXOP_RES_OID 0x8aUL /* context specific + primitive */
+#define LDAP_TAG_EXOP_RES_VALUE 0x8bUL /* context specific + primitive */
+
#define LDAP_TAG_SASL_RES_CREDS 0x87UL /* context specific + primitive */
+
+
+
/* possible operations a client can invoke */
#define LDAP_REQ_BIND 0x60UL /* application + constructed */
#define LDAP_REQ_UNBIND 0x42UL /* application + primitive */
#define LDAP_MOD_DELETE 0x0001
#define LDAP_MOD_REPLACE 0x0002
#define LDAP_MOD_BVALUES 0x0080
+/* IMPORTANT: do not use code 0x1000 (or above),
+ * it is used internally by the backends!
+ * (see ldap/servers/slapd/slap.h)
+ * JCG 05/1999 (gomez@engr.sgi.com)
+ */
char *mod_type;
union mod_vals_u {
char **modv_strvals;
#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */
#define LDAP_ALIAS_DEREF_PROBLEM 0x24
-#define LDAP_NAME_ERROR(n) (((n) & 0x00f0) == 0x0020)
+#define LDAP_NAME_ERROR(n) (((int)(n) & 0x00f0) == 0x0020)
#define LDAP_INAPPROPRIATE_AUTH 0x30
#define LDAP_INVALID_CREDENTIALS 0x31
#define LDAP_CLIENT_LOOP 0x60 /* new */
#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* new */
-/* default limit on nesting of referrals */
-#define LDAP_DEFAULT_REFHOPLIMIT 5
-
/*
* This structure represents both ldap messages and ldap responses.
* These are really the same, except in the case of search responses,
} LDAPURLDesc;
#define LDAP_URL_ERR_NOTLDAP 0x01 /* URL doesn't begin with "ldap://" */
-#define LDAP_URL_ERR_NODN 0x02 /* URL has no DN (required) */
+#define LDAP_URL_ERR_NODN 0x02 /* URL has no DN (required) */
#define LDAP_URL_ERR_BADSCOPE 0x03 /* URL scope string is invalid */
-#define LDAP_URL_ERR_MEM 0x04 /* can't allocate memory space */
+#define LDAP_URL_ERR_MEM 0x04 /* can't allocate memory space */
-/* avoid pulling in headers */
+/*
+ * The API draft spec says we should declare (or cause to be declared)
+ * 'struct timeval'. We don't. See LDAPext discussions.
+ */
struct timeval;
/*
*/
LDAP_F( int )
ldap_get_option LDAP_P((
- LDAP *ld,
+ LDAP_CONST LDAP *ld,
int option,
void *outvalue));
LDAP_F( int )
ldap_extended_operation LDAP_P((
LDAP *ld,
- LDAP_CONST char *exoid,
- struct berval *exdata,
+ LDAP_CONST char *reqoid,
+ struct berval *reqdata,
LDAPControl **serverctrls,
LDAPControl **clientctrls,
int *msgidp ));
LDAP_F( int )
ldap_extended_operation_s LDAP_P((
LDAP *ld,
- LDAP_CONST char *exoid,
- struct berval *exdata,
+ LDAP_CONST char *reqoid,
+ struct berval *reqdata,
LDAPControl **serverctrls,
LDAPControl **clientctrls,
char **retoidp,
struct berval **retdatap ));
+LDAP_F( int )
+ldap_parse_extended_result LDAP_P((
+ LDAP *ld,
+ LDAPMessage *res,
+ char **retoidp,
+ struct berval **retdatap,
+ int freeit ));
+
/*
* in abandon.c:
*/
LDAPControl **clientctrls,
struct berval **servercredp ));
+LDAP_F( int )
+ldap_parse_sasl_bind_result LDAP_P((
+ LDAP *ld,
+ LDAPMessage *res,
+ struct berval **servercredp,
+ int freeit ));
/*
* in bind.c:
/*
* in cache.c
- * DEPRECATED
+ * (deprecated)
*/
LDAP_F( int )
ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem ));
* in error.c:
*/
LDAP_F( int )
-ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit ));
+ldap_result2error LDAP_P(( /* deprecated */
+ LDAP *ld,
+ LDAPMessage *r,
+ int freeit ));
+
LDAP_F( char *)
-ldap_err2string LDAP_P(( int err ));
+ldap_err2string LDAP_P((
+ int err ));
+
LDAP_F( void )
-ldap_perror LDAP_P((
+ldap_perror LDAP_P(( /* deprecated */
LDAP *ld,
LDAP_CONST char *s ));
/*
- * in rename.c:
+ * in modrdn.c:
*/
LDAP_F( int )
ldap_rename_ext LDAP_P((
LDAPControl **serverctrls,
LDAPControl **clientctrls ));
+LDAP_F( int )
+ldap_rename2 LDAP_P((
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior ));
+
+LDAP_F( int )
+ldap_rename2_s LDAP_P((
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior));
-/*
- * in modrdn.c:
- */
LDAP_F( int )
ldap_modrdn LDAP_P((
LDAP *ld,
LDAP_CONST char *newrdn,
int deleteoldrdn));
-LDAP_F( int )
-ldap_rename2 LDAP_P((
- LDAP *ld,
- LDAP_CONST char *dn,
- LDAP_CONST char *newrdn,
- int deleteoldrdn,
- LDAP_CONST char *newSuperior ));
-
-LDAP_F( int )
-ldap_rename2_s LDAP_P((
- LDAP *ld,
- LDAP_CONST char *dn,
- LDAP_CONST char *newrdn,
- int deleteoldrdn,
- LDAP_CONST char *newSuperior));
/*
* in open.c:
struct timeval *timeout,
LDAPMessage **result ));
+LDAP_F( int )
+ldap_parse_result LDAP_P((
+ LDAP *ld,
+ LDAPMessage *res,
+ int *errcodep,
+ char **matcheddnp,
+ char **errmsgp,
+ char ***referralsp,
+ LDAPControl ***serverctrls,
+ int freeit ));
+
LDAP_F( int )
ldap_msgtype LDAP_P((
LDAPMessage *lm ));
/*
* in free.c
*/
+
+LDAP_F( void * )
+ldap_memalloc LDAP_P((
+ size_t s ));
+
+LDAP_F( void * )
+ldap_memrealloc LDAP_P((
+ void* p,
+ size_t s ));
+
+LDAP_F( void * )
+ldap_memcalloc LDAP_P((
+ size_t n,
+ size_t s ));
+
LDAP_F( void )
ldap_memfree LDAP_P((
- void *p ));
+ void* p ));
+
+LDAP_F( void )
+ldap_memvfree LDAP_P((
+ void** v ));
+
+LDAP_F( char * )
+ldap_strdup LDAP_P((
+ LDAP_CONST char * ));
LDAP_F( void )
ldap_getfilter_free LDAP_P((