|
|
|
@ -22,6 +22,7 @@ namespace i2p
@@ -22,6 +22,7 @@ namespace i2p
|
|
|
|
|
I2NPMessage * msg = new I2NPMessage; |
|
|
|
|
msg->offset = 2; // reserve 2 bytes for NTCP header, should reserve more for SSU in future
|
|
|
|
|
msg->len = sizeof (I2NPHeader) + 2; |
|
|
|
|
msg->from = nullptr; |
|
|
|
|
return msg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -414,7 +415,7 @@ namespace i2p
@@ -414,7 +415,7 @@ namespace i2p
|
|
|
|
|
return be16toh (header->size) + sizeof (I2NPHeader); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HandleI2NPMessage (uint8_t * msg, size_t len, bool isFromTunnel) |
|
|
|
|
void HandleI2NPMessage (uint8_t * msg, size_t len) |
|
|
|
|
{ |
|
|
|
|
I2NPHeader * header = (I2NPHeader *)msg; |
|
|
|
|
uint32_t msgID = be32toh (header->msgID); |
|
|
|
@ -423,12 +424,7 @@ namespace i2p
@@ -423,12 +424,7 @@ namespace i2p
|
|
|
|
|
uint8_t * buf = msg + sizeof (I2NPHeader); |
|
|
|
|
int size = be16toh (header->size); |
|
|
|
|
switch (header->typeID) |
|
|
|
|
{ |
|
|
|
|
case eI2NPGarlic: |
|
|
|
|
LogPrint ("Garlic"); |
|
|
|
|
i2p::garlic::routing.HandleGarlicMessage (buf, size, isFromTunnel); |
|
|
|
|
break; |
|
|
|
|
break; |
|
|
|
|
{ |
|
|
|
|
case eI2NPDeliveryStatus: |
|
|
|
|
LogPrint ("DeliveryStatus"); |
|
|
|
|
// we assume DeliveryStatusMessage is sent with garlic only
|
|
|
|
@ -451,7 +447,7 @@ namespace i2p
@@ -451,7 +447,7 @@ namespace i2p
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HandleI2NPMessage (I2NPMessage * msg, bool isFromTunnel) |
|
|
|
|
void HandleI2NPMessage (I2NPMessage * msg) |
|
|
|
|
{ |
|
|
|
|
if (msg) |
|
|
|
|
{ |
|
|
|
@ -473,8 +469,12 @@ namespace i2p
@@ -473,8 +469,12 @@ namespace i2p
|
|
|
|
|
LogPrint ("DatabaseSearchReply"); |
|
|
|
|
i2p::data::netdb.PostI2NPMsg (msg); |
|
|
|
|
break; |
|
|
|
|
case eI2NPGarlic: |
|
|
|
|
LogPrint ("Garlic"); |
|
|
|
|
i2p::garlic::routing.HandleGarlicMessage (msg); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
HandleI2NPMessage (msg->GetBuffer (), msg->GetLength (), isFromTunnel); |
|
|
|
|
HandleI2NPMessage (msg->GetBuffer (), msg->GetLength ()); |
|
|
|
|
DeleteI2NPMessage (msg); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|