+// $OpenLDAP$
/*
- * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2011 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include<string>
#include<ldap.h>
-#include<lber.h>
#include <LDAPEntry.h>
#include <LDAPException.h>
#include <LDAPModList.h>
#include <LDAPUrl.h>
#include <LDAPUrlList.h>
+#include <SaslInteractionHandler.h>
+#include <TlsOptions.h>
//* Main class for an asynchronous LDAP connection
/**
* Search
*/
static const int SEARCH_SUB=2;
-// static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
-// static const int SEARCH_ONE=LDAP_SCOPE_ONELEVEL;
-// static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
/** Construtor that initializes a connection to a server
* @param hostname Name (or IP-Adress) of the destination host
* @param cons Default constraints to use with operations over
* this connection
*/
- LDAPAsynConnection(const std::string& hostname=std::string("localhost"),
+ LDAPAsynConnection(const std::string& url=std::string("localhost"),
int port=0, LDAPConstraints *cons=new LDAPConstraints() );
//* Destructor
virtual ~LDAPAsynConnection();
-
/**
* Initializes a connection to a server.
*
*/
void init(const std::string& hostname, int port);
+ /**
+ * Initializes a connection to a server.
+ *
+ * There actually no communication to the server. Just the
+ * object is initialized
+ * @param uri The LDAP-Uri for the destination
+ */
+ void initialize(const std::string& uri);
+
/**
* Start TLS on this connection. This isn't in the constructor,
* because it could fail (i.e. server doesn't have SSL cert, client
* @param dn the distiguished name to bind as
* @param passwd cleartext password to use
*/
- LDAPMessageQueue* bind(const std::string& dn="", const std::string& passwd="",
+ LDAPMessageQueue* bind(const std::string& dn="",
+ const std::string& passwd="",
+ const LDAPConstraints *cons=0);
+
+ LDAPMessageQueue* saslBind(const std::string& mech,
+ const std::string& cred,
+ const LDAPConstraints *cons=0);
+
+ LDAPMessageQueue* saslInteractiveBind(const std::string& mech,
+ int flags=0,
+ SaslInteractionHandler *sih=0,
const LDAPConstraints *cons=0);
/** Performing a search on a directory tree.
const StringList& attrs=StringList(),
bool attrsOnly=false,
const LDAPConstraints *cons=0);
-
+
/** Delete an entry from the directory
*
* This method sends a delete request to the server
* request
*/
LDAPMessageQueue* del(const std::string& dn, const LDAPConstraints *cons=0);
-
+
/**
* Perform the COMPARE-operation on an attribute
*
const std::string& newRDN,
bool delOldRDN=false, const std::string& newParentDN="",
const LDAPConstraints* cons=0);
-
+
/** Perform a LDAP extended Operation
*
* @throws LDAPException If the Request could not be sent to the
*/
LDAPMessageQueue* extOperation(const std::string& oid,
const std::string& value="", const LDAPConstraints *cons=0);
-
+
/** End an outstanding request
*
* @param q All outstanding request related to this LDAPMessageQueue
* will be abandoned
*/
void abandon(LDAPMessageQueue *q);
-
+
/**
* Performs the UNBIND-operation on the destination server
*
* the remote server.
*/
int getPort() const;
-
+
/** Change the default constraints of the connection
*
* @parameter cons cons New LDAPConstraints to use with the connection
*/
void setConstraints(LDAPConstraints *cons);
-
+
/** Get the default constraints of the connection
*
* @return Pointer to the LDAPConstraints-Object that is currently
* used with the Connection
*/
const LDAPConstraints* getConstraints() const;
-
+ TlsOptions getTlsOptions() const;
/**
* This method is used internally for automatic referral chasing.
* It tries to bind to a destination server of the URLs of a
* Private copy constructor. So nobody can call it.
*/
LDAPAsynConnection(const LDAPAsynConnection& lc){};
-
+
/**
* A pointer to the C-API LDAP-structure that is associated with
* this connection
LDAPConstraints *m_constr;
/**
- * The name of the destination host
- */
- std::string m_host;
-
- /**
- * The port the destination server is running on.
+ * The URI of this connection
*/
- int m_port;
+ LDAPUrl m_uri;
- protected:
+ protected:
/**
* Is caching enabled?
*/