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

Method CreateI2NPBlock

libi2pd/SSU2Session.cpp:3043–3053  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3041 }
3042
3043 size_t SSU2Session::CreateI2NPBlock (uint8_t * buf, size_t len, std::shared_ptr<I2NPMessage>&& msg)
3044 {
3045 msg->ToNTCP2 ();
3046 auto msgBuf = msg->GetNTCP2Header ();
3047 auto msgLen = msg->GetNTCP2Length ();
3048 if (msgLen + 3 > len) msgLen = len - 3;
3049 buf[0] = eSSU2BlkI2NPMessage;
3050 htobe16buf (buf + 1, msgLen); // size
3051 memcpy (buf + 3, msgBuf, msgLen);
3052 return msgLen + 3;
3053 }
3054
3055 size_t SSU2Session::CreateFirstFragmentBlock (uint8_t * buf, size_t len, std::shared_ptr<I2NPMessage> msg)
3056 {

Callers

nothing calls this directly

Calls 4

htobe16bufFunction · 0.85
ToNTCP2Method · 0.80
GetNTCP2HeaderMethod · 0.80
GetNTCP2LengthMethod · 0.80

Tested by

no test coverage detected