Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

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=389, LDAPConstraints *cons=new LDAPConstraints() );
00075 
00076         //* Destructor
00077         virtual ~LDAPAsynConnection();
00078 
00090         void init(const std::string& hostname, int port);
00091 
00098         int start_tls();
00099 
00110         LDAPMessageQueue* bind(const std::string& dn="", const std::string& passwd="",
00111                 const LDAPConstraints *cons=0);
00112 
00132         LDAPMessageQueue* search(const std::string& base="", int scope=0, 
00133                                  const std::string& filter="objectClass=*", 
00134                                  const StringList& attrs=StringList(), 
00135                                  bool attrsOnly=false,
00136                                  const LDAPConstraints *cons=0);
00137         
00148         LDAPMessageQueue* del(const std::string& dn, const LDAPConstraints *cons=0);
00149         
00163         LDAPMessageQueue* compare(const std::string& dn, 
00164                 const LDAPAttribute& attr, 
00165                 const LDAPConstraints *cons=0);
00166 
00174         LDAPMessageQueue* add( const LDAPEntry* le,
00175                 const LDAPConstraints *const=0);
00176 
00188         LDAPMessageQueue* modify(const std::string& dn, 
00189                 const LDAPModList *modlist,
00190                 const LDAPConstraints *cons=0);
00191 
00206         LDAPMessageQueue* rename(const std::string& dn, 
00207                 const std::string& newRDN,
00208                 bool delOldRDN=false, const std::string& newParentDN="",
00209                 const LDAPConstraints* cons=0);
00210         
00222         LDAPMessageQueue* extOperation(const std::string& oid, 
00223                 const std::string& value="", const LDAPConstraints *cons=0);
00224         
00230         void abandon(LDAPMessageQueue *q);
00231         
00237         void unbind();
00238 
00243         LDAP* getSessionHandle() const ;
00244 
00249         const std::string& getHost() const;
00250 
00255         int getPort() const;
00256         
00261         void setConstraints(LDAPConstraints *cons);
00262         
00268         const LDAPConstraints* getConstraints() const;
00269 
00285         LDAPAsynConnection* referralConnect(const LDAPUrlList& urls,
00286                 LDAPUrlList::const_iterator& usedUrl,
00287                 const LDAPConstraints* cons) const;
00288 
00289     private :
00293         LDAPAsynConnection(const LDAPAsynConnection& lc){};
00294         
00299         LDAP *cur_session;
00300 
00306         LDAPConstraints *m_constr;
00307 
00311         std::string m_host;
00312 
00316         int m_port;
00317 
00318  protected:
00322         bool m_cacheEnabled;
00323 };
00324 #endif //LDAP_ASYN_CONNECTION_H
00325 
00326 

Generated on Wed Nov 12 02:19:03 2008 for ldapsdk by  doxygen 1.3.9.1