diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-06 00:05:39 -0400 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-06 00:05:39 -0400 |
| commit | e73c4cb68b7461b8a2bdf7b6e5919bd0fcef2c1e (patch) | |
| tree | 659c59132d6a91093fe4b64ce7105f3f44414db5 /node/Network.hpp | |
| parent | c9c63074bbd7025c624ab4987c3a32fd2e925b6a (diff) | |
| download | infinitytier-e73c4cb68b7461b8a2bdf7b6e5919bd0fcef2c1e.tar.gz infinitytier-e73c4cb68b7461b8a2bdf7b6e5919bd0fcef2c1e.zip | |
Whole bunch of stuff: netconf, bug fixes, tweaks to ping and firewall opener timing code.
Diffstat (limited to 'node/Network.hpp')
| -rw-r--r-- | node/Network.hpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/node/Network.hpp b/node/Network.hpp index d3bb5ad7..6b7b3055 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -208,6 +208,11 @@ public: { } + inline bool containsAllFields() const + { + return (contains("nwid")&&contains("peer")); + } + inline std::string toString() const { return Dictionary::toString(); @@ -241,7 +246,7 @@ public: */ inline bool isOpen() const { - return (get("isOpen") == "1"); + return (get("isOpen","0") == "1"); } /** @@ -267,6 +272,14 @@ private: ~Network(); + /** + * Causes all persistent disk presence to be erased on delete + */ + inline void destroyOnDelete() + { + _destroyOnDelete = true; + } + public: /** * @return Network ID @@ -350,16 +363,16 @@ public: * @param peer Peer that owns certificate * @param cert Certificate itself */ - inline void addMembershipCertificate(const Address &peer,const Certificate &cert) - { - Mutex::Lock _l(_lock); - _membershipCertificates[peer] = cert; - } + void addMembershipCertificate(const Address &peer,const Certificate &cert); + /** + * @param peer Peer address to check + * @return True if peer is allowed to communicate on this network + */ bool isAllowed(const Address &peer) const; /** - * Perform periodic database cleaning such as removing expired membership certificates + * Perform cleanup and possibly save state */ void clean(); @@ -377,16 +390,20 @@ private: const RuntimeEnvironment *_r; + // Tap and tap multicast memberships EthernetTap _tap; - std::set<MulticastGroup> _multicastGroups; + + // Membership certificates supplied by peers std::map<Address,Certificate> _membershipCertificates; + // Configuration from network master node Config _configuration; Certificate _myCertificate; uint64_t _id; volatile uint64_t _lastConfigUpdate; + volatile bool _destroyOnDelete; Mutex _lock; |
