File name format change and Removed warning messages (Except warning from boost for Logging)
Change-Id: If3a3a5411d377d925527fc3e8809c228a9a81e26
diff --git a/src/security/waiting-list.cpp b/src/security/waiting-list.cpp
new file mode 100644
index 0000000..dbf9b68
--- /dev/null
+++ b/src/security/waiting-list.cpp
@@ -0,0 +1,74 @@
+#include <ndn-cpp-dev/face.hpp>
+#include "waiting-list.hpp"
+
+namespace nlsr {
+static bool
+waitingListCompare(const WaitingListEntry& w1, const std::string& respCert)
+{
+ return w1.getResponsibleCert() == respCert;
+}
+
+std::pair<WaitingListEntry, bool>
+WaitingList::getWaitingListEntry(std::string respCert)
+{
+ std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
+ m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
+ if (it != m_waitingTable.end())
+ {
+ return std::make_pair(*(it), true);
+ }
+
+ WaitingListEntry wle;
+ return std::make_pair(wle, false);
+
+}
+
+bool
+WaitingList::add(std::string respCert, std::string waitee)
+{
+ std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
+ m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
+ if (it == m_waitingTable.end())
+ {
+ WaitingListEntry newWle(respCert);
+ newWle.addWaitee(waitee);
+ m_waitingTable.push_back(newWle);
+ return true;
+ }
+ else
+ {
+ return it->addWaitee(waitee);
+ }
+ return false;
+}
+
+bool
+WaitingList::remove(std::string respCert)
+{
+ std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
+ m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
+ if (it == m_waitingTable.end())
+ {
+ return false;
+ }
+ else
+ {
+ m_waitingTable.erase(it);
+ return true;
+ }
+ return false;
+}
+
+std::ostream&
+operator<<(std::ostream& os, WaitingList wl)
+{
+ os << "-------Waiting List--------" << std::endl;
+ std::list<WaitingListEntry> wles = wl.getWaitingTable();
+ for (std::list<WaitingListEntry> ::iterator it = wles.begin();
+ it != wles.end(); ++it)
+ {
+ os << *(it) << std::endl;
+ }
+ return os;
+}
+}//namespace nlsr