]> git.sur5r.net Git - openldap/blobdiff - contrib/ldapc++/src/LDAPConnection.h
Happy New Year
[openldap] / contrib / ldapc++ / src / LDAPConnection.h
index 0be90837c420284a9b4a9e2cab3237ef805ab2dd..551fb0acb8fd95bc753c2ffd20f2c20aa6f97b3c 100644 (file)
@@ -1,5 +1,6 @@
+// $OpenLDAP$
 /*
- * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2013 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,15 +67,16 @@ 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.).  If you need TLS,
-         * then you should error if this call fails with an error code.
+         * api wasn't compiled against OpenSSL, etc.). 
+         * @throws LDAPException if the TLS Layer could not be setup 
+         * correctly
          */
-        int start_tls();
+        void start_tls();
 
         /** 
          * Performs a simple authentication with the server
@@ -85,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
@@ -112,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);
        
         /**
@@ -126,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
@@ -151,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); 
 
         /**
@@ -174,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);
         
         /**
@@ -190,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
@@ -199,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);
        
@@ -219,32 +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 ;
-
-        /**
-         * Turn on caching, maxmem is in MB and timeout is in seconds.
-         * maxmem can be zero if you want to restrict caching by timeout only.
-         */
-        int enableCache(long timeout, long maxmem);
-        /// disable caching.
-        void disableCache();
-        /// is cacheEnabled?
-        bool getCacheEnabled();
-        /// uncache a specific dn.  Used internally by methods that write.
-        void uncache_entry(string &dn);
-        /// used to clear the cache.  Probably should be used after creating
-        /// an object that a cached search should find.
-        void flush_cache();
-
+        TlsOptions getTlsOptions() const;
 };
 
 #endif //LDAP_CONNECTION_H