00001 00010 #include "PKIFHttpCertNode.h" 00011 00012 #include "Certificate.h" 00013 #include "GottaMatch.h" 00014 #include "LDAP_URL_Header.h" 00015 #include "Name.h" 00016 #include "PKIFLDAPRepository.h" 00017 00018 using namespace std; 00019 00021 bool CAC_API RetrieveCertGivenHTTPURL(const char* url, CPKIFCertificateNodeList& certNodeList); //implemented in PKIFCRLDPRetrieval 00022 struct CPKIFHttpCertNodeImpl 00023 { 00024 CPKIFCertificateNodeList m_certNodeList; 00025 }; 00027 00034 CPKIFHttpCertNode::CPKIFHttpCertNode() 00035 : m_impl(new CPKIFHttpCertNodeImpl) 00036 { 00037 } 00045 CPKIFHttpCertNode::~CPKIFHttpCertNode() 00046 { 00047 if(m_impl) delete m_impl; 00048 } 00056 void CPKIFHttpCertNode::GetCertificates( 00058 CPKIFCertificateNodeList& certNodeList, 00060 PathBuildingDirection pbd) 00061 { 00062 if(m_impl->m_certNodeList.empty()) 00063 { 00064 vector<string> sources; 00065 GetSources(sources); 00066 vector<string>::iterator pos; 00067 vector<string>::iterator end = sources.end(); 00068 for(pos = sources.begin(); pos != end; ++pos) 00069 { 00070 if(0 == (*pos).find("http")) 00071 { 00072 RetrieveCertGivenHTTPURL((*pos).c_str(), m_impl->m_certNodeList); 00073 } 00074 } 00075 } 00076 if(!m_impl->m_certNodeList.empty()) 00077 { 00078 this->SetState(PAS_AVAILABLE); 00079 CPKIFCertificateNodeList::iterator pos; 00080 CPKIFCertificateNodeList::iterator end = m_impl->m_certNodeList.end(); 00081 for(pos = m_impl->m_certNodeList.begin(); pos != end; ++pos) 00082 { 00083 GottaMatch<CPKIFCertificateNodeEntryPtr> gm; 00084 gm.SetRHS(*pos); 00085 if(certNodeList.end() == find_if(certNodeList.begin(), certNodeList.end(), gm)) 00086 { 00087 (*pos)->SetState(PAS_AVAILABLE); 00088 certNodeList.push_back(*pos); 00089 } 00090 } 00091 } 00092 else 00093 { 00094 this->SetState(PAS_UNAVAILABLE); 00095 } 00096 }