00001 00009 #ifndef CSINGLETONLDAPCONNECTION_H_ 00010 #define CSINGLETONLDAPCONNECTION_H_ 00011 00012 //#include "stdafx.h" 00013 #include "PKIFdll.h" 00014 #include <string> 00015 #include <vector> 00016 00017 #ifdef _WIN32 00018 #include <winldap.h> 00019 #else 00020 #include "ldap.h" 00021 #endif 00022 00023 // #include "LDAP_URL_Header.h" 00024 // #include "ToolkitUtils.h" 00025 00026 class CLDAPConnectionInfo; 00027 00028 namespace PKIFLDAP { 00029 00030 void CAC_API AddBlacklistedServer(std::string& server, bool bPermanent = true); 00031 void CAC_API RemoveBlacklistedServer(std::string& server); 00032 bool CAC_API IsBlacklisted(std::string& server); 00033 void CAC_API ClearServerBlacklist(void); 00034 void CAC_API GetServerBlacklist(std::vector<std::string> & bl); 00035 00036 }; 00037 00043 class CSingletonLDAPConnection 00044 { 00045 public: 00046 static CSingletonLDAPConnection* Instance(); 00047 ~CSingletonLDAPConnection(); 00048 void PushConnection(std::string& host, int port, LDAP* ldap); 00049 LDAP* GetConnection(std::string& host, int port); 00050 static void CSingletonLDAPConnectionDestructor(); 00051 private: 00052 static CSingletonLDAPConnection* m_instance; 00053 CSingletonLDAPConnection(); 00054 std::vector<CLDAPConnectionInfo*> m_ldaps; 00055 }; 00056 00057 #endif //CSINGLETONLDAPCONNECTION_H_