summaryrefslogtreecommitdiff
path: root/node/CertificateOfMembership.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/CertificateOfMembership.hpp')
-rw-r--r--node/CertificateOfMembership.hpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/node/CertificateOfMembership.hpp b/node/CertificateOfMembership.hpp
index ae976b50..dfccb138 100644
--- a/node/CertificateOfMembership.hpp
+++ b/node/CertificateOfMembership.hpp
@@ -27,6 +27,7 @@
#include <algorithm>
#include "Constants.hpp"
+#include "Credential.hpp"
#include "Buffer.hpp"
#include "Address.hpp"
#include "C25519.hpp"
@@ -68,9 +69,11 @@ class RuntimeEnvironment;
* This is a memcpy()'able structure and is safe (in a crash sense) to modify
* without locks.
*/
-class CertificateOfMembership
+class CertificateOfMembership : public Credential
{
public:
+ static inline Credential::Type credentialType() { return Credential::CREDENTIAL_TYPE_COM; }
+
/**
* Reserved qualifier IDs
*
@@ -155,18 +158,23 @@ public:
/**
* @return True if there's something here
*/
- inline operator bool() const throw() { return (_qualifierCount != 0); }
+ inline operator bool() const { return (_qualifierCount != 0); }
+
+ /**
+ * @return Credential ID, always 0 for COMs
+ */
+ inline uint32_t id() const { return 0; }
/**
* @return Timestamp for this cert and maximum delta for timestamp
*/
- inline std::pair<uint64_t,uint64_t> timestamp() const
+ inline uint64_t timestamp() const
{
for(unsigned int i=0;i<_qualifierCount;++i) {
if (_qualifiers[i].id == COM_RESERVED_ID_TIMESTAMP)
- return std::pair<uint64_t,uint64_t>(_qualifiers[i].value,_qualifiers[i].maxDelta);
+ return _qualifiers[i].value;
}
- return std::pair<uint64_t,uint64_t>(0ULL,0ULL);
+ return 0;
}
/**
@@ -258,12 +266,12 @@ public:
/**
* @return True if signed
*/
- inline bool isSigned() const throw() { return (_signedBy); }
+ inline bool isSigned() const { return (_signedBy); }
/**
* @return Address that signed this certificate or null address if none
*/
- inline const Address &signedBy() const throw() { return _signedBy; }
+ inline const Address &signedBy() const { return _signedBy; }
template<unsigned int C>
inline void serialize(Buffer<C> &b) const
@@ -321,7 +329,6 @@ public:
}
inline bool operator==(const CertificateOfMembership &c) const
- throw()
{
if (_signedBy != c._signedBy)
return false;
@@ -335,7 +342,7 @@ public:
}
return (_signature == c._signature);
}
- inline bool operator!=(const CertificateOfMembership &c) const throw() { return (!(*this == c)); }
+ inline bool operator!=(const CertificateOfMembership &c) const { return (!(*this == c)); }
private:
struct _Qualifier