add function to return all branch prefixes
diff --git a/include/sync-logic.h b/include/sync-logic.h
index aeb39d8..7108054 100644
--- a/include/sync-logic.h
+++ b/include/sync-logic.h
@@ -27,6 +27,7 @@
#include <boost/thread/recursive_mutex.hpp>
#include <boost/random.hpp>
#include <memory>
+#include <map>
#include "sync-ccnx-wrapper.h"
#include "sync-interest-table.h"
@@ -126,6 +127,9 @@
void
printState () const;
+ std::map<std::string, bool>
+ getBranchPrefixes() const;
+
private:
void
delayedChecksLoop ();
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 141cf57..234f059 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -601,5 +601,24 @@
}
}
+std::map<std::string, bool>
+SyncLogic::getBranchPrefixes() const
+{
+ recursive_mutex::scoped_lock lock (m_stateMutex);
+
+ std::map<std::string, bool> m;
+
+ BOOST_FOREACH (const boost::shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
+ {
+ std::string prefix = leaf->getInfo()->toString();
+ // do not return forwarder prefix
+ if (prefix != forwarderPrefix)
+ {
+ m.insert(pair<std::string, bool>(prefix, false));
+ }
+ }
+
+ return m;
+}
}