use LocalLeaseSet for own LeaseSets

This commit is contained in:
orignal 2016-05-25 15:10:28 -04:00
parent f2292fd618
commit 4e4f9b6f8b
8 changed files with 44 additions and 17 deletions

View file

@ -92,15 +92,19 @@ namespace data
LocalLeaseSet (std::shared_ptr<const IdentityEx> identity, const uint8_t * encryptionPublicKey, std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels);
~LocalLeaseSet () { delete[] m_Buffer; };
void SetSignature (const uint8_t * signature);
const uint8_t * GetBuffer () const { return m_Buffer; };
uint8_t * GetSignature () { return m_Buffer + m_BufferLen - GetSignatureLen (); };
size_t GetBufferLen () const { return m_BufferLen; };
size_t GetSignatureLen () const { return m_Identity->GetSignatureLen (); };
const IdentHash& GetIdentHash () const { return m_Identity->GetIdentHash (); };
bool IsExpired () const;
bool operator== (const LeaseSet& other) const
{ return m_BufferLen == other.GetBufferLen () && !memcmp (other.GetBuffer (), other.GetBuffer (), m_BufferLen); };
private:
uint64_t m_ExpirationTime; // in milliseconds
std::shared_ptr<const IdentityEx> m_Identity;
uint8_t * m_Buffer;
size_t m_BufferLen;