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