LocalLeaseSet added

This commit is contained in:
orignal 2016-05-25 14:17:34 -04:00
parent 7035ead9e7
commit f2292fd618
2 changed files with 68 additions and 3 deletions

View file

@ -12,6 +12,7 @@ namespace i2p
namespace tunnel
{
class InboundTunnel;
class TunnelPool;
}
@ -37,14 +38,15 @@ namespace data
};
};
const int MAX_LS_BUFFER_SIZE = 3072;
const size_t MAX_LS_BUFFER_SIZE = 3072;
const size_t LEASE_SIZE = 44; // 32 + 4 + 8
const uint8_t MAX_NUM_LEASES = 16;
class LeaseSet: public RoutingDestination
{
public:
LeaseSet (const uint8_t * buf, size_t len, bool storeLeases = true);
LeaseSet (std::shared_ptr<const i2p::tunnel::TunnelPool> pool);
LeaseSet (std::shared_ptr<const i2p::tunnel::TunnelPool> pool); // deprecated
~LeaseSet () { delete[] m_Buffer; };
void Update (const uint8_t * buf, size_t len);
bool IsNewer (const uint8_t * buf, size_t len) const;
@ -82,6 +84,27 @@ namespace data
uint8_t * m_Buffer;
size_t m_BufferLen;
};
class LocalLeaseSet
{
public:
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; };
size_t GetBufferLen () const { return m_BufferLen; };
size_t GetSignatureLen () const { return m_Identity->GetSignatureLen (); };
const IdentHash& GetIdentHash () const { return m_Identity->GetIdentHash (); };
private:
std::shared_ptr<const IdentityEx> m_Identity;
uint8_t * m_Buffer;
size_t m_BufferLen;
};
}
}