CACCertificateNodeEntry.cpp

Go to the documentation of this file.
00001 
00009 #include "PKIFCertificateNodeEntry.h"
00010 #include "ToolkitUtils.h"
00011 #include "Certificate.h"
00012 #include "PKIFCertStatus.h"
00013 #include "components.h"
00014 
00016 struct CPKIFCertificateNodeEntryImpl
00017 {
00018     CPKIFCertStatusPtr m_certStatus;
00019     CPKIFCertificatePtr m_cert;
00020     PKIInfoSource m_source;
00021     bool m_bIgnore;
00022     bool m_bNameIgnore;
00023     int m_score;
00024     std::vector<CPKIFX509ExtensionPtr> m_processedExts;
00025 };
00027 
00034 CPKIFCertificatePtr CPKIFCertificateNodeEntry::GetCert()const 
00035 {
00036     return m_impl->m_cert;
00037 }
00045 void CPKIFCertificateNodeEntry::SetCert(
00047     const CPKIFCertificatePtr& cert) 
00048 {
00049     m_impl->m_cert = cert;
00050     if(cert)
00051         SetState(PAS_AVAILABLE);
00052 }
00062 void CPKIFCertificateNodeEntry::SetIgnore() 
00063 {
00064     m_impl->m_bIgnore = true;
00065 }
00073 void CPKIFCertificateNodeEntry::ClearIgnore() 
00074 {
00075     m_impl->m_bIgnore = false;
00076 }
00086 bool CPKIFCertificateNodeEntry::GetIgnore() const 
00087 {
00088     return m_impl->m_bIgnore;
00089 }
00097 void CPKIFCertificateNodeEntry::SetNameIgnore() 
00098 {
00099     m_impl->m_bNameIgnore = true;
00100 }
00108 void CPKIFCertificateNodeEntry::ClearNameIgnore() 
00109 {
00110     m_impl->m_bNameIgnore = false;
00111 }
00123 bool CPKIFCertificateNodeEntry::GetHardIgnore() const 
00124 {
00125     return m_impl->m_bNameIgnore;
00126 }
00134 void CPKIFCertificateNodeEntry::ClearProcessedExtensions()
00135 {
00136     m_impl->m_processedExts.clear();
00137 }
00149 void CPKIFCertificateNodeEntry::MarkExtensionAsProcessed(
00151     CPKIFX509ExtensionPtr& ref) 
00152 {
00153     m_impl->m_processedExts.push_back(ref);
00154 }
00164 bool CPKIFCertificateNodeEntry::AreThereAnyUnprocessedCriticalExtensions() 
00165 {
00166     return m_impl->m_cert->AreThereAnyUnprocessedCriticalExtensions(m_impl->m_processedExts);
00167 }
00175 void CPKIFCertificateNodeEntry::SetStatus(
00177     CPKIFCertStatusPtr& status) 
00178 {
00179     m_impl->m_certStatus = status;
00180 }
00188 void CPKIFCertificateNodeEntry::GetStatus(
00190     CPKIFCertStatusPtr& status) const 
00191 {
00192     status = m_impl->m_certStatus;
00193 }
00202 CPKIFCertStatusPtr CPKIFCertificateNodeEntry::GetStatus() const 
00203 {
00204     return m_impl->m_certStatus;
00205 }
00214 bool CPKIFCertificateNodeEntry::GetProcessedSuccessfully() const 
00215 {
00216     if(m_impl->m_certStatus == (CPKIFCertStatus*)NULL)
00217         return false;
00218 
00219     return 0 == m_impl->m_certStatus->GetDiagnosticCode();
00220 }
00228 void CPKIFCertificateNodeEntry::ClearScore()
00229 {
00230     m_impl->m_score = 0;
00231 }
00243 void CPKIFCertificateNodeEntry::AddToScore(
00245     int add)
00246 {
00247     m_impl->m_score += add;
00248 }
00256 int CPKIFCertificateNodeEntry::GetScore() const 
00257 {
00258     return m_impl->m_score;
00259 }
00269 PKIInfoSource CPKIFCertificateNodeEntry::GetSource() const 
00270 {
00271     return m_impl->m_source;
00272 }
00281 void CPKIFCertificateNodeEntry::SetSource(
00283     PKIInfoSource source) 
00284 {
00285     m_impl->m_source = source;
00286 }
00294 CPKIFCertificateNodeEntry::CPKIFCertificateNodeEntry(void)
00295   :m_impl (new CPKIFCertificateNodeEntryImpl)
00296 {
00297     LOG_STRING_DEBUG("CPKIFCertificateNodeEntry::CPKIFCertificateNodeEntry(void)", TOOLKIT_PATH_MISC, 0, this);
00298 
00299     m_impl->m_bIgnore = false;
00300     m_impl->m_source = LOCAL;
00301     //m_bHardIgnore = false;
00302     m_impl->m_score = 0;
00303 
00304     m_impl->m_bNameIgnore = false;
00305 }
00313 CPKIFCertificateNodeEntry::CPKIFCertificateNodeEntry(
00316     CPKIFCertificatePtr& cert) 
00317   :m_impl (new CPKIFCertificateNodeEntryImpl)
00318 {
00319     LOG_STRING_DEBUG("CPKIFCertificateNodeEntry::CPKIFCertificateNodeEntry(CPKIFCertificatePtr& cert)", TOOLKIT_PATH_MISC, 0, this);
00320 
00321     m_impl->m_bIgnore = false; 
00322     m_impl->m_cert = cert;
00323     m_impl->m_source = LOCAL;
00324     m_impl->m_score = 0;
00325     m_impl->m_bNameIgnore = false;
00326 }
00334 CPKIFCertificateNodeEntry::~CPKIFCertificateNodeEntry(void)
00335 {
00336     LOG_STRING_DEBUG("CPKIFCertificateNodeEntry::~CPKIFCertificateNodeEntry(void)", TOOLKIT_PATH_MISC, 0, this);
00337     
00338     delete m_impl;
00339     m_impl = 0;
00340 }
00349 bool CPKIFCertificateNodeEntry::operator==(
00351     const CPKIFCertificateNodeEntry& rhs) const
00352 {
00353     CPKIFCertificatePtr lhsCert = GetCert();
00354     CPKIFCertificatePtr rhsCert = rhs.GetCert();
00355 
00356     if(!lhsCert || !rhsCert)
00357         return false;
00358     else
00359         return *lhsCert == *rhsCert;
00360 }

Generated on Mon Nov 15 11:15:46 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6