A bunch of multicast work... in progress.

This commit is contained in:
Adam Ierymenko 2019-09-07 19:15:21 -07:00
parent 0d2c87fe4e
commit 540ee69773
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
11 changed files with 139 additions and 911 deletions

View file

@ -260,6 +260,27 @@ public:
*/
ZT_ALWAYS_INLINE const Address &address() const { return _address; }
/**
* Attempt to generate an older type identity from a newer type
*
* If this identity has its private key this is not transferred to
* the downgraded identity.
*
* @param dest Destination to fill with downgraded identity
* @param toType Desired identity type
*/
inline bool downgrade(Identity &dest,const Type toType)
{
if ((_type == P384)&&(toType == C25519)) {
dest._address = _address;
dest._type = C25519;
dest._hasPrivate = false;
memcpy(dest._pub.c25519,_pub.c25519,ZT_C25519_PUBLIC_KEY_LEN);
return true;
}
return false;
}
/**
* Serialize this identity (binary)
*