MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / HandleDataMessagePayload

Method HandleDataMessagePayload

libi2pd/Datagram.cpp:425–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423 }
424
425 void DatagramDestination::HandleDataMessagePayload (uint16_t fromPort, uint16_t toPort,
426 const uint8_t * buf, size_t len, uint8_t protocolType, i2p::garlic::ECIESX25519AEADRatchetSession * from)
427 {
428 // unzip it
429 uint8_t uncompressed[MAX_DATAGRAM_SIZE];
430 size_t uncompressedLen = m_Inflator.Inflate (buf, len, uncompressed, MAX_DATAGRAM_SIZE);
431 if (uncompressedLen)
432 {
433 switch (protocolType)
434 {
435 case i2p::client::PROTOCOL_TYPE_RAW:
436 HandleRawDatagram (fromPort, toPort, uncompressed, uncompressedLen);
437 break;
438 case i2p::client::PROTOCOL_TYPE_DATAGRAM3:
439 HandleDatagram3 (fromPort, toPort, uncompressed, uncompressedLen, from);
440 break;
441 case i2p::client::PROTOCOL_TYPE_DATAGRAM:
442 HandleDatagram (fromPort, toPort, uncompressed, uncompressedLen, from);
443 break;
444 case i2p::client::PROTOCOL_TYPE_DATAGRAM2:
445 HandleDatagram2 (fromPort, toPort, uncompressed, uncompressedLen, from);
446 break;
447 default:
448 LogPrint (eLogInfo, "Datagram: unknown protocol type ", protocolType);
449 };
450 }
451 else
452 LogPrint (eLogWarning, "Datagram: decompression failed");
453 }
454
455 std::shared_ptr<I2NPMessage> DatagramDestination::CreateDataMessage (
456 const std::vector<std::pair<const uint8_t *, size_t> >& payloads,

Callers 1

HandleDataMessageMethod · 0.45

Calls 2

LogPrintFunction · 0.85
InflateMethod · 0.80

Tested by

no test coverage detected