security: adjusting class names and method names to the new ndn-cpp security api
diff --git a/src/sync-policy-manager.cc b/src/sec-policy-sync.cc
similarity index 82%
rename from src/sync-policy-manager.cc
rename to src/sec-policy-sync.cc
index 8b34856..5a07b5c 100644
--- a/src/sync-policy-manager.cc
+++ b/src/sec-policy-sync.cc
@@ -11,17 +11,17 @@
#include "sync-intro-certificate.h"
#include "sync-logging.h"
#include <ndn-cpp/security/verifier.hpp>
-#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/security/signature-sha256-with-rsa.hpp>
-#include "sync-policy-manager.h"
+#include "sec-policy-sync.h"
using namespace ndn;
using namespace ndn::ptr_lib;
using namespace std;
-INIT_LOGGER("SyncPolicyManager");
+INIT_LOGGER("SecPolicySync");
-SyncPolicyManager::SyncPolicyManager(const Name& signingIdentity,
+SecPolicySync::SecPolicySync(const Name& signingIdentity,
const Name& signingCertificateName,
const Name& syncPrefix,
shared_ptr<Face> face,
@@ -36,24 +36,24 @@
wotPrefix.append("WOT");
m_syncPrefixRegex = Regex::fromName(syncPrefix);
m_wotPrefixRegex = Regex::fromName(wotPrefix);
- m_chatDataPolicy = make_shared<IdentityPolicyRule>("^[^<%F0.>]*<%F0.>([^<chronos>]*)<chronos><>",
- "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
- "==", "\\1", "\\1", true);
+ m_chatDataPolicy = make_shared<SecRuleIdentity>("^[^<%F0.>]*<%F0.>([^<chronos>]*)<chronos><>",
+ "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
+ "==", "\\1", "\\1", true);
}
-SyncPolicyManager::~SyncPolicyManager()
+SecPolicySync::~SecPolicySync()
{}
bool
-SyncPolicyManager::skipVerifyAndTrust (const Data& data)
+SecPolicySync::skipVerifyAndTrust (const Data& data)
{ return false; }
bool
-SyncPolicyManager::requireVerify (const Data& data)
+SecPolicySync::requireVerify (const Data& data)
{ return true; }
shared_ptr<ValidationRequest>
-SyncPolicyManager::checkVerificationPolicy(const shared_ptr<Data>& data,
+SecPolicySync::checkVerificationPolicy(const shared_ptr<Data>& data,
int stepCount,
const OnVerified& onVerified,
const OnVerifyFailed& onVerifyFailed)
@@ -61,7 +61,7 @@
if(stepCount > m_stepLimit)
{
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
try{
@@ -81,7 +81,7 @@
onVerified(data);
else
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
else
return prepareRequest(keyName, true, data, stepCount, onVerified, onVerifyFailed);
@@ -99,7 +99,7 @@
onVerified(data);
else
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
it = m_trustedProducers.find(keyName.toUri());
@@ -109,38 +109,38 @@
onVerified(data);
else
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
return prepareRequest(keyName, false, data, stepCount, onVerified, onVerifyFailed);
}
}catch(SignatureSha256WithRsa::Error &e){
- _LOG_DEBUG("SyncPolicyManager Error: " << e.what());
+ _LOG_DEBUG("SecPolicySync Error: " << e.what());
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}catch(KeyLocator::Error &e){
- _LOG_DEBUG("SyncPolicyManager Error: " << e.what());
+ _LOG_DEBUG("SecPolicySync Error: " << e.what());
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
bool
-SyncPolicyManager::checkSigningPolicy(const Name& dataName,
+SecPolicySync::checkSigningPolicy(const Name& dataName,
const Name& certificateName)
{
return true;
}
Name
-SyncPolicyManager::inferSigningIdentity(const ndn::Name& dataName)
+SecPolicySync::inferSigningIdentity(const ndn::Name& dataName)
{ return m_signingIdentity; }
void
-SyncPolicyManager::addTrustAnchor(const IdentityCertificate& identityCertificate, bool isIntroducer)
+SecPolicySync::addTrustAnchor(const IdentityCertificate& identityCertificate, bool isIntroducer)
{
// _LOG_DEBUG("Add intro/producer: " << identityCertificate.getPublicKeyName());
if(isIntroducer)
@@ -152,7 +152,7 @@
}
void
-SyncPolicyManager::addChatDataRule(const Name& prefix,
+SecPolicySync::addChatDataRule(const Name& prefix,
const IdentityCertificate& identityCertificate,
bool isIntroducer)
{
@@ -161,7 +161,7 @@
shared_ptr<const vector<Name> >
-SyncPolicyManager::getAllIntroducerName()
+SecPolicySync::getAllIntroducerName()
{
shared_ptr<vector<Name> > nameList = make_shared<vector<Name> >();
@@ -173,7 +173,7 @@
}
shared_ptr<ValidationRequest>
-SyncPolicyManager::prepareRequest(const Name& keyName,
+SecPolicySync::prepareRequest(const Name& keyName,
bool forIntroducer,
shared_ptr<Data> data,
const int & stepCount,
@@ -187,7 +187,7 @@
if(0 == nameList->size())
{
onVerifyFailed(data);
- return SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
+ return shared_ptr<ValidationRequest>();
}
Name interestName = *interestPrefixName;
@@ -199,7 +199,7 @@
shared_ptr<ndn::Interest> interest = make_shared<ndn::Interest>(interestName);
// _LOG_DEBUG("send interest for intro cert: " << interest->getName());
- OnVerified requestedCertVerifiedCallback = boost::bind(&SyncPolicyManager::onIntroCertVerified,
+ OnVerified requestedCertVerifiedCallback = boost::bind(&SecPolicySync::onIntroCertVerified,
this,
_1,
forIntroducer,
@@ -207,7 +207,7 @@
onVerified,
onVerifyFailed);
- OnVerifyFailed requestedCertUnverifiedCallback = boost::bind(&SyncPolicyManager::onIntroCertVerifyFailed,
+ OnVerifyFailed requestedCertUnverifiedCallback = boost::bind(&SecPolicySync::onIntroCertVerifyFailed,
this,
_1,
interestPrefixName,
@@ -228,7 +228,7 @@
}
void
-SyncPolicyManager::OnIntroCertInterest(const shared_ptr<const Name>& prefix,
+SecPolicySync::OnIntroCertInterest(const shared_ptr<const Name>& prefix,
const shared_ptr<const ndn::Interest>& interest,
Transport& transport,
uint64_t registeredPrefixId)
@@ -240,12 +240,12 @@
}
void
-SyncPolicyManager::OnIntroCertRegisterFailed(const shared_ptr<const Name>& prefix)
+SecPolicySync::OnIntroCertRegisterFailed(const shared_ptr<const Name>& prefix)
{
}
void
-SyncPolicyManager::onIntroCertVerified(const shared_ptr<Data>& introCertificateData,
+SecPolicySync::onIntroCertVerified(const shared_ptr<Data>& introCertificateData,
bool forIntroducer,
shared_ptr<Data> originalData,
const OnVerified& onVerified,
@@ -281,8 +281,8 @@
// {
// m_introCert.insert(pair <string, Data> (prefix.toEscapedString(), syncIntroCertificate));
// m_face->registerPrefix(prefix,
- // boost::bind(&SyncPolicyManager::onIntroCertInterest, this, _1, _2, _3, _4),
- // boost::bind(&SyncPolicyManager::onIntroCertRegisterFailed, this, _1));
+ // boost::bind(&SecPolicySync::onIntroCertInterest, this, _1, _2, _3, _4),
+ // boost::bind(&SecPolicySync::onIntroCertRegisterFailed, this, _1));
// }
}
else
@@ -314,8 +314,8 @@
// {
// m_introCert.insert(pair <string, Data> (prefix.toEscapedString(), syncIntroCertificate));
// m_face->registerPrefix(prefix,
- // boost::bind(&SyncPolicyManager::onIntroCertInterest, this, _1, _2, _3, _4),
- // boost::bind(&SyncPolicyManager::onIntroCertRegisterFailed, this, _1));
+ // boost::bind(&SecPolicySync::onIntroCertInterest, this, _1, _2, _3, _4),
+ // boost::bind(&SecPolicySync::onIntroCertRegisterFailed, this, _1));
// }
}
@@ -333,7 +333,7 @@
}
void
-SyncPolicyManager::onIntroCertVerifyFailed(const shared_ptr<Data>& introCertificateData,
+SecPolicySync::onIntroCertVerifyFailed(const shared_ptr<Data>& introCertificateData,
shared_ptr<Name> interestPrefixName,
bool forIntroducer,
shared_ptr<const vector<Name> > introNameList,
@@ -353,7 +353,7 @@
shared_ptr<ndn::Interest> interest = make_shared<ndn::Interest>(interestName);
- OnVerified onRecursiveVerified = boost::bind(&SyncPolicyManager::onIntroCertVerified,
+ OnVerified onRecursiveVerified = boost::bind(&SecPolicySync::onIntroCertVerified,
this,
_1,
forIntroducer,
@@ -361,7 +361,7 @@
onVerified,
onVerifyFailed);
- OnVerifyFailed onRecursiveVerifyFailed = boost::bind(&SyncPolicyManager::onIntroCertVerifyFailed,
+ OnVerifyFailed onRecursiveVerifyFailed = boost::bind(&SecPolicySync::onIntroCertVerifyFailed,
this,
_1,
interestPrefixName,
@@ -373,7 +373,7 @@
onVerifyFailed);
m_face->expressInterest(*interest,
- boost::bind(&SyncPolicyManager::onIntroCertData,
+ boost::bind(&SecPolicySync::onIntroCertData,
this,
_1,
_2,
@@ -382,7 +382,7 @@
onRecursiveVerifyFailed,
originalData,
onVerifyFailed),
- boost::bind(&SyncPolicyManager::onIntroCertTimeout,
+ boost::bind(&SecPolicySync::onIntroCertTimeout,
this,
_1,
1,
@@ -394,7 +394,7 @@
}
void
-SyncPolicyManager::onIntroCertData(const shared_ptr<const ndn::Interest> &interest,
+SecPolicySync::onIntroCertData(const shared_ptr<const ndn::Interest> &interest,
const shared_ptr<Data>& introCertificateData,
int stepCount,
const OnVerified& onRecursiveVerified,
@@ -406,7 +406,7 @@
if (nextStep)
m_face->expressInterest
(*nextStep->interest_,
- boost::bind(&SyncPolicyManager::onIntroCertData,
+ boost::bind(&SecPolicySync::onIntroCertData,
this,
_1,
_2,
@@ -415,7 +415,7 @@
nextStep->onVerifyFailed_,
introCertificateData,
onRecursiveVerifyFailed),
- boost::bind(&SyncPolicyManager::onIntroCertTimeout,
+ boost::bind(&SecPolicySync::onIntroCertTimeout,
this,
_1,
nextStep->retry_,
@@ -427,7 +427,7 @@
}
void
-SyncPolicyManager::onIntroCertTimeout(const shared_ptr<const ndn::Interest>& interest,
+SecPolicySync::onIntroCertTimeout(const shared_ptr<const ndn::Interest>& interest,
int retry,
int stepCount,
const OnVerified& onRecursiveVerified,
@@ -438,7 +438,7 @@
if(retry > 0)
{
m_face->expressInterest(*interest,
- boost::bind(&SyncPolicyManager::onIntroCertData,
+ boost::bind(&SecPolicySync::onIntroCertData,
this,
_1,
_2,
@@ -447,7 +447,7 @@
onRecursiveVerifyFailed,
originalData,
onVerifyFailed),
- boost::bind(&SyncPolicyManager::onIntroCertTimeout,
+ boost::bind(&SecPolicySync::onIntroCertTimeout,
this,
_1,
retry - 1,
diff --git a/src/sync-policy-manager.h b/src/sec-policy-sync.h
similarity index 88%
rename from src/sync-policy-manager.h
rename to src/sec-policy-sync.h
index 922ebbb..01b22f6 100644
--- a/src/sync-policy-manager.h
+++ b/src/sec-policy-sync.h
@@ -8,33 +8,31 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef SYNC_POLICY_MANAGER_H
-#define SYNC_POLICY_MANAGER_H
+#ifndef SEC_POLICY_SYNC_H
+#define SEC_POLICY_SYNC_H
#include <ndn-cpp/face.hpp>
#include <ndn-cpp/security/key-chain.hpp>
#include <ndn-cpp/security/verifier.hpp>
-#include <ndn-cpp/security/policy/policy-manager.hpp>
-#include <ndn-cpp/security/certificate/identity-certificate.hpp>
+#include <ndn-cpp/security/sec-policy.hpp>
+#include <ndn-cpp/security/identity-certificate.hpp>
#include <ndn-cpp-et/regex/regex.hpp>
-#include <ndn-cpp-et/policy-manager/identity-policy-rule.hpp>
+#include <ndn-cpp-et/policy/sec-rule-identity.hpp>
#include <map>
-#include "specific-policy-rule.h"
+#include "sec-rule-sync-specific.h"
-static ndn::ptr_lib::shared_ptr<ndn::ValidationRequest> SYNC_POLICY_MANAGER_NULL_VALIDATION_REQUEST_PTR;
-
-class SyncPolicyManager : public ndn::PolicyManager
+class SecPolicySync : public ndn::SecPolicy
{
public:
- SyncPolicyManager(const ndn::Name& signingIdentity,
+ SecPolicySync(const ndn::Name& signingIdentity,
const ndn::Name& signingCertificateName,
const ndn::Name& syncPrefix,
ndn::ptr_lib::shared_ptr<ndn::Face> face,
int m_stepLimit = 3);
virtual
- ~SyncPolicyManager();
+ ~SecPolicySync();
bool
skipVerifyAndTrust (const ndn::Data& data);
@@ -136,10 +134,10 @@
int m_stepLimit;
ndn::ptr_lib::shared_ptr<ndn::Regex> m_syncPrefixRegex;
ndn::ptr_lib::shared_ptr<ndn::Regex> m_wotPrefixRegex;
- ndn::ptr_lib::shared_ptr<ndn::IdentityPolicyRule> m_chatDataPolicy;
+ ndn::ptr_lib::shared_ptr<ndn::SecRuleIdentity> m_chatDataPolicy;
std::map<std::string, ndn::PublicKey> m_trustedIntroducers;
std::map<std::string, ndn::PublicKey> m_trustedProducers;
- std::map<std::string, SpecificPolicyRule> m_chatDataRules;
+ std::map<std::string, SecRuleSyncSpecific> m_chatDataRules;
std::map<std::string, ndn::Data> m_introCert;
ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
diff --git a/src/specific-policy-rule.cc b/src/sec-rule-sync-specific.cc
similarity index 61%
rename from src/specific-policy-rule.cc
rename to src/sec-rule-sync-specific.cc
index 3a74e64..802ed4f 100644
--- a/src/specific-policy-rule.cc
+++ b/src/sec-rule-sync-specific.cc
@@ -8,33 +8,33 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "specific-policy-rule.h"
-#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include "sec-rule-sync-specific.h"
+#include <ndn-cpp/security/signature-sha256-with-rsa.hpp>
using namespace ndn;
using namespace ndn::ptr_lib;
using namespace std;
-SpecificPolicyRule::SpecificPolicyRule(shared_ptr<Regex> dataRegex,
- shared_ptr<Regex> signerRegex)
- : PolicyRule(PolicyRule::IDENTITY_POLICY, true)
+SecRuleSyncSpecific::SecRuleSyncSpecific(shared_ptr<Regex> dataRegex,
+ shared_ptr<Regex> signerRegex)
+ : SecRule(SecRule::IDENTITY_RULE, true)
, m_dataRegex(dataRegex)
, m_signerRegex(signerRegex)
{}
-SpecificPolicyRule::SpecificPolicyRule(const SpecificPolicyRule& rule)
- : PolicyRule(PolicyRule::IDENTITY_POLICY, true)
+SecRuleSyncSpecific::SecRuleSyncSpecific(const SecRuleSyncSpecific& rule)
+ : SecRule(SecRule::IDENTITY_RULE, true)
, m_dataRegex(rule.m_dataRegex)
, m_signerRegex(rule.m_signerRegex)
{}
bool
-SpecificPolicyRule::matchDataName(const Data& data)
+SecRuleSyncSpecific::matchDataName(const Data& data)
{ return m_dataRegex->match(data.getName()); }
bool
-SpecificPolicyRule::matchSignerName(const Data& data)
+SecRuleSyncSpecific::matchSignerName(const Data& data)
{
try{
SignatureSha256WithRsa sig(data.getSignature());
@@ -48,9 +48,9 @@
}
bool
-SpecificPolicyRule::satisfy(const Data & data)
+SecRuleSyncSpecific::satisfy(const Data & data)
{ return (matchDataName(data) && matchSignerName(data)) ? true : false ; }
bool
-SpecificPolicyRule::satisfy(const Name & dataName, const Name & signerName)
+SecRuleSyncSpecific::satisfy(const Name & dataName, const Name & signerName)
{ return (m_dataRegex->match(dataName) && m_signerRegex->match(signerName)); }
diff --git a/src/specific-policy-rule.h b/src/sec-rule-sync-specific.h
similarity index 61%
rename from src/specific-policy-rule.h
rename to src/sec-rule-sync-specific.h
index 429eff7..25e4e28 100644
--- a/src/specific-policy-rule.h
+++ b/src/sec-rule-sync-specific.h
@@ -8,23 +8,23 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef SPECIFIC_POLICY_RULE_H
-#define SPECIFIC_POLICY_RULE_H
+#ifndef SEC_RULE_SYNC_SPECIFIC_H
+#define SEC_RULE_SYNC_SPECIFIC_H
-#include <ndn-cpp-et/policy-manager/policy-rule.hpp>
+#include <ndn-cpp-et/policy/sec-rule.hpp>
#include <ndn-cpp-et/regex/regex.hpp>
-class SpecificPolicyRule : public ndn::PolicyRule
+class SecRuleSyncSpecific : public ndn::SecRule
{
public:
- SpecificPolicyRule(ndn::ptr_lib::shared_ptr<ndn::Regex> dataRegex,
- ndn::ptr_lib::shared_ptr<ndn::Regex> signerRegex);
+ SecRuleSyncSpecific(ndn::ptr_lib::shared_ptr<ndn::Regex> dataRegex,
+ ndn::ptr_lib::shared_ptr<ndn::Regex> signerRegex);
- SpecificPolicyRule(const SpecificPolicyRule& rule);
+ SecRuleSyncSpecific(const SecRuleSyncSpecific& rule);
virtual
- ~SpecificPolicyRule() {};
+ ~SecRuleSyncSpecific() {};
bool
matchDataName(const ndn::Data& data);
@@ -43,4 +43,4 @@
ndn::ptr_lib::shared_ptr<ndn::Regex> m_signerRegex;
};
-#endif //CHAT_POLICY_RULE_H
+#endif
diff --git a/src/sync-intro-certificate.cc b/src/sync-intro-certificate.cc
index 9489bb2..13f4cad 100644
--- a/src/sync-intro-certificate.cc
+++ b/src/sync-intro-certificate.cc
@@ -9,7 +9,6 @@
*/
#include "sync-intro-certificate.h"
-#include <ndn-cpp/security/security-exception.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
diff --git a/src/sync-intro-certificate.h b/src/sync-intro-certificate.h
index 6479126..da21ddc 100644
--- a/src/sync-intro-certificate.h
+++ b/src/sync-intro-certificate.h
@@ -11,8 +11,8 @@
#ifndef SYNC_INTRO_CERTIFICATE_H
#define SYNC_INTRO_CERTIFICATE_H
-#include <ndn-cpp/security/certificate/certificate.hpp>
-#include <ndn-cpp/security/certificate/identity-certificate.hpp>
+#include <ndn-cpp/security/certificate.hpp>
+#include <ndn-cpp/security/identity-certificate.hpp>
class SyncIntroCertificate : public ndn::Certificate
{
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 448d791..240e9df 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -60,7 +60,7 @@
{
SyncLogic::SyncLogic (const Name& syncPrefix,
- shared_ptr<SyncPolicyManager> syncPolicyManager,
+ shared_ptr<SecPolicySync> policy,
shared_ptr<Face> face,
LogicUpdateCallback onUpdate,
LogicRemoveCallback onRemove)
@@ -70,8 +70,8 @@
, m_onUpdate (onUpdate)
, m_onRemove (onRemove)
, m_perBranch (false)
- , m_policyManager(syncPolicyManager)
- , m_verifier(new Verifier(syncPolicyManager))
+ , m_policy(policy)
+ , m_verifier(new Verifier(policy))
, m_keyChain(new KeyChain())
, m_face(face)
#ifndef NS3_MODULE
@@ -99,7 +99,7 @@
}
SyncLogic::SyncLogic (const Name& syncPrefix,
- shared_ptr<SyncPolicyManager> syncPolicyManager,
+ shared_ptr<SecPolicySync> policy,
shared_ptr<Face> face,
LogicPerBranchCallback onUpdateBranch)
: m_state (new FullState)
@@ -107,8 +107,8 @@
, m_syncPrefix (syncPrefix)
, m_onUpdateBranch (onUpdateBranch)
, m_perBranch(true)
- , m_policyManager(syncPolicyManager)
- , m_verifier(new Verifier(syncPolicyManager))
+ , m_policy(policy)
+ , m_verifier(new Verifier(policy))
, m_keyChain(new KeyChain())
, m_face(face)
#ifndef NS3_MODULE
@@ -709,7 +709,7 @@
int size = ssm.ByteSize();
char *wireData = new char[size];
Name dataName(name);
- Name signingIdentity = m_policyManager->inferSigningIdentity(dataName);
+ Name signingIdentity = m_policy->inferSigningIdentity(dataName);
shared_ptr<Data> syncData = make_shared<Data>(dataName);
syncData->setContent(reinterpret_cast<const uint8_t*>(wireData), size);
diff --git a/src/sync-logic.h b/src/sync-logic.h
index c351324..f797c96 100644
--- a/src/sync-logic.h
+++ b/src/sync-logic.h
@@ -38,7 +38,7 @@
#include "sync-full-state.h"
#include "sync-std-name-info.h"
#include "sync-scheduler.h"
-#include "sync-policy-manager.h"
+#include "sec-policy-sync.h"
#include "sync-diff-state-container.h"
@@ -87,13 +87,13 @@
* the app data when new remote names are learned
*/
SyncLogic (const ndn::Name& syncPrefix,
- ndn::ptr_lib::shared_ptr<SyncPolicyManager> syncPolicyManager,
+ ndn::ptr_lib::shared_ptr<SecPolicySync> syncPolicyManager,
ndn::ptr_lib::shared_ptr<ndn::Face> face,
LogicUpdateCallback onUpdate,
LogicRemoveCallback onRemove);
SyncLogic (const ndn::Name& syncPrefix,
- ndn::ptr_lib::shared_ptr<SyncPolicyManager> syncPolicyManager,
+ ndn::ptr_lib::shared_ptr<SecPolicySync> syncPolicyManager,
ndn::ptr_lib::shared_ptr<ndn::Face> face,
LogicPerBranchCallback onUpdateBranch);
@@ -237,7 +237,7 @@
LogicRemoveCallback m_onRemove;
LogicPerBranchCallback m_onUpdateBranch;
bool m_perBranch;
- ndn::ptr_lib::shared_ptr<SyncPolicyManager> m_policyManager;
+ ndn::ptr_lib::shared_ptr<SecPolicySync> m_policy;
ndn::ptr_lib::shared_ptr<ndn::Verifier> m_verifier;
ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
ndn::ptr_lib::shared_ptr<ndn::Face> m_face;
diff --git a/src/sync-socket.cc b/src/sync-socket.cc
index 924145b..cb00ba4 100644
--- a/src/sync-socket.cc
+++ b/src/sync-socket.cc
@@ -21,9 +21,6 @@
#include "sync-socket.h"
#include "sync-logging.h"
-#include <ndn-cpp/security/identity/basic-identity-storage.hpp>
-#include <ndn-cpp/security/identity/osx-private-key-storage.hpp>
-
using namespace std;
using namespace ndn;
using namespace ndn::ptr_lib;
@@ -33,17 +30,17 @@
namespace Sync {
SyncSocket::SyncSocket (const string &syncPrefix,
- shared_ptr<SyncPolicyManager> syncPolicyManager,
+ shared_ptr<SecPolicySync> policy,
shared_ptr<Face> face,
NewDataCallback dataCallback,
RemoveCallback rmCallback )
: m_newDataCallback(dataCallback)
- , m_syncPolicyManager(syncPolicyManager)
- , m_verifier(new Verifier(syncPolicyManager))
+ , m_policy(policy)
+ , m_verifier(new Verifier(policy))
, m_keyChain(new KeyChain())
, m_face(face)
, m_syncLogic (syncPrefix,
- syncPolicyManager,
+ policy,
face,
bind(&SyncSocket::passCallback, this, _1),
rmCallback)
@@ -63,7 +60,7 @@
contentNameWithSeqno << prefix << "/" << session << "/" << sequence;
Name dataName(contentNameWithSeqno.str ());
- Name signingIdentity = m_syncPolicyManager->inferSigningIdentity(dataName);
+ Name signingIdentity = m_policy->inferSigningIdentity(dataName);
shared_ptr<Data> data = make_shared<Data>(dataName);
data->setContent(reinterpret_cast<const uint8_t*>(buf), len);
diff --git a/src/sync-socket.h b/src/sync-socket.h
index a0ceec1..c3232bb 100644
--- a/src/sync-socket.h
+++ b/src/sync-socket.h
@@ -56,7 +56,7 @@
* @param dataCallback the callback to process data
*/
SyncSocket (const std::string &syncPrefix,
- ndn::ptr_lib::shared_ptr<SyncPolicyManager> syncPolicyManager,
+ ndn::ptr_lib::shared_ptr<SecPolicySync> policy,
ndn::ptr_lib::shared_ptr<ndn::Face> face,
NewDataCallback dataCallback,
RemoveCallback rmCallback);
@@ -113,7 +113,7 @@
typedef boost::unordered_map<std::string, SeqNo> SequenceLog;
NewDataCallback m_newDataCallback;
SequenceLog m_sequenceLog;
- ndn::ptr_lib::shared_ptr<SyncPolicyManager> m_syncPolicyManager;
+ ndn::ptr_lib::shared_ptr<SecPolicySync> m_policy;
ndn::ptr_lib::shared_ptr<ndn::Verifier> m_verifier;
ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
ndn::ptr_lib::shared_ptr<ndn::Face> m_face;