summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Capability.hpp23
-rw-r--r--node/Tag.hpp7
2 files changed, 18 insertions, 12 deletions
diff --git a/node/Capability.hpp b/node/Capability.hpp
index 29dbfd5c..293193e0 100644
--- a/node/Capability.hpp
+++ b/node/Capability.hpp
@@ -72,9 +72,13 @@ class Capability : public Credential
public:
static inline Credential::Type credentialType() { return Credential::CREDENTIAL_TYPE_CAPABILITY; }
- Capability()
+ Capability() :
+ _nwid(0),
+ _ts(0),
+ _id(0),
+ _maxCustodyChainLength(0),
+ _ruleCount(0)
{
- memset(this,0,sizeof(Capability));
}
/**
@@ -85,15 +89,14 @@ public:
* @param rules Network flow rules for this capability
* @param ruleCount Number of flow rules
*/
- Capability(uint32_t id,uint64_t nwid,int64_t ts,unsigned int mccl,const ZT_VirtualNetworkRule *rules,unsigned int ruleCount)
+ Capability(uint32_t id,uint64_t nwid,int64_t ts,unsigned int mccl,const ZT_VirtualNetworkRule *rules,unsigned int ruleCount) :
+ _nwid(nwid),
+ _ts(ts),
+ _id(id),
+ _maxCustodyChainLength((mccl > 0) ? ((mccl < ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH) ? mccl : (unsigned int)ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH) : 1),
+ _ruleCount((ruleCount < ZT_MAX_CAPABILITY_RULES) ? ruleCount : ZT_MAX_CAPABILITY_RULES)
{
- memset(this,0,sizeof(Capability));
- _nwid = nwid;
- _ts = ts;
- _id = id;
- _maxCustodyChainLength = (mccl > 0) ? ((mccl < ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH) ? mccl : (unsigned int)ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH) : 1;
- _ruleCount = (ruleCount < ZT_MAX_CAPABILITY_RULES) ? ruleCount : ZT_MAX_CAPABILITY_RULES;
- if (_ruleCount)
+ if (_ruleCount > 0)
memcpy(_rules,rules,sizeof(ZT_VirtualNetworkRule) * _ruleCount);
}
diff --git a/node/Tag.hpp b/node/Tag.hpp
index d6ef246f..2f3bf66e 100644
--- a/node/Tag.hpp
+++ b/node/Tag.hpp
@@ -65,9 +65,12 @@ class Tag : public Credential
public:
static inline Credential::Type credentialType() { return Credential::CREDENTIAL_TYPE_TAG; }
- Tag()
+ Tag() :
+ _id(0),
+ _value(0),
+ _networkId(0),
+ _ts(0)
{
- memset(this,0,sizeof(Tag));
}
/**