mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-23 13:24:20 +00:00
DatabaseStore for LeaseSet
This commit is contained in:
parent
ee2297c851
commit
220637b29d
@ -209,6 +209,19 @@ namespace i2p
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::LeaseSet * leaseSet)
|
||||||
|
{
|
||||||
|
if (!leaseSet) return nullptr;
|
||||||
|
I2NPMessage * m = NewI2NPMessage ();
|
||||||
|
I2NPDatabaseStoreMsg * msg = (I2NPDatabaseStoreMsg *)m->GetPayload ();
|
||||||
|
memcpy (msg->key, leaseSet->GetIdentHash (), 32);
|
||||||
|
msg->type = 1; // LeaseSet
|
||||||
|
msg->replyToken = 0;
|
||||||
|
memcpy (m->GetPayload () + sizeof (I2NPDatabaseStoreMsg), leaseSet->GetBuffer (), leaseSet->GetBufferLen ());
|
||||||
|
m->len += leaseSet->GetBufferLen () + sizeof (I2NPDatabaseStoreMsg);
|
||||||
|
FillI2NPMessageHeader (m, eI2NPDatabaseStore);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
I2NPBuildRequestRecordClearText CreateBuildRequestRecord (
|
I2NPBuildRequestRecordClearText CreateBuildRequestRecord (
|
||||||
const uint8_t * ourIdent, uint32_t receiveTunnelID,
|
const uint8_t * ourIdent, uint32_t receiveTunnelID,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
#include "RouterInfo.h"
|
#include "RouterInfo.h"
|
||||||
|
#include "LeaseSet.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
@ -157,7 +158,8 @@ namespace tunnel
|
|||||||
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident, const i2p::data::RouterInfo * floodfill);
|
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident, const i2p::data::RouterInfo * floodfill);
|
||||||
|
|
||||||
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router = nullptr);
|
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router = nullptr);
|
||||||
|
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::LeaseSet * leaseSet);
|
||||||
|
|
||||||
I2NPBuildRequestRecordClearText CreateBuildRequestRecord (
|
I2NPBuildRequestRecordClearText CreateBuildRequestRecord (
|
||||||
const uint8_t * ourIdent, uint32_t receiveTunnelID,
|
const uint8_t * ourIdent, uint32_t receiveTunnelID,
|
||||||
const uint8_t * nextIdent, uint32_t nextTunnelID,
|
const uint8_t * nextIdent, uint32_t nextTunnelID,
|
||||||
|
@ -55,6 +55,9 @@ namespace data
|
|||||||
LeaseSet& operator=(const LeaseSet& ) = default;
|
LeaseSet& operator=(const LeaseSet& ) = default;
|
||||||
void Update (const uint8_t * buf, int len);
|
void Update (const uint8_t * buf, int len);
|
||||||
|
|
||||||
|
const uint8_t * GetBuffer () const { return m_Buffer; };
|
||||||
|
size_t GetBufferLen () const { return m_BufferLen; };
|
||||||
|
|
||||||
// implements RoutingDestination
|
// implements RoutingDestination
|
||||||
const Identity& GetIdentity () const { return m_Identity; };
|
const Identity& GetIdentity () const { return m_Identity; };
|
||||||
const IdentHash& GetIdentHash () const { return m_IdentHash; };
|
const IdentHash& GetIdentHash () const { return m_IdentHash; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user