LDAPAsynConnection.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
00003  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
00004  */
00005 
00006 
00007 #ifndef LDAP_ASYN_CONNECTION_H
00008 #define LDAP_ASYN_CONNECTION_H
00009 
00010 #include<iostream>
00011 #include<string>
00012 
00013 #include<ldap.h>
00014 #include<lber.h>
00015 
00016 #include <LDAPMessageQueue.h>
00017 #include <LDAPConstraints.h>
00018 #include <LDAPModification.h>
00019 #include <LDAPModList.h>
00020 #include <LDAPUrl.h>
00021 #include <LDAPUrlList.h>
00022 
00023 class LDAPEntry;
00024 class LDAPAttribute;
00025 
00026 //* Main class for an asynchronous LDAP connection 
00044 class LDAPAsynConnection{
00045     public :
00050         static const int SEARCH_BASE=0;
00051         
00056         static const int SEARCH_ONE=1;
00057         
00062         static const int SEARCH_SUB=2;
00063 //        static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
00064 //        static const int SEARCH_ONE=LDAP_SCOPE_ONELEVEL;
00065 //        static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
00066 
00073         LDAPAsynConnection(const std::string& hostname=std::string("localhost"),
00074                 int port=0, LDAPConstraints *cons=new LDAPConstraints() );
00075 
00076         //* Destructor
00077         virtual ~LDAPAsynConnection();
00078 
00090         void init(const std::string& hostname, int port);
00091 
00099         void start_tls();
00100 
00111         LDAPMessageQueue* bind(const std::string& dn="", const std::string& passwd="",
00112                 const LDAPConstraints *cons=0);
00113 
00133         LDAPMessageQueue* search(const std::string& base="", int scope=0, 
00134                                  const std::string& filter="objectClass=*", 
00135                                  const StringList& attrs=StringList(), 
00136                                  bool attrsOnly=false,
00137                                  const LDAPConstraints *cons=0);
00138         
00149         LDAPMessageQueue* del(const std::string& dn, const LDAPConstraints *cons=0);
00150         
00164         LDAPMessageQueue* compare(const std::string& dn, 
00165                 const LDAPAttribute& attr, 
00166                 const LDAPConstraints *cons=0);
00167 
00175         LDAPMessageQueue* add( const LDAPEntry* le,
00176                 const LDAPConstraints *const=0);
00177 
00189         LDAPMessageQueue* modify(const std::string& dn, 
00190                 const LDAPModList *modlist,
00191                 const LDAPConstraints *cons=0);
00192 
00207         LDAPMessageQueue* rename(const std::string& dn, 
00208                 const std::string& newRDN,
00209                 bool delOldRDN=false, const std::string& newParentDN="",
00210                 const LDAPConstraints* cons=0);
00211         
00223         LDAPMessageQueue* extOperation(const std::string& oid, 
00224                 const std::string& value="", const LDAPConstraints *cons=0);
00225         
00231         void abandon(LDAPMessageQueue *q);
00232         
00238         void unbind();
00239 
00244         LDAP* getSessionHandle() const ;
00245 
00250         const std::string& getHost() const;
00251 
00256         int getPort() const;
00257         
00262         void setConstraints(LDAPConstraints *cons);
00263         
00269         const LDAPConstraints* getConstraints() const;
00270 
00286         LDAPAsynConnection* referralConnect(const LDAPUrlList& urls,
00287                 LDAPUrlList::const_iterator& usedUrl,
00288                 const LDAPConstraints* cons) const;
00289 
00290     private :
00294         LDAPAsynConnection(const LDAPAsynConnection& lc){};
00295         
00300         LDAP *cur_session;
00301 
00307         LDAPConstraints *m_constr;
00308 
00312         std::string m_host;
00313 
00317         int m_port;
00318 
00319  protected:
00323         bool m_cacheEnabled;
00324 };
00325 #endif //LDAP_ASYN_CONNECTION_H
00326 
00327 

Generated on Fri Jun 16 17:48:53 2006 for ldapsdk by  doxygen 1.4.6