summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Hashtable.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/node/Hashtable.hpp b/node/Hashtable.hpp
index 5076751d..6f7541c4 100644
--- a/node/Hashtable.hpp
+++ b/node/Hashtable.hpp
@@ -30,6 +30,8 @@
#include <stdexcept>
#include <vector>
+#include <utility>
+#include <algorithm>
namespace ZeroTier {
@@ -197,6 +199,24 @@ public:
}
/**
+ * @return Vector of all entries (pairs of K,V)
+ */
+ inline typename std::vector< std::pair<K,V> > entries()
+ {
+ typename std::vector< std::pair<K,V> > k;
+ if (_s) {
+ for(unsigned long i=0;i<_bc;++i) {
+ _Bucket *b = _t[i];
+ while (b) {
+ k.push_back(std::pair<K,V>(b->k,b->v));
+ b = b->next;
+ }
+ }
+ }
+ return k;
+ }
+
+ /**
* @param k Key
* @return Pointer to value or NULL if not found
*/