From e73c4cb68b7461b8a2bdf7b6e5919bd0fcef2c1e Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 6 Aug 2013 00:05:39 -0400 Subject: Whole bunch of stuff: netconf, bug fixes, tweaks to ping and firewall opener timing code. --- node/Network.hpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'node/Network.hpp') 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 _multicastGroups; + + // Membership certificates supplied by peers std::map _membershipCertificates; + // Configuration from network master node Config _configuration; Certificate _myCertificate; uint64_t _id; volatile uint64_t _lastConfigUpdate; + volatile bool _destroyOnDelete; Mutex _lock; -- cgit v1.2.3