xref: /netbsd/external/bsd/openldap/dist/include/ldap.h (revision cf1d77f7)
1*cf1d77f7Schristos /*	$NetBSD: ldap.h,v 1.3 2021/08/14 16:14:55 christos Exp $	*/
24e6df137Slukem 
333197c6aStron /* $OpenLDAP$ */
42de962bdSlukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
52de962bdSlukem  *
6*cf1d77f7Schristos  * Copyright 1998-2021 The OpenLDAP Foundation.
72de962bdSlukem  * All rights reserved.
82de962bdSlukem  *
92de962bdSlukem  * Redistribution and use in source and binary forms, with or without
102de962bdSlukem  * modification, are permitted only as authorized by the OpenLDAP
112de962bdSlukem  * Public License.
122de962bdSlukem  *
132de962bdSlukem  * A copy of this license is available in file LICENSE in the
142de962bdSlukem  * top-level directory of the distribution or, alternatively, at
152de962bdSlukem  * <http://www.OpenLDAP.org/license.html>.
162de962bdSlukem  */
172de962bdSlukem /* Portions Copyright (c) 1990 Regents of the University of Michigan.
182de962bdSlukem  * All rights reserved.
192de962bdSlukem  *
202de962bdSlukem  * Redistribution and use in source and binary forms are permitted
212de962bdSlukem  * provided that this notice is preserved and that due credit is given
222de962bdSlukem  * to the University of Michigan at Ann Arbor. The name of the University
232de962bdSlukem  * may not be used to endorse or promote products derived from this
242de962bdSlukem  * software without specific prior written permission. This software
252de962bdSlukem  * is provided ``as is'' without express or implied warranty.
262de962bdSlukem  */
272de962bdSlukem 
282de962bdSlukem #ifndef _LDAP_H
292de962bdSlukem #define _LDAP_H
302de962bdSlukem 
312de962bdSlukem /* pull in lber */
322de962bdSlukem #include <lber.h>
332de962bdSlukem 
342de962bdSlukem /* include version and API feature defines */
352de962bdSlukem #include <ldap_features.h>
362de962bdSlukem 
372de962bdSlukem LDAP_BEGIN_DECL
382de962bdSlukem 
392de962bdSlukem #define LDAP_VERSION1	1
402de962bdSlukem #define LDAP_VERSION2	2
412de962bdSlukem #define LDAP_VERSION3	3
422de962bdSlukem 
432de962bdSlukem #define LDAP_VERSION_MIN	LDAP_VERSION2
442de962bdSlukem #define	LDAP_VERSION		LDAP_VERSION2
452de962bdSlukem #define LDAP_VERSION_MAX	LDAP_VERSION3
462de962bdSlukem 
472de962bdSlukem /*
482de962bdSlukem  * We use 3000+n here because it is above 1823 (for RFC 1823),
492de962bdSlukem  * above 2000+rev of IETF LDAPEXT draft (now quite dated),
502de962bdSlukem  * yet below allocations for new RFCs (just in case there is
512de962bdSlukem  * someday an RFC produced).
522de962bdSlukem  */
532de962bdSlukem #define LDAP_API_VERSION	3001
542de962bdSlukem #define LDAP_VENDOR_NAME	"OpenLDAP"
552de962bdSlukem 
562de962bdSlukem /* OpenLDAP API Features */
572de962bdSlukem #define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION
582de962bdSlukem 
59*cf1d77f7Schristos #if defined( LDAP_API_FEATURE_X_OPENLDAP_REENTRANT )
602de962bdSlukem #	define	LDAP_API_FEATURE_THREAD_SAFE 		1
61*cf1d77f7Schristos #endif
62*cf1d77f7Schristos #if defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE )
6333197c6aStron #	define  LDAP_API_FEATURE_SESSION_THREAD_SAFE	1
6433197c6aStron #	define  LDAP_API_FEATURE_OPERATION_THREAD_SAFE	1
652de962bdSlukem #endif
662de962bdSlukem 
672de962bdSlukem 
682de962bdSlukem #define LDAP_PORT		389		/* ldap:///		default LDAP port */
692de962bdSlukem #define LDAPS_PORT		636		/* ldaps:///	default LDAP over TLS port */
702de962bdSlukem 
712de962bdSlukem #define LDAP_ROOT_DSE				""
722de962bdSlukem #define LDAP_NO_ATTRS				"1.1"
732de962bdSlukem #define LDAP_ALL_USER_ATTRIBUTES	"*"
742de962bdSlukem #define LDAP_ALL_OPERATIONAL_ATTRIBUTES	"+" /* RFC 3673 */
752de962bdSlukem 
762de962bdSlukem /* RFC 4511:  maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */
772de962bdSlukem #define LDAP_MAXINT (2147483647)
782de962bdSlukem 
792de962bdSlukem /*
802de962bdSlukem  * LDAP_OPTions
812de962bdSlukem  *	0x0000 - 0x0fff reserved for api options
822de962bdSlukem  *	0x1000 - 0x3fff reserved for api extended options
832de962bdSlukem  *	0x4000 - 0x7fff reserved for private and experimental options
842de962bdSlukem  */
852de962bdSlukem 
862de962bdSlukem #define LDAP_OPT_API_INFO			0x0000
872de962bdSlukem #define LDAP_OPT_DESC				0x0001 /* historic */
882de962bdSlukem #define LDAP_OPT_DEREF				0x0002
892de962bdSlukem #define LDAP_OPT_SIZELIMIT			0x0003
902de962bdSlukem #define LDAP_OPT_TIMELIMIT			0x0004
912de962bdSlukem /* 0x05 - 0x07 not defined */
922de962bdSlukem #define LDAP_OPT_REFERRALS			0x0008
932de962bdSlukem #define LDAP_OPT_RESTART			0x0009
942de962bdSlukem /* 0x0a - 0x10 not defined */
952de962bdSlukem #define LDAP_OPT_PROTOCOL_VERSION		0x0011
962de962bdSlukem #define LDAP_OPT_SERVER_CONTROLS		0x0012
972de962bdSlukem #define LDAP_OPT_CLIENT_CONTROLS		0x0013
982de962bdSlukem /* 0x14 not defined */
992de962bdSlukem #define LDAP_OPT_API_FEATURE_INFO		0x0015
1002de962bdSlukem /* 0x16 - 0x2f not defined */
1012de962bdSlukem #define LDAP_OPT_HOST_NAME			0x0030
1022de962bdSlukem #define LDAP_OPT_RESULT_CODE			0x0031
1032de962bdSlukem #define LDAP_OPT_ERROR_NUMBER			LDAP_OPT_RESULT_CODE
1042de962bdSlukem #define LDAP_OPT_DIAGNOSTIC_MESSAGE		0x0032
1052de962bdSlukem #define LDAP_OPT_ERROR_STRING			LDAP_OPT_DIAGNOSTIC_MESSAGE
1062de962bdSlukem #define LDAP_OPT_MATCHED_DN			0x0033
1072de962bdSlukem /* 0x0034 - 0x3fff not defined */
1084e6df137Slukem /* 0x0091 used by Microsoft for LDAP_OPT_AUTO_RECONNECT */
1094e6df137Slukem #define LDAP_OPT_SSPI_FLAGS			0x0092
1104e6df137Slukem /* 0x0093 used by Microsoft for LDAP_OPT_SSL_INFO */
1114e6df137Slukem /* 0x0094 used by Microsoft for LDAP_OPT_REF_DEREF_CONN_PER_MSG */
1124e6df137Slukem #define LDAP_OPT_SIGN				0x0095
1134e6df137Slukem #define LDAP_OPT_ENCRYPT			0x0096
1144e6df137Slukem #define LDAP_OPT_SASL_METHOD			0x0097
1154e6df137Slukem /* 0x0098 used by Microsoft for LDAP_OPT_AREC_EXCLUSIVE */
1164e6df137Slukem #define LDAP_OPT_SECURITY_CONTEXT		0x0099
1174e6df137Slukem /* 0x009A used by Microsoft for LDAP_OPT_ROOTDSE_CACHE */
1184e6df137Slukem /* 0x009B - 0x3fff not defined */
1192de962bdSlukem 
1202de962bdSlukem /* API Extensions */
1212de962bdSlukem #define LDAP_OPT_API_EXTENSION_BASE 0x4000  /* API extensions */
1222de962bdSlukem 
1232de962bdSlukem /* private and experimental options */
1242de962bdSlukem /* OpenLDAP specific options */
1252de962bdSlukem #define LDAP_OPT_DEBUG_LEVEL		0x5001	/* debug level */
1262de962bdSlukem #define LDAP_OPT_TIMEOUT			0x5002	/* default timeout */
1272de962bdSlukem #define LDAP_OPT_REFHOPLIMIT		0x5003	/* ref hop limit */
1282de962bdSlukem #define LDAP_OPT_NETWORK_TIMEOUT	0x5005	/* socket level timeout */
1292de962bdSlukem #define LDAP_OPT_URI				0x5006
1302de962bdSlukem #define LDAP_OPT_REFERRAL_URLS      0x5007  /* Referral URLs */
1312de962bdSlukem #define LDAP_OPT_SOCKBUF            0x5008  /* sockbuf */
1322de962bdSlukem #define LDAP_OPT_DEFBASE		0x5009	/* searchbase */
1332de962bdSlukem #define	LDAP_OPT_CONNECT_ASYNC		0x5010	/* create connections asynchronously */
1344e6df137Slukem #define	LDAP_OPT_CONNECT_CB			0x5011	/* connection callbacks */
13533197c6aStron #define	LDAP_OPT_SESSION_REFCNT		0x5012	/* session reference count */
136*cf1d77f7Schristos #define	LDAP_OPT_KEEPCONN		0x5013	/* keep the connection on read error or NoD */
137*cf1d77f7Schristos #define	LDAP_OPT_SOCKET_BIND_ADDRESSES	0x5014	/* user configured bind IPs */
138*cf1d77f7Schristos #define	LDAP_OPT_TCP_USER_TIMEOUT	0x5015	/* set TCP_USER_TIMEOUT if the OS supports it, ignored otherwise */
1392de962bdSlukem 
1402de962bdSlukem /* OpenLDAP TLS options */
1412de962bdSlukem #define LDAP_OPT_X_TLS				0x6000
1424e6df137Slukem #define LDAP_OPT_X_TLS_CTX			0x6001	/* OpenSSL CTX* */
1432de962bdSlukem #define LDAP_OPT_X_TLS_CACERTFILE	0x6002
1442de962bdSlukem #define LDAP_OPT_X_TLS_CACERTDIR	0x6003
1452de962bdSlukem #define LDAP_OPT_X_TLS_CERTFILE		0x6004
1462de962bdSlukem #define LDAP_OPT_X_TLS_KEYFILE		0x6005
1472de962bdSlukem #define LDAP_OPT_X_TLS_REQUIRE_CERT	0x6006
1484e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_MIN	0x6007
1492de962bdSlukem #define LDAP_OPT_X_TLS_CIPHER_SUITE	0x6008
1502de962bdSlukem #define LDAP_OPT_X_TLS_RANDOM_FILE	0x6009
1514e6df137Slukem #define LDAP_OPT_X_TLS_SSL_CTX		0x600a	/* OpenSSL SSL* */
1522de962bdSlukem #define LDAP_OPT_X_TLS_CRLCHECK		0x600b
1532de962bdSlukem #define LDAP_OPT_X_TLS_CONNECT_CB	0x600c
1542de962bdSlukem #define LDAP_OPT_X_TLS_CONNECT_ARG	0x600d
1552de962bdSlukem #define LDAP_OPT_X_TLS_DHFILE		0x600e
1562de962bdSlukem #define LDAP_OPT_X_TLS_NEWCTX		0x600f
1572de962bdSlukem #define LDAP_OPT_X_TLS_CRLFILE		0x6010	/* GNUtls only */
15833197c6aStron #define LDAP_OPT_X_TLS_PACKAGE		0x6011
1598da6f2f6Schristos #define LDAP_OPT_X_TLS_ECNAME		0x6012
160*cf1d77f7Schristos #define LDAP_OPT_X_TLS_VERSION		0x6013	/* read-only */
161*cf1d77f7Schristos #define LDAP_OPT_X_TLS_CIPHER		0x6014	/* read-only */
162*cf1d77f7Schristos #define LDAP_OPT_X_TLS_PEERCERT		0x6015	/* read-only */
163*cf1d77f7Schristos #define LDAP_OPT_X_TLS_CACERT		0x6016
164*cf1d77f7Schristos #define LDAP_OPT_X_TLS_CERT			0x6017
165*cf1d77f7Schristos #define LDAP_OPT_X_TLS_KEY			0x6018
166*cf1d77f7Schristos #define LDAP_OPT_X_TLS_PEERKEY_HASH	0x6019
167*cf1d77f7Schristos #define LDAP_OPT_X_TLS_REQUIRE_SAN	0x601a
168*cf1d77f7Schristos #define LDAP_OPT_X_TLS_PROTOCOL_MAX	0x601b
1692de962bdSlukem 
1702de962bdSlukem #define LDAP_OPT_X_TLS_NEVER	0
1712de962bdSlukem #define LDAP_OPT_X_TLS_HARD		1
1722de962bdSlukem #define LDAP_OPT_X_TLS_DEMAND	2
1732de962bdSlukem #define LDAP_OPT_X_TLS_ALLOW	3
1742de962bdSlukem #define LDAP_OPT_X_TLS_TRY		4
1752de962bdSlukem 
1762de962bdSlukem #define LDAP_OPT_X_TLS_CRL_NONE	0
1772de962bdSlukem #define LDAP_OPT_X_TLS_CRL_PEER	1
1782de962bdSlukem #define LDAP_OPT_X_TLS_CRL_ALL	2
1792de962bdSlukem 
180*cf1d77f7Schristos /* for LDAP_OPT_X_TLS_PROTOCOL_MIN/MAX */
1814e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL(maj,min)	(((maj) << 8) + (min))
1824e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_SSL2		(2 << 8)
1834e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_SSL3		(3 << 8)
1844e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_0		((3 << 8) + 1)
1854e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_1		((3 << 8) + 2)
1864e6df137Slukem #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_2		((3 << 8) + 3)
187*cf1d77f7Schristos #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_3		((3 << 8) + 4)
188*cf1d77f7Schristos 
189*cf1d77f7Schristos #define LDAP_OPT_X_SASL_CBINDING_NONE		0
190*cf1d77f7Schristos #define LDAP_OPT_X_SASL_CBINDING_TLS_UNIQUE	1
191*cf1d77f7Schristos #define LDAP_OPT_X_SASL_CBINDING_TLS_ENDPOINT	2
1924e6df137Slukem 
1932de962bdSlukem /* OpenLDAP SASL options */
1942de962bdSlukem #define LDAP_OPT_X_SASL_MECH			0x6100
1952de962bdSlukem #define LDAP_OPT_X_SASL_REALM			0x6101
1962de962bdSlukem #define LDAP_OPT_X_SASL_AUTHCID			0x6102
1972de962bdSlukem #define LDAP_OPT_X_SASL_AUTHZID			0x6103
1982de962bdSlukem #define LDAP_OPT_X_SASL_SSF				0x6104 /* read-only */
1992de962bdSlukem #define LDAP_OPT_X_SASL_SSF_EXTERNAL	0x6105 /* write-only */
2002de962bdSlukem #define LDAP_OPT_X_SASL_SECPROPS		0x6106 /* write-only */
2012de962bdSlukem #define LDAP_OPT_X_SASL_SSF_MIN			0x6107
2022de962bdSlukem #define LDAP_OPT_X_SASL_SSF_MAX			0x6108
2032de962bdSlukem #define LDAP_OPT_X_SASL_MAXBUFSIZE		0x6109
2044e6df137Slukem #define LDAP_OPT_X_SASL_MECHLIST		0x610a /* read-only */
2054e6df137Slukem #define LDAP_OPT_X_SASL_NOCANON			0x610b
2064e6df137Slukem #define LDAP_OPT_X_SASL_USERNAME		0x610c /* read-only */
2070bafdad3Sadam #define LDAP_OPT_X_SASL_GSS_CREDS		0x610d
208*cf1d77f7Schristos #define LDAP_OPT_X_SASL_CBINDING		0x610e
2094e6df137Slukem 
2104e6df137Slukem /* OpenLDAP GSSAPI options */
2114e6df137Slukem #define LDAP_OPT_X_GSSAPI_DO_NOT_FREE_CONTEXT      0x6200
2124e6df137Slukem #define LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL   0x6201
2134e6df137Slukem 
2144e6df137Slukem /*
2154e6df137Slukem  * OpenLDAP per connection tcp-keepalive settings
2164e6df137Slukem  * (Linux only, ignored where unsupported)
2174e6df137Slukem  */
2184e6df137Slukem #define LDAP_OPT_X_KEEPALIVE_IDLE		0x6300
2194e6df137Slukem #define LDAP_OPT_X_KEEPALIVE_PROBES		0x6301
2204e6df137Slukem #define LDAP_OPT_X_KEEPALIVE_INTERVAL	0x6302
2212de962bdSlukem 
2222de962bdSlukem /* Private API Extensions -- reserved for application use */
2232de962bdSlukem #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x7000  /* Private API inclusive */
2242de962bdSlukem 
2252de962bdSlukem /*
2262de962bdSlukem  * ldap_get_option() and ldap_set_option() return values.
2272de962bdSlukem  * As later versions may return other values indicating
2282de962bdSlukem  * failure, current applications should only compare returned
2292de962bdSlukem  * value against LDAP_OPT_SUCCESS.
2302de962bdSlukem  */
2312de962bdSlukem #define LDAP_OPT_SUCCESS	0
2322de962bdSlukem #define	LDAP_OPT_ERROR		(-1)
2332de962bdSlukem 
2342de962bdSlukem /* option on/off values */
2352de962bdSlukem #define LDAP_OPT_ON		((void *) &ber_pvt_opt_on)
2362de962bdSlukem #define LDAP_OPT_OFF	((void *) 0)
2372de962bdSlukem 
2382de962bdSlukem typedef struct ldapapiinfo {
2392de962bdSlukem 	int		ldapai_info_version;		/* version of LDAPAPIInfo */
2402de962bdSlukem #define LDAP_API_INFO_VERSION	(1)
2412de962bdSlukem 	int		ldapai_api_version;			/* revision of API supported */
2422de962bdSlukem 	int		ldapai_protocol_version;	/* highest LDAP version supported */
2432de962bdSlukem 	char	**ldapai_extensions;		/* names of API extensions */
2442de962bdSlukem 	char	*ldapai_vendor_name;		/* name of supplier */
2452de962bdSlukem 	int		ldapai_vendor_version;		/* supplier-specific version * 100 */
2462de962bdSlukem } LDAPAPIInfo;
2472de962bdSlukem 
2482de962bdSlukem typedef struct ldap_apifeature_info {
2492de962bdSlukem 	int		ldapaif_info_version;		/* version of LDAPAPIFeatureInfo */
2502de962bdSlukem #define LDAP_FEATURE_INFO_VERSION (1)	/* apifeature_info struct version */
2512de962bdSlukem 	char*	ldapaif_name;				/* LDAP_API_FEATURE_* (less prefix) */
2522de962bdSlukem 	int		ldapaif_version;			/* value of LDAP_API_FEATURE_... */
2532de962bdSlukem } LDAPAPIFeatureInfo;
2542de962bdSlukem 
2552de962bdSlukem /*
2562de962bdSlukem  * LDAP Control structure
2572de962bdSlukem  */
2582de962bdSlukem typedef struct ldapcontrol {
2592de962bdSlukem 	char *			ldctl_oid;			/* numericoid of control */
2602de962bdSlukem 	struct berval	ldctl_value;		/* encoded value of control */
2612de962bdSlukem 	char			ldctl_iscritical;	/* criticality */
2622de962bdSlukem } LDAPControl;
2632de962bdSlukem 
2642de962bdSlukem /* LDAP Controls */
2652de962bdSlukem /*	standard track controls */
2662de962bdSlukem #define LDAP_CONTROL_MANAGEDSAIT	"2.16.840.1.113730.3.4.2"  /* RFC 3296 */
2672de962bdSlukem #define LDAP_CONTROL_PROXY_AUTHZ	"2.16.840.1.113730.3.4.18" /* RFC 4370 */
2682de962bdSlukem #define LDAP_CONTROL_SUBENTRIES		"1.3.6.1.4.1.4203.1.10.1"  /* RFC 3672 */
2692de962bdSlukem 
2702de962bdSlukem #define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.3344810.2.3"/* RFC 3876 */
2712de962bdSlukem 
2722de962bdSlukem #define LDAP_CONTROL_ASSERT				"1.3.6.1.1.12"			/* RFC 4528 */
2732de962bdSlukem #define LDAP_CONTROL_PRE_READ			"1.3.6.1.1.13.1"		/* RFC 4527 */
2742de962bdSlukem #define LDAP_CONTROL_POST_READ			"1.3.6.1.1.13.2"		/* RFC 4527 */
2752de962bdSlukem 
2762de962bdSlukem #define LDAP_CONTROL_SORTREQUEST    "1.2.840.113556.1.4.473" /* RFC 2891 */
2772de962bdSlukem #define LDAP_CONTROL_SORTRESPONSE	"1.2.840.113556.1.4.474" /* RFC 2891 */
2782de962bdSlukem 
2792de962bdSlukem /*	non-standard track controls */
2802de962bdSlukem #define LDAP_CONTROL_PAGEDRESULTS	"1.2.840.113556.1.4.319"   /* RFC 2696 */
2812de962bdSlukem 
282*cf1d77f7Schristos #define LDAP_CONTROL_AUTHZID_REQUEST	"2.16.840.1.113730.3.4.16"   /* RFC 3829 */
283*cf1d77f7Schristos #define LDAP_CONTROL_AUTHZID_RESPONSE   "2.16.840.1.113730.3.4.15"   /* RFC 3829 */
284*cf1d77f7Schristos 
2852de962bdSlukem /* LDAP Content Synchronization Operation -- RFC 4533 */
2862de962bdSlukem #define LDAP_SYNC_OID			"1.3.6.1.4.1.4203.1.9.1"
2872de962bdSlukem #define LDAP_CONTROL_SYNC		LDAP_SYNC_OID ".1"
2882de962bdSlukem #define LDAP_CONTROL_SYNC_STATE	LDAP_SYNC_OID ".2"
2892de962bdSlukem #define LDAP_CONTROL_SYNC_DONE	LDAP_SYNC_OID ".3"
2902de962bdSlukem #define LDAP_SYNC_INFO			LDAP_SYNC_OID ".4"
2912de962bdSlukem 
2922de962bdSlukem #define LDAP_SYNC_NONE					0x00
2932de962bdSlukem #define LDAP_SYNC_REFRESH_ONLY			0x01
2942de962bdSlukem #define LDAP_SYNC_RESERVED				0x02
2952de962bdSlukem #define LDAP_SYNC_REFRESH_AND_PERSIST	0x03
2962de962bdSlukem 
2972de962bdSlukem #define LDAP_SYNC_REFRESH_PRESENTS		0
2982de962bdSlukem #define LDAP_SYNC_REFRESH_DELETES		1
2992de962bdSlukem 
3002de962bdSlukem #define LDAP_TAG_SYNC_NEW_COOKIE		((ber_tag_t) 0x80U)
3012de962bdSlukem #define LDAP_TAG_SYNC_REFRESH_DELETE	((ber_tag_t) 0xa1U)
3022de962bdSlukem #define LDAP_TAG_SYNC_REFRESH_PRESENT	((ber_tag_t) 0xa2U)
3032de962bdSlukem #define	LDAP_TAG_SYNC_ID_SET			((ber_tag_t) 0xa3U)
3042de962bdSlukem 
3052de962bdSlukem #define LDAP_TAG_SYNC_COOKIE			((ber_tag_t) 0x04U)
3062de962bdSlukem #define LDAP_TAG_REFRESHDELETES			((ber_tag_t) 0x01U)
3072de962bdSlukem #define LDAP_TAG_REFRESHDONE			((ber_tag_t) 0x01U)
3082de962bdSlukem #define LDAP_TAG_RELOAD_HINT			((ber_tag_t) 0x01U)
3092de962bdSlukem 
3102de962bdSlukem #define LDAP_SYNC_PRESENT				0
3112de962bdSlukem #define LDAP_SYNC_ADD					1
3122de962bdSlukem #define LDAP_SYNC_MODIFY				2
3132de962bdSlukem #define LDAP_SYNC_DELETE				3
3144e6df137Slukem #define LDAP_SYNC_NEW_COOKIE			4
3152de962bdSlukem 
3168bd9f7cdSchristos /* LDAP Don't Use Copy Control (RFC 6171) */
3178bd9f7cdSchristos #define LDAP_CONTROL_DONTUSECOPY		"1.3.6.1.1.22"
3182de962bdSlukem 
3192de962bdSlukem /* Password policy Controls *//* work in progress */
3202de962bdSlukem /* ITS#3458: released; disabled by default */
3212de962bdSlukem #define LDAP_CONTROL_PASSWORDPOLICYREQUEST	"1.3.6.1.4.1.42.2.27.8.5.1"
3222de962bdSlukem #define LDAP_CONTROL_PASSWORDPOLICYRESPONSE	"1.3.6.1.4.1.42.2.27.8.5.1"
3232de962bdSlukem 
3242de962bdSlukem /* various works in progress */
3252de962bdSlukem #define LDAP_CONTROL_NOOP				"1.3.6.1.4.1.4203.666.5.2"
3262de962bdSlukem #define LDAP_CONTROL_NO_SUBORDINATES	"1.3.6.1.4.1.4203.666.5.11"
3272de962bdSlukem #define LDAP_CONTROL_RELAX				"1.3.6.1.4.1.4203.666.5.12"
3282de962bdSlukem #define LDAP_CONTROL_MANAGEDIT			LDAP_CONTROL_RELAX
3292de962bdSlukem #define LDAP_CONTROL_SLURP				"1.3.6.1.4.1.4203.666.5.13"
3302de962bdSlukem #define LDAP_CONTROL_VALSORT			"1.3.6.1.4.1.4203.666.5.14"
3314e6df137Slukem #define	LDAP_CONTROL_X_DEREF			"1.3.6.1.4.1.4203.666.5.16"
3324e6df137Slukem #define	LDAP_CONTROL_X_WHATFAILED		"1.3.6.1.4.1.4203.666.5.17"
3332de962bdSlukem 
3342de962bdSlukem /* LDAP Chaining Behavior Control *//* work in progress */
3352de962bdSlukem /* <draft-sermersheim-ldap-chaining>;
3362de962bdSlukem  * see also LDAP_NO_REFERRALS_FOUND, LDAP_CANNOT_CHAIN */
3372de962bdSlukem #define LDAP_CONTROL_X_CHAINING_BEHAVIOR	"1.3.6.1.4.1.4203.666.11.3"
3382de962bdSlukem 
3392de962bdSlukem #define	LDAP_CHAINING_PREFERRED				0
3402de962bdSlukem #define	LDAP_CHAINING_REQUIRED				1
3412de962bdSlukem #define LDAP_REFERRALS_PREFERRED			2
3422de962bdSlukem #define LDAP_REFERRALS_REQUIRED				3
3432de962bdSlukem 
3442de962bdSlukem /* MS Active Directory controls (for compatibility) */
345*cf1d77f7Schristos #define LDAP_CONTROL_X_LAZY_COMMIT			"1.2.840.113556.1.4.619"
3462de962bdSlukem #define LDAP_CONTROL_X_INCREMENTAL_VALUES	"1.2.840.113556.1.4.802"
3472de962bdSlukem #define LDAP_CONTROL_X_DOMAIN_SCOPE			"1.2.840.113556.1.4.1339"
3482de962bdSlukem #define LDAP_CONTROL_X_PERMISSIVE_MODIFY	"1.2.840.113556.1.4.1413"
3492de962bdSlukem #define LDAP_CONTROL_X_SEARCH_OPTIONS		"1.2.840.113556.1.4.1340"
3502de962bdSlukem #define LDAP_SEARCH_FLAG_DOMAIN_SCOPE 1 /* do not generate referrals */
3512de962bdSlukem #define LDAP_SEARCH_FLAG_PHANTOM_ROOT 2 /* search all subordinate NCs */
3522de962bdSlukem #define LDAP_CONTROL_X_TREE_DELETE		"1.2.840.113556.1.4.805"
3532de962bdSlukem 
3542de962bdSlukem /* MS Active Directory controls - not implemented in slapd(8) */
355*cf1d77f7Schristos #define LDAP_CONTROL_X_SERVER_NOTIFICATION	"1.2.840.113556.1.4.528"
3562de962bdSlukem #define LDAP_CONTROL_X_EXTENDED_DN		"1.2.840.113556.1.4.529"
357*cf1d77f7Schristos #define LDAP_CONTROL_X_SHOW_DELETED		"1.2.840.113556.1.4.417"
358*cf1d77f7Schristos #define LDAP_CONTROL_X_DIRSYNC			"1.2.840.113556.1.4.841"
359*cf1d77f7Schristos 
360*cf1d77f7Schristos #define LDAP_CONTROL_X_DIRSYNC_OBJECT_SECURITY		0x00000001
361*cf1d77f7Schristos #define LDAP_CONTROL_X_DIRSYNC_ANCESTORS_FIRST		0x00000800
362*cf1d77f7Schristos #define LDAP_CONTROL_X_DIRSYNC_PUBLIC_DATA_ONLY		0x00002000
363*cf1d77f7Schristos #define LDAP_CONTROL_X_DIRSYNC_INCREMENTAL_VALUES	0x80000000
364*cf1d77f7Schristos 
3652de962bdSlukem 
3662de962bdSlukem /* <draft-wahl-ldap-session> */
3672de962bdSlukem #define LDAP_CONTROL_X_SESSION_TRACKING		"1.3.6.1.4.1.21008.108.63.1"
3682de962bdSlukem #define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_SESSION_ID \
3692de962bdSlukem 						LDAP_CONTROL_X_SESSION_TRACKING ".1"
3702de962bdSlukem #define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_MULTI_SESSION_ID \
3712de962bdSlukem 						LDAP_CONTROL_X_SESSION_TRACKING ".2"
3722de962bdSlukem #define LDAP_CONTROL_X_SESSION_TRACKING_USERNAME \
3732de962bdSlukem 						LDAP_CONTROL_X_SESSION_TRACKING ".3"
3742de962bdSlukem /* various expired works */
37533197c6aStron 
3762de962bdSlukem /* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */
3772de962bdSlukem #define LDAP_CONTROL_DUPENT_REQUEST		"2.16.840.1.113719.1.27.101.1"
3782de962bdSlukem #define LDAP_CONTROL_DUPENT_RESPONSE	"2.16.840.1.113719.1.27.101.2"
3792de962bdSlukem #define LDAP_CONTROL_DUPENT_ENTRY		"2.16.840.1.113719.1.27.101.3"
3802de962bdSlukem #define LDAP_CONTROL_DUPENT	LDAP_CONTROL_DUPENT_REQUEST
3812de962bdSlukem 
3822de962bdSlukem /* LDAP Persistent Search Control *//* not implemented in slapd(8) */
3832de962bdSlukem #define LDAP_CONTROL_PERSIST_REQUEST				"2.16.840.1.113730.3.4.3"
3842de962bdSlukem #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE	"2.16.840.1.113730.3.4.7"
3852de962bdSlukem #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_ADD		0x1
3862de962bdSlukem #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_DELETE	0x2
3872de962bdSlukem #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_MODIFY	0x4
3882de962bdSlukem #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_RENAME	0x8
3892de962bdSlukem 
3904e6df137Slukem /* LDAP VLV */
3912de962bdSlukem #define LDAP_CONTROL_VLVREQUEST    	"2.16.840.1.113730.3.4.9"
3922de962bdSlukem #define LDAP_CONTROL_VLVRESPONSE    "2.16.840.1.113730.3.4.10"
3932de962bdSlukem 
394*cf1d77f7Schristos /* Sun's analogue to ppolicy */
395*cf1d77f7Schristos #define LDAP_CONTROL_X_ACCOUNT_USABILITY "1.3.6.1.4.1.42.2.27.9.5.8"
396*cf1d77f7Schristos 
397*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_AVAILABLE	((ber_tag_t) 0x80U)	/* primitive + 0 */
398*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_NOT_AVAILABLE	((ber_tag_t) 0xA1U)	/* constructed + 1 */
399*cf1d77f7Schristos 
400*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_INACTIVE	((ber_tag_t) 0x80U)	/* primitive + 0 */
401*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_RESET	((ber_tag_t) 0x81U)	/* primitive + 1 */
402*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_EXPIRED	((ber_tag_t) 0x82U)	/* primitive + 2 */
403*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_REMAINING_GRACE	((ber_tag_t) 0x83U)	/* primitive + 3 */
404*cf1d77f7Schristos #define LDAP_TAG_X_ACCOUNT_USABILITY_UNTIL_UNLOCK	((ber_tag_t) 0x84U)	/* primitive + 4 */
405*cf1d77f7Schristos 
406*cf1d77f7Schristos /* Netscape Password policy response controls */
407*cf1d77f7Schristos /* <draft-vchu-ldap-pwd-policy> */
408*cf1d77f7Schristos #define LDAP_CONTROL_X_PASSWORD_EXPIRED		"2.16.840.1.113730.3.4.4"
409*cf1d77f7Schristos #define LDAP_CONTROL_X_PASSWORD_EXPIRING	"2.16.840.1.113730.3.4.5"
410*cf1d77f7Schristos 
4112de962bdSlukem /* LDAP Unsolicited Notifications */
4122de962bdSlukem #define	LDAP_NOTICE_OF_DISCONNECTION	"1.3.6.1.4.1.1466.20036" /* RFC 4511 */
4132de962bdSlukem #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION
4142de962bdSlukem 
4152de962bdSlukem /* LDAP Extended Operations */
4162de962bdSlukem #define LDAP_EXOP_START_TLS		"1.3.6.1.4.1.1466.20037"	/* RFC 4511 */
4172de962bdSlukem 
4182de962bdSlukem #define LDAP_EXOP_MODIFY_PASSWD	"1.3.6.1.4.1.4203.1.11.1"	/* RFC 3062 */
4192de962bdSlukem #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID	((ber_tag_t) 0x80U)
4202de962bdSlukem #define LDAP_TAG_EXOP_MODIFY_PASSWD_OLD	((ber_tag_t) 0x81U)
4212de962bdSlukem #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW	((ber_tag_t) 0x82U)
4222de962bdSlukem #define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN	((ber_tag_t) 0x80U)
4232de962bdSlukem 
4242de962bdSlukem #define LDAP_EXOP_CANCEL		"1.3.6.1.1.8"					/* RFC 3909 */
4252de962bdSlukem #define LDAP_EXOP_X_CANCEL		LDAP_EXOP_CANCEL
4262de962bdSlukem 
4272de962bdSlukem #define	LDAP_EXOP_REFRESH		"1.3.6.1.4.1.1466.101.119.1"	/* RFC 2589 */
4282de962bdSlukem #define	LDAP_TAG_EXOP_REFRESH_REQ_DN	((ber_tag_t) 0x80U)
4292de962bdSlukem #define	LDAP_TAG_EXOP_REFRESH_REQ_TTL	((ber_tag_t) 0x81U)
43033197c6aStron #define	LDAP_TAG_EXOP_REFRESH_RES_TTL	((ber_tag_t) 0x81U)
4312de962bdSlukem 
432*cf1d77f7Schristos #define LDAP_EXOP_VERIFY_CREDENTIALS	"1.3.6.1.4.1.4203.666.6.5"
433*cf1d77f7Schristos #define LDAP_EXOP_X_VERIFY_CREDENTIALS	LDAP_EXOP_VERIFY_CREDENTIALS
434*cf1d77f7Schristos 
435*cf1d77f7Schristos #define LDAP_TAG_EXOP_VERIFY_CREDENTIALS_COOKIE	 ((ber_tag_t) 0x80U)
436*cf1d77f7Schristos #define LDAP_TAG_EXOP_VERIFY_CREDENTIALS_SCREDS	 ((ber_tag_t) 0x81U)
437*cf1d77f7Schristos #define LDAP_TAG_EXOP_VERIFY_CREDENTIALS_CONTROLS ((ber_tag_t) 0xa2U) /* context specific + constructed + 2 */
438*cf1d77f7Schristos 
4392de962bdSlukem #define LDAP_EXOP_WHO_AM_I		"1.3.6.1.4.1.4203.1.11.3"		/* RFC 4532 */
4402de962bdSlukem #define LDAP_EXOP_X_WHO_AM_I	LDAP_EXOP_WHO_AM_I
4412de962bdSlukem 
4422de962bdSlukem /* various works in progress */
4432de962bdSlukem #define LDAP_EXOP_TURN		"1.3.6.1.1.19"				/* RFC 4531 */
4442de962bdSlukem #define LDAP_EXOP_X_TURN	LDAP_EXOP_TURN
4452de962bdSlukem 
4462de962bdSlukem /* LDAP Distributed Procedures <draft-sermersheim-ldap-distproc> */
4472de962bdSlukem /* a work in progress */
4482de962bdSlukem #define LDAP_X_DISTPROC_BASE		"1.3.6.1.4.1.4203.666.11.6"
4492de962bdSlukem #define LDAP_EXOP_X_CHAINEDREQUEST	LDAP_X_DISTPROC_BASE ".1"
4502de962bdSlukem #define LDAP_FEATURE_X_CANCHAINOPS	LDAP_X_DISTPROC_BASE ".2"
4512de962bdSlukem #define LDAP_CONTROL_X_RETURNCONTREF	LDAP_X_DISTPROC_BASE ".3"
4522de962bdSlukem #define LDAP_URLEXT_X_LOCALREFOID	LDAP_X_DISTPROC_BASE ".4"
4532de962bdSlukem #define LDAP_URLEXT_X_REFTYPEOID	LDAP_X_DISTPROC_BASE ".5"
4542de962bdSlukem #define LDAP_URLEXT_X_SEARCHEDSUBTREEOID \
4552de962bdSlukem 					LDAP_X_DISTPROC_BASE ".6"
4562de962bdSlukem #define LDAP_URLEXT_X_FAILEDNAMEOID	LDAP_X_DISTPROC_BASE ".7"
4572de962bdSlukem #define LDAP_URLEXT_X_LOCALREF		"x-localReference"
4582de962bdSlukem #define LDAP_URLEXT_X_REFTYPE		"x-referenceType"
4592de962bdSlukem #define LDAP_URLEXT_X_SEARCHEDSUBTREE	"x-searchedSubtree"
4602de962bdSlukem #define LDAP_URLEXT_X_FAILEDNAME	"x-failedName"
4612de962bdSlukem 
462*cf1d77f7Schristos #define LDAP_TXN						"1.3.6.1.1.21" /* RFC 5805 */
463*cf1d77f7Schristos #define LDAP_EXOP_TXN_START				LDAP_TXN ".1"
464*cf1d77f7Schristos #define LDAP_CONTROL_TXN_SPEC			LDAP_TXN ".2"
465*cf1d77f7Schristos #define LDAP_EXOP_TXN_END				LDAP_TXN ".3"
466*cf1d77f7Schristos #define LDAP_EXOP_TXN_ABORTED_NOTICE	LDAP_TXN ".4"
4672de962bdSlukem 
4682de962bdSlukem /* LDAP Features */
4692de962bdSlukem #define LDAP_FEATURE_ALL_OP_ATTRS	"1.3.6.1.4.1.4203.1.5.1"	/* RFC 3673 */
4702de962bdSlukem #define LDAP_FEATURE_OBJECTCLASS_ATTRS \
4712de962bdSlukem 	"1.3.6.1.4.1.4203.1.5.2" /*  @objectClass - new number to be assigned */
4722de962bdSlukem #define LDAP_FEATURE_ABSOLUTE_FILTERS "1.3.6.1.4.1.4203.1.5.3"  /* (&) (|) */
4732de962bdSlukem #define LDAP_FEATURE_LANGUAGE_TAG_OPTIONS "1.3.6.1.4.1.4203.1.5.4"
4742de962bdSlukem #define LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS "1.3.6.1.4.1.4203.1.5.5"
4752de962bdSlukem #define LDAP_FEATURE_MODIFY_INCREMENT "1.3.6.1.1.14"
4762de962bdSlukem 
4772de962bdSlukem /* LDAP Experimental (works in progress) Features */
4782de962bdSlukem #define LDAP_FEATURE_SUBORDINATE_SCOPE \
4792de962bdSlukem 	"1.3.6.1.4.1.4203.666.8.1" /* "children" */
4802de962bdSlukem #define LDAP_FEATURE_CHILDREN_SCOPE LDAP_FEATURE_SUBORDINATE_SCOPE
4812de962bdSlukem 
4822de962bdSlukem /*
4832de962bdSlukem  * specific LDAP instantiations of BER types we know about
4842de962bdSlukem  */
4852de962bdSlukem 
4862de962bdSlukem /* Overview of LBER tag construction
4872de962bdSlukem  *
4882de962bdSlukem  *	Bits
4892de962bdSlukem  *	______
4902de962bdSlukem  *	8 7 | CLASS
4912de962bdSlukem  *	0 0 = UNIVERSAL
4922de962bdSlukem  *	0 1 = APPLICATION
4932de962bdSlukem  *	1 0 = CONTEXT-SPECIFIC
4942de962bdSlukem  *	1 1 = PRIVATE
4952de962bdSlukem  *		_____
4962de962bdSlukem  *		| 6 | DATA-TYPE
4972de962bdSlukem  *		  0 = PRIMITIVE
4982de962bdSlukem  *		  1 = CONSTRUCTED
4992de962bdSlukem  *			___________
5002de962bdSlukem  *			| 5 ... 1 | TAG-NUMBER
5012de962bdSlukem  */
5022de962bdSlukem 
5032de962bdSlukem /* general stuff */
5042de962bdSlukem #define LDAP_TAG_MESSAGE	((ber_tag_t) 0x30U)	/* constructed + 16 */
5052de962bdSlukem #define LDAP_TAG_MSGID		((ber_tag_t) 0x02U)	/* integer */
5062de962bdSlukem 
5072de962bdSlukem #define LDAP_TAG_LDAPDN		((ber_tag_t) 0x04U)	/* octet string */
5082de962bdSlukem #define LDAP_TAG_LDAPCRED	((ber_tag_t) 0x04U)	/* octet string */
5092de962bdSlukem 
5102de962bdSlukem #define LDAP_TAG_CONTROLS	((ber_tag_t) 0xa0U)	/* context specific + constructed + 0 */
5112de962bdSlukem #define LDAP_TAG_REFERRAL	((ber_tag_t) 0xa3U)	/* context specific + constructed + 3 */
5122de962bdSlukem 
5132de962bdSlukem #define LDAP_TAG_NEWSUPERIOR	((ber_tag_t) 0x80U)	/* context-specific + primitive + 0 */
5142de962bdSlukem 
5152de962bdSlukem #define LDAP_TAG_EXOP_REQ_OID   ((ber_tag_t) 0x80U)	/* context specific + primitive */
5162de962bdSlukem #define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U)	/* context specific + primitive */
5172de962bdSlukem #define LDAP_TAG_EXOP_RES_OID   ((ber_tag_t) 0x8aU)	/* context specific + primitive */
5182de962bdSlukem #define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU)	/* context specific + primitive */
5192de962bdSlukem 
5202de962bdSlukem #define LDAP_TAG_IM_RES_OID   ((ber_tag_t) 0x80U)	/* context specific + primitive */
5212de962bdSlukem #define LDAP_TAG_IM_RES_VALUE ((ber_tag_t) 0x81U)	/* context specific + primitive */
5222de962bdSlukem 
5232de962bdSlukem #define LDAP_TAG_SASL_RES_CREDS	((ber_tag_t) 0x87U)	/* context specific + primitive */
5242de962bdSlukem 
5252de962bdSlukem /* LDAP Request Messages */
5262de962bdSlukem #define LDAP_REQ_BIND		((ber_tag_t) 0x60U)	/* application + constructed */
5272de962bdSlukem #define LDAP_REQ_UNBIND		((ber_tag_t) 0x42U)	/* application + primitive   */
5282de962bdSlukem #define LDAP_REQ_SEARCH		((ber_tag_t) 0x63U)	/* application + constructed */
5292de962bdSlukem #define LDAP_REQ_MODIFY		((ber_tag_t) 0x66U)	/* application + constructed */
5302de962bdSlukem #define LDAP_REQ_ADD		((ber_tag_t) 0x68U)	/* application + constructed */
5312de962bdSlukem #define LDAP_REQ_DELETE		((ber_tag_t) 0x4aU)	/* application + primitive   */
5322de962bdSlukem #define LDAP_REQ_MODDN		((ber_tag_t) 0x6cU)	/* application + constructed */
5332de962bdSlukem #define LDAP_REQ_MODRDN		LDAP_REQ_MODDN
5342de962bdSlukem #define LDAP_REQ_RENAME		LDAP_REQ_MODDN
5352de962bdSlukem #define LDAP_REQ_COMPARE	((ber_tag_t) 0x6eU)	/* application + constructed */
5362de962bdSlukem #define LDAP_REQ_ABANDON	((ber_tag_t) 0x50U)	/* application + primitive   */
5372de962bdSlukem #define LDAP_REQ_EXTENDED	((ber_tag_t) 0x77U)	/* application + constructed */
5382de962bdSlukem 
5392de962bdSlukem /* LDAP Response Messages */
5402de962bdSlukem #define LDAP_RES_BIND		((ber_tag_t) 0x61U)	/* application + constructed */
5412de962bdSlukem #define LDAP_RES_SEARCH_ENTRY	((ber_tag_t) 0x64U)	/* application + constructed */
5422de962bdSlukem #define LDAP_RES_SEARCH_REFERENCE	((ber_tag_t) 0x73U)	/* V3: application + constructed */
5432de962bdSlukem #define LDAP_RES_SEARCH_RESULT	((ber_tag_t) 0x65U)	/* application + constructed */
5442de962bdSlukem #define LDAP_RES_MODIFY		((ber_tag_t) 0x67U)	/* application + constructed */
5452de962bdSlukem #define LDAP_RES_ADD		((ber_tag_t) 0x69U)	/* application + constructed */
5462de962bdSlukem #define LDAP_RES_DELETE		((ber_tag_t) 0x6bU)	/* application + constructed */
5472de962bdSlukem #define LDAP_RES_MODDN		((ber_tag_t) 0x6dU)	/* application + constructed */
5482de962bdSlukem #define LDAP_RES_MODRDN		LDAP_RES_MODDN	/* application + constructed */
5492de962bdSlukem #define LDAP_RES_RENAME		LDAP_RES_MODDN	/* application + constructed */
5502de962bdSlukem #define LDAP_RES_COMPARE	((ber_tag_t) 0x6fU)	/* application + constructed */
5512de962bdSlukem #define LDAP_RES_EXTENDED	((ber_tag_t) 0x78U)	/* V3: application + constructed */
5522de962bdSlukem #define LDAP_RES_INTERMEDIATE	((ber_tag_t) 0x79U) /* V3+: application + constructed */
5532de962bdSlukem 
5542de962bdSlukem #define LDAP_RES_ANY			(-1)
5552de962bdSlukem #define LDAP_RES_UNSOLICITED	(0)
5562de962bdSlukem 
5572de962bdSlukem 
5582de962bdSlukem /* sasl methods */
5592de962bdSlukem #define LDAP_SASL_SIMPLE	((char*)0)
5602de962bdSlukem #define LDAP_SASL_NULL		("")
5612de962bdSlukem 
5622de962bdSlukem 
5632de962bdSlukem /* authentication methods available */
5642de962bdSlukem #define LDAP_AUTH_NONE   ((ber_tag_t) 0x00U) /* no authentication */
5652de962bdSlukem #define LDAP_AUTH_SIMPLE ((ber_tag_t) 0x80U) /* context specific + primitive */
5662de962bdSlukem #define LDAP_AUTH_SASL   ((ber_tag_t) 0xa3U) /* context specific + constructed */
5672de962bdSlukem #define LDAP_AUTH_KRBV4  ((ber_tag_t) 0xffU) /* means do both of the following */
5682de962bdSlukem #define LDAP_AUTH_KRBV41 ((ber_tag_t) 0x81U) /* context specific + primitive */
5692de962bdSlukem #define LDAP_AUTH_KRBV42 ((ber_tag_t) 0x82U) /* context specific + primitive */
5702de962bdSlukem 
5714e6df137Slukem /* used by the Windows API but not used on the wire */
5724e6df137Slukem #define LDAP_AUTH_NEGOTIATE ((ber_tag_t) 0x04FFU)
5732de962bdSlukem 
5742de962bdSlukem /* filter types */
5752de962bdSlukem #define LDAP_FILTER_AND	((ber_tag_t) 0xa0U)	/* context specific + constructed */
5762de962bdSlukem #define LDAP_FILTER_OR	((ber_tag_t) 0xa1U)	/* context specific + constructed */
5772de962bdSlukem #define LDAP_FILTER_NOT	((ber_tag_t) 0xa2U)	/* context specific + constructed */
5782de962bdSlukem #define LDAP_FILTER_EQUALITY ((ber_tag_t) 0xa3U) /* context specific + constructed */
5792de962bdSlukem #define LDAP_FILTER_SUBSTRINGS ((ber_tag_t) 0xa4U) /* context specific + constructed */
5802de962bdSlukem #define LDAP_FILTER_GE ((ber_tag_t) 0xa5U) /* context specific + constructed */
5812de962bdSlukem #define LDAP_FILTER_LE ((ber_tag_t) 0xa6U) /* context specific + constructed */
5822de962bdSlukem #define LDAP_FILTER_PRESENT ((ber_tag_t) 0x87U) /* context specific + primitive   */
5832de962bdSlukem #define LDAP_FILTER_APPROX ((ber_tag_t) 0xa8U)	/* context specific + constructed */
5842de962bdSlukem #define LDAP_FILTER_EXT	((ber_tag_t) 0xa9U)	/* context specific + constructed */
5852de962bdSlukem 
5862de962bdSlukem /* extended filter component types */
5872de962bdSlukem #define LDAP_FILTER_EXT_OID		((ber_tag_t) 0x81U)	/* context specific */
5882de962bdSlukem #define LDAP_FILTER_EXT_TYPE	((ber_tag_t) 0x82U)	/* context specific */
5892de962bdSlukem #define LDAP_FILTER_EXT_VALUE	((ber_tag_t) 0x83U)	/* context specific */
5902de962bdSlukem #define LDAP_FILTER_EXT_DNATTRS	((ber_tag_t) 0x84U)	/* context specific */
5912de962bdSlukem 
5922de962bdSlukem /* substring filter component types */
5932de962bdSlukem #define LDAP_SUBSTRING_INITIAL	((ber_tag_t) 0x80U)	/* context specific */
5942de962bdSlukem #define LDAP_SUBSTRING_ANY		((ber_tag_t) 0x81U)	/* context specific */
5952de962bdSlukem #define LDAP_SUBSTRING_FINAL	((ber_tag_t) 0x82U)	/* context specific */
5962de962bdSlukem 
5972de962bdSlukem /* search scopes */
5982de962bdSlukem #define LDAP_SCOPE_BASE			((ber_int_t) 0x0000)
5992de962bdSlukem #define LDAP_SCOPE_BASEOBJECT	LDAP_SCOPE_BASE
6002de962bdSlukem #define LDAP_SCOPE_ONELEVEL		((ber_int_t) 0x0001)
6012de962bdSlukem #define LDAP_SCOPE_ONE			LDAP_SCOPE_ONELEVEL
6022de962bdSlukem #define LDAP_SCOPE_SUBTREE		((ber_int_t) 0x0002)
6032de962bdSlukem #define LDAP_SCOPE_SUB			LDAP_SCOPE_SUBTREE
6042de962bdSlukem #define LDAP_SCOPE_SUBORDINATE	((ber_int_t) 0x0003) /* OpenLDAP extension */
6052de962bdSlukem #define LDAP_SCOPE_CHILDREN		LDAP_SCOPE_SUBORDINATE
6062de962bdSlukem #define LDAP_SCOPE_DEFAULT		((ber_int_t) -1)	 /* OpenLDAP extension */
6072de962bdSlukem 
6082de962bdSlukem /* substring filter component types */
6092de962bdSlukem #define LDAP_SUBSTRING_INITIAL	((ber_tag_t) 0x80U)	/* context specific */
6102de962bdSlukem #define LDAP_SUBSTRING_ANY		((ber_tag_t) 0x81U)	/* context specific */
6112de962bdSlukem #define LDAP_SUBSTRING_FINAL	((ber_tag_t) 0x82U)	/* context specific */
6122de962bdSlukem 
6132de962bdSlukem /*
6142de962bdSlukem  * LDAP Result Codes
6152de962bdSlukem  */
6162de962bdSlukem #define LDAP_SUCCESS				0x00
6172de962bdSlukem 
6182de962bdSlukem #define LDAP_RANGE(n,x,y)	(((x) <= (n)) && ((n) <= (y)))
6192de962bdSlukem 
6202de962bdSlukem #define LDAP_OPERATIONS_ERROR		0x01
6212de962bdSlukem #define LDAP_PROTOCOL_ERROR			0x02
6222de962bdSlukem #define LDAP_TIMELIMIT_EXCEEDED		0x03
6232de962bdSlukem #define LDAP_SIZELIMIT_EXCEEDED		0x04
6242de962bdSlukem #define LDAP_COMPARE_FALSE			0x05
6252de962bdSlukem #define LDAP_COMPARE_TRUE			0x06
6262de962bdSlukem #define LDAP_AUTH_METHOD_NOT_SUPPORTED	0x07
6272de962bdSlukem #define LDAP_STRONG_AUTH_NOT_SUPPORTED	LDAP_AUTH_METHOD_NOT_SUPPORTED
6282de962bdSlukem #define LDAP_STRONG_AUTH_REQUIRED	0x08
6292de962bdSlukem #define LDAP_STRONGER_AUTH_REQUIRED	LDAP_STRONG_AUTH_REQUIRED
6302de962bdSlukem #define LDAP_PARTIAL_RESULTS		0x09	/* LDAPv2+ (not LDAPv3) */
6312de962bdSlukem 
6322de962bdSlukem #define	LDAP_REFERRAL				0x0a /* LDAPv3 */
6332de962bdSlukem #define LDAP_ADMINLIMIT_EXCEEDED	0x0b /* LDAPv3 */
6342de962bdSlukem #define	LDAP_UNAVAILABLE_CRITICAL_EXTENSION	0x0c /* LDAPv3 */
6352de962bdSlukem #define LDAP_CONFIDENTIALITY_REQUIRED	0x0d /* LDAPv3 */
6362de962bdSlukem #define	LDAP_SASL_BIND_IN_PROGRESS	0x0e /* LDAPv3 */
6372de962bdSlukem 
6382de962bdSlukem #define LDAP_ATTR_ERROR(n)	LDAP_RANGE((n),0x10,0x15) /* 16-21 */
6392de962bdSlukem 
6402de962bdSlukem #define LDAP_NO_SUCH_ATTRIBUTE		0x10
6412de962bdSlukem #define LDAP_UNDEFINED_TYPE			0x11
6422de962bdSlukem #define LDAP_INAPPROPRIATE_MATCHING	0x12
6432de962bdSlukem #define LDAP_CONSTRAINT_VIOLATION	0x13
6442de962bdSlukem #define LDAP_TYPE_OR_VALUE_EXISTS	0x14
6452de962bdSlukem #define LDAP_INVALID_SYNTAX			0x15
6462de962bdSlukem 
6472de962bdSlukem #define LDAP_NAME_ERROR(n)	LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
6482de962bdSlukem 
6492de962bdSlukem #define LDAP_NO_SUCH_OBJECT			0x20
6502de962bdSlukem #define LDAP_ALIAS_PROBLEM			0x21
6512de962bdSlukem #define LDAP_INVALID_DN_SYNTAX		0x22
6522de962bdSlukem #define LDAP_IS_LEAF				0x23 /* not LDAPv3 */
6532de962bdSlukem #define LDAP_ALIAS_DEREF_PROBLEM	0x24
6542de962bdSlukem 
6552de962bdSlukem #define LDAP_SECURITY_ERROR(n)	LDAP_RANGE((n),0x2F,0x32) /* 47-50 */
6562de962bdSlukem 
6572de962bdSlukem #define LDAP_X_PROXY_AUTHZ_FAILURE	0x2F /* LDAPv3 proxy authorization */
6582de962bdSlukem #define LDAP_INAPPROPRIATE_AUTH		0x30
6592de962bdSlukem #define LDAP_INVALID_CREDENTIALS	0x31
6602de962bdSlukem #define LDAP_INSUFFICIENT_ACCESS	0x32
6612de962bdSlukem 
6622de962bdSlukem #define LDAP_SERVICE_ERROR(n)	LDAP_RANGE((n),0x33,0x36) /* 51-54 */
6632de962bdSlukem 
6642de962bdSlukem #define LDAP_BUSY					0x33
6652de962bdSlukem #define LDAP_UNAVAILABLE			0x34
6662de962bdSlukem #define LDAP_UNWILLING_TO_PERFORM	0x35
6672de962bdSlukem #define LDAP_LOOP_DETECT			0x36
6682de962bdSlukem 
6692de962bdSlukem #define LDAP_UPDATE_ERROR(n)	LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
6702de962bdSlukem 
6712de962bdSlukem #define LDAP_NAMING_VIOLATION		0x40
6722de962bdSlukem #define LDAP_OBJECT_CLASS_VIOLATION	0x41
6732de962bdSlukem #define LDAP_NOT_ALLOWED_ON_NONLEAF	0x42
6742de962bdSlukem #define LDAP_NOT_ALLOWED_ON_RDN		0x43
6752de962bdSlukem #define LDAP_ALREADY_EXISTS			0x44
6762de962bdSlukem #define LDAP_NO_OBJECT_CLASS_MODS	0x45
6772de962bdSlukem #define LDAP_RESULTS_TOO_LARGE		0x46 /* CLDAP */
6782de962bdSlukem #define LDAP_AFFECTS_MULTIPLE_DSAS	0x47
6792de962bdSlukem 
6804e6df137Slukem #define LDAP_VLV_ERROR				0x4C
6814e6df137Slukem 
6822de962bdSlukem #define LDAP_OTHER					0x50
6832de962bdSlukem 
6842de962bdSlukem /* LCUP operation codes (113-117) - not implemented */
6852de962bdSlukem #define LDAP_CUP_RESOURCES_EXHAUSTED	0x71
6862de962bdSlukem #define LDAP_CUP_SECURITY_VIOLATION		0x72
6872de962bdSlukem #define LDAP_CUP_INVALID_DATA			0x73
6882de962bdSlukem #define LDAP_CUP_UNSUPPORTED_SCHEME		0x74
6892de962bdSlukem #define LDAP_CUP_RELOAD_REQUIRED		0x75
6902de962bdSlukem 
6912de962bdSlukem /* Cancel operation codes (118-121) */
6922de962bdSlukem #define LDAP_CANCELLED				0x76
6932de962bdSlukem #define LDAP_NO_SUCH_OPERATION		0x77
6942de962bdSlukem #define LDAP_TOO_LATE				0x78
6952de962bdSlukem #define LDAP_CANNOT_CANCEL			0x79
6962de962bdSlukem 
6972de962bdSlukem /* Assertion control (122) */
6982de962bdSlukem #define LDAP_ASSERTION_FAILED		0x7A
6992de962bdSlukem 
7002de962bdSlukem /* Proxied Authorization Denied (123) */
7012de962bdSlukem #define LDAP_PROXIED_AUTHORIZATION_DENIED		0x7B
7022de962bdSlukem 
7032de962bdSlukem /* Experimental result codes */
7042de962bdSlukem #define LDAP_E_ERROR(n)	LDAP_RANGE((n),0x1000,0x3FFF)
7052de962bdSlukem 
7062de962bdSlukem /* LDAP Sync (4096) */
7072de962bdSlukem #define LDAP_SYNC_REFRESH_REQUIRED		0x1000
7082de962bdSlukem 
7092de962bdSlukem 
7102de962bdSlukem /* Private Use result codes */
7112de962bdSlukem #define LDAP_X_ERROR(n)	LDAP_RANGE((n),0x4000,0xFFFF)
7122de962bdSlukem 
7132de962bdSlukem #define LDAP_X_SYNC_REFRESH_REQUIRED	0x4100 /* defunct */
7142de962bdSlukem #define LDAP_X_ASSERTION_FAILED			0x410f /* defunct */
7152de962bdSlukem 
7162de962bdSlukem /* for the LDAP No-Op control */
7172de962bdSlukem #define LDAP_X_NO_OPERATION				0x410e
7182de962bdSlukem 
7192de962bdSlukem /* for the Chaining Behavior control (consecutive result codes requested;
7202de962bdSlukem  * see <draft-sermersheim-ldap-chaining> ) */
7212de962bdSlukem #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
7222de962bdSlukem #define	LDAP_X_NO_REFERRALS_FOUND		0x4110
7232de962bdSlukem #define LDAP_X_CANNOT_CHAIN			0x4111
7242de962bdSlukem #endif
7252de962bdSlukem 
7262de962bdSlukem /* for Distributed Procedures (see <draft-sermersheim-ldap-distproc>) */
7272de962bdSlukem #ifdef LDAP_X_DISTPROC_BASE
7282de962bdSlukem #define LDAP_X_INVALIDREFERENCE			0x4112
7292de962bdSlukem #endif
7302de962bdSlukem 
731*cf1d77f7Schristos #define LDAP_TXN_SPECIFY_OKAY		0x4120
732*cf1d77f7Schristos #define LDAP_TXN_ID_INVALID			0x4121
7332de962bdSlukem 
7342de962bdSlukem /* API Error Codes
7352de962bdSlukem  *
7362de962bdSlukem  * Based on draft-ietf-ldap-c-api-xx
7372de962bdSlukem  * but with new negative code values
7382de962bdSlukem  */
7392de962bdSlukem #define LDAP_API_ERROR(n)		((n)<0)
7402de962bdSlukem #define LDAP_API_RESULT(n)		((n)<=0)
7412de962bdSlukem 
7422de962bdSlukem #define LDAP_SERVER_DOWN				(-1)
7432de962bdSlukem #define LDAP_LOCAL_ERROR				(-2)
7442de962bdSlukem #define LDAP_ENCODING_ERROR				(-3)
7452de962bdSlukem #define LDAP_DECODING_ERROR				(-4)
7462de962bdSlukem #define LDAP_TIMEOUT					(-5)
7472de962bdSlukem #define LDAP_AUTH_UNKNOWN				(-6)
7482de962bdSlukem #define LDAP_FILTER_ERROR				(-7)
7492de962bdSlukem #define LDAP_USER_CANCELLED				(-8)
7502de962bdSlukem #define LDAP_PARAM_ERROR				(-9)
7512de962bdSlukem #define LDAP_NO_MEMORY					(-10)
7522de962bdSlukem #define LDAP_CONNECT_ERROR				(-11)
7532de962bdSlukem #define LDAP_NOT_SUPPORTED				(-12)
7542de962bdSlukem #define LDAP_CONTROL_NOT_FOUND			(-13)
7552de962bdSlukem #define LDAP_NO_RESULTS_RETURNED		(-14)
7562de962bdSlukem #define LDAP_MORE_RESULTS_TO_RETURN		(-15)	/* Obsolete */
7572de962bdSlukem #define LDAP_CLIENT_LOOP				(-16)
7582de962bdSlukem #define LDAP_REFERRAL_LIMIT_EXCEEDED	(-17)
7592de962bdSlukem #define	LDAP_X_CONNECTING			(-18)
7602de962bdSlukem 
7612de962bdSlukem 
7622de962bdSlukem /*
7632de962bdSlukem  * This structure represents both ldap messages and ldap responses.
7642de962bdSlukem  * These are really the same, except in the case of search responses,
7652de962bdSlukem  * where a response has multiple messages.
7662de962bdSlukem  */
7672de962bdSlukem 
7682de962bdSlukem typedef struct ldapmsg LDAPMessage;
7692de962bdSlukem 
7702de962bdSlukem /* for modifications */
7712de962bdSlukem typedef struct ldapmod {
7722de962bdSlukem 	int		mod_op;
7732de962bdSlukem 
7742de962bdSlukem #define LDAP_MOD_OP			(0x0007)
7752de962bdSlukem #define LDAP_MOD_ADD		(0x0000)
7762de962bdSlukem #define LDAP_MOD_DELETE		(0x0001)
7772de962bdSlukem #define LDAP_MOD_REPLACE	(0x0002)
7782de962bdSlukem #define LDAP_MOD_INCREMENT	(0x0003) /* OpenLDAP extension */
7792de962bdSlukem #define LDAP_MOD_BVALUES	(0x0080)
7802de962bdSlukem /* IMPORTANT: do not use code 0x1000 (or above),
7812de962bdSlukem  * it is used internally by the backends!
7822de962bdSlukem  * (see ldap/servers/slapd/slap.h)
7832de962bdSlukem  */
7842de962bdSlukem 
7852de962bdSlukem 	char		*mod_type;
7862de962bdSlukem 	union mod_vals_u {
7872de962bdSlukem 		char		**modv_strvals;
7882de962bdSlukem 		struct berval	**modv_bvals;
7892de962bdSlukem 	} mod_vals;
7902de962bdSlukem #define mod_values	mod_vals.modv_strvals
7912de962bdSlukem #define mod_bvalues	mod_vals.modv_bvals
7922de962bdSlukem } LDAPMod;
7932de962bdSlukem 
7942de962bdSlukem /*
7952de962bdSlukem  * structure representing an ldap session which can
7962de962bdSlukem  * encompass connections to multiple servers (in the
7972de962bdSlukem  * face of referrals).
7982de962bdSlukem  */
7992de962bdSlukem typedef struct ldap LDAP;
8002de962bdSlukem 
8012de962bdSlukem #define LDAP_DEREF_NEVER		0x00
8022de962bdSlukem #define LDAP_DEREF_SEARCHING	0x01
8032de962bdSlukem #define LDAP_DEREF_FINDING		0x02
8042de962bdSlukem #define LDAP_DEREF_ALWAYS		0x03
8052de962bdSlukem 
8062de962bdSlukem #define LDAP_NO_LIMIT			0
8072de962bdSlukem 
8082de962bdSlukem /* how many messages to retrieve results for */
8092de962bdSlukem #define LDAP_MSG_ONE			0x00
8102de962bdSlukem #define LDAP_MSG_ALL			0x01
8112de962bdSlukem #define LDAP_MSG_RECEIVED		0x02
8122de962bdSlukem 
8132de962bdSlukem /*
8142de962bdSlukem  * types for ldap URL handling
8152de962bdSlukem  */
8162de962bdSlukem typedef struct ldap_url_desc {
8172de962bdSlukem 	struct ldap_url_desc *lud_next;
8182de962bdSlukem 	char	*lud_scheme;
8192de962bdSlukem 	char	*lud_host;
8202de962bdSlukem 	int		lud_port;
8212de962bdSlukem 	char	*lud_dn;
8222de962bdSlukem 	char	**lud_attrs;
8232de962bdSlukem 	int		lud_scope;
8242de962bdSlukem 	char	*lud_filter;
8252de962bdSlukem 	char	**lud_exts;
8262de962bdSlukem 	int		lud_crit_exts;
8272de962bdSlukem } LDAPURLDesc;
8282de962bdSlukem 
8292de962bdSlukem #define LDAP_URL_SUCCESS		0x00	/* Success */
8302de962bdSlukem #define LDAP_URL_ERR_MEM		0x01	/* can't allocate memory space */
8312de962bdSlukem #define LDAP_URL_ERR_PARAM		0x02	/* parameter is bad */
8322de962bdSlukem 
8332de962bdSlukem #define LDAP_URL_ERR_BADSCHEME	0x03	/* URL doesn't begin with "ldap[si]://" */
8342de962bdSlukem #define LDAP_URL_ERR_BADENCLOSURE 0x04	/* URL is missing trailing ">" */
8352de962bdSlukem #define LDAP_URL_ERR_BADURL		0x05	/* URL is bad */
8362de962bdSlukem #define LDAP_URL_ERR_BADHOST	0x06	/* host port is bad */
8372de962bdSlukem #define LDAP_URL_ERR_BADATTRS	0x07	/* bad (or missing) attributes */
8382de962bdSlukem #define LDAP_URL_ERR_BADSCOPE	0x08	/* scope string is invalid (or missing) */
8392de962bdSlukem #define LDAP_URL_ERR_BADFILTER	0x09	/* bad or missing filter */
8402de962bdSlukem #define LDAP_URL_ERR_BADEXTS	0x0a	/* bad or missing extensions */
8412de962bdSlukem 
8422de962bdSlukem /*
8432de962bdSlukem  * LDAP sync (RFC4533) API
8442de962bdSlukem  */
8452de962bdSlukem 
8462de962bdSlukem typedef struct ldap_sync_t ldap_sync_t;
8472de962bdSlukem 
8482de962bdSlukem typedef enum {
8492de962bdSlukem 	/* these are private - the client should never see them */
8502de962bdSlukem 	LDAP_SYNC_CAPI_NONE		= -1,
8512de962bdSlukem 
8522de962bdSlukem 	LDAP_SYNC_CAPI_PHASE_FLAG	= 0x10U,
8532de962bdSlukem 	LDAP_SYNC_CAPI_IDSET_FLAG	= 0x20U,
8542de962bdSlukem 	LDAP_SYNC_CAPI_DONE_FLAG	= 0x40U,
8552de962bdSlukem 
8562de962bdSlukem 	/* these are passed to ls_search_entry() */
8572de962bdSlukem 	LDAP_SYNC_CAPI_PRESENT		= LDAP_SYNC_PRESENT,
8582de962bdSlukem 	LDAP_SYNC_CAPI_ADD		= LDAP_SYNC_ADD,
8592de962bdSlukem 	LDAP_SYNC_CAPI_MODIFY		= LDAP_SYNC_MODIFY,
8602de962bdSlukem 	LDAP_SYNC_CAPI_DELETE		= LDAP_SYNC_DELETE,
8612de962bdSlukem 
8622de962bdSlukem 	/* these are passed to ls_intermediate() */
8632de962bdSlukem 	LDAP_SYNC_CAPI_PRESENTS		= ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_PRESENT ),
8642de962bdSlukem 	LDAP_SYNC_CAPI_DELETES		= ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_DELETE ),
8652de962bdSlukem 
8662de962bdSlukem 	LDAP_SYNC_CAPI_PRESENTS_IDSET	= ( LDAP_SYNC_CAPI_PRESENTS | LDAP_SYNC_CAPI_IDSET_FLAG ),
8672de962bdSlukem 	LDAP_SYNC_CAPI_DELETES_IDSET	= ( LDAP_SYNC_CAPI_DELETES | LDAP_SYNC_CAPI_IDSET_FLAG ),
8682de962bdSlukem 
8692de962bdSlukem 	LDAP_SYNC_CAPI_DONE		= ( LDAP_SYNC_CAPI_DONE_FLAG | LDAP_SYNC_CAPI_PRESENTS )
8702de962bdSlukem } ldap_sync_refresh_t;
8712de962bdSlukem 
8722de962bdSlukem /*
8732de962bdSlukem  * Called when an entry is returned by ldap_result().
8742de962bdSlukem  * If phase is LDAP_SYNC_CAPI_ADD or LDAP_SYNC_CAPI_MODIFY,
8752de962bdSlukem  * the entry has been either added or modified, and thus
8762de962bdSlukem  * the complete view of the entry should be in the LDAPMessage.
8772de962bdSlukem  * If phase is LDAP_SYNC_CAPI_PRESENT or LDAP_SYNC_CAPI_DELETE,
8782de962bdSlukem  * only the DN should be in the LDAPMessage.
8792de962bdSlukem  */
8802de962bdSlukem typedef int (*ldap_sync_search_entry_f) LDAP_P((
8812de962bdSlukem 	ldap_sync_t			*ls,
8822de962bdSlukem 	LDAPMessage			*msg,
8832de962bdSlukem 	struct berval			*entryUUID,
8842de962bdSlukem 	ldap_sync_refresh_t		phase ));
8852de962bdSlukem 
8862de962bdSlukem /*
8872de962bdSlukem  * Called when a reference is returned; the client should know
8882de962bdSlukem  * what to do with it.
8892de962bdSlukem  */
8902de962bdSlukem typedef int (*ldap_sync_search_reference_f) LDAP_P((
8912de962bdSlukem 	ldap_sync_t			*ls,
8922de962bdSlukem 	LDAPMessage			*msg ));
8932de962bdSlukem 
8942de962bdSlukem /*
8952de962bdSlukem  * Called when specific intermediate/final messages are returned.
8962de962bdSlukem  * If phase is LDAP_SYNC_CAPI_PRESENTS or LDAP_SYNC_CAPI_DELETES,
8972de962bdSlukem  * a "presents" or "deletes" phase begins.
8982de962bdSlukem  * If phase is LDAP_SYNC_CAPI_DONE, a special "presents" phase
8992de962bdSlukem  * with refreshDone set to "TRUE" has been returned, to indicate
9002de962bdSlukem  * that the refresh phase of a refreshAndPersist is complete.
9012de962bdSlukem  * In the above cases, syncUUIDs is NULL.
9022de962bdSlukem  *
9032de962bdSlukem  * If phase is LDAP_SYNC_CAPI_PRESENTS_IDSET or
9042de962bdSlukem  * LDAP_SYNC_CAPI_DELETES_IDSET, syncUUIDs is an array of UUIDs
9052de962bdSlukem  * that are either present or have been deleted.
9062de962bdSlukem  */
9072de962bdSlukem typedef int (*ldap_sync_intermediate_f) LDAP_P((
9082de962bdSlukem 	ldap_sync_t			*ls,
9092de962bdSlukem 	LDAPMessage			*msg,
9102de962bdSlukem 	BerVarray			syncUUIDs,
9112de962bdSlukem 	ldap_sync_refresh_t		phase ));
9122de962bdSlukem 
9132de962bdSlukem /*
9142de962bdSlukem  * Called when a searchResultDone is returned.  In refreshAndPersist,
9152de962bdSlukem  * this can only occur if the search for any reason is being terminated
9162de962bdSlukem  * by the server.
9172de962bdSlukem  */
9182de962bdSlukem typedef int (*ldap_sync_search_result_f) LDAP_P((
9192de962bdSlukem 	ldap_sync_t			*ls,
9202de962bdSlukem 	LDAPMessage			*msg,
9212de962bdSlukem 	int				refreshDeletes ));
9222de962bdSlukem 
9232de962bdSlukem /*
9242de962bdSlukem  * This structure contains all information about the persistent search;
9252de962bdSlukem  * the caller is responsible for connecting, setting version, binding, tls...
9262de962bdSlukem  */
9272de962bdSlukem struct ldap_sync_t {
9282de962bdSlukem 	/* conf search params */
9292de962bdSlukem 	char				*ls_base;
9302de962bdSlukem 	int				ls_scope;
9312de962bdSlukem 	char				*ls_filter;
9322de962bdSlukem 	char				**ls_attrs;
9332de962bdSlukem 	int				ls_timelimit;
9342de962bdSlukem 	int				ls_sizelimit;
9352de962bdSlukem 
9362de962bdSlukem 	/* poll timeout */
9372de962bdSlukem 	int				ls_timeout;
9382de962bdSlukem 
9392de962bdSlukem 	/* helpers - add as appropriate */
9402de962bdSlukem 	ldap_sync_search_entry_f	ls_search_entry;
9412de962bdSlukem 	ldap_sync_search_reference_f	ls_search_reference;
9422de962bdSlukem 	ldap_sync_intermediate_f	ls_intermediate;
9432de962bdSlukem 	ldap_sync_search_result_f	ls_search_result;
9442de962bdSlukem 
9452de962bdSlukem 	/* set by the caller as appropriate */
9462de962bdSlukem 	void				*ls_private;
9472de962bdSlukem 
9482de962bdSlukem 	/* conn stuff */
9492de962bdSlukem 	LDAP				*ls_ld;
9502de962bdSlukem 
9512de962bdSlukem 	/* --- the parameters below are private - do not modify --- */
9522de962bdSlukem 
9532de962bdSlukem 	/* FIXME: make the structure opaque, and provide an interface
9542de962bdSlukem 	 * to modify the public values? */
9552de962bdSlukem 
9562de962bdSlukem 	/* result stuff */
9572de962bdSlukem 	int				ls_msgid;
9582de962bdSlukem 
9592de962bdSlukem 	/* sync stuff */
9602de962bdSlukem 	/* needed by refreshOnly */
9612de962bdSlukem 	int				ls_reloadHint;
9622de962bdSlukem 
9632de962bdSlukem 	/* opaque - need to pass between sessions, updated by the API */
9642de962bdSlukem 	struct berval			ls_cookie;
9652de962bdSlukem 
9662de962bdSlukem 	/* state variable - do not modify */
9672de962bdSlukem 	ldap_sync_refresh_t		ls_refreshPhase;
9682de962bdSlukem };
9692de962bdSlukem 
9702de962bdSlukem /*
9712de962bdSlukem  * End of LDAP sync (RFC4533) API
9722de962bdSlukem  */
9732de962bdSlukem 
9742de962bdSlukem /*
9754e6df137Slukem  * Connection callbacks...
9764e6df137Slukem  */
9774e6df137Slukem struct ldap_conncb;
9784e6df137Slukem struct sockaddr;
9794e6df137Slukem 
9804e6df137Slukem /* Called after a connection is established */
9814e6df137Slukem typedef int (ldap_conn_add_f) LDAP_P(( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, struct sockaddr *addr,
9824e6df137Slukem 	struct ldap_conncb *ctx ));
9834e6df137Slukem /* Called before a connection is closed */
9844e6df137Slukem typedef void (ldap_conn_del_f) LDAP_P(( LDAP *ld, Sockbuf *sb, struct ldap_conncb *ctx ));
9854e6df137Slukem 
9864e6df137Slukem /* Callbacks are pushed on a stack. Last one pushed is first one executed. The
9874e6df137Slukem  * delete callback is called with a NULL Sockbuf just before freeing the LDAP handle.
9884e6df137Slukem  */
9894e6df137Slukem typedef struct ldap_conncb {
9904e6df137Slukem 	ldap_conn_add_f *lc_add;
9914e6df137Slukem 	ldap_conn_del_f *lc_del;
9924e6df137Slukem 	void *lc_arg;
9934e6df137Slukem } ldap_conncb;
9944e6df137Slukem 
9954e6df137Slukem /*
9962de962bdSlukem  * The API draft spec says we should declare (or cause to be declared)
9972de962bdSlukem  * 'struct timeval'.   We don't.  See IETF LDAPext discussions.
9982de962bdSlukem  */
9992de962bdSlukem struct timeval;
10002de962bdSlukem 
10012de962bdSlukem /*
10022de962bdSlukem  * in options.c:
10032de962bdSlukem  */
10042de962bdSlukem LDAP_F( int )
10052de962bdSlukem ldap_get_option LDAP_P((
10062de962bdSlukem 	LDAP *ld,
10072de962bdSlukem 	int option,
10082de962bdSlukem 	void *outvalue));
10092de962bdSlukem 
10102de962bdSlukem LDAP_F( int )
10112de962bdSlukem ldap_set_option LDAP_P((
10122de962bdSlukem 	LDAP *ld,
10132de962bdSlukem 	int option,
10142de962bdSlukem 	LDAP_CONST void *invalue));
10152de962bdSlukem 
10162de962bdSlukem /* V3 REBIND Function Callback Prototype */
10172de962bdSlukem typedef int (LDAP_REBIND_PROC) LDAP_P((
10182de962bdSlukem 	LDAP *ld, LDAP_CONST char *url,
10192de962bdSlukem 	ber_tag_t request, ber_int_t msgid,
10202de962bdSlukem 	void *params ));
10212de962bdSlukem 
10222de962bdSlukem LDAP_F( int )
10232de962bdSlukem ldap_set_rebind_proc LDAP_P((
10242de962bdSlukem 	LDAP *ld,
10252de962bdSlukem 	LDAP_REBIND_PROC *rebind_proc,
10262de962bdSlukem 	void *params ));
10272de962bdSlukem 
10282de962bdSlukem /* V3 referral selection Function Callback Prototype */
10292de962bdSlukem typedef int (LDAP_NEXTREF_PROC) LDAP_P((
10302de962bdSlukem 	LDAP *ld, char ***refsp, int *cntp,
10312de962bdSlukem 	void *params ));
10322de962bdSlukem 
10332de962bdSlukem LDAP_F( int )
10342de962bdSlukem ldap_set_nextref_proc LDAP_P((
10352de962bdSlukem 	LDAP *ld,
10362de962bdSlukem 	LDAP_NEXTREF_PROC *nextref_proc,
10372de962bdSlukem 	void *params ));
10382de962bdSlukem 
10392de962bdSlukem /* V3 URLLIST Function Callback Prototype */
10402de962bdSlukem typedef int (LDAP_URLLIST_PROC) LDAP_P((
10412de962bdSlukem 	LDAP *ld,
10422de962bdSlukem 	LDAPURLDesc **urllist,
10432de962bdSlukem 	LDAPURLDesc **url,
10442de962bdSlukem 	void *params ));
10452de962bdSlukem 
10462de962bdSlukem LDAP_F( int )
10472de962bdSlukem ldap_set_urllist_proc LDAP_P((
10482de962bdSlukem 	LDAP *ld,
10492de962bdSlukem 	LDAP_URLLIST_PROC *urllist_proc,
10502de962bdSlukem 	void *params ));
10512de962bdSlukem 
10522de962bdSlukem /*
10532de962bdSlukem  * in controls.c:
10542de962bdSlukem  */
10552de962bdSlukem #if LDAP_DEPRECATED
10562de962bdSlukem LDAP_F( int )
10572de962bdSlukem ldap_create_control LDAP_P((	/* deprecated, use ldap_control_create */
10582de962bdSlukem 	LDAP_CONST char *requestOID,
10592de962bdSlukem 	BerElement *ber,
10602de962bdSlukem 	int iscritical,
10612de962bdSlukem 	LDAPControl **ctrlp ));
10622de962bdSlukem 
10632de962bdSlukem LDAP_F( LDAPControl * )
10642de962bdSlukem ldap_find_control LDAP_P((	/* deprecated, use ldap_control_find */
10652de962bdSlukem 	LDAP_CONST char *oid,
10662de962bdSlukem 	LDAPControl **ctrls ));
10672de962bdSlukem #endif
10682de962bdSlukem 
10692de962bdSlukem LDAP_F( int )
10702de962bdSlukem ldap_control_create LDAP_P((
10712de962bdSlukem 	LDAP_CONST char *requestOID,
10722de962bdSlukem 	int iscritical,
10732de962bdSlukem 	struct berval *value,
10742de962bdSlukem 	int dupval,
10752de962bdSlukem 	LDAPControl **ctrlp ));
10762de962bdSlukem 
10772de962bdSlukem LDAP_F( LDAPControl * )
10782de962bdSlukem ldap_control_find LDAP_P((
10792de962bdSlukem 	LDAP_CONST char *oid,
10802de962bdSlukem 	LDAPControl **ctrls,
10812de962bdSlukem 	LDAPControl ***nextctrlp ));
10822de962bdSlukem 
10832de962bdSlukem LDAP_F( void )
10842de962bdSlukem ldap_control_free LDAP_P((
10852de962bdSlukem 	LDAPControl *ctrl ));
10862de962bdSlukem 
10872de962bdSlukem LDAP_F( void )
10882de962bdSlukem ldap_controls_free LDAP_P((
10892de962bdSlukem 	LDAPControl **ctrls ));
10902de962bdSlukem 
10912de962bdSlukem LDAP_F( LDAPControl ** )
10922de962bdSlukem ldap_controls_dup LDAP_P((
10932de962bdSlukem 	LDAPControl *LDAP_CONST *controls ));
10942de962bdSlukem 
10952de962bdSlukem LDAP_F( LDAPControl * )
10962de962bdSlukem ldap_control_dup LDAP_P((
10972de962bdSlukem 	LDAP_CONST LDAPControl *c ));
10982de962bdSlukem 
10992de962bdSlukem /*
11002de962bdSlukem  * in dnssrv.c:
11012de962bdSlukem  */
11022de962bdSlukem LDAP_F( int )
11032de962bdSlukem ldap_domain2dn LDAP_P((
11042de962bdSlukem 	LDAP_CONST char* domain,
11052de962bdSlukem 	char** dn ));
11062de962bdSlukem 
11072de962bdSlukem LDAP_F( int )
11082de962bdSlukem ldap_dn2domain LDAP_P((
11092de962bdSlukem 	LDAP_CONST char* dn,
11102de962bdSlukem 	char** domain ));
11112de962bdSlukem 
11122de962bdSlukem LDAP_F( int )
11132de962bdSlukem ldap_domain2hostlist LDAP_P((
11142de962bdSlukem 	LDAP_CONST char *domain,
11152de962bdSlukem 	char** hostlist ));
11162de962bdSlukem 
11172de962bdSlukem /*
11182de962bdSlukem  * in extended.c:
11192de962bdSlukem  */
11202de962bdSlukem LDAP_F( int )
11212de962bdSlukem ldap_extended_operation LDAP_P((
11222de962bdSlukem 	LDAP			*ld,
11232de962bdSlukem 	LDAP_CONST char	*reqoid,
11242de962bdSlukem 	struct berval	*reqdata,
11252de962bdSlukem 	LDAPControl		**serverctrls,
11262de962bdSlukem 	LDAPControl		**clientctrls,
11272de962bdSlukem 	int				*msgidp ));
11282de962bdSlukem 
11292de962bdSlukem LDAP_F( int )
11302de962bdSlukem ldap_extended_operation_s LDAP_P((
11312de962bdSlukem 	LDAP			*ld,
11322de962bdSlukem 	LDAP_CONST char	*reqoid,
11332de962bdSlukem 	struct berval	*reqdata,
11342de962bdSlukem 	LDAPControl		**serverctrls,
11352de962bdSlukem 	LDAPControl		**clientctrls,
11362de962bdSlukem 	char			**retoidp,
11372de962bdSlukem 	struct berval	**retdatap ));
11382de962bdSlukem 
11392de962bdSlukem LDAP_F( int )
11402de962bdSlukem ldap_parse_extended_result LDAP_P((
11412de962bdSlukem 	LDAP			*ld,
11422de962bdSlukem 	LDAPMessage		*res,
11432de962bdSlukem 	char			**retoidp,
11442de962bdSlukem 	struct berval	**retdatap,
11452de962bdSlukem 	int				freeit ));
11462de962bdSlukem 
11472de962bdSlukem LDAP_F( int )
11482de962bdSlukem ldap_parse_intermediate LDAP_P((
11492de962bdSlukem 	LDAP			*ld,
11502de962bdSlukem 	LDAPMessage		*res,
11512de962bdSlukem 	char			**retoidp,
11522de962bdSlukem 	struct berval	**retdatap,
11532de962bdSlukem 	LDAPControl		***serverctrls,
11542de962bdSlukem 	int				freeit ));
11552de962bdSlukem 
11562de962bdSlukem 
11572de962bdSlukem /*
11582de962bdSlukem  * in abandon.c:
11592de962bdSlukem  */
11602de962bdSlukem LDAP_F( int )
11612de962bdSlukem ldap_abandon_ext LDAP_P((
11622de962bdSlukem 	LDAP			*ld,
11632de962bdSlukem 	int				msgid,
11642de962bdSlukem 	LDAPControl		**serverctrls,
11652de962bdSlukem 	LDAPControl		**clientctrls ));
11662de962bdSlukem 
11672de962bdSlukem #if LDAP_DEPRECATED
11682de962bdSlukem LDAP_F( int )
11692de962bdSlukem ldap_abandon LDAP_P((	/* deprecated, use ldap_abandon_ext */
11702de962bdSlukem 	LDAP *ld,
11712de962bdSlukem 	int msgid ));
11722de962bdSlukem #endif
11732de962bdSlukem 
11742de962bdSlukem /*
11752de962bdSlukem  * in add.c:
11762de962bdSlukem  */
11772de962bdSlukem LDAP_F( int )
11782de962bdSlukem ldap_add_ext LDAP_P((
11792de962bdSlukem 	LDAP			*ld,
11802de962bdSlukem 	LDAP_CONST char	*dn,
11812de962bdSlukem 	LDAPMod			**attrs,
11822de962bdSlukem 	LDAPControl		**serverctrls,
11832de962bdSlukem 	LDAPControl		**clientctrls,
11842de962bdSlukem 	int 			*msgidp ));
11852de962bdSlukem 
11862de962bdSlukem LDAP_F( int )
11872de962bdSlukem ldap_add_ext_s LDAP_P((
11882de962bdSlukem 	LDAP			*ld,
11892de962bdSlukem 	LDAP_CONST char	*dn,
11902de962bdSlukem 	LDAPMod			**attrs,
11912de962bdSlukem 	LDAPControl		**serverctrls,
11922de962bdSlukem 	LDAPControl		**clientctrls ));
11932de962bdSlukem 
11942de962bdSlukem #if LDAP_DEPRECATED
11952de962bdSlukem LDAP_F( int )
11962de962bdSlukem ldap_add LDAP_P((	/* deprecated, use ldap_add_ext */
11972de962bdSlukem 	LDAP *ld,
11982de962bdSlukem 	LDAP_CONST char *dn,
11992de962bdSlukem 	LDAPMod **attrs ));
12002de962bdSlukem 
12012de962bdSlukem LDAP_F( int )
12022de962bdSlukem ldap_add_s LDAP_P((	/* deprecated, use ldap_add_ext_s */
12032de962bdSlukem 	LDAP *ld,
12042de962bdSlukem 	LDAP_CONST char *dn,
12052de962bdSlukem 	LDAPMod **attrs ));
12062de962bdSlukem #endif
12072de962bdSlukem 
12082de962bdSlukem 
12092de962bdSlukem /*
12102de962bdSlukem  * in sasl.c:
12112de962bdSlukem  */
12122de962bdSlukem LDAP_F( int )
12132de962bdSlukem ldap_sasl_bind LDAP_P((
12142de962bdSlukem 	LDAP			*ld,
12152de962bdSlukem 	LDAP_CONST char	*dn,
12162de962bdSlukem 	LDAP_CONST char	*mechanism,
12172de962bdSlukem 	struct berval	*cred,
12182de962bdSlukem 	LDAPControl		**serverctrls,
12192de962bdSlukem 	LDAPControl		**clientctrls,
12202de962bdSlukem 	int				*msgidp ));
12212de962bdSlukem 
12222de962bdSlukem /* Interaction flags (should be passed about in a control)
12232de962bdSlukem  *  Automatic (default): use defaults, prompt otherwise
12242de962bdSlukem  *  Interactive: prompt always
12252de962bdSlukem  *  Quiet: never prompt
12262de962bdSlukem  */
12272de962bdSlukem #define LDAP_SASL_AUTOMATIC		0U
12282de962bdSlukem #define LDAP_SASL_INTERACTIVE	1U
12292de962bdSlukem #define LDAP_SASL_QUIET			2U
12302de962bdSlukem 
12312de962bdSlukem /*
12322de962bdSlukem  * V3 SASL Interaction Function Callback Prototype
12332de962bdSlukem  *	when using Cyrus SASL, interact is pointer to sasl_interact_t
12342de962bdSlukem  *  should likely passed in a control (and provided controls)
12352de962bdSlukem  */
12362de962bdSlukem typedef int (LDAP_SASL_INTERACT_PROC) LDAP_P((
12372de962bdSlukem 	LDAP *ld, unsigned flags, void* defaults, void *interact ));
12382de962bdSlukem 
12392de962bdSlukem LDAP_F( int )
124033197c6aStron ldap_sasl_interactive_bind LDAP_P((
124133197c6aStron 	LDAP *ld,
124233197c6aStron 	LDAP_CONST char *dn, /* usually NULL */
124333197c6aStron 	LDAP_CONST char *saslMechanism,
124433197c6aStron 	LDAPControl **serverControls,
124533197c6aStron 	LDAPControl **clientControls,
124633197c6aStron 
124733197c6aStron 	/* should be client controls */
124833197c6aStron 	unsigned flags,
124933197c6aStron 	LDAP_SASL_INTERACT_PROC *proc,
125033197c6aStron 	void *defaults,
125133197c6aStron 
125233197c6aStron 	/* as obtained from ldap_result() */
125333197c6aStron 	LDAPMessage *result,
125433197c6aStron 
125533197c6aStron 	/* returned during bind processing */
125633197c6aStron 	const char **rmech,
125733197c6aStron 	int *msgid ));
125833197c6aStron 
125933197c6aStron LDAP_F( int )
12602de962bdSlukem ldap_sasl_interactive_bind_s LDAP_P((
12612de962bdSlukem 	LDAP *ld,
12622de962bdSlukem 	LDAP_CONST char *dn, /* usually NULL */
12632de962bdSlukem 	LDAP_CONST char *saslMechanism,
12642de962bdSlukem 	LDAPControl **serverControls,
12652de962bdSlukem 	LDAPControl **clientControls,
12662de962bdSlukem 
12672de962bdSlukem 	/* should be client controls */
12682de962bdSlukem 	unsigned flags,
12692de962bdSlukem 	LDAP_SASL_INTERACT_PROC *proc,
12702de962bdSlukem 	void *defaults ));
12712de962bdSlukem 
12722de962bdSlukem LDAP_F( int )
12732de962bdSlukem ldap_sasl_bind_s LDAP_P((
12742de962bdSlukem 	LDAP			*ld,
12752de962bdSlukem 	LDAP_CONST char	*dn,
12762de962bdSlukem 	LDAP_CONST char	*mechanism,
12772de962bdSlukem 	struct berval	*cred,
12782de962bdSlukem 	LDAPControl		**serverctrls,
12792de962bdSlukem 	LDAPControl		**clientctrls,
12802de962bdSlukem 	struct berval	**servercredp ));
12812de962bdSlukem 
12822de962bdSlukem LDAP_F( int )
12832de962bdSlukem ldap_parse_sasl_bind_result LDAP_P((
12842de962bdSlukem 	LDAP			*ld,
12852de962bdSlukem 	LDAPMessage		*res,
12862de962bdSlukem 	struct berval	**servercredp,
12872de962bdSlukem 	int				freeit ));
12882de962bdSlukem 
12892de962bdSlukem #if LDAP_DEPRECATED
12902de962bdSlukem /*
12912de962bdSlukem  * in bind.c:
12922de962bdSlukem  *	(deprecated)
12932de962bdSlukem  */
12942de962bdSlukem LDAP_F( int )
12952de962bdSlukem ldap_bind LDAP_P((	/* deprecated, use ldap_sasl_bind */
12962de962bdSlukem 	LDAP *ld,
12972de962bdSlukem 	LDAP_CONST char *who,
12982de962bdSlukem 	LDAP_CONST char *passwd,
12992de962bdSlukem 	int authmethod ));
13002de962bdSlukem 
13012de962bdSlukem LDAP_F( int )
13022de962bdSlukem ldap_bind_s LDAP_P((	/* deprecated, use ldap_sasl_bind_s */
13032de962bdSlukem 	LDAP *ld,
13042de962bdSlukem 	LDAP_CONST char *who,
13052de962bdSlukem 	LDAP_CONST char *cred,
13062de962bdSlukem 	int authmethod ));
13072de962bdSlukem 
13082de962bdSlukem /*
13092de962bdSlukem  * in sbind.c:
13102de962bdSlukem  */
13112de962bdSlukem LDAP_F( int )
13122de962bdSlukem ldap_simple_bind LDAP_P(( /* deprecated, use ldap_sasl_bind */
13132de962bdSlukem 	LDAP *ld,
13142de962bdSlukem 	LDAP_CONST char *who,
13152de962bdSlukem 	LDAP_CONST char *passwd ));
13162de962bdSlukem 
13172de962bdSlukem LDAP_F( int )
13182de962bdSlukem ldap_simple_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */
13192de962bdSlukem 	LDAP *ld,
13202de962bdSlukem 	LDAP_CONST char *who,
13212de962bdSlukem 	LDAP_CONST char *passwd ));
13222de962bdSlukem 
13232de962bdSlukem #endif
13242de962bdSlukem 
13252de962bdSlukem 
13262de962bdSlukem /*
13272de962bdSlukem  * in compare.c:
13282de962bdSlukem  */
13292de962bdSlukem LDAP_F( int )
13302de962bdSlukem ldap_compare_ext LDAP_P((
13312de962bdSlukem 	LDAP			*ld,
13322de962bdSlukem 	LDAP_CONST char	*dn,
13332de962bdSlukem 	LDAP_CONST char	*attr,
13342de962bdSlukem 	struct berval	*bvalue,
13352de962bdSlukem 	LDAPControl		**serverctrls,
13362de962bdSlukem 	LDAPControl		**clientctrls,
13372de962bdSlukem 	int 			*msgidp ));
13382de962bdSlukem 
13392de962bdSlukem LDAP_F( int )
13402de962bdSlukem ldap_compare_ext_s LDAP_P((
13412de962bdSlukem 	LDAP			*ld,
13422de962bdSlukem 	LDAP_CONST char	*dn,
13432de962bdSlukem 	LDAP_CONST char	*attr,
13442de962bdSlukem 	struct berval	*bvalue,
13452de962bdSlukem 	LDAPControl		**serverctrls,
13462de962bdSlukem 	LDAPControl		**clientctrls ));
13472de962bdSlukem 
13482de962bdSlukem #if LDAP_DEPRECATED
13492de962bdSlukem LDAP_F( int )
13502de962bdSlukem ldap_compare LDAP_P((	/* deprecated, use ldap_compare_ext */
13512de962bdSlukem 	LDAP *ld,
13522de962bdSlukem 	LDAP_CONST char *dn,
13532de962bdSlukem 	LDAP_CONST char *attr,
13542de962bdSlukem 	LDAP_CONST char *value ));
13552de962bdSlukem 
13562de962bdSlukem LDAP_F( int )
13572de962bdSlukem ldap_compare_s LDAP_P((	/* deprecated, use ldap_compare_ext_s */
13582de962bdSlukem 	LDAP *ld,
13592de962bdSlukem 	LDAP_CONST char *dn,
13602de962bdSlukem 	LDAP_CONST char *attr,
13612de962bdSlukem 	LDAP_CONST char *value ));
13622de962bdSlukem #endif
13632de962bdSlukem 
13642de962bdSlukem 
13652de962bdSlukem /*
13662de962bdSlukem  * in delete.c:
13672de962bdSlukem  */
13682de962bdSlukem LDAP_F( int )
13692de962bdSlukem ldap_delete_ext LDAP_P((
13702de962bdSlukem 	LDAP			*ld,
13712de962bdSlukem 	LDAP_CONST char	*dn,
13722de962bdSlukem 	LDAPControl		**serverctrls,
13732de962bdSlukem 	LDAPControl		**clientctrls,
13742de962bdSlukem 	int 			*msgidp ));
13752de962bdSlukem 
13762de962bdSlukem LDAP_F( int )
13772de962bdSlukem ldap_delete_ext_s LDAP_P((
13782de962bdSlukem 	LDAP			*ld,
13792de962bdSlukem 	LDAP_CONST char	*dn,
13802de962bdSlukem 	LDAPControl		**serverctrls,
13812de962bdSlukem 	LDAPControl		**clientctrls ));
13822de962bdSlukem 
13832de962bdSlukem #if LDAP_DEPRECATED
13842de962bdSlukem LDAP_F( int )
13852de962bdSlukem ldap_delete LDAP_P((	/* deprecated, use ldap_delete_ext */
13862de962bdSlukem 	LDAP *ld,
13872de962bdSlukem 	LDAP_CONST char *dn ));
13882de962bdSlukem 
13892de962bdSlukem LDAP_F( int )
13902de962bdSlukem ldap_delete_s LDAP_P((	/* deprecated, use ldap_delete_ext_s */
13912de962bdSlukem 	LDAP *ld,
13922de962bdSlukem 	LDAP_CONST char *dn ));
13932de962bdSlukem #endif
13942de962bdSlukem 
13952de962bdSlukem 
13962de962bdSlukem /*
13972de962bdSlukem  * in error.c:
13982de962bdSlukem  */
13992de962bdSlukem LDAP_F( int )
14002de962bdSlukem ldap_parse_result LDAP_P((
14012de962bdSlukem 	LDAP			*ld,
14022de962bdSlukem 	LDAPMessage		*res,
14032de962bdSlukem 	int				*errcodep,
14042de962bdSlukem 	char			**matcheddnp,
1405*cf1d77f7Schristos 	char			**diagmsgp,
14062de962bdSlukem 	char			***referralsp,
14072de962bdSlukem 	LDAPControl		***serverctrls,
14082de962bdSlukem 	int				freeit ));
14092de962bdSlukem 
14102de962bdSlukem LDAP_F( char * )
14112de962bdSlukem ldap_err2string LDAP_P((
14122de962bdSlukem 	int err ));
14132de962bdSlukem 
14142de962bdSlukem #if LDAP_DEPRECATED
14152de962bdSlukem LDAP_F( int )
14162de962bdSlukem ldap_result2error LDAP_P((	/* deprecated, use ldap_parse_result */
14172de962bdSlukem 	LDAP *ld,
14182de962bdSlukem 	LDAPMessage *r,
14192de962bdSlukem 	int freeit ));
14202de962bdSlukem 
14212de962bdSlukem LDAP_F( void )
14222de962bdSlukem ldap_perror LDAP_P((	/* deprecated, use ldap_err2string */
14232de962bdSlukem 	LDAP *ld,
14242de962bdSlukem 	LDAP_CONST char *s ));
14252de962bdSlukem #endif
14262de962bdSlukem 
14272de962bdSlukem /*
14284e6df137Slukem  * gssapi.c:
14294e6df137Slukem  */
14304e6df137Slukem LDAP_F( int )
14314e6df137Slukem ldap_gssapi_bind LDAP_P((
14324e6df137Slukem 	LDAP *ld,
14334e6df137Slukem 	LDAP_CONST char *dn,
14344e6df137Slukem 	LDAP_CONST char *creds ));
14354e6df137Slukem 
14364e6df137Slukem LDAP_F( int )
14374e6df137Slukem ldap_gssapi_bind_s LDAP_P((
14384e6df137Slukem 	LDAP *ld,
14394e6df137Slukem 	LDAP_CONST char *dn,
14404e6df137Slukem 	LDAP_CONST char *creds ));
14414e6df137Slukem 
14424e6df137Slukem 
14434e6df137Slukem /*
14442de962bdSlukem  * in modify.c:
14452de962bdSlukem  */
14462de962bdSlukem LDAP_F( int )
14472de962bdSlukem ldap_modify_ext LDAP_P((
14482de962bdSlukem 	LDAP			*ld,
14492de962bdSlukem 	LDAP_CONST char	*dn,
14502de962bdSlukem 	LDAPMod			**mods,
14512de962bdSlukem 	LDAPControl		**serverctrls,
14522de962bdSlukem 	LDAPControl		**clientctrls,
14532de962bdSlukem 	int 			*msgidp ));
14542de962bdSlukem 
14552de962bdSlukem LDAP_F( int )
14562de962bdSlukem ldap_modify_ext_s LDAP_P((
14572de962bdSlukem 	LDAP			*ld,
14582de962bdSlukem 	LDAP_CONST char	*dn,
14592de962bdSlukem 	LDAPMod			**mods,
14602de962bdSlukem 	LDAPControl		**serverctrls,
14612de962bdSlukem 	LDAPControl		**clientctrls ));
14622de962bdSlukem 
14632de962bdSlukem #if LDAP_DEPRECATED
14642de962bdSlukem LDAP_F( int )
14652de962bdSlukem ldap_modify LDAP_P((	/* deprecated, use ldap_modify_ext */
14662de962bdSlukem 	LDAP *ld,
14672de962bdSlukem 	LDAP_CONST char *dn,
14682de962bdSlukem 	LDAPMod **mods ));
14692de962bdSlukem 
14702de962bdSlukem LDAP_F( int )
14712de962bdSlukem ldap_modify_s LDAP_P((	/* deprecated, use ldap_modify_ext_s */
14722de962bdSlukem 	LDAP *ld,
14732de962bdSlukem 	LDAP_CONST char *dn,
14742de962bdSlukem 	LDAPMod **mods ));
14752de962bdSlukem #endif
14762de962bdSlukem 
14772de962bdSlukem 
14782de962bdSlukem /*
14792de962bdSlukem  * in modrdn.c:
14802de962bdSlukem  */
14812de962bdSlukem LDAP_F( int )
14822de962bdSlukem ldap_rename LDAP_P((
14832de962bdSlukem 	LDAP *ld,
14842de962bdSlukem 	LDAP_CONST char *dn,
14852de962bdSlukem 	LDAP_CONST char *newrdn,
14862de962bdSlukem 	LDAP_CONST char *newSuperior,
14872de962bdSlukem 	int deleteoldrdn,
14882de962bdSlukem 	LDAPControl **sctrls,
14892de962bdSlukem 	LDAPControl **cctrls,
14902de962bdSlukem 	int *msgidp ));
14912de962bdSlukem 
14922de962bdSlukem LDAP_F( int )
14932de962bdSlukem ldap_rename_s LDAP_P((
14942de962bdSlukem 	LDAP *ld,
14952de962bdSlukem 	LDAP_CONST char *dn,
14962de962bdSlukem 	LDAP_CONST char *newrdn,
14972de962bdSlukem 	LDAP_CONST char *newSuperior,
14982de962bdSlukem 	int deleteoldrdn,
14992de962bdSlukem 	LDAPControl **sctrls,
15002de962bdSlukem 	LDAPControl **cctrls ));
15012de962bdSlukem 
15022de962bdSlukem #if LDAP_DEPRECATED
15032de962bdSlukem LDAP_F( int )
15042de962bdSlukem ldap_rename2 LDAP_P((	/* deprecated, use ldap_rename */
15052de962bdSlukem 	LDAP *ld,
15062de962bdSlukem 	LDAP_CONST char *dn,
15072de962bdSlukem 	LDAP_CONST char *newrdn,
15082de962bdSlukem 	LDAP_CONST char *newSuperior,
15092de962bdSlukem 	int deleteoldrdn ));
15102de962bdSlukem 
15112de962bdSlukem LDAP_F( int )
15122de962bdSlukem ldap_rename2_s LDAP_P((	/* deprecated, use ldap_rename_s */
15132de962bdSlukem 	LDAP *ld,
15142de962bdSlukem 	LDAP_CONST char *dn,
15152de962bdSlukem 	LDAP_CONST char *newrdn,
15162de962bdSlukem 	LDAP_CONST char *newSuperior,
15172de962bdSlukem 	int deleteoldrdn ));
15182de962bdSlukem 
15192de962bdSlukem LDAP_F( int )
15202de962bdSlukem ldap_modrdn LDAP_P((	/* deprecated, use ldap_rename */
15212de962bdSlukem 	LDAP *ld,
15222de962bdSlukem 	LDAP_CONST char *dn,
15232de962bdSlukem 	LDAP_CONST char *newrdn ));
15242de962bdSlukem 
15252de962bdSlukem LDAP_F( int )
15262de962bdSlukem ldap_modrdn_s LDAP_P((	/* deprecated, use ldap_rename_s */
15272de962bdSlukem 	LDAP *ld,
15282de962bdSlukem 	LDAP_CONST char *dn,
15292de962bdSlukem 	LDAP_CONST char *newrdn ));
15302de962bdSlukem 
15312de962bdSlukem LDAP_F( int )
15322de962bdSlukem ldap_modrdn2 LDAP_P((	/* deprecated, use ldap_rename */
15332de962bdSlukem 	LDAP *ld,
15342de962bdSlukem 	LDAP_CONST char *dn,
15352de962bdSlukem 	LDAP_CONST char *newrdn,
15362de962bdSlukem 	int deleteoldrdn ));
15372de962bdSlukem 
15382de962bdSlukem LDAP_F( int )
15392de962bdSlukem ldap_modrdn2_s LDAP_P((	/* deprecated, use ldap_rename_s */
15402de962bdSlukem 	LDAP *ld,
15412de962bdSlukem 	LDAP_CONST char *dn,
15422de962bdSlukem 	LDAP_CONST char *newrdn,
15432de962bdSlukem 	int deleteoldrdn));
15442de962bdSlukem #endif
15452de962bdSlukem 
15462de962bdSlukem 
15472de962bdSlukem /*
15482de962bdSlukem  * in open.c:
15492de962bdSlukem  */
15502de962bdSlukem #if LDAP_DEPRECATED
15512de962bdSlukem LDAP_F( LDAP * )
15522de962bdSlukem ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */
15532de962bdSlukem 	LDAP_CONST char *host,
15542de962bdSlukem 	int port ));
15552de962bdSlukem 
15562de962bdSlukem LDAP_F( LDAP * )
15572de962bdSlukem ldap_open LDAP_P((	/* deprecated, use ldap_create or ldap_initialize */
15582de962bdSlukem 	LDAP_CONST char *host,
15592de962bdSlukem 	int port ));
15602de962bdSlukem #endif
15612de962bdSlukem 
15622de962bdSlukem LDAP_F( int )
15632de962bdSlukem ldap_create LDAP_P((
15642de962bdSlukem 	LDAP **ldp ));
15652de962bdSlukem 
15662de962bdSlukem LDAP_F( int )
15672de962bdSlukem ldap_initialize LDAP_P((
15682de962bdSlukem 	LDAP **ldp,
15692de962bdSlukem 	LDAP_CONST char *url ));
15702de962bdSlukem 
157133197c6aStron LDAP_F( LDAP * )
157233197c6aStron ldap_dup LDAP_P((
157333197c6aStron 	LDAP *old ));
157433197c6aStron 
1575*cf1d77f7Schristos LDAP_F( int )
1576*cf1d77f7Schristos ldap_connect( LDAP *ld );
1577*cf1d77f7Schristos 
15782de962bdSlukem /*
15792de962bdSlukem  * in tls.c
15802de962bdSlukem  */
15812de962bdSlukem 
15822de962bdSlukem LDAP_F( int )
15832de962bdSlukem ldap_tls_inplace LDAP_P((
15842de962bdSlukem 	LDAP *ld ));
15852de962bdSlukem 
15862de962bdSlukem LDAP_F( int )
15872de962bdSlukem ldap_start_tls LDAP_P((
15882de962bdSlukem 	LDAP *ld,
15892de962bdSlukem 	LDAPControl **serverctrls,
15902de962bdSlukem 	LDAPControl **clientctrls,
15912de962bdSlukem 	int *msgidp ));
15922de962bdSlukem 
15932de962bdSlukem LDAP_F( int )
15942de962bdSlukem ldap_install_tls LDAP_P((
15952de962bdSlukem 	LDAP *ld ));
15962de962bdSlukem 
15972de962bdSlukem LDAP_F( int )
15982de962bdSlukem ldap_start_tls_s LDAP_P((
15992de962bdSlukem 	LDAP *ld,
16002de962bdSlukem 	LDAPControl **serverctrls,
16012de962bdSlukem 	LDAPControl **clientctrls ));
16022de962bdSlukem 
16032de962bdSlukem /*
16042de962bdSlukem  * in messages.c:
16052de962bdSlukem  */
16062de962bdSlukem LDAP_F( LDAPMessage * )
16072de962bdSlukem ldap_first_message LDAP_P((
16082de962bdSlukem 	LDAP *ld,
16092de962bdSlukem 	LDAPMessage *chain ));
16102de962bdSlukem 
16112de962bdSlukem LDAP_F( LDAPMessage * )
16122de962bdSlukem ldap_next_message LDAP_P((
16132de962bdSlukem 	LDAP *ld,
16142de962bdSlukem 	LDAPMessage *msg ));
16152de962bdSlukem 
16162de962bdSlukem LDAP_F( int )
16172de962bdSlukem ldap_count_messages LDAP_P((
16182de962bdSlukem 	LDAP *ld,
16192de962bdSlukem 	LDAPMessage *chain ));
16202de962bdSlukem 
16212de962bdSlukem /*
16222de962bdSlukem  * in references.c:
16232de962bdSlukem  */
16242de962bdSlukem LDAP_F( LDAPMessage * )
16252de962bdSlukem ldap_first_reference LDAP_P((
16262de962bdSlukem 	LDAP *ld,
16272de962bdSlukem 	LDAPMessage *chain ));
16282de962bdSlukem 
16292de962bdSlukem LDAP_F( LDAPMessage * )
16302de962bdSlukem ldap_next_reference LDAP_P((
16312de962bdSlukem 	LDAP *ld,
16322de962bdSlukem 	LDAPMessage *ref ));
16332de962bdSlukem 
16342de962bdSlukem LDAP_F( int )
16352de962bdSlukem ldap_count_references LDAP_P((
16362de962bdSlukem 	LDAP *ld,
16372de962bdSlukem 	LDAPMessage *chain ));
16382de962bdSlukem 
16392de962bdSlukem LDAP_F( int )
16402de962bdSlukem ldap_parse_reference LDAP_P((
16412de962bdSlukem 	LDAP			*ld,
16422de962bdSlukem 	LDAPMessage		*ref,
16432de962bdSlukem 	char			***referralsp,
16442de962bdSlukem 	LDAPControl		***serverctrls,
16452de962bdSlukem 	int				freeit));
16462de962bdSlukem 
16472de962bdSlukem 
16482de962bdSlukem /*
16492de962bdSlukem  * in getentry.c:
16502de962bdSlukem  */
16512de962bdSlukem LDAP_F( LDAPMessage * )
16522de962bdSlukem ldap_first_entry LDAP_P((
16532de962bdSlukem 	LDAP *ld,
16542de962bdSlukem 	LDAPMessage *chain ));
16552de962bdSlukem 
16562de962bdSlukem LDAP_F( LDAPMessage * )
16572de962bdSlukem ldap_next_entry LDAP_P((
16582de962bdSlukem 	LDAP *ld,
16592de962bdSlukem 	LDAPMessage *entry ));
16602de962bdSlukem 
16612de962bdSlukem LDAP_F( int )
16622de962bdSlukem ldap_count_entries LDAP_P((
16632de962bdSlukem 	LDAP *ld,
16642de962bdSlukem 	LDAPMessage *chain ));
16652de962bdSlukem 
16662de962bdSlukem LDAP_F( int )
16672de962bdSlukem ldap_get_entry_controls LDAP_P((
16682de962bdSlukem 	LDAP			*ld,
16692de962bdSlukem 	LDAPMessage		*entry,
16702de962bdSlukem 	LDAPControl		***serverctrls));
16712de962bdSlukem 
16722de962bdSlukem 
16732de962bdSlukem /*
16742de962bdSlukem  * in addentry.c
16752de962bdSlukem  */
16762de962bdSlukem LDAP_F( LDAPMessage * )
16772de962bdSlukem ldap_delete_result_entry LDAP_P((
16782de962bdSlukem 	LDAPMessage **list,
16792de962bdSlukem 	LDAPMessage *e ));
16802de962bdSlukem 
16812de962bdSlukem LDAP_F( void )
16822de962bdSlukem ldap_add_result_entry LDAP_P((
16832de962bdSlukem 	LDAPMessage **list,
16842de962bdSlukem 	LDAPMessage *e ));
16852de962bdSlukem 
16862de962bdSlukem 
16872de962bdSlukem /*
16882de962bdSlukem  * in getdn.c
16892de962bdSlukem  */
16902de962bdSlukem LDAP_F( char * )
16912de962bdSlukem ldap_get_dn LDAP_P((
16922de962bdSlukem 	LDAP *ld,
16932de962bdSlukem 	LDAPMessage *entry ));
16942de962bdSlukem 
16952de962bdSlukem typedef struct ldap_ava {
16962de962bdSlukem 	struct berval la_attr;
16972de962bdSlukem 	struct berval la_value;
16982de962bdSlukem 	unsigned la_flags;
16992de962bdSlukem #define LDAP_AVA_NULL				0x0000U
17002de962bdSlukem #define LDAP_AVA_STRING				0x0001U
17012de962bdSlukem #define LDAP_AVA_BINARY				0x0002U
17022de962bdSlukem #define LDAP_AVA_NONPRINTABLE		0x0004U
17032de962bdSlukem #define LDAP_AVA_FREE_ATTR			0x0010U
17042de962bdSlukem #define LDAP_AVA_FREE_VALUE			0x0020U
17052de962bdSlukem 
17062de962bdSlukem 	void *la_private;
17072de962bdSlukem } LDAPAVA;
17082de962bdSlukem 
17092de962bdSlukem typedef LDAPAVA** LDAPRDN;
17102de962bdSlukem typedef LDAPRDN* LDAPDN;
17112de962bdSlukem 
17122de962bdSlukem /* DN formats */
17132de962bdSlukem #define LDAP_DN_FORMAT_LDAP			0x0000U
17142de962bdSlukem #define LDAP_DN_FORMAT_LDAPV3		0x0010U
17152de962bdSlukem #define LDAP_DN_FORMAT_LDAPV2		0x0020U
17162de962bdSlukem #define LDAP_DN_FORMAT_DCE			0x0030U
17172de962bdSlukem #define LDAP_DN_FORMAT_UFN			0x0040U	/* dn2str only */
17182de962bdSlukem #define LDAP_DN_FORMAT_AD_CANONICAL	0x0050U	/* dn2str only */
17192de962bdSlukem #define LDAP_DN_FORMAT_LBER			0x00F0U /* for testing only */
17202de962bdSlukem #define LDAP_DN_FORMAT_MASK			0x00F0U
17212de962bdSlukem 
17222de962bdSlukem /* DN flags */
17232de962bdSlukem #define LDAP_DN_PRETTY				0x0100U
17242de962bdSlukem #define LDAP_DN_SKIP				0x0200U
17252de962bdSlukem #define LDAP_DN_P_NOLEADTRAILSPACES	0x1000U
17262de962bdSlukem #define LDAP_DN_P_NOSPACEAFTERRDN	0x2000U
17272de962bdSlukem #define LDAP_DN_PEDANTIC			0xF000U
17282de962bdSlukem 
17292de962bdSlukem LDAP_F( void ) ldap_rdnfree LDAP_P(( LDAPRDN rdn ));
17302de962bdSlukem LDAP_F( void ) ldap_dnfree LDAP_P(( LDAPDN dn ));
17312de962bdSlukem 
17322de962bdSlukem LDAP_F( int )
17332de962bdSlukem ldap_bv2dn LDAP_P((
17342de962bdSlukem 	struct berval *bv,
17352de962bdSlukem 	LDAPDN *dn,
17362de962bdSlukem 	unsigned flags ));
17372de962bdSlukem 
17382de962bdSlukem LDAP_F( int )
17392de962bdSlukem ldap_str2dn LDAP_P((
17402de962bdSlukem 	LDAP_CONST char *str,
17412de962bdSlukem 	LDAPDN *dn,
17422de962bdSlukem 	unsigned flags ));
17432de962bdSlukem 
17442de962bdSlukem LDAP_F( int )
17452de962bdSlukem ldap_dn2bv LDAP_P((
17462de962bdSlukem 	LDAPDN dn,
17472de962bdSlukem 	struct berval *bv,
17482de962bdSlukem 	unsigned flags ));
17492de962bdSlukem 
17502de962bdSlukem LDAP_F( int )
17512de962bdSlukem ldap_dn2str LDAP_P((
17522de962bdSlukem 	LDAPDN dn,
17532de962bdSlukem 	char **str,
17542de962bdSlukem 	unsigned flags ));
17552de962bdSlukem 
17562de962bdSlukem LDAP_F( int )
17572de962bdSlukem ldap_bv2rdn LDAP_P((
17582de962bdSlukem 	struct berval *bv,
17592de962bdSlukem 	LDAPRDN *rdn,
17602de962bdSlukem 	char **next,
17612de962bdSlukem 	unsigned flags ));
17622de962bdSlukem 
17632de962bdSlukem LDAP_F( int )
17642de962bdSlukem ldap_str2rdn LDAP_P((
17652de962bdSlukem 	LDAP_CONST char *str,
17662de962bdSlukem 	LDAPRDN *rdn,
17672de962bdSlukem 	char **next,
17682de962bdSlukem 	unsigned flags ));
17692de962bdSlukem 
17702de962bdSlukem LDAP_F( int )
17712de962bdSlukem ldap_rdn2bv LDAP_P((
17722de962bdSlukem 	LDAPRDN rdn,
17732de962bdSlukem 	struct berval *bv,
17742de962bdSlukem 	unsigned flags ));
17752de962bdSlukem 
17762de962bdSlukem LDAP_F( int )
17772de962bdSlukem ldap_rdn2str LDAP_P((
17782de962bdSlukem 	LDAPRDN rdn,
17792de962bdSlukem 	char **str,
17802de962bdSlukem 	unsigned flags ));
17812de962bdSlukem 
17822de962bdSlukem LDAP_F( int )
17832de962bdSlukem ldap_dn_normalize LDAP_P((
17842de962bdSlukem 	LDAP_CONST char *in, unsigned iflags,
17852de962bdSlukem 	char **out, unsigned oflags ));
17862de962bdSlukem 
17872de962bdSlukem LDAP_F( char * )
17882de962bdSlukem ldap_dn2ufn LDAP_P(( /* deprecated, use ldap_str2dn/dn2str */
17892de962bdSlukem 	LDAP_CONST char *dn ));
17902de962bdSlukem 
17912de962bdSlukem LDAP_F( char ** )
17922de962bdSlukem ldap_explode_dn LDAP_P(( /* deprecated, ldap_str2dn */
17932de962bdSlukem 	LDAP_CONST char *dn,
17942de962bdSlukem 	int notypes ));
17952de962bdSlukem 
17962de962bdSlukem LDAP_F( char ** )
17972de962bdSlukem ldap_explode_rdn LDAP_P(( /* deprecated, ldap_str2rdn */
17982de962bdSlukem 	LDAP_CONST char *rdn,
17992de962bdSlukem 	int notypes ));
18002de962bdSlukem 
18012de962bdSlukem typedef int LDAPDN_rewrite_func
18022de962bdSlukem 	LDAP_P(( LDAPDN dn, unsigned flags, void *ctx ));
18032de962bdSlukem 
18042de962bdSlukem LDAP_F( int )
18052de962bdSlukem ldap_X509dn2bv LDAP_P(( void *x509_name, struct berval *dn,
18062de962bdSlukem 	LDAPDN_rewrite_func *func, unsigned flags ));
18072de962bdSlukem 
18082de962bdSlukem LDAP_F( char * )
18092de962bdSlukem ldap_dn2dcedn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
18102de962bdSlukem 	LDAP_CONST char *dn ));
18112de962bdSlukem 
18122de962bdSlukem LDAP_F( char * )
18132de962bdSlukem ldap_dcedn2dn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
18142de962bdSlukem 	LDAP_CONST char *dce ));
18152de962bdSlukem 
18162de962bdSlukem LDAP_F( char * )
18172de962bdSlukem ldap_dn2ad_canonical LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
18182de962bdSlukem 	LDAP_CONST char *dn ));
18192de962bdSlukem 
18202de962bdSlukem LDAP_F( int )
18212de962bdSlukem ldap_get_dn_ber LDAP_P((
18222de962bdSlukem 	LDAP *ld, LDAPMessage *e, BerElement **berout, struct berval *dn ));
18232de962bdSlukem 
18242de962bdSlukem LDAP_F( int )
18252de962bdSlukem ldap_get_attribute_ber LDAP_P((
18262de962bdSlukem 	LDAP *ld, LDAPMessage *e, BerElement *ber, struct berval *attr,
18272de962bdSlukem 	struct berval **vals ));
18282de962bdSlukem 
18292de962bdSlukem /*
18302de962bdSlukem  * in getattr.c
18312de962bdSlukem  */
18322de962bdSlukem LDAP_F( char * )
18332de962bdSlukem ldap_first_attribute LDAP_P((
18342de962bdSlukem 	LDAP *ld,
18352de962bdSlukem 	LDAPMessage *entry,
18362de962bdSlukem 	BerElement **ber ));
18372de962bdSlukem 
18382de962bdSlukem LDAP_F( char * )
18392de962bdSlukem ldap_next_attribute LDAP_P((
18402de962bdSlukem 	LDAP *ld,
18412de962bdSlukem 	LDAPMessage *entry,
18422de962bdSlukem 	BerElement *ber ));
18432de962bdSlukem 
18442de962bdSlukem 
18452de962bdSlukem /*
18462de962bdSlukem  * in getvalues.c
18472de962bdSlukem  */
18482de962bdSlukem LDAP_F( struct berval ** )
18492de962bdSlukem ldap_get_values_len LDAP_P((
18502de962bdSlukem 	LDAP *ld,
18512de962bdSlukem 	LDAPMessage *entry,
18522de962bdSlukem 	LDAP_CONST char *target ));
18532de962bdSlukem 
18542de962bdSlukem LDAP_F( int )
18552de962bdSlukem ldap_count_values_len LDAP_P((
18562de962bdSlukem 	struct berval **vals ));
18572de962bdSlukem 
18582de962bdSlukem LDAP_F( void )
18592de962bdSlukem ldap_value_free_len LDAP_P((
18602de962bdSlukem 	struct berval **vals ));
18612de962bdSlukem 
18622de962bdSlukem #if LDAP_DEPRECATED
18632de962bdSlukem LDAP_F( char ** )
18642de962bdSlukem ldap_get_values LDAP_P((	/* deprecated, use ldap_get_values_len */
18652de962bdSlukem 	LDAP *ld,
18662de962bdSlukem 	LDAPMessage *entry,
18672de962bdSlukem 	LDAP_CONST char *target ));
18682de962bdSlukem 
18692de962bdSlukem LDAP_F( int )
18702de962bdSlukem ldap_count_values LDAP_P((	/* deprecated, use ldap_count_values_len */
18712de962bdSlukem 	char **vals ));
18722de962bdSlukem 
18732de962bdSlukem LDAP_F( void )
18742de962bdSlukem ldap_value_free LDAP_P((	/* deprecated, use ldap_value_free_len */
18752de962bdSlukem 	char **vals ));
18762de962bdSlukem #endif
18772de962bdSlukem 
18782de962bdSlukem /*
18792de962bdSlukem  * in result.c:
18802de962bdSlukem  */
18812de962bdSlukem LDAP_F( int )
18822de962bdSlukem ldap_result LDAP_P((
18832de962bdSlukem 	LDAP *ld,
18842de962bdSlukem 	int msgid,
18852de962bdSlukem 	int all,
18862de962bdSlukem 	struct timeval *timeout,
18872de962bdSlukem 	LDAPMessage **result ));
18882de962bdSlukem 
18892de962bdSlukem LDAP_F( int )
18902de962bdSlukem ldap_msgtype LDAP_P((
18912de962bdSlukem 	LDAPMessage *lm ));
18922de962bdSlukem 
18932de962bdSlukem LDAP_F( int )
18942de962bdSlukem ldap_msgid   LDAP_P((
18952de962bdSlukem 	LDAPMessage *lm ));
18962de962bdSlukem 
18972de962bdSlukem LDAP_F( int )
18982de962bdSlukem ldap_msgfree LDAP_P((
18992de962bdSlukem 	LDAPMessage *lm ));
19002de962bdSlukem 
19012de962bdSlukem LDAP_F( int )
19022de962bdSlukem ldap_msgdelete LDAP_P((
19032de962bdSlukem 	LDAP *ld,
19042de962bdSlukem 	int msgid ));
19052de962bdSlukem 
19062de962bdSlukem 
19072de962bdSlukem /*
19082de962bdSlukem  * in search.c:
19092de962bdSlukem  */
19102de962bdSlukem LDAP_F( int )
19112de962bdSlukem ldap_bv2escaped_filter_value LDAP_P((
19122de962bdSlukem 	struct berval *in,
19132de962bdSlukem 	struct berval *out ));
19142de962bdSlukem 
19152de962bdSlukem LDAP_F( int )
19162de962bdSlukem ldap_search_ext LDAP_P((
19172de962bdSlukem 	LDAP			*ld,
19182de962bdSlukem 	LDAP_CONST char	*base,
19192de962bdSlukem 	int				scope,
19202de962bdSlukem 	LDAP_CONST char	*filter,
19212de962bdSlukem 	char			**attrs,
19222de962bdSlukem 	int				attrsonly,
19232de962bdSlukem 	LDAPControl		**serverctrls,
19242de962bdSlukem 	LDAPControl		**clientctrls,
19252de962bdSlukem 	struct timeval	*timeout,
19262de962bdSlukem 	int				sizelimit,
19272de962bdSlukem 	int				*msgidp ));
19282de962bdSlukem 
19292de962bdSlukem LDAP_F( int )
19302de962bdSlukem ldap_search_ext_s LDAP_P((
19312de962bdSlukem 	LDAP			*ld,
19322de962bdSlukem 	LDAP_CONST char	*base,
19332de962bdSlukem 	int				scope,
19342de962bdSlukem 	LDAP_CONST char	*filter,
19352de962bdSlukem 	char			**attrs,
19362de962bdSlukem 	int				attrsonly,
19372de962bdSlukem 	LDAPControl		**serverctrls,
19382de962bdSlukem 	LDAPControl		**clientctrls,
19392de962bdSlukem 	struct timeval	*timeout,
19402de962bdSlukem 	int				sizelimit,
19412de962bdSlukem 	LDAPMessage		**res ));
19422de962bdSlukem 
19432de962bdSlukem #if LDAP_DEPRECATED
19442de962bdSlukem LDAP_F( int )
19452de962bdSlukem ldap_search LDAP_P((	/* deprecated, use ldap_search_ext */
19462de962bdSlukem 	LDAP *ld,
19472de962bdSlukem 	LDAP_CONST char *base,
19482de962bdSlukem 	int scope,
19492de962bdSlukem 	LDAP_CONST char *filter,
19502de962bdSlukem 	char **attrs,
19512de962bdSlukem 	int attrsonly ));
19522de962bdSlukem 
19532de962bdSlukem LDAP_F( int )
19542de962bdSlukem ldap_search_s LDAP_P((	/* deprecated, use ldap_search_ext_s */
19552de962bdSlukem 	LDAP *ld,
19562de962bdSlukem 	LDAP_CONST char *base,
19572de962bdSlukem 	int scope,
19582de962bdSlukem 	LDAP_CONST char *filter,
19592de962bdSlukem 	char **attrs,
19602de962bdSlukem 	int attrsonly,
19612de962bdSlukem 	LDAPMessage **res ));
19622de962bdSlukem 
19632de962bdSlukem LDAP_F( int )
19642de962bdSlukem ldap_search_st LDAP_P((	/* deprecated, use ldap_search_ext_s */
19652de962bdSlukem 	LDAP *ld,
19662de962bdSlukem 	LDAP_CONST char *base,
19672de962bdSlukem 	int scope,
19682de962bdSlukem 	LDAP_CONST char *filter,
19692de962bdSlukem     char **attrs,
19702de962bdSlukem 	int attrsonly,
19712de962bdSlukem 	struct timeval *timeout,
19722de962bdSlukem 	LDAPMessage **res ));
19732de962bdSlukem #endif
19742de962bdSlukem 
19752de962bdSlukem /*
19762de962bdSlukem  * in unbind.c
19772de962bdSlukem  */
19782de962bdSlukem LDAP_F( int )
19792de962bdSlukem ldap_unbind_ext LDAP_P((
19802de962bdSlukem 	LDAP			*ld,
19812de962bdSlukem 	LDAPControl		**serverctrls,
19822de962bdSlukem 	LDAPControl		**clientctrls));
19832de962bdSlukem 
19842de962bdSlukem LDAP_F( int )
19852de962bdSlukem ldap_unbind_ext_s LDAP_P((
19862de962bdSlukem 	LDAP			*ld,
19872de962bdSlukem 	LDAPControl		**serverctrls,
19882de962bdSlukem 	LDAPControl		**clientctrls));
19892de962bdSlukem 
199033197c6aStron LDAP_F( int )
199133197c6aStron ldap_destroy LDAP_P((
199233197c6aStron 	LDAP			*ld));
199333197c6aStron 
19942de962bdSlukem #if LDAP_DEPRECATED
19952de962bdSlukem LDAP_F( int )
19962de962bdSlukem ldap_unbind LDAP_P(( /* deprecated, use ldap_unbind_ext */
19972de962bdSlukem 	LDAP *ld ));
19982de962bdSlukem 
19992de962bdSlukem LDAP_F( int )
20002de962bdSlukem ldap_unbind_s LDAP_P(( /* deprecated, use ldap_unbind_ext_s */
20012de962bdSlukem 	LDAP *ld ));
20022de962bdSlukem #endif
20032de962bdSlukem 
20042de962bdSlukem /*
20052de962bdSlukem  * in filter.c
20062de962bdSlukem  */
20072de962bdSlukem LDAP_F( int )
20082de962bdSlukem ldap_put_vrFilter LDAP_P((
20092de962bdSlukem 	BerElement *ber,
20102de962bdSlukem 	const char *vrf ));
20112de962bdSlukem 
20122de962bdSlukem /*
20132de962bdSlukem  * in free.c
20142de962bdSlukem  */
20152de962bdSlukem 
20162de962bdSlukem LDAP_F( void * )
20172de962bdSlukem ldap_memalloc LDAP_P((
20182de962bdSlukem 	ber_len_t s ));
20192de962bdSlukem 
20202de962bdSlukem LDAP_F( void * )
20212de962bdSlukem ldap_memrealloc LDAP_P((
20222de962bdSlukem 	void* p,
20232de962bdSlukem 	ber_len_t s ));
20242de962bdSlukem 
20252de962bdSlukem LDAP_F( void * )
20262de962bdSlukem ldap_memcalloc LDAP_P((
20272de962bdSlukem 	ber_len_t n,
20282de962bdSlukem 	ber_len_t s ));
20292de962bdSlukem 
20302de962bdSlukem LDAP_F( void )
20312de962bdSlukem ldap_memfree LDAP_P((
20322de962bdSlukem 	void* p ));
20332de962bdSlukem 
20342de962bdSlukem LDAP_F( void )
20352de962bdSlukem ldap_memvfree LDAP_P((
20362de962bdSlukem 	void** v ));
20372de962bdSlukem 
20382de962bdSlukem LDAP_F( char * )
20392de962bdSlukem ldap_strdup LDAP_P((
20402de962bdSlukem 	LDAP_CONST char * ));
20412de962bdSlukem 
20422de962bdSlukem LDAP_F( void )
20432de962bdSlukem ldap_mods_free LDAP_P((
20442de962bdSlukem 	LDAPMod **mods,
20452de962bdSlukem 	int freemods ));
20462de962bdSlukem 
20472de962bdSlukem 
20482de962bdSlukem #if LDAP_DEPRECATED
20492de962bdSlukem /*
20502de962bdSlukem  * in sort.c (deprecated, use custom code instead)
20512de962bdSlukem  */
20522de962bdSlukem typedef int (LDAP_SORT_AD_CMP_PROC) LDAP_P(( /* deprecated */
20532de962bdSlukem 	LDAP_CONST char *left,
20542de962bdSlukem 	LDAP_CONST char *right ));
20552de962bdSlukem 
20562de962bdSlukem typedef int (LDAP_SORT_AV_CMP_PROC) LDAP_P(( /* deprecated */
20572de962bdSlukem 	LDAP_CONST void *left,
20582de962bdSlukem 	LDAP_CONST void *right ));
20592de962bdSlukem 
20602de962bdSlukem LDAP_F( int )	/* deprecated */
20612de962bdSlukem ldap_sort_entries LDAP_P(( LDAP *ld,
20622de962bdSlukem 	LDAPMessage **chain,
20632de962bdSlukem 	LDAP_CONST char *attr,
20642de962bdSlukem 	LDAP_SORT_AD_CMP_PROC *cmp ));
20652de962bdSlukem 
20662de962bdSlukem LDAP_F( int )	/* deprecated */
20672de962bdSlukem ldap_sort_values LDAP_P((
20682de962bdSlukem 	LDAP *ld,
20692de962bdSlukem 	char **vals,
20702de962bdSlukem 	LDAP_SORT_AV_CMP_PROC *cmp ));
20712de962bdSlukem 
20722de962bdSlukem LDAP_F( int ) /* deprecated */
20732de962bdSlukem ldap_sort_strcasecmp LDAP_P((
20742de962bdSlukem 	LDAP_CONST void *a,
20752de962bdSlukem 	LDAP_CONST void *b ));
20762de962bdSlukem #endif
20772de962bdSlukem 
20782de962bdSlukem /*
20792de962bdSlukem  * in url.c
20802de962bdSlukem  */
20812de962bdSlukem LDAP_F( int )
20822de962bdSlukem ldap_is_ldap_url LDAP_P((
20832de962bdSlukem 	LDAP_CONST char *url ));
20842de962bdSlukem 
20852de962bdSlukem LDAP_F( int )
20862de962bdSlukem ldap_is_ldaps_url LDAP_P((
20872de962bdSlukem 	LDAP_CONST char *url ));
20882de962bdSlukem 
20892de962bdSlukem LDAP_F( int )
20902de962bdSlukem ldap_is_ldapi_url LDAP_P((
20912de962bdSlukem 	LDAP_CONST char *url ));
20922de962bdSlukem 
20938da6f2f6Schristos #ifdef LDAP_CONNECTIONLESS
20948da6f2f6Schristos LDAP_F( int )
20958da6f2f6Schristos ldap_is_ldapc_url LDAP_P((
20968da6f2f6Schristos 	LDAP_CONST char *url ));
20978da6f2f6Schristos #endif
20988da6f2f6Schristos 
20992de962bdSlukem LDAP_F( int )
21002de962bdSlukem ldap_url_parse LDAP_P((
21012de962bdSlukem 	LDAP_CONST char *url,
21022de962bdSlukem 	LDAPURLDesc **ludpp ));
21032de962bdSlukem 
21042de962bdSlukem LDAP_F( char * )
21052de962bdSlukem ldap_url_desc2str LDAP_P((
21062de962bdSlukem 	LDAPURLDesc *ludp ));
21072de962bdSlukem 
21082de962bdSlukem LDAP_F( void )
21092de962bdSlukem ldap_free_urldesc LDAP_P((
21102de962bdSlukem 	LDAPURLDesc *ludp ));
21112de962bdSlukem 
21122de962bdSlukem 
21132de962bdSlukem /*
21142de962bdSlukem  * LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
21152de962bdSlukem  *  in cancel.c
21162de962bdSlukem  */
21172de962bdSlukem #define LDAP_API_FEATURE_CANCEL 1000
21182de962bdSlukem 
21192de962bdSlukem LDAP_F( int )
21202de962bdSlukem ldap_cancel LDAP_P(( LDAP *ld,
21212de962bdSlukem 	int cancelid,
21222de962bdSlukem 	LDAPControl		**sctrls,
21232de962bdSlukem 	LDAPControl		**cctrls,
21242de962bdSlukem 	int				*msgidp ));
21252de962bdSlukem 
21262de962bdSlukem LDAP_F( int )
21272de962bdSlukem ldap_cancel_s LDAP_P(( LDAP *ld,
21282de962bdSlukem 	int cancelid,
21292de962bdSlukem 	LDAPControl **sctrl,
21302de962bdSlukem 	LDAPControl **cctrl ));
21312de962bdSlukem 
21322de962bdSlukem /*
21332de962bdSlukem  * LDAP Turn Extended Operation <draft-zeilenga-ldap-turn-xx.txt>
21342de962bdSlukem  *  in turn.c
21352de962bdSlukem  */
21362de962bdSlukem #define LDAP_API_FEATURE_TURN 1000
21372de962bdSlukem 
21382de962bdSlukem LDAP_F( int )
21392de962bdSlukem ldap_turn LDAP_P(( LDAP *ld,
21402de962bdSlukem 	int mutual,
21412de962bdSlukem 	LDAP_CONST char* identifier,
21422de962bdSlukem 	LDAPControl		**sctrls,
21432de962bdSlukem 	LDAPControl		**cctrls,
21442de962bdSlukem 	int				*msgidp ));
21452de962bdSlukem 
21462de962bdSlukem LDAP_F( int )
21472de962bdSlukem ldap_turn_s LDAP_P(( LDAP *ld,
21482de962bdSlukem 	int mutual,
21492de962bdSlukem 	LDAP_CONST char* identifier,
21502de962bdSlukem 	LDAPControl **sctrl,
21512de962bdSlukem 	LDAPControl **cctrl ));
21522de962bdSlukem 
21532de962bdSlukem /*
21542de962bdSlukem  * LDAP Paged Results
21552de962bdSlukem  *	in pagectrl.c
21562de962bdSlukem  */
21572de962bdSlukem #define LDAP_API_FEATURE_PAGED_RESULTS 2000
21582de962bdSlukem 
21592de962bdSlukem LDAP_F( int )
21602de962bdSlukem ldap_create_page_control_value LDAP_P((
21612de962bdSlukem 	LDAP *ld,
21622de962bdSlukem 	ber_int_t pagesize,
21632de962bdSlukem 	struct berval *cookie,
21642de962bdSlukem 	struct berval *value ));
21652de962bdSlukem 
21662de962bdSlukem LDAP_F( int )
21672de962bdSlukem ldap_create_page_control LDAP_P((
21682de962bdSlukem 	LDAP *ld,
21692de962bdSlukem 	ber_int_t pagesize,
21702de962bdSlukem 	struct berval *cookie,
21712de962bdSlukem 	int iscritical,
21722de962bdSlukem 	LDAPControl **ctrlp ));
21732de962bdSlukem 
21742de962bdSlukem #if LDAP_DEPRECATED
21752de962bdSlukem LDAP_F( int )
21762de962bdSlukem ldap_parse_page_control LDAP_P((
21772de962bdSlukem 	/* deprecated, use ldap_parse_pageresponse_control */
21782de962bdSlukem 	LDAP *ld,
21792de962bdSlukem 	LDAPControl **ctrls,
21802de962bdSlukem 	ber_int_t *count,
21812de962bdSlukem 	struct berval **cookie ));
21822de962bdSlukem #endif
21832de962bdSlukem 
21842de962bdSlukem LDAP_F( int )
21852de962bdSlukem ldap_parse_pageresponse_control LDAP_P((
21862de962bdSlukem 	LDAP *ld,
21872de962bdSlukem 	LDAPControl *ctrl,
21882de962bdSlukem 	ber_int_t *count,
21892de962bdSlukem 	struct berval *cookie ));
21902de962bdSlukem 
21912de962bdSlukem /*
21922de962bdSlukem  * LDAP Server Side Sort
21932de962bdSlukem  *	in sortctrl.c
21942de962bdSlukem  */
21952de962bdSlukem #define LDAP_API_FEATURE_SERVER_SIDE_SORT 2000
21962de962bdSlukem 
21972de962bdSlukem /* structure for a sort-key */
21982de962bdSlukem typedef struct ldapsortkey {
21992de962bdSlukem 	char *attributeType;
22002de962bdSlukem 	char *orderingRule;
22012de962bdSlukem 	int reverseOrder;
22022de962bdSlukem } LDAPSortKey;
22032de962bdSlukem 
22042de962bdSlukem LDAP_F( int )
22052de962bdSlukem ldap_create_sort_keylist LDAP_P((
22062de962bdSlukem 	LDAPSortKey ***sortKeyList,
22072de962bdSlukem 	char *keyString ));
22082de962bdSlukem 
22092de962bdSlukem LDAP_F( void )
22102de962bdSlukem ldap_free_sort_keylist LDAP_P((
22112de962bdSlukem 	LDAPSortKey **sortkeylist ));
22122de962bdSlukem 
22132de962bdSlukem LDAP_F( int )
22142de962bdSlukem ldap_create_sort_control_value LDAP_P((
22152de962bdSlukem 	LDAP *ld,
22162de962bdSlukem 	LDAPSortKey **keyList,
22172de962bdSlukem 	struct berval *value ));
22182de962bdSlukem 
22192de962bdSlukem LDAP_F( int )
22202de962bdSlukem ldap_create_sort_control LDAP_P((
22212de962bdSlukem 	LDAP *ld,
22222de962bdSlukem 	LDAPSortKey **keyList,
22232de962bdSlukem 	int iscritical,
22242de962bdSlukem 	LDAPControl **ctrlp ));
22252de962bdSlukem 
22262de962bdSlukem LDAP_F( int )
22272de962bdSlukem ldap_parse_sortresponse_control LDAP_P((
22282de962bdSlukem 	LDAP *ld,
22292de962bdSlukem 	LDAPControl *ctrl,
22302de962bdSlukem 	ber_int_t *result,
22312de962bdSlukem 	char **attribute ));
22322de962bdSlukem 
22332de962bdSlukem /*
22342de962bdSlukem  * LDAP Virtual List View
22352de962bdSlukem  *	in vlvctrl.c
22362de962bdSlukem  */
22372de962bdSlukem #define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 2000
22382de962bdSlukem 
22392de962bdSlukem /* structure for virtual list */
22402de962bdSlukem typedef struct ldapvlvinfo {
22412de962bdSlukem 	ber_int_t ldvlv_version;
22422de962bdSlukem     ber_int_t ldvlv_before_count;
22432de962bdSlukem     ber_int_t ldvlv_after_count;
22442de962bdSlukem     ber_int_t ldvlv_offset;
22452de962bdSlukem     ber_int_t ldvlv_count;
22462de962bdSlukem     struct berval *	ldvlv_attrvalue;
22472de962bdSlukem     struct berval *	ldvlv_context;
22482de962bdSlukem     void *			ldvlv_extradata;
22492de962bdSlukem } LDAPVLVInfo;
22502de962bdSlukem 
22512de962bdSlukem LDAP_F( int )
22522de962bdSlukem ldap_create_vlv_control_value LDAP_P((
22532de962bdSlukem 	LDAP *ld,
22542de962bdSlukem 	LDAPVLVInfo *ldvlistp,
22552de962bdSlukem 	struct berval *value));
22562de962bdSlukem 
22572de962bdSlukem LDAP_F( int )
22582de962bdSlukem ldap_create_vlv_control LDAP_P((
22592de962bdSlukem 	LDAP *ld,
22602de962bdSlukem 	LDAPVLVInfo *ldvlistp,
22612de962bdSlukem 	LDAPControl **ctrlp ));
22622de962bdSlukem 
22632de962bdSlukem LDAP_F( int )
22642de962bdSlukem ldap_parse_vlvresponse_control LDAP_P((
22652de962bdSlukem 	LDAP          *ld,
22662de962bdSlukem 	LDAPControl   *ctrls,
22672de962bdSlukem 	ber_int_t *target_posp,
22682de962bdSlukem 	ber_int_t *list_countp,
22692de962bdSlukem 	struct berval **contextp,
22702de962bdSlukem 	int           *errcodep ));
22712de962bdSlukem 
22722de962bdSlukem /*
2273*cf1d77f7Schristos  * LDAP Verify Credentials
2274*cf1d77f7Schristos  */
2275*cf1d77f7Schristos #define LDAP_API_FEATURE_VERIFY_CREDENTIALS 1000
2276*cf1d77f7Schristos 
2277*cf1d77f7Schristos LDAP_F( int )
2278*cf1d77f7Schristos ldap_verify_credentials LDAP_P((
2279*cf1d77f7Schristos 	LDAP		*ld,
2280*cf1d77f7Schristos 	struct berval	*cookie,
2281*cf1d77f7Schristos 	LDAP_CONST char	*dn,
2282*cf1d77f7Schristos 	LDAP_CONST char	*mechanism,
2283*cf1d77f7Schristos 	struct berval	*cred,
2284*cf1d77f7Schristos 	LDAPControl	**ctrls,
2285*cf1d77f7Schristos 	LDAPControl	**serverctrls,
2286*cf1d77f7Schristos 	LDAPControl	**clientctrls,
2287*cf1d77f7Schristos 	int		*msgidp ));
2288*cf1d77f7Schristos 
2289*cf1d77f7Schristos LDAP_F( int )
2290*cf1d77f7Schristos ldap_verify_credentials_s LDAP_P((
2291*cf1d77f7Schristos 	LDAP		*ld,
2292*cf1d77f7Schristos 	struct berval	*cookie,
2293*cf1d77f7Schristos 	LDAP_CONST char	*dn,
2294*cf1d77f7Schristos 	LDAP_CONST char	*mechanism,
2295*cf1d77f7Schristos 	struct berval	*cred,
2296*cf1d77f7Schristos 	LDAPControl	**vcictrls,
2297*cf1d77f7Schristos 	LDAPControl	**serverctrls,
2298*cf1d77f7Schristos 	LDAPControl	**clientctrls,
2299*cf1d77f7Schristos 	int				*code,
2300*cf1d77f7Schristos 	char			**diagmsgp,
2301*cf1d77f7Schristos 	struct berval	**scookie,
2302*cf1d77f7Schristos 	struct berval	**servercredp,
2303*cf1d77f7Schristos 	LDAPControl	***vcoctrls));
2304*cf1d77f7Schristos 
2305*cf1d77f7Schristos 
2306*cf1d77f7Schristos LDAP_F( int )
2307*cf1d77f7Schristos ldap_parse_verify_credentials LDAP_P((
2308*cf1d77f7Schristos 	LDAP		*ld,
2309*cf1d77f7Schristos 	LDAPMessage	*res,
2310*cf1d77f7Schristos 	int			*code,
2311*cf1d77f7Schristos 	char			**diagmsgp,
2312*cf1d77f7Schristos 	struct berval	**cookie,
2313*cf1d77f7Schristos 	struct berval	**servercredp,
2314*cf1d77f7Schristos 	LDAPControl	***vcctrls));
2315*cf1d77f7Schristos 
2316*cf1d77f7Schristos /* not yet implemented */
2317*cf1d77f7Schristos /* #define LDAP_API_FEATURE_VERIFY_CREDENTIALS_INTERACTIVE 1000 */
2318*cf1d77f7Schristos #ifdef LDAP_API_FEATURE_VERIFY_CREDENTIALS_INTERACTIVE
2319*cf1d77f7Schristos LDAP_F( int )
2320*cf1d77f7Schristos ldap_verify_credentials_interactive LDAP_P((
2321*cf1d77f7Schristos 	LDAP *ld,
2322*cf1d77f7Schristos 	LDAP_CONST char *dn, /* usually NULL */
2323*cf1d77f7Schristos 	LDAP_CONST char *saslMechanism,
2324*cf1d77f7Schristos 	LDAPControl **vcControls,
2325*cf1d77f7Schristos 	LDAPControl **serverControls,
2326*cf1d77f7Schristos 	LDAPControl **clientControls,
2327*cf1d77f7Schristos 
2328*cf1d77f7Schristos 	/* should be client controls */
2329*cf1d77f7Schristos 	unsigned flags,
2330*cf1d77f7Schristos 	LDAP_SASL_INTERACT_PROC *proc,
2331*cf1d77f7Schristos 	void *defaults,
2332*cf1d77f7Schristos 	void *context,
2333*cf1d77f7Schristos 
2334*cf1d77f7Schristos 	/* as obtained from ldap_result() */
2335*cf1d77f7Schristos 	LDAPMessage *result,
2336*cf1d77f7Schristos 
2337*cf1d77f7Schristos 	/* returned during bind processing */
2338*cf1d77f7Schristos 	const char **rmech,
2339*cf1d77f7Schristos 	int *msgid ));
2340*cf1d77f7Schristos #endif
2341*cf1d77f7Schristos 
2342*cf1d77f7Schristos /*
23432de962bdSlukem  * LDAP Who Am I?
23442de962bdSlukem  *	in whoami.c
23452de962bdSlukem  */
23462de962bdSlukem #define LDAP_API_FEATURE_WHOAMI 1000
23472de962bdSlukem 
23482de962bdSlukem LDAP_F( int )
23492de962bdSlukem ldap_parse_whoami LDAP_P((
23502de962bdSlukem 	LDAP *ld,
23512de962bdSlukem 	LDAPMessage *res,
23522de962bdSlukem 	struct berval **authzid ));
23532de962bdSlukem 
23542de962bdSlukem LDAP_F( int )
23552de962bdSlukem ldap_whoami LDAP_P(( LDAP *ld,
23562de962bdSlukem 	LDAPControl		**sctrls,
23572de962bdSlukem 	LDAPControl		**cctrls,
23582de962bdSlukem 	int				*msgidp ));
23592de962bdSlukem 
23602de962bdSlukem LDAP_F( int )
23612de962bdSlukem ldap_whoami_s LDAP_P((
23622de962bdSlukem 	LDAP *ld,
23632de962bdSlukem 	struct berval **authzid,
23642de962bdSlukem 	LDAPControl **sctrls,
23652de962bdSlukem 	LDAPControl **cctrls ));
23662de962bdSlukem 
23672de962bdSlukem /*
23682de962bdSlukem  * LDAP Password Modify
23692de962bdSlukem  *	in passwd.c
23702de962bdSlukem  */
23712de962bdSlukem #define LDAP_API_FEATURE_PASSWD_MODIFY 1000
23722de962bdSlukem 
23732de962bdSlukem LDAP_F( int )
23742de962bdSlukem ldap_parse_passwd LDAP_P((
23752de962bdSlukem 	LDAP *ld,
23762de962bdSlukem 	LDAPMessage *res,
23772de962bdSlukem 	struct berval *newpasswd ));
23782de962bdSlukem 
23792de962bdSlukem LDAP_F( int )
23802de962bdSlukem ldap_passwd LDAP_P(( LDAP *ld,
23812de962bdSlukem 	struct berval	*user,
23822de962bdSlukem 	struct berval	*oldpw,
23832de962bdSlukem 	struct berval	*newpw,
23842de962bdSlukem 	LDAPControl		**sctrls,
23852de962bdSlukem 	LDAPControl		**cctrls,
23862de962bdSlukem 	int				*msgidp ));
23872de962bdSlukem 
23882de962bdSlukem LDAP_F( int )
23892de962bdSlukem ldap_passwd_s LDAP_P((
23902de962bdSlukem 	LDAP *ld,
23912de962bdSlukem 	struct berval	*user,
23922de962bdSlukem 	struct berval	*oldpw,
23932de962bdSlukem 	struct berval	*newpw,
23942de962bdSlukem 	struct berval *newpasswd,
23952de962bdSlukem 	LDAPControl **sctrls,
23962de962bdSlukem 	LDAPControl **cctrls ));
23972de962bdSlukem 
23982de962bdSlukem #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
23992de962bdSlukem /*
24002de962bdSlukem  * LDAP Password Policy controls
24012de962bdSlukem  *	in ppolicy.c
24022de962bdSlukem  */
24032de962bdSlukem #define LDAP_API_FEATURE_PASSWORD_POLICY 1000
24042de962bdSlukem 
24052de962bdSlukem typedef enum passpolicyerror_enum {
24062de962bdSlukem        PP_passwordExpired = 0,
24072de962bdSlukem        PP_accountLocked = 1,
24082de962bdSlukem        PP_changeAfterReset = 2,
24092de962bdSlukem        PP_passwordModNotAllowed = 3,
24102de962bdSlukem        PP_mustSupplyOldPassword = 4,
24112de962bdSlukem        PP_insufficientPasswordQuality = 5,
24122de962bdSlukem        PP_passwordTooShort = 6,
24132de962bdSlukem        PP_passwordTooYoung = 7,
24142de962bdSlukem        PP_passwordInHistory = 8,
2415*cf1d77f7Schristos        PP_passwordTooLong = 9,
24162de962bdSlukem        PP_noError = 65535
24172de962bdSlukem } LDAPPasswordPolicyError;
24182de962bdSlukem 
24192de962bdSlukem LDAP_F( int )
24202de962bdSlukem ldap_create_passwordpolicy_control LDAP_P((
24212de962bdSlukem         LDAP *ld,
24222de962bdSlukem         LDAPControl **ctrlp ));
24232de962bdSlukem 
24242de962bdSlukem LDAP_F( int )
24252de962bdSlukem ldap_parse_passwordpolicy_control LDAP_P((
24262de962bdSlukem         LDAP *ld,
24272de962bdSlukem         LDAPControl *ctrl,
24282de962bdSlukem         ber_int_t *expirep,
24292de962bdSlukem         ber_int_t *gracep,
24302de962bdSlukem         LDAPPasswordPolicyError *errorp ));
24312de962bdSlukem 
24322de962bdSlukem LDAP_F( const char * )
24332de962bdSlukem ldap_passwordpolicy_err2txt LDAP_P(( LDAPPasswordPolicyError ));
24342de962bdSlukem #endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */
24352de962bdSlukem 
2436*cf1d77f7Schristos LDAP_F( int )
2437*cf1d77f7Schristos ldap_parse_password_expiring_control LDAP_P((
2438*cf1d77f7Schristos 	LDAP           *ld,
2439*cf1d77f7Schristos 	LDAPControl    *ctrl,
2440*cf1d77f7Schristos 	long           *secondsp ));
2441*cf1d77f7Schristos 
24422de962bdSlukem /*
24432de962bdSlukem  * LDAP Dynamic Directory Services Refresh -- RFC 2589
24442de962bdSlukem  *	in dds.c
24452de962bdSlukem  */
24462de962bdSlukem #define LDAP_API_FEATURE_REFRESH 1000
24472de962bdSlukem 
24482de962bdSlukem LDAP_F( int )
24492de962bdSlukem ldap_parse_refresh LDAP_P((
24502de962bdSlukem 	LDAP *ld,
24512de962bdSlukem 	LDAPMessage *res,
24522de962bdSlukem 	ber_int_t *newttl ));
24532de962bdSlukem 
24542de962bdSlukem LDAP_F( int )
24552de962bdSlukem ldap_refresh LDAP_P(( LDAP *ld,
24562de962bdSlukem 	struct berval	*dn,
24572de962bdSlukem 	ber_int_t ttl,
24582de962bdSlukem 	LDAPControl		**sctrls,
24592de962bdSlukem 	LDAPControl		**cctrls,
24602de962bdSlukem 	int				*msgidp ));
24612de962bdSlukem 
24622de962bdSlukem LDAP_F( int )
24632de962bdSlukem ldap_refresh_s LDAP_P((
24642de962bdSlukem 	LDAP *ld,
24652de962bdSlukem 	struct berval	*dn,
24662de962bdSlukem 	ber_int_t ttl,
24672de962bdSlukem 	ber_int_t *newttl,
24682de962bdSlukem 	LDAPControl **sctrls,
24692de962bdSlukem 	LDAPControl **cctrls ));
24702de962bdSlukem 
24712de962bdSlukem /*
24722de962bdSlukem  * LDAP Transactions
24732de962bdSlukem  */
24742de962bdSlukem LDAP_F( int )
24752de962bdSlukem ldap_txn_start LDAP_P(( LDAP *ld,
24762de962bdSlukem 	LDAPControl		**sctrls,
24772de962bdSlukem 	LDAPControl		**cctrls,
24782de962bdSlukem 	int				*msgidp ));
24792de962bdSlukem 
24802de962bdSlukem LDAP_F( int )
24812de962bdSlukem ldap_txn_start_s LDAP_P(( LDAP *ld,
24822de962bdSlukem 	LDAPControl **sctrl,
24832de962bdSlukem 	LDAPControl **cctrl,
24842de962bdSlukem 	struct berval **rettxnid ));
24852de962bdSlukem 
24862de962bdSlukem LDAP_F( int )
24872de962bdSlukem ldap_txn_end LDAP_P(( LDAP *ld,
24882de962bdSlukem 	int	commit,
24892de962bdSlukem 	struct berval	*txnid,
24902de962bdSlukem 	LDAPControl		**sctrls,
24912de962bdSlukem 	LDAPControl		**cctrls,
24922de962bdSlukem 	int				*msgidp ));
24932de962bdSlukem 
24942de962bdSlukem LDAP_F( int )
24952de962bdSlukem ldap_txn_end_s LDAP_P(( LDAP *ld,
24962de962bdSlukem 	int	commit,
24972de962bdSlukem 	struct berval *txnid,
24982de962bdSlukem 	LDAPControl **sctrl,
24992de962bdSlukem 	LDAPControl **cctrl,
25002de962bdSlukem 	int *retidp ));
25012de962bdSlukem 
25022de962bdSlukem /*
25032de962bdSlukem  * in ldap_sync.c
25042de962bdSlukem  */
25052de962bdSlukem 
25062de962bdSlukem /*
25072de962bdSlukem  * initialize the persistent search structure
25082de962bdSlukem  */
25092de962bdSlukem LDAP_F( ldap_sync_t * )
25102de962bdSlukem ldap_sync_initialize LDAP_P((
25112de962bdSlukem 	ldap_sync_t	*ls ));
25122de962bdSlukem 
25132de962bdSlukem /*
25142de962bdSlukem  * destroy the persistent search structure
25152de962bdSlukem  */
25162de962bdSlukem LDAP_F( void )
25172de962bdSlukem ldap_sync_destroy LDAP_P((
25182de962bdSlukem 	ldap_sync_t	*ls,
25192de962bdSlukem 	int		freeit ));
25202de962bdSlukem 
25212de962bdSlukem /*
25222de962bdSlukem  * initialize a refreshOnly sync
25232de962bdSlukem  */
25242de962bdSlukem LDAP_F( int )
25252de962bdSlukem ldap_sync_init LDAP_P((
25262de962bdSlukem 	ldap_sync_t	*ls,
25272de962bdSlukem 	int		mode ));
25282de962bdSlukem 
25292de962bdSlukem /*
25302de962bdSlukem  * initialize a refreshOnly sync
25312de962bdSlukem  */
25322de962bdSlukem LDAP_F( int )
25332de962bdSlukem ldap_sync_init_refresh_only LDAP_P((
25342de962bdSlukem 	ldap_sync_t	*ls ));
25352de962bdSlukem 
25362de962bdSlukem /*
25372de962bdSlukem  * initialize a refreshAndPersist sync
25382de962bdSlukem  */
25392de962bdSlukem LDAP_F( int )
25402de962bdSlukem ldap_sync_init_refresh_and_persist LDAP_P((
25412de962bdSlukem 	ldap_sync_t	*ls ));
25422de962bdSlukem 
25432de962bdSlukem /*
25442de962bdSlukem  * poll for new responses
25452de962bdSlukem  */
25462de962bdSlukem LDAP_F( int )
25472de962bdSlukem ldap_sync_poll LDAP_P((
25482de962bdSlukem 	ldap_sync_t	*ls ));
25492de962bdSlukem 
25502de962bdSlukem #ifdef LDAP_CONTROL_X_SESSION_TRACKING
25512de962bdSlukem 
25522de962bdSlukem /*
25532de962bdSlukem  * in stctrl.c
25542de962bdSlukem  */
25552de962bdSlukem LDAP_F( int )
25562de962bdSlukem ldap_create_session_tracking_value LDAP_P((
25572de962bdSlukem 	LDAP		*ld,
25582de962bdSlukem 	char		*sessionSourceIp,
25592de962bdSlukem 	char		*sessionSourceName,
25602de962bdSlukem 	char		*formatOID,
25612de962bdSlukem 	struct berval	*sessionTrackingIdentifier,
25622de962bdSlukem 	struct berval	*value ));
25632de962bdSlukem 
25642de962bdSlukem LDAP_F( int )
256533197c6aStron ldap_create_session_tracking_control LDAP_P((
25662de962bdSlukem 	LDAP		*ld,
25672de962bdSlukem 	char		*sessionSourceIp,
25682de962bdSlukem 	char		*sessionSourceName,
25692de962bdSlukem 	char		*formatOID,
25702de962bdSlukem 	struct berval	*sessionTrackingIdentifier,
25712de962bdSlukem 	LDAPControl	**ctrlp ));
25722de962bdSlukem 
25732de962bdSlukem LDAP_F( int )
25742de962bdSlukem ldap_parse_session_tracking_control LDAP_P((
25752de962bdSlukem 	LDAP *ld,
25762de962bdSlukem 	LDAPControl *ctrl,
25772de962bdSlukem 	struct berval *ip,
25782de962bdSlukem 	struct berval *name,
25792de962bdSlukem 	struct berval *oid,
25802de962bdSlukem 	struct berval *id ));
25812de962bdSlukem 
25822de962bdSlukem #endif /* LDAP_CONTROL_X_SESSION_TRACKING */
25832de962bdSlukem 
2584bb30016cSlukem /*
2585*cf1d77f7Schristos  * in msctrl.c
2586*cf1d77f7Schristos  */
2587*cf1d77f7Schristos #ifdef LDAP_CONTROL_X_DIRSYNC
2588*cf1d77f7Schristos LDAP_F( int )
2589*cf1d77f7Schristos ldap_create_dirsync_value LDAP_P((
2590*cf1d77f7Schristos 	LDAP		*ld,
2591*cf1d77f7Schristos 	int		flags,
2592*cf1d77f7Schristos 	int		maxAttrCount,
2593*cf1d77f7Schristos 	struct berval	*cookie,
2594*cf1d77f7Schristos 	struct berval	*value ));
2595*cf1d77f7Schristos 
2596*cf1d77f7Schristos LDAP_F( int )
2597*cf1d77f7Schristos ldap_create_dirsync_control LDAP_P((
2598*cf1d77f7Schristos 	LDAP		*ld,
2599*cf1d77f7Schristos 	int		flags,
2600*cf1d77f7Schristos 	int		maxAttrCount,
2601*cf1d77f7Schristos 	struct berval	*cookie,
2602*cf1d77f7Schristos 	LDAPControl	**ctrlp ));
2603*cf1d77f7Schristos 
2604*cf1d77f7Schristos LDAP_F( int )
2605*cf1d77f7Schristos ldap_parse_dirsync_control LDAP_P((
2606*cf1d77f7Schristos 	LDAP		*ld,
2607*cf1d77f7Schristos 	LDAPControl	*ctrl,
2608*cf1d77f7Schristos 	int		*continueFlag,
2609*cf1d77f7Schristos 	struct berval	*cookie ));
2610*cf1d77f7Schristos #endif /* LDAP_CONTROL_X_DIRSYNC */
2611*cf1d77f7Schristos 
2612*cf1d77f7Schristos #ifdef LDAP_CONTROL_X_EXTENDED_DN
2613*cf1d77f7Schristos LDAP_F( int )
2614*cf1d77f7Schristos ldap_create_extended_dn_value LDAP_P((
2615*cf1d77f7Schristos 	LDAP		*ld,
2616*cf1d77f7Schristos 	int		flag,
2617*cf1d77f7Schristos 	struct berval	*value ));
2618*cf1d77f7Schristos 
2619*cf1d77f7Schristos LDAP_F( int )
2620*cf1d77f7Schristos ldap_create_extended_dn_control LDAP_P((
2621*cf1d77f7Schristos 	LDAP		*ld,
2622*cf1d77f7Schristos 	int		flag,
2623*cf1d77f7Schristos 	LDAPControl	**ctrlp ));
2624*cf1d77f7Schristos #endif /* LDAP_CONTROL_X_EXTENDED_DN */
2625*cf1d77f7Schristos 
2626*cf1d77f7Schristos #ifdef LDAP_CONTROL_X_SHOW_DELETED
2627*cf1d77f7Schristos LDAP_F( int )
2628*cf1d77f7Schristos ldap_create_show_deleted_control LDAP_P((
2629*cf1d77f7Schristos 	LDAP		*ld,
2630*cf1d77f7Schristos 	LDAPControl	**ctrlp ));
2631*cf1d77f7Schristos #endif /* LDAP_CONTROL_X_SHOW_DELETED */
2632*cf1d77f7Schristos 
2633*cf1d77f7Schristos #ifdef LDAP_CONTROL_X_SERVER_NOTIFICATION
2634*cf1d77f7Schristos LDAP_F( int )
2635*cf1d77f7Schristos ldap_create_server_notification_control LDAP_P((
2636*cf1d77f7Schristos 	LDAP		*ld,
2637*cf1d77f7Schristos 	LDAPControl	**ctrlp ));
2638*cf1d77f7Schristos #endif /* LDAP_CONTROL_X_SERVER_NOTIFICATION */
2639*cf1d77f7Schristos 
2640*cf1d77f7Schristos /*
2641bb30016cSlukem  * in assertion.c
2642bb30016cSlukem  */
2643bb30016cSlukem LDAP_F (int)
2644bb30016cSlukem ldap_create_assertion_control_value LDAP_P((
2645bb30016cSlukem 	LDAP		*ld,
2646bb30016cSlukem 	char		*assertion,
2647bb30016cSlukem 	struct berval	*value ));
2648bb30016cSlukem 
2649bb30016cSlukem LDAP_F( int )
2650bb30016cSlukem ldap_create_assertion_control LDAP_P((
2651bb30016cSlukem 	LDAP		*ld,
2652bb30016cSlukem 	char		*filter,
2653bb30016cSlukem 	int		iscritical,
2654bb30016cSlukem 	LDAPControl	**ctrlp ));
2655bb30016cSlukem 
26564e6df137Slukem /*
26574e6df137Slukem  * in deref.c
26584e6df137Slukem  */
26594e6df137Slukem 
26604e6df137Slukem typedef struct LDAPDerefSpec {
26614e6df137Slukem 	char *derefAttr;
26624e6df137Slukem 	char **attributes;
26634e6df137Slukem } LDAPDerefSpec;
26644e6df137Slukem 
26654e6df137Slukem typedef struct LDAPDerefVal {
26664e6df137Slukem 	char *type;
26674e6df137Slukem 	BerVarray vals;
26684e6df137Slukem 	struct LDAPDerefVal *next;
26694e6df137Slukem } LDAPDerefVal;
26704e6df137Slukem 
26714e6df137Slukem typedef struct LDAPDerefRes {
26724e6df137Slukem 	char *derefAttr;
26734e6df137Slukem 	struct berval derefVal;
26744e6df137Slukem 	LDAPDerefVal *attrVals;
26754e6df137Slukem 	struct LDAPDerefRes *next;
26764e6df137Slukem } LDAPDerefRes;
26774e6df137Slukem 
26784e6df137Slukem LDAP_F( int )
26794e6df137Slukem ldap_create_deref_control_value LDAP_P((
26804e6df137Slukem 	LDAP *ld,
26814e6df137Slukem 	LDAPDerefSpec *ds,
26824e6df137Slukem 	struct berval *value ));
26834e6df137Slukem 
26844e6df137Slukem LDAP_F( int )
26854e6df137Slukem ldap_create_deref_control LDAP_P((
26864e6df137Slukem 	LDAP		*ld,
26874e6df137Slukem 	LDAPDerefSpec	*ds,
26884e6df137Slukem 	int		iscritical,
26894e6df137Slukem 	LDAPControl	**ctrlp ));
26904e6df137Slukem 
26914e6df137Slukem LDAP_F( void )
26924e6df137Slukem ldap_derefresponse_free LDAP_P((
26934e6df137Slukem 	LDAPDerefRes *dr ));
26944e6df137Slukem 
26954e6df137Slukem LDAP_F( int )
26964e6df137Slukem ldap_parse_derefresponse_control LDAP_P((
26974e6df137Slukem 	LDAP *ld,
26984e6df137Slukem 	LDAPControl *ctrl,
26994e6df137Slukem 	LDAPDerefRes **drp ));
27004e6df137Slukem 
27014e6df137Slukem LDAP_F( int )
27024e6df137Slukem ldap_parse_deref_control LDAP_P((
27034e6df137Slukem 	LDAP		*ld,
27044e6df137Slukem 	LDAPControl	**ctrls,
27054e6df137Slukem 	LDAPDerefRes	**drp ));
27064e6df137Slukem 
2707*cf1d77f7Schristos /*
2708*cf1d77f7Schristos  * in psearch.c
2709*cf1d77f7Schristos  */
2710*cf1d77f7Schristos 
2711*cf1d77f7Schristos LDAP_F( int )
2712*cf1d77f7Schristos ldap_create_persistentsearch_control_value LDAP_P((
2713*cf1d77f7Schristos 	LDAP *ld,
2714*cf1d77f7Schristos 	int changetypes,
2715*cf1d77f7Schristos 	int changesonly,
2716*cf1d77f7Schristos 	int return_echg_ctls,
2717*cf1d77f7Schristos 	struct berval *value ));
2718*cf1d77f7Schristos 
2719*cf1d77f7Schristos LDAP_F( int )
2720*cf1d77f7Schristos ldap_create_persistentsearch_control LDAP_P((
2721*cf1d77f7Schristos 	LDAP *ld,
2722*cf1d77f7Schristos 	int changetypes,
2723*cf1d77f7Schristos 	int changesonly,
2724*cf1d77f7Schristos 	int return_echg_ctls,
2725*cf1d77f7Schristos 	int isCritical,
2726*cf1d77f7Schristos 	LDAPControl **ctrlp ));
2727*cf1d77f7Schristos 
2728*cf1d77f7Schristos LDAP_F( int )
2729*cf1d77f7Schristos ldap_parse_entrychange_control LDAP_P((
2730*cf1d77f7Schristos 	LDAP *ld,
2731*cf1d77f7Schristos 	LDAPControl *ctrl,
2732*cf1d77f7Schristos 	int *chgtypep,
2733*cf1d77f7Schristos 	struct berval *prevdnp,
2734*cf1d77f7Schristos 	int *chgnumpresentp,
2735*cf1d77f7Schristos 	long *chgnump ));
2736*cf1d77f7Schristos 
2737*cf1d77f7Schristos /* in account_usability.c */
2738*cf1d77f7Schristos 
2739*cf1d77f7Schristos LDAP_F( int )
2740*cf1d77f7Schristos ldap_create_accountusability_control LDAP_P((
2741*cf1d77f7Schristos 	LDAP *ld,
2742*cf1d77f7Schristos 	LDAPControl **ctrlp ));
2743*cf1d77f7Schristos 
2744*cf1d77f7Schristos typedef struct LDAPAccountUsabilityMoreInfo {
2745*cf1d77f7Schristos 	ber_int_t inactive;
2746*cf1d77f7Schristos 	ber_int_t reset;
2747*cf1d77f7Schristos 	ber_int_t expired;
2748*cf1d77f7Schristos 	ber_int_t remaining_grace;
2749*cf1d77f7Schristos 	ber_int_t seconds_before_unlock;
2750*cf1d77f7Schristos } LDAPAccountUsabilityMoreInfo;
2751*cf1d77f7Schristos 
2752*cf1d77f7Schristos typedef union LDAPAccountUsability {
2753*cf1d77f7Schristos 	ber_int_t seconds_remaining;
2754*cf1d77f7Schristos 	LDAPAccountUsabilityMoreInfo more_info;
2755*cf1d77f7Schristos } LDAPAccountUsability;
2756*cf1d77f7Schristos 
2757*cf1d77f7Schristos LDAP_F( int )
2758*cf1d77f7Schristos ldap_parse_accountusability_control LDAP_P((
2759*cf1d77f7Schristos 	LDAP           *ld,
2760*cf1d77f7Schristos 	LDAPControl    *ctrl,
2761*cf1d77f7Schristos 	int            *availablep,
2762*cf1d77f7Schristos 	LDAPAccountUsability *usabilityp ));
2763*cf1d77f7Schristos 
2764*cf1d77f7Schristos 
2765*cf1d77f7Schristos /*
2766*cf1d77f7Schristos  * high level LDIF to LDAP structure support
2767*cf1d77f7Schristos  */
2768*cf1d77f7Schristos #define LDIF_DEFAULT_ADD  0x01 /* if changetype missing, assume LDAP_ADD */
2769*cf1d77f7Schristos #define LDIF_ENTRIES_ONLY 0x02 /* ignore changetypes other than add */
2770*cf1d77f7Schristos #define LDIF_NO_CONTROLS  0x04 /* ignore control specifications */
2771*cf1d77f7Schristos #define LDIF_MODS_ONLY    0x08 /* no changetypes, assume LDAP_MODIFY */
2772*cf1d77f7Schristos #define LDIF_NO_DN        0x10 /* dn is not present */
2773*cf1d77f7Schristos 
2774*cf1d77f7Schristos typedef struct ldifrecord {
2775*cf1d77f7Schristos 	ber_tag_t lr_op; /* type of operation - LDAP_REQ_MODIFY, LDAP_REQ_ADD, etc. */
2776*cf1d77f7Schristos 	struct berval lr_dn; /* DN of operation */
2777*cf1d77f7Schristos 	LDAPControl **lr_ctrls; /* controls specified for operation */
2778*cf1d77f7Schristos 	/* some ops such as LDAP_REQ_DELETE require only a DN */
2779*cf1d77f7Schristos 	/* other ops require different data - the ldif_ops union
2780*cf1d77f7Schristos 	   is used to specify the data for each type of operation */
2781*cf1d77f7Schristos 	union ldif_ops_u {
2782*cf1d77f7Schristos 		LDAPMod **lr_mods; /* list of mods for LDAP_REQ_MODIFY, LDAP_REQ_ADD */
2783*cf1d77f7Schristos #define lrop_mods ldif_ops.lr_mods
2784*cf1d77f7Schristos 		struct ldif_op_rename_s {
2785*cf1d77f7Schristos 			struct berval lr_newrdn; /* LDAP_REQ_MODDN, LDAP_REQ_MODRDN, LDAP_REQ_RENAME */
2786*cf1d77f7Schristos #define lrop_newrdn ldif_ops.ldif_op_rename.lr_newrdn
2787*cf1d77f7Schristos 			struct berval lr_newsuperior; /* LDAP_REQ_MODDN, LDAP_REQ_MODRDN, LDAP_REQ_RENAME */
2788*cf1d77f7Schristos #define lrop_newsup ldif_ops.ldif_op_rename.lr_newsuperior
2789*cf1d77f7Schristos 			int lr_deleteoldrdn; /* LDAP_REQ_MODDN, LDAP_REQ_MODRDN, LDAP_REQ_RENAME */
2790*cf1d77f7Schristos #define lrop_delold ldif_ops.ldif_op_rename.lr_deleteoldrdn
2791*cf1d77f7Schristos 		} ldif_op_rename; /* rename/moddn/modrdn */
2792*cf1d77f7Schristos 		/* the following are for future support */
2793*cf1d77f7Schristos 		struct ldif_op_ext_s {
2794*cf1d77f7Schristos 			struct berval lr_extop_oid; /* LDAP_REQ_EXTENDED */
2795*cf1d77f7Schristos #define lrop_extop_oid ldif_ops.ldif_op_ext.lr_extop_oid
2796*cf1d77f7Schristos 			struct berval lr_extop_data; /* LDAP_REQ_EXTENDED */
2797*cf1d77f7Schristos #define lrop_extop_data ldif_ops.ldif_op_ext.lr_extop_data
2798*cf1d77f7Schristos 		} ldif_op_ext; /* extended operation */
2799*cf1d77f7Schristos 		struct ldif_op_cmp_s {
2800*cf1d77f7Schristos 			struct berval lr_cmp_attr; /* LDAP_REQ_COMPARE */
2801*cf1d77f7Schristos #define lrop_cmp_attr ldif_ops.ldif_op_cmp.lr_cmp_attr
2802*cf1d77f7Schristos 			struct berval lr_cmp_bvalue; /* LDAP_REQ_COMPARE */
2803*cf1d77f7Schristos #define lrop_cmp_bval ldif_ops.ldif_op_cmp.lr_cmp_bvalue
2804*cf1d77f7Schristos 		} ldif_op_cmp; /* compare operation */
2805*cf1d77f7Schristos 	} ldif_ops;
2806*cf1d77f7Schristos 	/* PRIVATE STUFF - DO NOT TOUCH */
2807*cf1d77f7Schristos 	/* for efficiency, the implementation allocates memory */
2808*cf1d77f7Schristos 	/* in large blobs, and makes the above fields point to */
2809*cf1d77f7Schristos 	/* locations inside those blobs - one consequence is that */
2810*cf1d77f7Schristos 	/* you cannot simply free the above allocated fields, nor */
2811*cf1d77f7Schristos 	/* assign them to be owned by another memory context which */
2812*cf1d77f7Schristos 	/* might free them (unless providing your own mem ctx) */
2813*cf1d77f7Schristos 	/* we use the fields below to keep track of those blobs */
2814*cf1d77f7Schristos 	/* so we that we can free them later */
2815*cf1d77f7Schristos 	void *lr_ctx; /* the memory context or NULL */
2816*cf1d77f7Schristos 	int lr_lines;
2817*cf1d77f7Schristos 	LDAPMod	*lr_lm;
2818*cf1d77f7Schristos 	unsigned char *lr_mops;
2819*cf1d77f7Schristos 	char *lr_freeval;
2820*cf1d77f7Schristos 	struct berval *lr_vals;
2821*cf1d77f7Schristos 	struct berval *lr_btype;
2822*cf1d77f7Schristos } LDIFRecord;
2823*cf1d77f7Schristos 
2824*cf1d77f7Schristos /* free internal fields - does not free the LDIFRecord */
2825*cf1d77f7Schristos LDAP_F( void )
2826*cf1d77f7Schristos ldap_ldif_record_done LDAP_P((
2827*cf1d77f7Schristos 	LDIFRecord *lr ));
2828*cf1d77f7Schristos 
2829*cf1d77f7Schristos LDAP_F( int )
2830*cf1d77f7Schristos ldap_parse_ldif_record LDAP_P((
2831*cf1d77f7Schristos 	struct berval *rbuf,
2832*cf1d77f7Schristos 	unsigned long linenum,
2833*cf1d77f7Schristos 	LDIFRecord *lr,
2834*cf1d77f7Schristos 	const char *errstr,
2835*cf1d77f7Schristos 	unsigned int flags ));
2836*cf1d77f7Schristos 
28372de962bdSlukem LDAP_END_DECL
28382de962bdSlukem #endif /* _LDAP_H */
2839