build: == Dependency change == ChronoChat now depends on ndn-cxx library
Change-Id: I25d1abe8035c34a7d34cba53960e3456d6677fdc
diff --git a/src/add-contact-panel.cpp b/src/add-contact-panel.cpp
index 5ce575c..639c113 100644
--- a/src/add-contact-panel.cpp
+++ b/src/add-contact-panel.cpp
@@ -50,7 +50,7 @@
void
AddContactPanel::onCancelClicked()
{
- this->close();
+ this->close();
}
void
@@ -78,10 +78,10 @@
for(int rowCount = 0; rowCount < entrySize; rowCount++)
{
- ui->infoView->insertRow(rowCount);
+ ui->infoView->insertRow(rowCount);
QTableWidgetItem* type = new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).type()));
ui->infoView->setItem(rowCount, 0, type);
-
+
QTableWidgetItem* value = new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).value()));
ui->infoView->setItem(rowCount, 1, value);
diff --git a/src/add-contact-panel.h b/src/add-contact-panel.h
index 5e8255d..5b99558 100644
--- a/src/add-contact-panel.h
+++ b/src/add-contact-panel.h
@@ -27,7 +27,7 @@
Q_OBJECT
public:
- explicit
+ explicit
AddContactPanel(QWidget *parent = 0);
~AddContactPanel();
@@ -39,7 +39,7 @@
private slots:
void
onCancelClicked();
-
+
void
onSearchClicked();
diff --git a/src/browse-contact-dialog.cpp b/src/browse-contact-dialog.cpp
index 50ca82d..c12d040 100644
--- a/src/browse-contact-dialog.cpp
+++ b/src/browse-contact-dialog.cpp
@@ -19,7 +19,7 @@
using namespace ndn;
using namespace chronos;
-BrowseContactDialog::BrowseContactDialog(QWidget *parent)
+BrowseContactDialog::BrowseContactDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::BrowseContactDialog)
, m_contactListModel(new QStringListModel)
@@ -36,9 +36,9 @@
connect(ui->ContactList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
connect(ui->AddButton, SIGNAL(clicked()),
- this, SLOT(onAddClicked()));
+ this, SLOT(onAddClicked()));
connect(ui->DirectAddButton, SIGNAL(clicked()),
- this, SLOT(onDirectAddClicked()));
+ this, SLOT(onDirectAddClicked()));
}
BrowseContactDialog::~BrowseContactDialog()
@@ -113,19 +113,19 @@
ui->InfoTable->horizontalHeader()->show();
ui->InfoTable->setColumnCount(2);
-
+
Profile::const_iterator proIt = profile.begin();
Profile::const_iterator proEnd = profile.end();
int rowCount = 0;
for(; proIt != proEnd; proIt++, rowCount++)
{
- ui->InfoTable->insertRow(rowCount);
+ ui->InfoTable->insertRow(rowCount);
QTableWidgetItem* type = new QTableWidgetItem(QString::fromStdString(proIt->first));
ui->InfoTable->setItem(rowCount, 0, type);
-
+
QTableWidgetItem* value = new QTableWidgetItem(QString::fromStdString(proIt->second));
- ui->InfoTable->setItem(rowCount, 1, value);
+ ui->InfoTable->setItem(rowCount, 1, value);
}
}
diff --git a/src/browse-contact-dialog.h b/src/browse-contact-dialog.h
index f13770e..54cdcb2 100644
--- a/src/browse-contact-dialog.h
+++ b/src/browse-contact-dialog.h
@@ -17,7 +17,7 @@
#include <QTableWidgetItem>
#ifndef Q_MOC_RUN
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/recursive_mutex.hpp>
#endif
@@ -29,9 +29,9 @@
class BrowseContactDialog : public QDialog
{
Q_OBJECT
-
+
public:
- explicit
+ explicit
BrowseContactDialog(QWidget *parent = 0);
~BrowseContactDialog();
@@ -64,7 +64,7 @@
signals:
void
directAddClicked();
-
+
void
fetchIdCert(const QString& certName);
diff --git a/src/chat-dialog.cpp b/src/chat-dialog.cpp
index 74b75c3..aabbcc2 100644
--- a/src/chat-dialog.cpp
+++ b/src/chat-dialog.cpp
@@ -21,7 +21,7 @@
#include <sync-intro-certificate.h>
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_int_distribution.hpp>
-#include <ndn-cpp-dev/util/random.hpp>
+#include <ndn-cxx/util/random.hpp>
#include <cryptopp/hex.h>
#include <cryptopp/files.h>
#include <queue>
@@ -46,10 +46,10 @@
shared_ptr<Face> face,
const IdentityCertificate& myCertificate,
const Name& chatroomPrefix,
- const Name& localPrefix,
+ const Name& localPrefix,
const std::string& nick,
bool withSecurity,
- QWidget* parent)
+ QWidget* parent)
: QDialog(parent)
, ui(new Ui::ChatDialog)
, m_contactManager(contactManager)
@@ -92,22 +92,22 @@
m_scene->setCurrentPrefix(QString(m_localChatPrefix.toUri().c_str()));
m_scene->plot("Empty");
- connect(ui->lineEdit, SIGNAL(returnPressed()),
+ connect(ui->lineEdit, SIGNAL(returnPressed()),
this, SLOT(onReturnPressed()));
- connect(ui->syncTreeButton, SIGNAL(pressed()),
+ connect(ui->syncTreeButton, SIGNAL(pressed()),
this, SLOT(onSyncTreeButtonPressed()));
- connect(ui->trustTreeButton, SIGNAL(pressed()),
+ connect(ui->trustTreeButton, SIGNAL(pressed()),
this, SLOT(onTrustTreeButtonPressed()));
connect(m_scene, SIGNAL(replot()),
this, SLOT(onReplot()));
- connect(m_scene, SIGNAL(rosterChanged(QStringList)),
+ connect(m_scene, SIGNAL(rosterChanged(QStringList)),
this, SLOT(onRosterChanged(QStringList)));
- connect(m_timer, SIGNAL(timeout()),
+ connect(m_timer, SIGNAL(timeout()),
this, SLOT(onReplot()));
- connect(this, SIGNAL(processData(const ndn::shared_ptr<const ndn::Data>&, bool, bool)),
+ connect(this, SIGNAL(processData(const ndn::shared_ptr<const ndn::Data>&, bool, bool)),
this, SLOT(onProcessData(const ndn::shared_ptr<const ndn::Data>&, bool, bool)));
- connect(this, SIGNAL(processTreeUpdate(const std::vector<Sync::MissingDataInfo>)),
+ connect(this, SIGNAL(processTreeUpdate(const std::vector<Sync::MissingDataInfo>)),
this, SLOT(onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>)));
connect(this, SIGNAL(reply(const ndn::Interest&, const ndn::shared_ptr<const ndn::Data>&, size_t, bool)),
this, SLOT(onReply(const ndn::Interest&, const ndn::shared_ptr<const ndn::Data>&, size_t, bool)));
@@ -264,14 +264,14 @@
if(m_certListPrefixId)
m_face->unsetInterestFilter(m_certListPrefixId);
- m_certListPrefixId = m_face->setInterestFilter (m_certListPrefix,
- bind(&ChatDialog::onCertListInterest, this, _1, _2),
+ m_certListPrefixId = m_face->setInterestFilter (m_certListPrefix,
+ bind(&ChatDialog::onCertListInterest, this, _1, _2),
bind(&ChatDialog::onCertListRegisterFailed, this, _1, _2));
if(m_certSinglePrefixId)
m_face->unsetInterestFilter(m_certSinglePrefixId);
- m_certSinglePrefixId = m_face->setInterestFilter (m_certSinglePrefix,
- bind(&ChatDialog::onCertSingleInterest, this, _1, _2),
+ m_certSinglePrefixId = m_face->setInterestFilter (m_certSinglePrefix,
+ bind(&ChatDialog::onCertSingleInterest, this, _1, _2),
bind(&ChatDialog::onCertSingleRegisterFailed, this, _1, _2));
}
@@ -285,7 +285,7 @@
Name privatePrefix("/private/local");
if(privatePrefix.isPrefixOf(m_localChatPrefix))
{
- prefixDisp =
+ prefixDisp =
QString("<Warning: no connection to hub or hub does not support prefix autoconfig.>\n <Prefix = %1>")
.arg(QString::fromStdString(m_localChatPrefix.toUri()));
ui->prefixLabel->setStyleSheet("QLabel {color: red; font-size: 12px; font: bold \"Verdana\";}");
@@ -302,7 +302,7 @@
void
ChatDialog::initializeSync()
{
-
+
m_sock = new Sync::SyncSocket(m_chatroomPrefix,
m_chatPrefix,
m_session,
@@ -313,7 +313,7 @@
m_dataRule,
bind(&ChatDialog::processTreeUpdateWrapper, this, _1, _2),
bind(&ChatDialog::processRemoveWrapper, this, _1));
-
+
usleep(100000);
QTimer::singleShot(600, this, SLOT(sendJoin()));
@@ -362,7 +362,7 @@
}
void
-ChatDialog::replyWrapper(const Interest& interest,
+ChatDialog::replyWrapper(const Interest& interest,
Data& data,
size_t routablePrefixOffset,
bool isIntroducer)
@@ -373,14 +373,14 @@
}
void
-ChatDialog::replyTimeoutWrapper(const Interest& interest,
+ChatDialog::replyTimeoutWrapper(const Interest& interest,
size_t routablePrefixOffset)
{
_LOG_DEBUG("ChatDialog::replyTimeoutWrapper");
emit replyTimeout(interest, routablePrefixOffset);
}
-void
+void
ChatDialog::onReplyValidated(const shared_ptr<const Data>& data,
size_t inviteeRoutablePrefixOffset,
bool isIntroducer)
@@ -415,8 +415,8 @@
}
void
-ChatDialog::invitationAccepted(const IdentityCertificate& inviteeCert,
- const Name& inviteePrefix,
+ChatDialog::invitationAccepted(const IdentityCertificate& inviteeCert,
+ const Name& inviteePrefix,
bool isIntroducer)
{
// Add invitee certificate as trust anchor.
@@ -435,7 +435,7 @@
if(!prefix.isPrefixOf(identity))
interestName.append(prefix).append(CHRONOS_RP_SEPARATOR, 2);
-
+
interestName.append(identity)
.append("CHRONOCHAT-CERT-LIST")
.append(m_chatroomName)
@@ -446,7 +446,7 @@
m_face->expressInterest(interest,
bind(&ChatDialog::onIntroCertList, this, _1, _2),
- bind(&ChatDialog::onIntroCertListTimeout, this, _1, 1,
+ bind(&ChatDialog::onIntroCertListTimeout, this, _1, 1,
"IntroCertList: " + interestName.toUri()));
}
@@ -467,9 +467,9 @@
m_face->expressInterest(interest,
bind(&ChatDialog::introCertWrapper, this, _1, _2),
- bind(&ChatDialog::introCertTimeoutWrapper, this, _1, 0,
+ bind(&ChatDialog::introCertTimeoutWrapper, this, _1, 0,
QString("IntroCert: %1").arg(introCertList.certname(i).c_str())));
- }
+ }
}
void
@@ -557,7 +557,7 @@
// send msg
OBufferStream os;
msg.SerializeToOstream(&os);
-
+
if (!msg.IsInitialized())
{
_LOG_DEBUG("Errrrr.. msg was not probally initialized "<<__FILE__ <<":"<<__LINE__<<". what is happening?");
@@ -766,7 +766,7 @@
using namespace CryptoPP;
StringSource(reinterpret_cast<uint8_t*>(&r), 4, true,
new HexEncoder(new FileSink(ss), false));
-
+
}
return ss.str();
@@ -875,7 +875,7 @@
erNode->addIntroducee(eeNode);
eeNode->addIntroducer(erNode);
}
-
+
nodeList.clear();
std::queue<shared_ptr<TrustTreeNode> > nodeQueue;
@@ -927,7 +927,7 @@
ChatDialog::onLocalPrefixUpdated(const QString& localPrefix)
{
Name newLocalPrefix(localPrefix.toStdString());
- if(!newLocalPrefix.empty() && newLocalPrefix != m_localPrefix)
+ if(!newLocalPrefix.empty() && newLocalPrefix != m_localPrefix)
{
// Update localPrefix
m_localPrefix = newLocalPrefix;
@@ -945,7 +945,7 @@
}
ui->textEdit->clear();
-
+
if (m_joined)
{
sendLeave();
@@ -953,7 +953,7 @@
delete m_sock;
m_sock = NULL;
-
+
usleep(100000);
m_sock = new Sync::SyncSocket(m_chatroomPrefix,
m_chatPrefix,
@@ -974,7 +974,7 @@
else
initializeSync();
}
- else
+ else
if (m_sock == NULL)
initializeSync();
@@ -1024,7 +1024,7 @@
fitView();
}
-void
+void
ChatDialog::onSyncTreeButtonPressed()
{
if (ui->syncTreeViewer->isVisible())
@@ -1256,14 +1256,14 @@
sendInvitation(inviteeItem, true);
}
-void
-ChatDialog::onReply(const Interest& interest,
+void
+ChatDialog::onReply(const Interest& interest,
const shared_ptr<const Data>& data,
size_t routablePrefixOffset,
bool isIntroducer)
{
OnDataValidated onValidated = bind(&ChatDialog::onReplyValidated,
- this, _1,
+ this, _1,
interest.getName().size()-routablePrefixOffset, //RoutablePrefix will be removed before data is passed to the validator
isIntroducer);
@@ -1282,7 +1282,7 @@
}
void
-ChatDialog::onReplyTimeout(const Interest& interest,
+ChatDialog::onReplyTimeout(const Interest& interest,
size_t routablePrefixOffset)
{
Name interestName;
diff --git a/src/chat-dialog.h b/src/chat-dialog.h
index c95aabf..7902e09 100644
--- a/src/chat-dialog.h
+++ b/src/chat-dialog.h
@@ -33,7 +33,7 @@
#include "trust-tree-node.h"
#include <sync-socket.h>
#include <sync-seq-no.h>
-#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include "validator-invitation.h"
#include <boost/thread/locks.hpp>
#include <boost/thread/recursive_mutex.hpp>
@@ -51,7 +51,7 @@
Q_OBJECT
public:
- explicit
+ explicit
ChatDialog(chronos::ContactManager* contactManager,
ndn::shared_ptr<ndn::Face> face,
const ndn::IdentityCertificate& myCertificate,
@@ -62,40 +62,40 @@
QWidget* parent = 0);
~ChatDialog();
-
- void
+
+ void
addSyncAnchor(const chronos::Invitation& invitation);
- void
+ void
processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>&, Sync::SyncSocket *);
- void
+ void
processDataWrapper(const ndn::shared_ptr<const ndn::Data>& data);
- void
+ void
processDataNoShowWrapper(const ndn::shared_ptr<const ndn::Data>& data);
- void
+ void
processRemoveWrapper(std::string);
protected:
- void
+ void
closeEvent(QCloseEvent *e);
void
changeEvent(QEvent *e);
- void
+ void
resizeEvent(QResizeEvent *);
-
- void
+
+ void
showEvent(QShowEvent *);
private:
void
updatePrefix();
-
- void
+
+ void
updateLabels();
void
@@ -104,17 +104,17 @@
void
sendInvitation(ndn::shared_ptr<chronos::Contact> contact, bool isIntroducer);
- void
- replyWrapper(const ndn::Interest& interest,
+ void
+ replyWrapper(const ndn::Interest& interest,
ndn::Data& data,
size_t routablePrefixOffset,
bool isIntroducer);
- void
+ void
replyTimeoutWrapper(const ndn::Interest& interest,
size_t routablePrefixOffset);
- void
+ void
onReplyValidated(const ndn::shared_ptr<const ndn::Data>& data,
size_t inviteeRoutablePrefixOffset,
bool isIntroduce);
@@ -125,10 +125,10 @@
void
invitationRejected(const ndn::Name& identity);
-
- void
+
+ void
invitationAccepted(const ndn::IdentityCertificate& inviteeCert,
- const ndn::Name& inviteePrefix,
+ const ndn::Name& inviteePrefix,
bool isIntroducer);
void
@@ -142,7 +142,7 @@
void
introCertWrapper(const ndn::Interest& interest, ndn::Data& data);
-
+
void
introCertTimeoutWrapper(const ndn::Interest& interest, int retry, const QString& msg);
@@ -159,43 +159,43 @@
onCertSingleRegisterFailed(const ndn::Name& prefix, const std::string& msg);
- void
+ void
sendMsg(SyncDemo::ChatMessage &msg);
- void
+ void
disableSyncTreeDisplay();
- void
+ void
appendMessage(const SyncDemo::ChatMessage msg, bool isHistory = false);
- void
+ void
processRemove(QString prefix);
ndn::Name
getInviteeRoutablePrefix(const ndn::Name& invitee);
- void
+ void
formChatMessage(const QString &text, SyncDemo::ChatMessage &msg);
- void
+ void
formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type);
- QString
+ QString
formatTime(time_t);
- void
+ void
printTimeInCell(QTextTable *, time_t);
- std::string
+ std::string
getRandomString();
- void
+ void
showMessage(const QString&, const QString&);
- void
+ void
fitView();
- void
+ void
summonReaper();
void
@@ -204,11 +204,11 @@
void
plotTrustTree();
-signals:
+signals:
void
processData(const ndn::shared_ptr<const ndn::Data>& data, bool show, bool isHistory);
- void
+ void
processTreeUpdate(const std::vector<Sync::MissingDataInfo>);
void
@@ -216,7 +216,7 @@
void
inivationRejection(const QString& msg);
-
+
void
showChatMessage(const QString& chatroomName, const QString& from, const QString& data);
@@ -229,13 +229,13 @@
size_t routablePrefixOffset, bool isIntroducer);
void
- replyTimeout(const ndn::Interest& interest,
+ replyTimeout(const ndn::Interest& interest,
size_t routablePrefixOffset);
void
introCert(const ndn::Interest& interest,
const ndn::shared_ptr<const ndn::Data>& data);
-
+
void
introCertTimeout(const ndn::Interest& interest,
int retry, const QString& msg);
@@ -254,29 +254,29 @@
void
onReturnPressed();
- void
+ void
onSyncTreeButtonPressed();
void
onTrustTreeButtonPressed();
- void
+ void
onProcessData(const ndn::shared_ptr<const ndn::Data>& data,
bool show, bool isHistory);
- void
+ void
onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>&);
- void
+ void
onReplot();
- void
+ void
onRosterChanged(QStringList);
void
onInviteListDialogRequested();
- void
+ void
sendJoin();
void
@@ -285,7 +285,7 @@
void
sendLeave();
- void
+ void
enableSyncTreeDisplay();
void
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index f89e023..fb792db 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -17,10 +17,10 @@
#include <QFile>
#ifndef Q_MOC_RUN
-#include <ndn-cpp-dev/util/crypto.hpp>
-#include <ndn-cpp-dev/util/io.hpp>
-#include <ndn-cpp-dev/security/sec-rule-relative.hpp>
-#include <ndn-cpp-dev/security/validator-regex.hpp>
+#include <ndn-cxx/util/crypto.hpp>
+#include <ndn-cxx/util/io.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/validator-regex.hpp>
#include <cryptopp/base64.h>
#include <cryptopp/files.h>
#include <cryptopp/sha.h>
@@ -105,7 +105,7 @@
{
shared_ptr<IdentityCertificate> anchor = loadTrustAnchor();
- shared_ptr<ValidatorRegex> validator = make_shared<ValidatorRegex>(m_face);
+ shared_ptr<ValidatorRegex> validator = make_shared<ValidatorRegex>(boost::ref(*m_face));
validator->addDataVerificationRule(make_shared<SecRuleRelative>("^([^<DNS>]*)<DNS><ENDORSED>",
"^([^<KEY>]*)<KEY>(<>*)<><ID-CERT>$",
"==", "\\1", "\\1\\2", true));
@@ -116,7 +116,7 @@
"^([^<KEY>]*)<KEY>(<>*)<><ID-CERT>$",
"==", "\\1", "\\1\\2", true));
validator->addDataVerificationRule(make_shared<SecRuleRelative>("^([^<PROFILE-CERT>]*)<PROFILE-CERT>",
- "^([^<KEY>]*)<KEY>(<>*<ksk-.*>)<ID-CERT>$",
+ "^([^<KEY>]*)<KEY>(<>*<ksk-.*>)<ID-CERT>$",
"==", "\\1", "\\1\\2", true));
validator->addDataVerificationRule(make_shared<SecRuleRelative>("^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>",
"^([^<KEY>]*)<KEY><dsk-.*><ID-CERT>$",
@@ -124,8 +124,8 @@
validator->addDataVerificationRule(make_shared<SecRuleRelative>("^([^<KEY>]*)<KEY><dsk-.*><ID-CERT>",
"^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
"==", "\\1", "\\1\\2", true));
- validator->addDataVerificationRule(make_shared<SecRuleRelative>("^(<>*)$",
- "^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
+ validator->addDataVerificationRule(make_shared<SecRuleRelative>("^(<>*)$",
+ "^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
">", "\\1", "\\1\\2", true));
validator->addTrustAnchor(anchor);
m_validator = validator;
@@ -163,7 +163,7 @@
interest.setMustBeFresh(true);
m_face->expressInterest(interest,
- bind(&ContactManager::onEndorseCertificateInternal,
+ bind(&ContactManager::onEndorseCertificateInternal,
this, _1, _2, identity, certIndex,
endorseCollection->endorsement(certIndex).hash()),
bind(&ContactManager::onEndorseCertificateInternalTimeout,
@@ -199,8 +199,8 @@
shared_ptr<Contact> contact = getContact((*cIt)->getSigner().getPrefix(-1));
if(!static_cast<bool>(contact))
continue;
-
- if(!contact->isIntroducer()
+
+ if(!contact->isIntroducer()
|| !contact->canBeTrustedFor(profile.getIdentityName()))
continue;
@@ -233,7 +233,7 @@
}
void
-ContactManager::onDnsSelfEndorseCertValidated(const shared_ptr<const Data>& data,
+ContactManager::onDnsSelfEndorseCertValidated(const shared_ptr<const Data>& data,
const Name& identity)
{
try
@@ -264,7 +264,7 @@
}
void
-ContactManager::onDnsSelfEndorseCertValidationFailed(const shared_ptr<const Data>& data,
+ContactManager::onDnsSelfEndorseCertValidationFailed(const shared_ptr<const Data>& data,
const std::string& failInfo,
const Name& identity)
{
@@ -283,7 +283,7 @@
}
void
-ContactManager::onDnsCollectEndorseValidated(const shared_ptr<const Data>& data,
+ContactManager::onDnsCollectEndorseValidated(const shared_ptr<const Data>& data,
const Name& identity)
{
shared_ptr<EndorseCollection> endorseCollection = make_shared<EndorseCollection>();
@@ -297,7 +297,7 @@
}
void
-ContactManager::onDnsCollectEndorseValidationFailed(const shared_ptr<const Data>& data,
+ContactManager::onDnsCollectEndorseValidationFailed(const shared_ptr<const Data>& data,
const std::string& failInfo,
const Name& identity)
{
@@ -314,20 +314,20 @@
void
ContactManager::onEndorseCertificateInternal(const Interest& interest,
- Data& data,
- const Name& identity,
+ Data& data,
+ const Name& identity,
int certIndex,
std::string hash)
{
std::stringstream ss;
- {
+ {
using namespace CryptoPP;
SHA256 hash;
StringSource(data.wireEncode().wire(), data.wireEncode().size(), true,
new HashFilter(hash, new FileSink(ss)));
}
-
+
if(ss.str() == hash)
{
shared_ptr<EndorseCertificate> endorseCertificate = make_shared<EndorseCertificate>(boost::cref(data));
@@ -339,7 +339,7 @@
void
ContactManager::onEndorseCertificateInternalTimeout(const Interest& interest,
- const Name& identity,
+ const Name& identity,
int certIndex)
{
fetchEndorseCertificateInternal(identity, certIndex+1);
@@ -351,7 +351,7 @@
{
boost::recursive_mutex::scoped_lock lock(m_collectCountMutex);
m_collectCount = m_contactList.size();
-
+
ContactList::iterator it = m_contactList.begin();
ContactList::iterator end = m_contactList.end();
@@ -359,14 +359,14 @@
{
Name interestName = (*it)->getNameSpace();
interestName.append("DNS").append(m_identity.wireEncode()).append("ENDORSEE");
-
+
Interest interest(interestName);
interest.setInterestLifetime(time::milliseconds(1000));
-
+
OnDataValidated onValidated = bind(&ContactManager::onDnsEndorseeValidated, this, _1);
OnDataValidationFailed onValidationFailed = bind(&ContactManager::onDnsEndorseeValidationFailed, this, _1, _2);
TimeoutNotify timeoutNotify = bind(&ContactManager::onDnsEndorseeTimeoutNotify, this, _1);
-
+
sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
}
}
@@ -396,10 +396,10 @@
decreaseCollectStatus();
}
-void
+void
ContactManager::decreaseCollectStatus()
{
- int count;
+ int count;
{
boost::recursive_mutex::scoped_lock lock(m_collectCountMutex);
m_collectCount--;
@@ -425,7 +425,7 @@
OBufferStream os;
endorseCollection.SerializeToOstream(&os);
- data.setContent(os.buf());
+ data.setContent(os.buf());
m_keyChain.signByIdentity(data, m_identity);
m_contactStorage->updateDnsOthersEndorse(data);
@@ -494,12 +494,12 @@
Profile::const_iterator it = profile.begin();
for(; it != profile.end(); it++)
endorseList.push_back(it->first);
-
- shared_ptr<EndorseCertificate> selfEndorseCertificate =
+
+ shared_ptr<EndorseCertificate> selfEndorseCertificate =
shared_ptr<EndorseCertificate>(new EndorseCertificate(*signingCert, profile, endorseList));
-
+
m_keyChain.sign(*selfEndorseCertificate, certificateName);
-
+
return selfEndorseCertificate;
}
@@ -520,7 +520,7 @@
m_face->put(data);
}
-shared_ptr<EndorseCertificate>
+shared_ptr<EndorseCertificate>
ContactManager::generateEndorseCertificate(const Name& identity)
{
shared_ptr<Contact> contact = getContact(identity);
@@ -532,14 +532,14 @@
std::vector<std::string> endorseList;
m_contactStorage->getEndorseList(identity, endorseList);
- shared_ptr<EndorseCertificate> cert =
- shared_ptr<EndorseCertificate>(new EndorseCertificate(contact->getPublicKeyName(),
+ shared_ptr<EndorseCertificate> cert =
+ shared_ptr<EndorseCertificate>(new EndorseCertificate(contact->getPublicKeyName(),
contact->getPublicKey(),
contact->getNotBefore(),
contact->getNotAfter(),
- signerKeyName,
- contact->getProfile(),
- endorseList));
+ signerKeyName,
+ contact->getProfile(),
+ endorseList));
m_keyChain.signByIdentity(*cert, m_identity);
return cert;
@@ -572,25 +572,25 @@
const TimeoutNotify& timeoutNotify,
int retry /* = 1 */)
{
- m_face->expressInterest(interest,
- bind(&ContactManager::onTargetData,
+ m_face->expressInterest(interest,
+ bind(&ContactManager::onTargetData,
this, _1, _2, onValidated, onValidationFailed),
bind(&ContactManager::onTargetTimeout,
this, _1, retry, onValidated, onValidationFailed, timeoutNotify));
}
void
-ContactManager::onTargetData(const Interest& interest,
+ContactManager::onTargetData(const Interest& interest,
const Data& data,
const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed)
{
// _LOG_DEBUG("On receiving data: " << data.getName());
- m_validator->validate(data, onValidated, onValidationFailed);
+ m_validator->validate(data, onValidated, onValidationFailed);
}
void
-ContactManager::onTargetTimeout(const Interest& interest,
+ContactManager::onTargetTimeout(const Interest& interest,
int retry,
const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
@@ -608,7 +608,7 @@
{
const Name& interestName = interest.getName();
shared_ptr<Data> data;
-
+
if(interestName.size() <= prefix.size())
return;
@@ -629,7 +629,7 @@
return;
}
}
-
+
void
ContactManager::onDnsRegisterFailed(const Name& prefix, const std::string& failInfo)
{
@@ -650,7 +650,7 @@
Name dnsPrefix;
dnsPrefix.append(m_identity).append("DNS");
- m_dnsListenerId = m_face->setInterestFilter(dnsPrefix,
+ m_dnsListenerId = m_face->setInterestFilter(dnsPrefix,
bind(&ContactManager::onDnsInterest, this, _1, _2),
bind(&ContactManager::onDnsRegisterFailed, this, _1, _2));
@@ -671,7 +671,7 @@
interestName.append(identityName).append("DNS").append("PROFILE");
// _LOG_DEBUG("onFetchContactInfo " << identity.toStdString() << " profile: " << interestName);
-
+
Interest interest(interestName);
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
@@ -786,7 +786,7 @@
std::istreambuf_iterator<char> stream_iter (request_stream);
std::istreambuf_iterator<char> end_of_stream;
-
+
typedef boost::tokenizer< boost::escaped_list_separator<char>, std::istreambuf_iterator<char> > tokenizer_t;
tokenizer_t certItems (stream_iter, end_of_stream,boost::escaped_list_separator<char>('\\', '\n', '"'));
@@ -814,14 +814,14 @@
Interest interest(certName);
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
-
+
OnDataValidated onValidated = bind(&ContactManager::onIdentityCertValidated, this, _1);
OnDataValidationFailed onValidationFailed = bind(&ContactManager::onIdentityCertValidationFailed, this, _1, _2);
TimeoutNotify timeoutNotify = bind(&ContactManager::onIdentityCertTimeoutNotify, this, _1);
sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
}
-
+
}
void
@@ -868,7 +868,7 @@
{
ContactList::const_iterator it = m_contactList.begin();
ContactList::const_iterator end = m_contactList.end();
-
+
QStringList aliasList;
QStringList idList;
for(; it != end; it++)
@@ -876,7 +876,7 @@
aliasList << QString((*it)->getAlias().c_str());
idList << QString((*it)->getNameSpace().toUri().c_str());
}
-
+
emit contactAliasListReady(aliasList);
emit contactIdListReady(idList);
}
diff --git a/src/contact-manager.h b/src/contact-manager.h
index c370bd7..8ab7e81 100644
--- a/src/contact-manager.h
+++ b/src/contact-manager.h
@@ -19,9 +19,9 @@
#include "profile.h"
#include "endorse-info.pb.h"
#include "endorse-collection.pb.h"
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/security/validator.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/validator.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/recursive_mutex.hpp>
#endif
@@ -70,22 +70,22 @@
prepareEndorseInfo(const ndn::Name& identity);
// PROFILE: self-endorse-certificate
- void
- onDnsSelfEndorseCertValidated(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
+ void
+ onDnsSelfEndorseCertValidated(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
const ndn::Name& identity);
void
- onDnsSelfEndorseCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
+ onDnsSelfEndorseCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
const std::string& failInfo,
const ndn::Name& identity);
void
onDnsSelfEndorseCertTimeoutNotify(const ndn::Interest& interest,
const ndn::Name& identity);
-
+
// ENDORSED: endorse-collection
void
- onDnsCollectEndorseValidated(const ndn::shared_ptr<const ndn::Data>& data,
+ onDnsCollectEndorseValidated(const ndn::shared_ptr<const ndn::Data>& data,
const ndn::Name& identity);
void
@@ -95,19 +95,19 @@
void
onDnsCollectEndorseTimeoutNotify(const ndn::Interest& interest,
- const ndn::Name& identity);
+ const ndn::Name& identity);
// PROFILE-CERT: endorse-certificate
void
onEndorseCertificateInternal(const ndn::Interest& interest,
- ndn::Data& data,
- const ndn::Name& identity,
+ ndn::Data& data,
+ const ndn::Name& identity,
int certIndex,
std::string hash);
void
onEndorseCertificateInternalTimeout(const ndn::Interest& interest,
- const ndn::Name& identity,
+ const ndn::Name& identity,
int certIndex);
// Collect endorsement
@@ -133,7 +133,7 @@
// Identity certificate
void
onIdentityCertValidated(const ndn::shared_ptr<const ndn::Data>& data);
-
+
void
onIdentityCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
const std::string& failInfo);
@@ -152,7 +152,7 @@
publishSelfEndorseCertificateInDNS(const EndorseCertificate& selfEndorseCertificate);
// Publish endorse certificate
- ndn::shared_ptr<EndorseCertificate>
+ ndn::shared_ptr<EndorseCertificate>
generateEndorseCertificate(const ndn::Name& identity);
void
@@ -167,13 +167,13 @@
int retry = 1);
void
- onTargetData(const ndn::Interest& interest,
+ onTargetData(const ndn::Interest& interest,
const ndn::Data& data,
const ndn::OnDataValidated& onValidated,
const ndn::OnDataValidationFailed& onValidationFailed);
void
- onTargetTimeout(const ndn::Interest& interest,
+ onTargetTimeout(const ndn::Interest& interest,
int retry,
const ndn::OnDataValidated& onValidated,
const ndn::OnDataValidationFailed& onValidationFailed,
@@ -182,7 +182,7 @@
// DNS listener
void
onDnsInterest(const ndn::Name& prefix, const ndn::Interest& interest);
-
+
void
onDnsRegisterFailed(const ndn::Name& prefix, const std::string& failInfo);
@@ -195,7 +195,7 @@
void
idCertNameListReady(const QStringList& certNameList);
-
+
void
nameListReady(const QStringList& certNameList);
@@ -209,9 +209,9 @@
contactIdListReady(const QStringList& idList);
void
- contactInfoReady(const QString& identity,
- const QString& name,
- const QString& institute,
+ contactInfoReady(const QString& identity,
+ const QString& name,
+ const QString& institute,
bool isIntro);
void
@@ -223,7 +223,7 @@
void
onFetchContactInfo(const QString& identity);
-
+
void
onAddFetchedContact(const QString& identity);
@@ -244,7 +244,7 @@
void
onWaitForContactInfo(const QString& identity);
-
+
void
onRemoveContact(const QString& identity);
diff --git a/src/contact-panel.cpp b/src/contact-panel.cpp
index 2c2c8e9..323667b 100644
--- a/src/contact-panel.cpp
+++ b/src/contact-panel.cpp
@@ -24,7 +24,7 @@
INIT_LOGGER("ContactPanel");
-ContactPanel::ContactPanel(QWidget *parent)
+ContactPanel::ContactPanel(QWidget *parent)
: QDialog(parent)
, ui(new Ui::ContactPanel)
, m_setAliasDialog(new SetAliasDialog)
@@ -158,9 +158,9 @@
}
void
-ContactPanel::onContactInfoReady(const QString& identity,
- const QString& name,
- const QString& institute,
+ContactPanel::onContactInfoReady(const QString& identity,
+ const QString& name,
+ const QString& institute,
bool isIntro)
{
ui->NameData->setText(name);
@@ -181,7 +181,7 @@
{
ui->isIntroducer->setChecked(true);
ui->addScope->setEnabled(true);
- ui->deleteScope->setEnabled(true);
+ ui->deleteScope->setEnabled(true);
ui->trustScopeList->setEnabled(true);
}
else
@@ -317,10 +317,10 @@
QItemSelectionModel* selectionModel = ui->trustScopeList->selectionModel();
QModelIndexList indexList = selectionModel->selectedIndexes();
- int i = indexList.size() - 1;
+ int i = indexList.size() - 1;
for(; i >= 0; i--)
m_trustScopeModel->removeRow(indexList[i].row());
-
+
m_trustScopeModel->submitAll();
}
diff --git a/src/contact-panel.h b/src/contact-panel.h
index 74010fc..f47287f 100644
--- a/src/contact-panel.h
+++ b/src/contact-panel.h
@@ -21,7 +21,6 @@
#ifndef Q_MOC_RUN
#endif
-
namespace Ui {
class ContactPanel;
}
@@ -31,7 +30,7 @@
Q_OBJECT
public:
- explicit
+ explicit
ContactPanel(QWidget *parent = 0);
virtual
@@ -56,7 +55,7 @@
void
updateIsIntroducer(const QString& identity, bool isIntro);
-
+
void
updateEndorseCertificate(const QString& identity);
@@ -77,11 +76,11 @@
onContactIdListReady(const QStringList& idList);
void
- onContactInfoReady(const QString& identity,
- const QString& name,
+ onContactInfoReady(const QString& identity,
+ const QString& name,
const QString& institute,
bool isIntro);
-
+
private slots:
void
onSelectionChanged(const QItemSelection &selected,
@@ -111,7 +110,7 @@
void
onEndorseButtonClicked();
- void
+ void
onAliasChanged(const QString& identity, const QString& alias);
private:
@@ -131,7 +130,7 @@
// Actions.
QAction* m_menuAlias;
QAction* m_menuDelete;
-
+
// Internal data structure.
QStringList m_contactAliasList;
QStringList m_contactIdList;
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index d5aeee8..aaf8b79 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -191,7 +191,7 @@
shared_ptr<Profile>
ContactStorage::getSelfProfile()
-{
+{
shared_ptr<Profile> profile = make_shared<Profile>(m_identity);
sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM SelfProfile", -1, &stmt, 0);
@@ -249,7 +249,7 @@
const Block &block = endorseCertificate.wireEncode();
sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(block.wire()), block.size(), SQLITE_TRANSIENT);
int res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_finalize (stmt);
return;
}
@@ -288,18 +288,18 @@
while( sqlite3_step (stmt) == SQLITE_ROW)
{
std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
- endorseList.push_back(profileType);
+ endorseList.push_back(profileType);
}
- sqlite3_finalize (stmt);
+ sqlite3_finalize (stmt);
}
-void
+void
ContactStorage::removeContact(const Name& identityName)
{
std::string identity = identityName.toUri();
-
- sqlite3_stmt *stmt;
+
+ sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "DELETE FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
int res = sqlite3_step (stmt);
@@ -309,13 +309,13 @@
sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
res = sqlite3_step (stmt);
sqlite3_finalize (stmt);
-
+
sqlite3_prepare_v2 (m_db, "DELETE FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_finalize (stmt);
}
-
+
void
ContactStorage::addContact(const Contact& contact)
{
@@ -325,9 +325,9 @@
std::string identity = contact.getNameSpace().toUri();
bool isIntroducer = contact.isIntroducer();
- sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer) values (?, ?, ?, ?, ?, ?, ?)",
+ sqlite3_stmt *stmt;
+ sqlite3_prepare_v2 (m_db,
+ "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer) values (?, ?, ?, ?, ?, ?, ?)",
-1,
&stmt,
0);
@@ -351,10 +351,10 @@
for(; it != profile.end(); it++)
{
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO ContactProfile (profile_identity, profile_type, profile_value, endorse) values (?, ?, ?, 0)",
- -1,
- &stmt,
+ sqlite3_prepare_v2 (m_db,
+ "INSERT INTO ContactProfile (profile_identity, profile_type, profile_value, endorse) values (?, ?, ?, 0)",
+ -1,
+ &stmt,
0);
sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, it->first.c_str(), it->first.size(), SQLITE_TRANSIENT);
@@ -370,15 +370,15 @@
while(it != end)
{
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)",
- -1,
- &stmt,
+ sqlite3_prepare_v2 (m_db,
+ "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)",
+ -1,
+ &stmt,
0);
sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, it->first.toUri().c_str(), it->first.toUri().size(), SQLITE_TRANSIENT);
res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_finalize (stmt);
it++;
}
}
@@ -410,7 +410,7 @@
sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM ContactProfile where profile_identity=?", -1, &stmt, 0);
sqlite3_bind_text (stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
-
+
while(sqlite3_step (stmt) == SQLITE_ROW)
{
std::string type(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
@@ -449,7 +449,7 @@
return;
}
-void
+void
ContactStorage::updateAlias(const Name& identity, std::string alias)
{
sqlite3_stmt *stmt;
@@ -465,20 +465,20 @@
ContactStorage::doesContactExist(const Name& name)
{
bool result = false;
-
+
sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "SELECT count(*) FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, name.toUri().c_str(), name.toUri().size(), SQLITE_TRANSIENT);
int res = sqlite3_step (stmt);
-
+
if (res == SQLITE_ROW)
{
int countAll = sqlite3_column_int (stmt, 0);
if (countAll > 0)
result = true;
- }
- sqlite3_finalize (stmt);
+ }
+ sqlite3_finalize (stmt);
return result;
}
@@ -489,7 +489,7 @@
sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "SELECT contact_namespace FROM Contact", -1, &stmt, 0);
-
+
while(sqlite3_step (stmt) == SQLITE_ROW)
{
std::string identity(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 0));
@@ -508,16 +508,16 @@
}
void
-ContactStorage::updateDnsData(const Block& data,
- const std::string& name,
- const std::string& type,
+ContactStorage::updateDnsData(const Block& data,
+ const std::string& name,
+ const std::string& type,
const std::string& dataName)
-{
+{
sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO DnsData (dns_name, dns_type, dns_value, data_name) VALUES (?, ?, ?, ?)", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(data.wire()), data.size(), SQLITE_TRANSIENT);
+ sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(data.wire()), data.size(), SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, dataName.c_str(), dataName.size(), SQLITE_TRANSIENT);
int res = sqlite3_step(stmt);
@@ -533,7 +533,7 @@
sqlite3_stmt *stmt;
sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where data_name=?", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, dataName.toUri().c_str(), dataName.toUri().size(), SQLITE_TRANSIENT);
-
+
if(sqlite3_step (stmt) == SQLITE_ROW)
{
data = make_shared<Data>();
@@ -553,7 +553,7 @@
sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where dns_name=? and dns_type=?", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
-
+
if(sqlite3_step (stmt) == SQLITE_ROW)
{
data = make_shared<Data>();
diff --git a/src/contact-storage.h b/src/contact-storage.h
index 5662ebb..1dd4804 100644
--- a/src/contact-storage.h
+++ b/src/contact-storage.h
@@ -15,7 +15,6 @@
#include "endorse-collection.pb.h"
#include <sqlite3.h>
-
namespace chronos{
class ContactStorage
@@ -25,15 +24,15 @@
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
ContactStorage(const ndn::Name& identity);
-
- ~ContactStorage()
+
+ ~ContactStorage()
{
- sqlite3_close(m_db);
+ sqlite3_close(m_db);
}
ndn::shared_ptr<Profile>
getSelfProfile();
-
+
void
addSelfEndorseCertificate(const EndorseCertificate& endorseCertificate);
@@ -63,7 +62,7 @@
void
updateIsIntroducer(const ndn::Name& identity, bool isIntroducer);
- void
+ void
updateAlias(const ndn::Name& identity, std::string alias);
void
@@ -80,11 +79,11 @@
{
updateDnsData(data.wireEncode(), endorsee, "ENDORSEE", data.getName().toUri());
}
-
+
void
updateDnsOthersEndorse(const ndn::Data& data)
{
- updateDnsData(data.wireEncode(), "N/A", "ENDORSED", data.getName().toUri());
+ updateDnsData(data.wireEncode(), "N/A", "ENDORSED", data.getName().toUri());
}
ndn::shared_ptr<ndn::Data>
@@ -96,7 +95,7 @@
private:
std::string
getDBName();
-
+
void
initializeTable(const std::string& tableName, const std::string& sqlCreateStmt);
diff --git a/src/contact.h b/src/contact.h
index e7736bf..a95ad42 100644
--- a/src/contact.h
+++ b/src/contact.h
@@ -11,8 +11,8 @@
#ifndef CHRONOS_CONTACT_H
#define CHRONOS_CONTACT_H
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/util/regex.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/util/regex.hpp>
#include "endorse-certificate.h"
#include <vector>
@@ -35,7 +35,7 @@
m_name = m_profile.get("name");
m_alias = alias.empty() ? m_name : alias;
m_institution = m_profile.get("institution");
-
+
m_keyName = identityCertificate.getPublicKeyName();
m_namespace = m_keyName.getPrefix(-1);
m_publicKey = identityCertificate.getPublicKeyInfo();
@@ -47,13 +47,13 @@
: m_notBefore(endorseCertificate.getNotBefore())
, m_notAfter(endorseCertificate.getNotAfter())
, m_isIntroducer(isIntroducer)
- {
+ {
m_profile = endorseCertificate.getProfile();
-
+
m_name = m_profile.get("name");
m_alias = alias.empty() ? m_name : alias;
m_institution = m_profile.get("institution");
-
+
m_keyName = endorseCertificate.getPublicKeyName();;
m_namespace = m_keyName.getPrefix(-1);
m_publicKey = endorseCertificate.getPublicKeyInfo();
@@ -75,7 +75,7 @@
, m_isIntroducer(isIntroducer)
{
}
-
+
Contact(const Contact& contact)
: m_namespace(contact.m_namespace)
, m_alias(contact.m_alias)
@@ -89,7 +89,7 @@
, m_profile(contact.m_profile)
, m_trustScope(contact.m_trustScope)
{}
-
+
virtual
~Contact()
{}
@@ -121,7 +121,7 @@
const ndn::Name&
getPublicKeyName() const
{
- return m_keyName;
+ return m_keyName;
}
const ndn::PublicKey&
@@ -163,15 +163,15 @@
}
void
- setIsIntroducer(bool isIntroducer)
- {
- m_isIntroducer = isIntroducer;
+ setIsIntroducer(bool isIntroducer)
+ {
+ m_isIntroducer = isIntroducer;
}
void
addTrustScope(const ndn::Name& nameSpace)
- {
- m_trustScope[nameSpace] = ndn::Regex::fromName(nameSpace);
+ {
+ m_trustScope[nameSpace] = ndn::Regex::fromName(nameSpace);
}
void
@@ -229,7 +229,7 @@
bool m_isIntroducer;
Profile m_profile;
-
+
TrustScopes m_trustScope;
};
diff --git a/src/controller.cpp b/src/controller.cpp
index 171dfc7..7517a4e 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -17,7 +17,7 @@
#ifndef Q_MOC_RUN
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include <ndn-cpp-dev/util/random.hpp>
+#include <ndn-cxx/util/random.hpp>
#include <cryptopp/sha.h>
#include <cryptopp/hex.h>
#include <cryptopp/files.h>
@@ -45,7 +45,7 @@
// constructor & destructor
Controller::Controller(shared_ptr<Face> face,
- QWidget* parent)
+ QWidget* parent)
: QDialog(parent)
, m_face(face)
, m_invitationListenerId(0)
@@ -160,7 +160,7 @@
onUpdateLocalPrefixAction();
}
-
+
Controller::~Controller()
{
saveConf();
@@ -204,7 +204,7 @@
Controller::initialize()
{
loadConf();
-
+
m_keyChain.createIdentity(m_identity);
openDB();
@@ -219,7 +219,7 @@
{
if(m_invitationListenerId != 0)
m_face->unsetInterestFilter(m_invitationListenerId);
-
+
Name invitationPrefix;
Name routingPrefix = getInvitationRoutingPrefix();
size_t offset = 0;
@@ -230,7 +230,7 @@
}
invitationPrefix.append(m_identity).append("CHRONOCHAT-INVITATION");
- m_invitationListenerId = m_face->setInterestFilter(invitationPrefix,
+ m_invitationListenerId = m_face->setInterestFilter(invitationPrefix,
bind(&Controller::onInvitationInterestWrapper, this, _1, _2, offset),
bind(&Controller::onInvitationRegisterFailed, this, _1, _2));
}
@@ -260,12 +260,12 @@
// TODO: change below to system default;
m_identity.append("chronochat-tmp-identity")
.append(getRandomString());
-
+
m_nick = m_identity.get(-1).toUri();
}
}
-void
+void
Controller::saveConf()
{
namespace fs = boost::filesystem;
@@ -346,7 +346,7 @@
{
QMenu* menu = new QMenu(this);
QMenu* closeMenu = 0;
-
+
menu->addAction(m_startChatroom);
menu->addSeparator();
menu->addAction(m_settingsAction);
@@ -384,7 +384,7 @@
}
menu->addSeparator();
menu->addAction(m_quitAction);
-
+
m_trayIcon->setContextMenu(menu);
delete m_trayIconMenu;
m_trayIconMenu = menu;
@@ -450,7 +450,7 @@
using namespace CryptoPP;
StringSource(reinterpret_cast<uint8_t*>(&r), 4, true,
new HexEncoder(new FileSink(ss), false));
-
+
}
// for(int i = 0; i < 8; i++)
// {
@@ -512,7 +512,7 @@
setInvitationListener();
emit closeDBModule();
-
+
QTimer::singleShot(500, this, SLOT(onIdentityUpdatedContinued()));
}
@@ -524,7 +524,7 @@
// _LOG_DEBUG("connection name: " << connection.toStdString());
QSqlDatabase::removeDatabase(connection);
m_db.close();
-
+
openDB();
emit identityUpdated(QString(m_identity.toUri().c_str()));
@@ -613,9 +613,9 @@
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
- m_face->expressInterest(interest,
- bind(&Controller::onLocalPrefix, this, _1, _2),
- bind(&Controller::onLocalPrefixTimeout, this, _1));
+ m_face->expressInterest(interest,
+ bind(&Controller::onLocalPrefix, this, _1, _2),
+ bind(&Controller::onLocalPrefixTimeout, this, _1));
}
void
@@ -679,7 +679,7 @@
shared_ptr<IdentityCertificate> idCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
ChatDialog* chatDialog = new ChatDialog(&m_contactManager, m_face, *idCert, chatroomPrefix, m_localPrefix, m_nick, secured);
- addChatDialog(chatroomName, chatDialog);
+ addChatDialog(chatroomName, chatDialog);
chatDialog->show();
}
@@ -709,7 +709,7 @@
response.setFreshnessPeriod(time::milliseconds(1000));
}
m_keyChain.signByIdentity(response, m_identity);
-
+
// Check if we need a wrapper
Name invitationRoutingPrefix = getInvitationRoutingPrefix();
if(invitationRoutingPrefix.isPrefixOf(m_identity))
@@ -724,7 +724,7 @@
.append(response.getName());
_LOG_DEBUG("onInvitationResponded: prepare reply " << wrappedName);
-
+
Data wrappedData(wrappedName);
wrappedData.setContent(response.wireEncode());
wrappedData.setFreshnessPeriod(time::milliseconds(1000));
@@ -756,8 +756,8 @@
void
Controller::onShowChatMessage(const QString& chatroomName, const QString& from, const QString& data)
{
- m_trayIcon->showMessage(QString("Chatroom %1 has a new message").arg(chatroomName),
- QString("<%1>: %2").arg(from).arg(data),
+ m_trayIcon->showMessage(QString("Chatroom %1 has a new message").arg(chatroomName),
+ QString("<%1>: %2").arg(from).arg(data),
QSystemTrayIcon::Information, 20000);
m_trayIcon->setIcon(QIcon(":/images/note.png"));
}
@@ -786,10 +786,10 @@
delete chatAction;
if(closeAction)
delete closeAction;
-
+
m_chatActionList.erase(chatroomName.toStdString());
m_closeActionList.erase(chatroomName.toStdString());
-
+
updateMenu();
}
}
@@ -801,7 +801,7 @@
}
void
-Controller::onError(const QString& msg)
+Controller::onError(const QString& msg)
{
QMessageBox::critical(this, tr("ChronoChat"), msg, QMessageBox::Ok);
exit(1);
diff --git a/src/controller.h b/src/controller.h
index 40a481a..77828d0 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -28,8 +28,8 @@
#ifndef Q_MOC_RUN
#include "contact-manager.h"
#include "validator-invitation.h"
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#endif
namespace chronos {
@@ -41,7 +41,7 @@
public: // public methods
Controller(ndn::shared_ptr<ndn::Face> face,
QWidget* parent = 0);
-
+
virtual
~Controller();
@@ -64,7 +64,7 @@
void
saveConf();
- void
+ void
createActions();
void
@@ -81,7 +81,7 @@
void
onInvitationInterestWrapper(const ndn::Name& prefix, const ndn::Interest& interest, size_t routingPrefixOffset);
-
+
void
onInvitationRegisterFailed(const ndn::Name& prefix, const std::string& failInfo);
@@ -167,7 +167,7 @@
void
onShowChatMessage(const QString& chatroomName, const QString& from, const QString& data);
-
+
void
onResetIcon();
diff --git a/src/digest-tree-scene.cpp b/src/digest-tree-scene.cpp
index b885714..88315b1 100644
--- a/src/digest-tree-scene.cpp
+++ b/src/digest-tree-scene.cpp
@@ -35,17 +35,17 @@
DigestTreeScene::processUpdate(const std::vector<Sync::MissingDataInfo> &v, QString digest)
{
int n = v.size();
- bool rePlot = false;
- for (int i = 0; i < n; i++)
+ bool rePlot = false;
+ for (int i = 0; i < n; i++)
{
QString routablePrefix(v[i].prefix.c_str());
QString prefix = trimRoutablePrefix(routablePrefix);
Roster_iterator it = m_roster.find(prefix);
- if (it == m_roster.end())
+ if (it == m_roster.end())
{
// std::cout << "processUpdate v[" << i << "]: " << prefix.toStdString() << std::endl;
- rePlot = true;
+ rePlot = true;
DisplayUserPtr p(new DisplayUser());
time_t tempTime = time(NULL) - FRESHNESS + 1;
p->setReceived(tempTime);
@@ -53,24 +53,24 @@
p->setSeq(v[i].high);
m_roster.insert(p->getPrefix(), p);
}
- else
+ else
{
it.value()->setSeq(v[i].high);
}
}
- if (rePlot)
+ if (rePlot)
{
plot(digest);
QTimer::singleShot(2100, this, SLOT(emitReplot()));
}
- else
+ else
{
- for (int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
QString routablePrefix(v[i].prefix.c_str());
QString prefix = trimRoutablePrefix(routablePrefix);
-
+
Roster_iterator it = m_roster.find(prefix);
if (it != m_roster.end()) {
DisplayUserPtr p = it.value();
@@ -116,12 +116,12 @@
QString prefix = trimRoutablePrefix(routablePrefix);
Roster_iterator it = m_roster.find(prefix);
// std::cout << "msgReceived prefix: " << prefix.toStdString() << std::endl;
- if (it != m_roster.end())
+ if (it != m_roster.end())
{
// std::cout << "Updating for prefix = " << prefix.toStdString() << " nick = " << nick.toStdString() << std::endl;
DisplayUserPtr p = it.value();
p->setReceived(time(NULL));
- if (nick != p->getNick())
+ if (nick != p->getNick())
{
// std::cout << "old nick = " << p->getNick().toStdString() << std::endl;
p->setNick(nick);
@@ -136,7 +136,7 @@
reDrawNode(p, Qt::red);
- if (previouslyUpdatedUser != DisplayUserNullPtr && previouslyUpdatedUser != p)
+ if (previouslyUpdatedUser != DisplayUserNullPtr && previouslyUpdatedUser != p)
{
reDrawNode(previouslyUpdatedUser, Qt::darkBlue);
}
@@ -279,11 +279,11 @@
// plot child nodes
for (int i = 0; i < n; i++)
{
- if (it.hasNext())
+ if (it.hasNext())
{
it.next();
}
- else
+ else
{
abort();
}
@@ -302,7 +302,7 @@
std::string s = boost::lexical_cast<std::string>(p->getSeqNo().getSeq());
QGraphicsTextItem *seqItem = addText(s.c_str());
seqItem->setFont(QFont("Cursive", 12, QFont::Bold));
- QRectF seqBoundingRect = seqItem->boundingRect();
+ QRectF seqBoundingRect = seqItem->boundingRect();
seqItem->setPos(x + nodeSize / 2 - seqBoundingRect.width() / 2, y + nodeSize / 2 - seqBoundingRect.height() / 2);
p->setSeqTextItem(seqItem);
@@ -334,7 +334,7 @@
seqTextItem->setPos(innerBR.x() + (innerBR.width() - textBR.width())/2, innerBR.y() + (innerBR.height() - textBR.height())/2);
}
-QString
+QString
DigestTreeScene::trimRoutablePrefix(QString prefix)
{
bool encaped = false;
diff --git a/src/digest-tree-scene.h b/src/digest-tree-scene.h
index bab1139..06befa8 100644
--- a/src/digest-tree-scene.h
+++ b/src/digest-tree-scene.h
@@ -69,12 +69,12 @@
private:
Roster m_roster;
- QGraphicsTextItem *m_rootDigest;
+ QGraphicsTextItem *m_rootDigest;
DisplayUserPtr previouslyUpdatedUser;
QString m_currentPrefix;
};
-class User
+class User
{
public:
User():m_received(time(NULL)) {}
@@ -100,7 +100,7 @@
time_t m_received;
};
-class DisplayUser : public User
+class DisplayUser : public User
{
public:
DisplayUser():m_seqTextItem(NULL), m_nickTextItem(NULL), m_rimRectItem(NULL) {}
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index b5c94ad..faa0972 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -12,7 +12,6 @@
#include "endorse-extension.pb.h"
#include <boost/iostreams/stream.hpp>
-
using namespace ndn;
namespace chronos{
@@ -24,7 +23,7 @@
Chronos::EndorseExtensionMsg&
operator << (Chronos::EndorseExtensionMsg& endorseExtension, const std::vector<std::string>& endorseList)
-{
+{
std::vector<std::string>::const_iterator it = endorseList.begin();
for(; it != endorseList.end(); it++)
endorseExtension.add_endorseentry()->set_name(*it);
@@ -58,7 +57,7 @@
setNotBefore(kskCertificate.getNotBefore());
setNotAfter(kskCertificate.getNotAfter());
addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
- setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
+ setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
OBufferStream profileStream;
m_profile.encode(profileStream);
@@ -69,7 +68,7 @@
endorseExtension << m_endorseList;
endorseExtension.SerializeToOstream(&endorseStream);
addExtension(CertificateExtension(ENDORSE_EXT_OID, true, *endorseStream.buf()));
-
+
encode();
}
@@ -85,7 +84,7 @@
Name dataName = m_keyName;
dataName.append("PROFILE-CERT").append(m_signer.wireEncode()).appendVersion();
setName(dataName);
-
+
setNotBefore(endorseCertificate.getNotBefore());
setNotAfter(endorseCertificate.getNotAfter());
addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
@@ -120,7 +119,7 @@
Name dataName = m_keyName;
dataName.append("PROFILE-CERT").append(m_signer.wireEncode()).appendVersion();
setName(dataName);
-
+
setNotBefore(notBefore);
setNotAfter(notAfter);
addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
@@ -136,7 +135,7 @@
endorseExtension.SerializeToOstream(&endorseStream);
addExtension(CertificateExtension(ENDORSE_EXT_OID, true, *endorseStream.buf()));
- encode();
+ encode();
}
EndorseCertificate::EndorseCertificate(const EndorseCertificate& endorseCertificate)
@@ -153,17 +152,17 @@
const Name& dataName = data.getName();
if(dataName.size() < 3 || dataName.get(-3).toEscapedString() != "PROFILE-CERT")
- throw Error("No PROFILE-CERT component in data name!");
+ throw Error("No PROFILE-CERT component in data name!");
m_keyName = dataName.getPrefix(-3);
m_signer.wireDecode(dataName.get(-2).blockFromValue());
- ExtensionList::iterator it = extensionList_.begin();
- for(; it != extensionList_.end(); it++)
+ ExtensionList::iterator it = m_extensionList.begin();
+ for(; it != m_extensionList.end(); it++)
{
if(PROFILE_EXT_OID == it->getOid())
{
- boost::iostreams::stream<boost::iostreams::array_source> is
+ boost::iostreams::stream<boost::iostreams::array_source> is
(reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
m_profile.decode(is);
}
@@ -171,8 +170,8 @@
{
Chronos::EndorseExtensionMsg endorseExtension;
- boost::iostreams::stream<boost::iostreams::array_source> is
- (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
+ boost::iostreams::stream<boost::iostreams::array_source> is
+ (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
endorseExtension.ParseFromIstream(&is);
endorseExtension >> m_endorseList;
diff --git a/src/endorse-certificate.h b/src/endorse-certificate.h
index 82ac8ba..970b5b7 100644
--- a/src/endorse-certificate.h
+++ b/src/endorse-certificate.h
@@ -13,9 +13,7 @@
#include "profile.h"
#include <vector>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-
-
+#include <ndn-cxx/security/identity-certificate.hpp>
namespace chronos{
diff --git a/src/endorse-combobox-delegate.cpp b/src/endorse-combobox-delegate.cpp
index bbefbeb..906020a 100644
--- a/src/endorse-combobox-delegate.cpp
+++ b/src/endorse-combobox-delegate.cpp
@@ -25,52 +25,52 @@
m_items.push_back("Not Endorsed");
m_items.push_back("Endorsed");
}
-
-
+
+
QWidget*
-EndorseComboBoxDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem &/* option */,
- const QModelIndex &/* index */) const
+EndorseComboBoxDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem &/* option */,
+ const QModelIndex &/* index */) const
{
QComboBox* editor = new QComboBox(parent);
for(unsigned int i = 0; i < m_items.size(); ++i)
editor->addItem(m_items[i].c_str());
return editor;
}
-
-void
+
+void
EndorseComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
int value = index.model()->data(index, Qt::EditRole).toUInt();
comboBox->setCurrentIndex(value);
}
-
-void
+
+void
EndorseComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
model->setData(index, comboBox->currentIndex(), Qt::EditRole);
}
-
-void
-EndorseComboBoxDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option,
- const QModelIndex &/* index */) const
+
+void
+EndorseComboBoxDelegate::updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &/* index */) const
{
editor->setGeometry(option.rect);
}
-
-void
-EndorseComboBoxDelegate::paint(QPainter *painter,
- const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+
+void
+EndorseComboBoxDelegate::paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
{
QStyleOptionViewItemV4 myOption = option;
QString text = m_items[index.model()->data(index, Qt::EditRole).toUInt()].c_str();
-
+
myOption.text = text;
-
+
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &myOption, painter);
}
diff --git a/src/endorse-combobox-delegate.h b/src/endorse-combobox-delegate.h
index 4b16172..424a8f7 100644
--- a/src/endorse-combobox-delegate.h
+++ b/src/endorse-combobox-delegate.h
@@ -14,7 +14,7 @@
#include <QItemDelegate>
#include <string>
#include <vector>
-
+
class EndorseComboBoxDelegate : public QItemDelegate
{
Q_OBJECT
@@ -23,25 +23,25 @@
// virtual
// ~ComboBoxDelegate() {}
-
+
QWidget*
createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- void
+ void
setEditorData(QWidget *editor, const QModelIndex &index) const;
-
- void
+
+ void
setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
-
+
void
updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
+
void
paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
+
private:
std::vector<std::string> m_items;
-
+
};
#endif
diff --git a/src/invitation-dialog.cpp b/src/invitation-dialog.cpp
index 1da8f00..17977f2 100644
--- a/src/invitation-dialog.cpp
+++ b/src/invitation-dialog.cpp
@@ -8,18 +8,17 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-
#include "invitation-dialog.h"
#include "ui_invitation-dialog.h"
using namespace ndn;
-InvitationDialog::InvitationDialog(QWidget *parent)
+InvitationDialog::InvitationDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::InvitationDialog)
{
ui->setupUi(this);
-
+
connect(ui->okButton, SIGNAL(clicked()),
this, SLOT(onOkClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
@@ -44,17 +43,17 @@
void
InvitationDialog::onOkClicked()
-{
- emit invitationResponded(m_invitationInterest, true);
+{
+ emit invitationResponded(m_invitationInterest, true);
this->close();
ui->msgLabel->clear();
m_invitationInterest.clear();
}
-
+
void
InvitationDialog::onCancelClicked()
-{
+{
emit invitationResponded(m_invitationInterest, false);
this->close();
diff --git a/src/invitation-dialog.h b/src/invitation-dialog.h
index 0112185..e6a9e97 100644
--- a/src/invitation-dialog.h
+++ b/src/invitation-dialog.h
@@ -14,7 +14,7 @@
#include <QDialog>
#ifndef Q_MOC_RUN
-#include <ndn-cpp-dev/name.hpp>
+#include <ndn-cxx/name.hpp>
#endif
namespace Ui {
@@ -41,7 +41,7 @@
private slots:
void
onOkClicked();
-
+
void
onCancelClicked();
diff --git a/src/invitation.cpp b/src/invitation.cpp
index cc5ba40..ae39761 100644
--- a/src/invitation.cpp
+++ b/src/invitation.cpp
@@ -10,8 +10,8 @@
#include "invitation.h"
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
#include "logging.h"
@@ -37,7 +37,7 @@
size_t nameSize = interestName.size();
if(nameSize < NAME_SIZE_MIN)
- throw Error("Wrong Invitation Name: Wrong length");
+ throw Error("Wrong Invitation Name: Wrong length");
if(interestName.get(CHRONOCHAT_INVITATION).toEscapedString() != "CHRONOCHAT-INVITATION")
throw Error("Wrong Invitation Name: Wrong application tags");
@@ -46,8 +46,8 @@
m_timestamp = interestName.get(TIMESTAMP).toNumber();
m_inviterCertificate.wireDecode(interestName.get(INVITER_CERT).blockFromValue());
m_inviterRoutingPrefix.wireDecode(interestName.get(INVITER_PREFIX).blockFromValue());
- m_chatroom = interestName.get(CHATROOM).toEscapedString();
- m_inviteeNameSpace = interestName.getPrefix(CHRONOCHAT_INVITATION);
+ m_chatroom = interestName.get(CHATROOM).toEscapedString();
+ m_inviteeNameSpace = interestName.getPrefix(CHRONOCHAT_INVITATION);
}
Invitation::Invitation(const Name& inviteeNameSpace,
diff --git a/src/invitation.h b/src/invitation.h
index d002402..6a53019 100644
--- a/src/invitation.h
+++ b/src/invitation.h
@@ -12,9 +12,9 @@
#define CHRONOS_INVITATION_H
-#include <ndn-cpp-dev/name.hpp>
-#include <ndn-cpp-dev/signature.hpp>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/signature.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
namespace chronos{
@@ -75,7 +75,7 @@
const uint64_t
getTimestamp() const
{ return m_timestamp; }
-
+
const ndn::Name&
getUnsignedInterestName() const
{ return m_interestName; }
diff --git a/src/invite-list-dialog.cpp b/src/invite-list-dialog.cpp
index bfc4040..6f62c5a 100644
--- a/src/invite-list-dialog.cpp
+++ b/src/invite-list-dialog.cpp
@@ -11,7 +11,7 @@
#include "invite-list-dialog.h"
#include "ui_invite-list-dialog.h"
-InviteListDialog::InviteListDialog(QWidget *parent)
+InviteListDialog::InviteListDialog(QWidget *parent)
:QDialog(parent)
, ui(new Ui::InviteListDialog)
, m_contactListModel(new QStringListModel)
@@ -21,9 +21,9 @@
ui->contactListView->setModel(m_contactListModel);
connect(ui->inviteButton, SIGNAL(clicked()),
- this, SLOT(onInviteClicked()));
+ this, SLOT(onInviteClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
- this, SLOT(onCancelClicked()));
+ this, SLOT(onCancelClicked()));
}
InviteListDialog::~InviteListDialog()
@@ -34,7 +34,7 @@
void
InviteListDialog::setInviteLabel(std::string label)
-{
+{
std::string msg("invite to chatroom:\n");
msg += label;
ui->inviteLabel->setText(QString::fromStdString(msg));
diff --git a/src/invite-list-dialog.h b/src/invite-list-dialog.h
index f5144fc..bf62ec0 100644
--- a/src/invite-list-dialog.h
+++ b/src/invite-list-dialog.h
@@ -28,12 +28,12 @@
public:
explicit
InviteListDialog(QWidget *parent = 0);
-
+
~InviteListDialog();
void
setInviteLabel(std::string label);
-
+
signals:
void
sendInvitation(const QString&);
@@ -46,7 +46,7 @@
onContactIdListReady(const QStringList& idList);
private slots:
- void
+ void
onInviteClicked();
void
diff --git a/src/main.cpp b/src/main.cpp
index a1ed56c..6ad597b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -13,7 +13,7 @@
#include "controller.h"
#include "logging.h"
-#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cxx/face.hpp>
#include <boost/thread/thread.hpp>
INIT_LOGGER("MAIN");
@@ -28,16 +28,16 @@
: QApplication(argc, argv)
{ }
- bool notify(QObject * receiver, QEvent * event)
+ bool notify(QObject * receiver, QEvent * event)
{
try {
return QApplication::notify(receiver, event);
- }
+ }
catch(std::exception& e){
std::cerr << "Exception thrown:" << e.what() << std::endl;
return false;
}
-
+
}
};
@@ -53,13 +53,13 @@
int main(int argc, char *argv[])
{
NewApp app(argc, argv);
-
+
shared_ptr<Face> face = make_shared<Face>();
chronos::Controller controller(face);
app.setQuitOnLastWindowClosed(false);
boost::thread (runIO, face->ioService());
-
+
return app.exec();
}
diff --git a/src/profile-editor.cpp b/src/profile-editor.cpp
index 457ecfd..9488f47 100644
--- a/src/profile-editor.cpp
+++ b/src/profile-editor.cpp
@@ -20,7 +20,7 @@
INIT_LOGGER("ProfileEditor")
-ProfileEditor::ProfileEditor(QWidget *parent)
+ProfileEditor::ProfileEditor(QWidget *parent)
: QDialog(parent)
, ui(new Ui::ProfileEditor)
, m_tableModel(new QSqlTableModel())
@@ -59,7 +59,7 @@
m_identity = identity;
ui->identityInput->setText(identity);
-
+
m_tableModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
m_tableModel->setTable("SelfProfile");
m_tableModel->select();
@@ -85,10 +85,10 @@
QItemSelectionModel* selectionModel = ui->profileTable->selectionModel();
QModelIndexList indexList = selectionModel->selectedIndexes();
- int i = indexList.size() - 1;
+ int i = indexList.size() - 1;
for(; i >= 0; i--)
m_tableModel->removeRow(indexList[i].row());
-
+
m_tableModel->submitAll();
}
diff --git a/src/profile-editor.h b/src/profile-editor.h
index 24c7aa2..8ec9713 100644
--- a/src/profile-editor.h
+++ b/src/profile-editor.h
@@ -27,7 +27,7 @@
public:
explicit ProfileEditor(QWidget *parent = 0);
-
+
~ProfileEditor();
public slots:
@@ -36,7 +36,7 @@
void
onIdentityUpdated(const QString& identity);
-
+
private slots:
void
onAddClicked();
diff --git a/src/profile.cpp b/src/profile.cpp
index 7bf7293..e6044fa 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -29,7 +29,7 @@
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(identityCertificate.getName());
m_entries[std::string("IDENTITY")] = keyName.getPrefix(-1).toUri();
-
+
const std::vector<CertificateSubjectDescription>& subList = identityCertificate.getSubjectDescriptionList();
std::vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
for(; it != subList.end(); it++)
@@ -59,8 +59,8 @@
}
Profile::Profile(const Name& identityName,
- const std::string& name,
- const std::string& institution)
+ const std::string& name,
+ const std::string& institution)
{
m_entries["IDENTITY"] = identityName.toUri();
m_entries["name"] = name;
@@ -82,7 +82,7 @@
void
Profile::decode(std::istream& is)
{
- Chronos::ProfileMsg profileMsg;
+ Chronos::ProfileMsg profileMsg;
profileMsg.ParseFromIstream(&is);
profileMsg >> (*this);
}
@@ -108,7 +108,7 @@
const Chronos::ProfileMsg::ProfileEntry& profileEntry = profileMsg.entry(i);
profile[profileEntry.oid()] = profileEntry.data();
}
-
+
return profileMsg;
}
diff --git a/src/profile.h b/src/profile.h
index 982c5d8..17b8d6c 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -12,8 +12,8 @@
#define CHRONOS_PROFILE_H
#include "config.h"
-#include <ndn-cpp-dev/name.hpp>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
#include <map>
#include <string>
#include "profile.pb.h"
@@ -35,16 +35,16 @@
Profile(const ndn::Name& identityName,
const std::string& name,
const std::string& institution);
-
+
Profile(const Profile& profile);
-
+
~Profile() {}
std::string&
operator [] (const std::string& profileKey)
{ return m_entries[profileKey]; }
- std::string
+ std::string
get (const std::string& profileKey) const
{
std::map<std::string, std::string>::const_iterator it = m_entries.find(profileKey);
diff --git a/src/set-alias-dialog.cpp b/src/set-alias-dialog.cpp
index 24fb6a8..ef21ab7 100644
--- a/src/set-alias-dialog.cpp
+++ b/src/set-alias-dialog.cpp
@@ -12,16 +12,16 @@
#include "ui_set-alias-dialog.h"
-SetAliasDialog::SetAliasDialog(QWidget *parent)
+SetAliasDialog::SetAliasDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::SetAliasDialog)
{
ui->setupUi(this);
connect(ui->okButton, SIGNAL(clicked()),
- this, SLOT(onOkClicked()));
+ this, SLOT(onOkClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
- this, SLOT(onCancelClicked()));
+ this, SLOT(onCancelClicked()));
}
SetAliasDialog::~SetAliasDialog()
@@ -38,14 +38,14 @@
void
SetAliasDialog::onCancelClicked()
-{
- this->close();
+{
+ this->close();
}
-void
+void
SetAliasDialog::setTargetIdentity(const QString& targetIdentity, const QString& alias)
-{
- m_targetIdentity = targetIdentity;
+{
+ m_targetIdentity = targetIdentity;
QString msg = QString("Set alias for %1:").arg(targetIdentity);
ui->introLabel->setText(msg);
ui->aliasInput->setText(alias);
diff --git a/src/set-alias-dialog.h b/src/set-alias-dialog.h
index 777b2c2..c04ea55 100644
--- a/src/set-alias-dialog.h
+++ b/src/set-alias-dialog.h
@@ -14,7 +14,7 @@
#include <QDialog>
#ifndef Q_MOC_RUN
-#include <ndn-cpp-dev/name.hpp>
+#include <ndn-cxx/name.hpp>
#endif
namespace Ui {
@@ -26,7 +26,7 @@
Q_OBJECT
public:
- explicit
+ explicit
SetAliasDialog(QWidget *parent = 0);
~SetAliasDialog();
@@ -42,7 +42,7 @@
void
onOkClicked();
- void
+ void
onCancelClicked();
private:
diff --git a/src/setting-dialog.cpp b/src/setting-dialog.cpp
index d0f98ae..c81bfdd 100644
--- a/src/setting-dialog.cpp
+++ b/src/setting-dialog.cpp
@@ -16,7 +16,7 @@
, ui(new Ui::SettingDialog)
{
ui->setupUi(this);
-
+
connect(ui->saveButton, SIGNAL(clicked()),
this, SLOT(onSaveClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
diff --git a/src/setting-dialog.h b/src/setting-dialog.h
index b38c376..fc61fb4 100644
--- a/src/setting-dialog.h
+++ b/src/setting-dialog.h
@@ -25,7 +25,7 @@
Q_OBJECT
public:
- explicit
+ explicit
SettingDialog(QWidget *parent = 0);
~SettingDialog();
diff --git a/src/start-chat-dialog.cpp b/src/start-chat-dialog.cpp
index c508c1e..f79e4a2 100644
--- a/src/start-chat-dialog.cpp
+++ b/src/start-chat-dialog.cpp
@@ -11,27 +11,27 @@
#include "start-chat-dialog.h"
#include "ui_start-chat-dialog.h"
-StartChatDialog::StartChatDialog(QWidget *parent)
+StartChatDialog::StartChatDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::StartChatDialog)
{
ui->setupUi(this);
connect(ui->okButton, SIGNAL(clicked()),
- this, SLOT(onOkClicked()));
+ this, SLOT(onOkClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
- this, SLOT(onCancelClicked()));
+ this, SLOT(onCancelClicked()));
}
StartChatDialog::~StartChatDialog()
-{
- delete ui;
+{
+ delete ui;
}
void
StartChatDialog::setChatroom(const std::string& chatroom)
-{
- ui->chatroomInput->setText(QString::fromStdString(chatroom));
+{
+ ui->chatroomInput->setText(QString::fromStdString(chatroom));
}
void
@@ -45,8 +45,8 @@
void
StartChatDialog::onCancelClicked()
-{
- this->close();
+{
+ this->close();
}
#if WAF
diff --git a/src/start-chat-dialog.h b/src/start-chat-dialog.h
index 7aa916b..771c993 100644
--- a/src/start-chat-dialog.h
+++ b/src/start-chat-dialog.h
@@ -36,11 +36,11 @@
signals:
void
startChatroom(const QString& chatroomName, bool secured);
-
+
private slots:
void
onOkClicked();
-
+
void
onCancelClicked();
diff --git a/src/tree-layout.h b/src/tree-layout.h
index 99e8cca..aa69251 100644
--- a/src/tree-layout.h
+++ b/src/tree-layout.h
@@ -16,7 +16,7 @@
#include <vector>
#include "trust-tree-node.h"
-class TreeLayout
+class TreeLayout
{
public:
struct Coordinate
diff --git a/src/trust-tree-node.h b/src/trust-tree-node.h
index c080672..77b62e6 100644
--- a/src/trust-tree-node.h
+++ b/src/trust-tree-node.h
@@ -12,7 +12,7 @@
#define TRUST_TREE_NODE_H
#include <vector>
-#include <ndn-cpp-dev/name.hpp>
+#include <ndn-cxx/name.hpp>
class TrustTreeNode;
@@ -31,7 +31,7 @@
, m_level(-1)
, m_visited(false)
{}
-
+
~TrustTreeNode()
{}
diff --git a/src/trust-tree-scene.cpp b/src/trust-tree-scene.cpp
index c62d82f..d3f84b5 100644
--- a/src/trust-tree-scene.cpp
+++ b/src/trust-tree-scene.cpp
@@ -23,7 +23,7 @@
static const double Pi = 3.14159265358979323846264338327950288419717;
TrustTreeScene::TrustTreeScene(QWidget *parent)
- : QGraphicsScene(parent)
+ : QGraphicsScene(parent)
{}
void
@@ -53,22 +53,22 @@
TrustTreeNodeList& introducees = (*it)->getIntroducees();
TrustTreeNodeList::iterator eeIt = introducees.begin();
TrustTreeNodeList::iterator eeEnd = introducees.end();
-
+
for(; eeIt != eeEnd; eeIt++)
{
if((*it)->level() >= (*eeIt)->level())
continue;
-
+
double x1 = (*it)->x;
double y1 = (*it)->y;
double x2 = (*eeIt)->x;
double y2 = (*eeIt)->y;
-
+
QPointF src(x1 + nodeSize/2, y1 + nodeSize/2);
QPointF dest(x2 + nodeSize/2, y2 + nodeSize/2);
QLineF line(src, dest);
double angle = ::acos(line.dx() / line.length());
-
+
double arrowSize = 10;
QPointF endP0 = src + QPointF((nodeSize/2) * line.dx() / line.dy(), nodeSize/2);
QPointF sourceArrowP0 = dest + QPointF((-nodeSize/2) * line.dx() / line.dy(), -nodeSize/2);
diff --git a/src/trust-tree-scene.h b/src/trust-tree-scene.h
index 59fdd8c..384c4cc 100644
--- a/src/trust-tree-scene.h
+++ b/src/trust-tree-scene.h
@@ -11,8 +11,6 @@
#ifndef TRUST_TREE_SCENE_H
#define TRUST_TREE_SCENE_H
-
-
#include <QtGui/QGraphicsScene>
#include <QColor>
#include <QMap>
diff --git a/src/validator-invitation.cpp b/src/validator-invitation.cpp
index a95f898..e311e79 100644
--- a/src/validator-invitation.cpp
+++ b/src/validator-invitation.cpp
@@ -25,8 +25,8 @@
ValidatorInvitation::ValidatorInvitation()
: Validator()
- , m_invitationReplyRule("^([^<CHRONOCHAT-INVITATION>]*)<CHRONOCHAT-INVITATION>",
- "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
+ , m_invitationReplyRule("^([^<CHRONOCHAT-INVITATION>]*)<CHRONOCHAT-INVITATION>",
+ "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
"==", "\\1", "\\1\\2", true)
, m_invitationInterestRule("^[^<CHRONOCHAT-INVITATION>]*<CHRONOCHAT-INVITATION><>{6}$")
, m_innerKeyRegex("^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT><>$", "\\1\\2")
@@ -34,17 +34,17 @@
}
void
-ValidatorInvitation::checkPolicy (const Data& data,
- int stepCount,
- const OnDataValidated& onValidated,
+ValidatorInvitation::checkPolicy (const Data& data,
+ int stepCount,
+ const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
try
{
- SignatureSha256WithRsa sig(data.getSignature());
+ SignatureSha256WithRsa sig(data.getSignature());
const Name & keyLocatorName = sig.getKeyLocator().getName();
-
+
if(!m_invitationReplyRule.satisfy(data.getName(), keyLocatorName))
return onValidationFailed(data.shared_from_this(),
"Does not comply with the invitation rule: "
@@ -53,34 +53,34 @@
Data innerData;
innerData.wireDecode(data.getContent().blockFromValue());
-
- return internalCheck(data.wireEncode().value(),
+
+ return internalCheck(data.wireEncode().value(),
data.wireEncode().value_size() - data.getSignature().getValue().size(),
sig,
innerData,
- bind(onValidated, data.shared_from_this()),
+ bind(onValidated, data.shared_from_this()),
bind(onValidationFailed, data.shared_from_this(), _1));
}
catch(SignatureSha256WithRsa::Error &e)
{
- return onValidationFailed(data.shared_from_this(),
+ return onValidationFailed(data.shared_from_this(),
"Not SignatureSha256WithRsa signature: " + data.getName().toUri());
}
}
void
-ValidatorInvitation::checkPolicy (const Interest& interest,
- int stepCount,
- const OnInterestValidated& onValidated,
+ValidatorInvitation::checkPolicy (const Interest& interest,
+ int stepCount,
+ const OnInterestValidated& onValidated,
const OnInterestValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
try
{
Name interestName = interest.getName();
-
+
if(!m_invitationInterestRule.match(interestName))
- return onValidationFailed(interest.shared_from_this(),
+ return onValidationFailed(interest.shared_from_this(),
"Invalid interest name: " + interest.getName().toUri());
Name signedName = interestName.getPrefix(-1);
@@ -94,16 +94,16 @@
Data innerData;
innerData.wireDecode(interestName.get(Invitation::INVITER_CERT).blockFromValue());
- return internalCheck(signedBlob.buf(),
+ return internalCheck(signedBlob.buf(),
signedBlob.size(),
sig,
innerData,
- bind(onValidated, interest.shared_from_this()),
+ bind(onValidated, interest.shared_from_this()),
bind(onValidationFailed, interest.shared_from_this(), _1));
}
catch(SignatureSha256WithRsa::Error& e)
{
- return onValidationFailed(interest.shared_from_this(),
+ return onValidationFailed(interest.shared_from_this(),
"Not SignatureSha256WithRsa signature: " + interest.getName().toUri());
}
}
@@ -112,14 +112,14 @@
ValidatorInvitation::internalCheck(const uint8_t* buf, size_t size,
const SignatureSha256WithRsa& sig,
const Data& innerData,
- const OnValidated& onValidated,
+ const OnValidated& onValidated,
const OnValidationFailed& onValidationFailed)
{
try
{
const Name & keyLocatorName = sig.getKeyLocator().getName();
Name signingKeyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
-
+
if(m_trustAnchors.find(signingKeyName) == m_trustAnchors.end())
return onValidationFailed("Cannot reach any trust anchor");
diff --git a/src/validator-invitation.h b/src/validator-invitation.h
index cb22d65..d7b8276 100644
--- a/src/validator-invitation.h
+++ b/src/validator-invitation.h
@@ -11,9 +11,9 @@
#ifndef CHRONOS_VALIDATOR_INVITATION_H
#define CHRONOS_VALIDATOR_INVITATION_H
-#include <ndn-cpp-dev/security/validator.hpp>
-#include <ndn-cpp-dev/security/certificate-cache.hpp>
-#include <ndn-cpp-dev/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
#include <map>
#include "endorse-certificate.h"
@@ -31,20 +31,20 @@
static const ndn::shared_ptr<ndn::CertificateCache> DefaultCertificateCache;
ValidatorInvitation();
-
+
virtual
~ValidatorInvitation() {};
void
addTrustAnchor(const ndn::Name& keyName, const ndn::PublicKey& key)
- {
- m_trustAnchors[keyName] = key;
+ {
+ m_trustAnchors[keyName] = key;
}
void
removeTrustAnchor(const ndn::Name& keyName)
- {
- m_trustAnchors.erase(keyName);
+ {
+ m_trustAnchors.erase(keyName);
}
void
@@ -52,19 +52,19 @@
{
m_trustAnchors.clear();
}
-
+
protected:
void
- checkPolicy(const ndn::Data& data,
- int stepCount,
- const ndn::OnDataValidated& onValidated,
+ checkPolicy(const ndn::Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
const ndn::OnDataValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
+
void
- checkPolicy(const ndn::Interest& interest,
- int stepCount,
- const ndn::OnInterestValidated& onValidated,
+ checkPolicy(const ndn::Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
const ndn::OnInterestValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
@@ -73,7 +73,7 @@
internalCheck(const uint8_t* buf, size_t size,
const ndn::SignatureSha256WithRsa& sig,
const ndn::Data& innerData,
- const OnValidated& onValidated,
+ const OnValidated& onValidated,
const OnValidationFailed& onValidationFailed);
private:
diff --git a/src/validator-panel.cpp b/src/validator-panel.cpp
index 2197d66..9caba64 100644
--- a/src/validator-panel.cpp
+++ b/src/validator-panel.cpp
@@ -27,25 +27,25 @@
const shared_ptr<CertificateCache> certificateCache/* = DEFAULT_CERT_CACHE */)
: m_stepLimit(stepLimit)
, m_certificateCache(certificateCache)
-{
- m_endorseeRule = make_shared<SecRuleRelative>("^([^<DNS>]*)<DNS><>*<ENDORSEE><>$",
- "^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
+{
+ m_endorseeRule = make_shared<SecRuleRelative>("^([^<DNS>]*)<DNS><>*<ENDORSEE><>$",
+ "^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
"==", "\\1", "\\1\\2", true);
}
void
-ValidatorPanel::checkPolicy (const Data& data,
- int stepCount,
- const OnDataValidated& onValidated,
+ValidatorPanel::checkPolicy (const Data& data,
+ int stepCount,
+ const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
if(m_stepLimit == stepCount)
{
_LOG_ERROR("Reach the maximum steps of verification!");
- onValidationFailed(data.shared_from_this(),
+ onValidationFailed(data.shared_from_this(),
"Reach maximum validation steps: " + data.getName().toUri());
return;
}
@@ -71,7 +71,7 @@
}
catch(SignatureSha256WithRsa::Error &e)
{
- return onValidationFailed(data.shared_from_this(),
+ return onValidationFailed(data.shared_from_this(),
"Not SignatureSha256WithRsa signature: " + data.getName().toUri());
}
catch(KeyLocator::Error &e)
diff --git a/src/validator-panel.h b/src/validator-panel.h
index 3b5f670..c786c9f 100644
--- a/src/validator-panel.h
+++ b/src/validator-panel.h
@@ -11,9 +11,9 @@
#ifndef CHRONOS_VALIDATOR_PANEL_H
#define CHRONOS_VALIDATOR_PANEL_H
-#include <ndn-cpp-dev/security/validator.hpp>
-#include <ndn-cpp-dev/security/sec-rule-relative.hpp>
-#include <ndn-cpp-dev/security/certificate-cache.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
#include <map>
#include "endorse-certificate.h"
@@ -23,7 +23,7 @@
class ValidatorPanel : public ndn::Validator
{
public:
-
+
static const ndn::shared_ptr<ndn::CertificateCache> DEFAULT_CERT_CACHE;
ValidatorPanel(int stepLimit = 10,
@@ -31,7 +31,7 @@
~ValidatorPanel()
{}
-
+
inline void
addTrustAnchor(const EndorseCertificate& selfEndorseCertificate);
@@ -40,16 +40,16 @@
protected:
virtual void
- checkPolicy (const ndn::Data& data,
- int stepCount,
- const ndn::OnDataValidated& onValidated,
+ checkPolicy (const ndn::Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
const ndn::OnDataValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
virtual void
- checkPolicy (const ndn::Interest& interest,
- int stepCount,
- const ndn::OnInterestValidated& onValidated,
+ checkPolicy (const ndn::Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
const ndn::OnInterestValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
{
@@ -62,14 +62,14 @@
ndn::shared_ptr<ndn::CertificateCache> m_certificateCache;
ndn::shared_ptr<ndn::SecRuleRelative> m_endorseeRule;
std::map<ndn::Name, ndn::PublicKey> m_trustAnchors;
-
+
};
inline void
ValidatorPanel::addTrustAnchor(const EndorseCertificate& cert)
{ m_trustAnchors[cert.getPublicKeyName()] = cert.getPublicKeyInfo(); }
-inline void
+inline void
ValidatorPanel::removeTrustAnchor(const ndn::Name& keyName)
{ m_trustAnchors.erase(keyName); }