src: Correcting coding style of security related code.
Change-Id: Iff09b16d8a86462aff0abbd202b82cebb74bc365
diff --git a/src/security/certificate-cache-ttl.cpp b/src/security/certificate-cache-ttl.cpp
index 0a9002e..7490471 100644
--- a/src/security/certificate-cache-ttl.cpp
+++ b/src/security/certificate-cache-ttl.cpp
@@ -6,44 +6,43 @@
*/
#include "common.hpp"
-
#include "certificate-cache-ttl.hpp"
-#include "../util/logging.hpp"
-
-INIT_LOGGER("ndn.CertificateCacheTtl");
-
using namespace std;
namespace ndn {
-CertificateCacheTtl::CertificateCacheTtl(shared_ptr<boost::asio::io_service> io, const time::seconds& defaultTtl)
+CertificateCacheTtl::CertificateCacheTtl(shared_ptr<boost::asio::io_service> io,
+ const time::seconds& defaultTtl)
: m_defaultTtl(defaultTtl)
, m_scheduler(*io)
-{}
+{
+}
CertificateCacheTtl::~CertificateCacheTtl()
-{}
-
-void
-CertificateCacheTtl::insertCertificate(ptr_lib::shared_ptr<const IdentityCertificate> certificate)
{
- time::milliseconds expire = (certificate->getFreshnessPeriod() >= time::seconds::zero() ?
- certificate->getFreshnessPeriod() : m_defaultTtl);
-
- Name trackerIndex = certificate->getName().getPrefix(-1);
- EventTracker::iterator it = m_tracker.find(trackerIndex);
- if(it != m_tracker.end())
- m_scheduler.cancelEvent(m_tracker[trackerIndex]);
-
- m_scheduler.scheduleEvent(time::seconds(0), bind(&CertificateCacheTtl::insert, this, certificate));
- m_tracker[trackerIndex] = m_scheduler.scheduleEvent(expire, bind(&CertificateCacheTtl::remove,
- this, certificate->getName()));
-
}
void
-CertificateCacheTtl::insert(ptr_lib::shared_ptr<const IdentityCertificate> certificate)
+CertificateCacheTtl::insertCertificate(shared_ptr<const IdentityCertificate> certificate)
+{
+ time::milliseconds expire = (certificate->getFreshnessPeriod() >= time::seconds::zero() ?
+ certificate->getFreshnessPeriod() : m_defaultTtl);
+
+ Name trackerIndex = certificate->getName().getPrefix(-1);
+ EventTracker::iterator it = m_tracker.find(trackerIndex);
+ if (it != m_tracker.end())
+ m_scheduler.cancelEvent(m_tracker[trackerIndex]);
+
+ m_scheduler.scheduleEvent(time::seconds(0),
+ bind(&CertificateCacheTtl::insert, this, certificate));
+ m_tracker[trackerIndex] = m_scheduler.scheduleEvent(expire,
+ bind(&CertificateCacheTtl::remove,
+ this, certificate->getName()));
+}
+
+void
+CertificateCacheTtl::insert(shared_ptr<const IdentityCertificate> certificate)
{
Name name = certificate->getName().getPrefix(-1);
m_cache[name] = certificate;
@@ -54,18 +53,18 @@
{
Name name = certificateName.getPrefix(-1);
Cache::iterator it = m_cache.find(name);
- if(it != m_cache.end())
+ if (it != m_cache.end())
m_cache.erase(it);
}
-ptr_lib::shared_ptr<const IdentityCertificate>
+shared_ptr<const IdentityCertificate>
CertificateCacheTtl::getCertificate(const Name& certificateName)
{
Cache::iterator it = m_cache.find(certificateName);
- if(it != m_cache.end())
+ if (it != m_cache.end())
return it->second;
else
- return ptr_lib::shared_ptr<IdentityCertificate>();
+ return shared_ptr<IdentityCertificate>();
}
} // namespace ndn