From 31ddc49da2e8c8aa9345616af28c9643968a8393 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 23 May 2014 15:13:34 -0700 Subject: GitHub issue #67 --- node/NetworkConfig.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'node/NetworkConfig.cpp') diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp index 0d6cd049..cc8dc382 100644 --- a/node/NetworkConfig.cpp +++ b/node/NetworkConfig.cpp @@ -65,9 +65,11 @@ const NetworkConfig::MulticastRate &NetworkConfig::multicastRate(const Multicast return r->second; } -static const std::string _zero("0"); void NetworkConfig::_fromDictionary(const Dictionary &d) { + static const std::string zero("0"); + static const std::string one("1"); + // NOTE: d.get(name) throws if not found, d.get(name,default) returns default memset(_etWhitelist,0,sizeof(_etWhitelist)); @@ -82,9 +84,10 @@ void NetworkConfig::_fromDictionary(const Dictionary &d) throw std::invalid_argument("configuration contains zero network ID"); _timestamp = Utils::hexStrToU64(d.get(ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP).c_str()); _issuedTo = Address(d.get(ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO)); - _multicastPrefixBits = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS,_zero).c_str()); - _multicastDepth = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH,_zero).c_str()); - _private = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_PRIVATE,_zero).c_str()) != 0); + _multicastPrefixBits = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS,zero).c_str()); + _multicastDepth = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH,zero).c_str()); + _private = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_PRIVATE,zero).c_str()) != 0); + _enableBroadcast = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0); _name = d.get(ZT_NETWORKCONFIG_DICT_KEY_NAME); _description = d.get(ZT_NETWORKCONFIG_DICT_KEY_DESC,std::string()); -- cgit v1.2.3