summaryrefslogtreecommitdiff
path: root/node/Topology.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-01 15:43:07 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-01 15:43:07 -0700
commita3bdae9735572fd6d888e6bf29b0302983a7c24c (patch)
tree9e427e297db253b7610fc07cb2214281c69a8e3c /node/Topology.hpp
parentd5e6f59004458ee2bddcaa18c6d0a8dfae2a2fc3 (diff)
downloadinfinitytier-a3bdae9735572fd6d888e6bf29b0302983a7c24c.tar.gz
infinitytier-a3bdae9735572fd6d888e6bf29b0302983a7c24c.zip
Work in progress: Path canonicalization refactor.
Diffstat (limited to 'node/Topology.hpp')
-rw-r--r--node/Topology.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/node/Topology.hpp b/node/Topology.hpp
index b8213cf8..e63766cb 100644
--- a/node/Topology.hpp
+++ b/node/Topology.hpp
@@ -33,6 +33,7 @@
#include "Address.hpp"
#include "Identity.hpp"
#include "Peer.hpp"
+#include "Path.hpp"
#include "Mutex.hpp"
#include "InetAddress.hpp"
#include "Hashtable.hpp"
@@ -90,6 +91,22 @@ public:
}
/**
+ * Get a Path object for a given local and remote physical address, creating if needed
+ *
+ * @param l Local address or NULL for 'any' or 'wildcard'
+ * @param r Remote address
+ * @return Pointer to canonicalized Path object
+ */
+ inline SharedPtr<Path> getPath(const InetAddress &l,const InetAddress &r)
+ {
+ Mutex::Lock _l(_lock);
+ SharedPtr<Path> &p = _paths[Path::HashKey(l,r)];
+ if (!p)
+ p.setToUnsafe(new Path(l,r));
+ return p;
+ }
+
+ /**
* Get the identity of a peer
*
* @param zta ZeroTier address of peer
@@ -319,8 +336,12 @@ private:
uint64_t _trustedPathIds[ZT_MAX_TRUSTED_PATHS];
InetAddress _trustedPathNetworks[ZT_MAX_TRUSTED_PATHS];
unsigned int _trustedPathCount;
+
World _world;
+
Hashtable< Address,SharedPtr<Peer> > _peers;
+ Hashtable< Path::HashKey,SharedPtr<Path> > _paths;
+
std::vector< Address > _rootAddresses;
std::vector< SharedPtr<Peer> > _rootPeers;
bool _amRoot;