diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-04-26 08:40:26 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-04-26 08:40:26 -0700 |
| commit | e731fc1a3ae5295be843ad84d3769c5c28839782 (patch) | |
| tree | 151b8f2222e99900af688a87555d84d67f9a279b /node/NetworkConfig.cpp | |
| parent | 90e1262a8b607f35af0eade34eba7a49217cb7ed (diff) | |
| download | infinitytier-e731fc1a3ae5295be843ad84d3769c5c28839782.tar.gz infinitytier-e731fc1a3ae5295be843ad84d3769c5c28839782.zip | |
Replace two bools in NetworkConfig with a flags field.
Diffstat (limited to 'node/NetworkConfig.cpp')
| -rw-r--r-- | node/NetworkConfig.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp index 5ca432ba..391d83ca 100644 --- a/node/NetworkConfig.cpp +++ b/node/NetworkConfig.cpp @@ -52,9 +52,8 @@ NetworkConfig NetworkConfig::createTestNetworkConfig(const Address &self) nc._revision = 1; nc._issuedTo = self; nc._multicastLimit = ZT_MULTICAST_DEFAULT_LIMIT; - nc._allowPassiveBridging = false; + nc._flags = ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST; nc._type = ZT_NETWORK_TYPE_PUBLIC; - nc._enableBroadcast = true; nc._rules[nc._ruleCount].ruleNo = 1; nc._rules[nc._ruleCount].matches = (uint8_t)ZT_NETWORK_RULE_MATCHES_ALL; @@ -82,11 +81,11 @@ NetworkConfig NetworkConfig::createTestNetworkConfig(const Address &self) void NetworkConfig::fromDictionary(const char *ds,unsigned int dslen) { - Dictionary d(ds,dslen); - static const std::string zero("0"); static const std::string one("1"); + Dictionary d(ds,dslen); + memset(this,0,sizeof(NetworkConfig)); // NOTE: d.get(name) throws if not found, d.get(name,default) returns default @@ -102,8 +101,9 @@ void NetworkConfig::fromDictionary(const char *ds,unsigned int dslen) _multicastLimit = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT,zero).c_str()); if (_multicastLimit == 0) _multicastLimit = ZT_MULTICAST_DEFAULT_LIMIT; - _allowPassiveBridging = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING,zero).c_str()) != 0); - _enableBroadcast = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0); + _flags |= ((Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING,zero).c_str()) != 0) ? ZT_NETWORKCONFIG_FLAG_ALLOW_PASSIVE_BRIDGING : 0); + _flags |= ((Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0) ? ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST : 0); + _type = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_PRIVATE,one).c_str()) != 0) ? ZT_NETWORK_TYPE_PRIVATE : ZT_NETWORK_TYPE_PUBLIC; std::string nametmp(d.get(ZT_NETWORKCONFIG_DICT_KEY_NAME,"")); |
