]> git.sur5r.net Git - openldap/blobdiff - contrib/ldapc++/src/LDAPConnection.h
Merge remote branch 'origin/mdb.master'
[openldap] / contrib / ldapc++ / src / LDAPConnection.h
index 7016665fe325328ff7cf021f2686c267df1f12b5..5428e8e230b6ac9efe302068b322b4bcba82bf15 100644 (file)
@@ -1,5 +1,6 @@
+// $OpenLDAP$
 /*
- * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -47,7 +48,7 @@ class LDAPConnection : private LDAPAsynConnection {
          * @param cons Default constraints to use with operations over 
          *      this connection
          */
-        LDAPConnection(const string& hostname="localhost", int port=389,
+        LDAPConnection(const std::string& hostname="localhost", int port=389,
                 LDAPConstraints* cons=new LDAPConstraints());
         
         /**
@@ -66,8 +67,17 @@ class LDAPConnection : private LDAPAsynConnection {
          *             LDAP-Server
          * @param port      The Network Port the server is running on
          */
-        void init(const string& hostname, int port);
+        void init(const std::string& hostname, int port);
         
+        /**
+         * Start TLS on this connection.  This isn't in the constructor,
+         * because it could fail (i.e. server doesn't have SSL cert, client
+         * api wasn't compiled against OpenSSL, etc.). 
+         * @throws LDAPException if the TLS Layer could not be setup 
+         * correctly
+         */
+        void start_tls();
+
         /** 
          * Performs a simple authentication with the server
          *
@@ -77,8 +87,12 @@ class LDAPConnection : private LDAPAsynConnection {
          * @param dn    The name of the entry to bind as
          * @param passwd    The cleartext password for the entry
          */
-        void bind(const string& dn="", const string& passwd="",
+        void bind(const std::string& dn="", const std::string& passwd="",
                 LDAPConstraints* cons=0);
+        void saslInteractiveBind(const std::string& mech,
+                int flags=0,
+                SaslInteractionHandler *sih=0,
+                const LDAPConstraints *cons=0);
         
         /**
          * Performs the UNBIND-operation on the destination server
@@ -104,7 +118,7 @@ class LDAPConnection : private LDAPAsynConnection {
          *      attr-parameter matched an Attribute of the entry. false if it
          *      did not match
          */
-        bool compare(const string& dn, const LDAPAttribute& attr,
+        bool compare(const std::string& dn, const LDAPAttribute& attr,
                 LDAPConstraints* cons=0);
        
         /**
@@ -118,7 +132,7 @@ class LDAPConnection : private LDAPAsynConnection {
          * @param cons  A set of constraints that should be used with this
          *              request
          */
-        void del(const string& dn, const LDAPConstraints* cons=0);
+        void del(const std::string& dn, const LDAPConstraints* cons=0);
         
         /**
          * Use this method to perform the ADD-operation
@@ -143,7 +157,7 @@ class LDAPConnection : private LDAPAsynConnection {
          * @param cons  A set of constraints that should be used with this
          *              request
          */
-        void modify(const string& dn, const LDAPModList* mods, 
+        void modify(const std::string& dn, const LDAPModList* mods, 
                 const LDAPConstraints* cons=0); 
 
         /**
@@ -166,8 +180,8 @@ class LDAPConnection : private LDAPAsynConnection {
          * @param cons  A set of constraints that should be used with this
          *              request
          */
-        void rename(const string& dn, const string& newRDN, 
-                bool delOldRDN=false, const string& newParentDN="",
+        void rename(const std::string& dn, const std::string& newRDN, 
+                bool delOldRDN=false, const std::string& newParentDN="",
                 const LDAPConstraints* cons=0);
         
         /**
@@ -182,7 +196,7 @@ class LDAPConnection : private LDAPAsynConnection {
          *      LDAPAsynConnection::SEARCH_BASE, <BR> 
          *      LDAPAsynConnection::SEARCH_ONE, <BR>
          *      LDAPAsynConnection::SEARCH_SUB
-         * @param filter The string representation of a search filter to
+         * @param filter The std::string representation of a search filter to
          *      use with this operation
          * @param attrsOnly true if only the attributes names (no values) 
          *      should be returned
@@ -191,8 +205,8 @@ class LDAPConnection : private LDAPAsynConnection {
          * @returns A pointer to a LDAPSearchResults-object that can be
          *      used to read the results of the search.
          */
-        LDAPSearchResults* search(const string& base, int scope=0, 
-                const string& filter="objectClass=*", 
+        LDAPSearchResults* search(const std::string& base, int scope=0, 
+                const std::string& filter="objectClass=*", 
                 const StringList& attrs=StringList(), bool attrsOnly=false,
                 const LDAPConstraints* cons=0);
        
@@ -211,16 +225,17 @@ class LDAPConnection : private LDAPAsynConnection {
          * @returns The result of the Extended Operation as an
          *      pointer to a LDAPExtResult-object.
          */
-        LDAPExtResult* extOperation(const string& oid, const string&
+        LDAPExtResult* extOperation(const std::string& oid, const std::string&
                 value="", const LDAPConstraints *const = 0);
         
-        const string& getHost() const;
+        const std::string& getHost() const;
 
         int getPort() const;
         
         void setConstraints(LDAPConstraints *cons);
         
         const LDAPConstraints* getConstraints() const ;
+        TlsOptions getTlsOptions() const;
 };
 
 #endif //LDAP_CONNECTION_H