mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
invoke HandleCloveI2NPMessage
This commit is contained in:
parent
815b6db0bf
commit
4afef91359
|
@ -913,7 +913,7 @@ namespace garlic
|
||||||
switch (blk)
|
switch (blk)
|
||||||
{
|
{
|
||||||
case eECIESx25519BlkGalicClove:
|
case eECIESx25519BlkGalicClove:
|
||||||
// TODO:
|
HandleECIESx25519GarlicClove (buf + offset, size);
|
||||||
break;
|
break;
|
||||||
case eECIESx25519BlkDateTime:
|
case eECIESx25519BlkDateTime:
|
||||||
LogPrint (eLogDebug, "Garlic: datetime");
|
LogPrint (eLogDebug, "Garlic: datetime");
|
||||||
|
@ -931,5 +931,31 @@ namespace garlic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GarlicDestination::HandleECIESx25519GarlicClove (const uint8_t * buf, size_t len)
|
||||||
|
{
|
||||||
|
const uint8_t * buf1 = buf;
|
||||||
|
uint8_t flag = buf[0]; buf++; // flag
|
||||||
|
GarlicDeliveryType deliveryType = (GarlicDeliveryType)((flag >> 5) & 0x03);
|
||||||
|
switch (deliveryType)
|
||||||
|
{
|
||||||
|
case eGarlicDeliveryTypeDestination:
|
||||||
|
buf += 32; // TODO: check destination
|
||||||
|
// no break here
|
||||||
|
case eGarlicDeliveryTypeLocal:
|
||||||
|
{
|
||||||
|
uint8_t typeID = buf[0]; buf++; // typeid
|
||||||
|
buf += (4 + 4); // msgID + expiration
|
||||||
|
ptrdiff_t offset = buf - buf1;
|
||||||
|
if (offset <= (int)len)
|
||||||
|
HandleCloveI2NPMessage (typeID, buf, len - offset);
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Garlic: clove is too long");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// TODO: tunnel
|
||||||
|
default:
|
||||||
|
LogPrint (eLogWarning, "Garlic: unexpected delivery type ", (int)deliveryType);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,7 @@ namespace garlic
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from) = 0; // called from clove only
|
virtual void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from) = 0; // called from clove only
|
||||||
|
virtual bool HandleCloveI2NPMessage (uint8_t typeID, const uint8_t * payload, size_t len) = 0;
|
||||||
void HandleGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
void HandleGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
void HandleDeliveryStatusMessage (uint32_t msgID);
|
void HandleDeliveryStatusMessage (uint32_t msgID);
|
||||||
|
|
||||||
|
@ -220,6 +221,7 @@ namespace garlic
|
||||||
// ECIES-X25519-AEAD-Ratchet
|
// ECIES-X25519-AEAD-Ratchet
|
||||||
void HandleECIESx25519 (const uint8_t * buf, size_t len);
|
void HandleECIESx25519 (const uint8_t * buf, size_t len);
|
||||||
void HandleECIESx25519Payload (const uint8_t * buf, size_t len);
|
void HandleECIESx25519Payload (const uint8_t * buf, size_t len);
|
||||||
|
void HandleECIESx25519GarlicClove (const uint8_t * buf, size_t len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -115,12 +115,17 @@ namespace i2p
|
||||||
// implements GarlicDestination
|
// implements GarlicDestination
|
||||||
std::shared_ptr<const i2p::data::LocalLeaseSet> GetLeaseSet () { return nullptr; };
|
std::shared_ptr<const i2p::data::LocalLeaseSet> GetLeaseSet () { return nullptr; };
|
||||||
std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const;
|
std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const;
|
||||||
void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from);
|
|
||||||
|
|
||||||
// override GarlicDestination
|
// override GarlicDestination
|
||||||
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
void ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
|
void ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// implements GarlicDestination
|
||||||
|
void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from);
|
||||||
|
bool HandleCloveI2NPMessage (uint8_t typeID, const uint8_t * payload, size_t len) { return false; }; // not implemented
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void CreateNewRouter ();
|
void CreateNewRouter ();
|
||||||
|
|
Loading…
Reference in a new issue