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

Method SendHostReplyMessage

libi2pd_client/I2CP.cpp:1017–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015 }
1016
1017 void I2CPSession::SendHostReplyMessage (uint32_t requestID, std::shared_ptr<const i2p::data::IdentityEx> identity)
1018 {
1019 if (identity)
1020 {
1021 size_t l = identity->GetFullLen () + 7;
1022 uint8_t * buf = new uint8_t[l];
1023 htobe16buf (buf, m_SessionID);
1024 htobe32buf (buf + 2, requestID);
1025 buf[6] = 0; // result code
1026 identity->ToBuffer (buf + 7, l - 7);
1027 SendI2CPMessage (I2CP_HOST_REPLY_MESSAGE, buf, l);
1028 delete[] buf;
1029 }
1030 else
1031 {
1032 uint8_t buf[7];
1033 htobe16buf (buf, m_SessionID);
1034 htobe32buf (buf + 2, requestID);
1035 buf[6] = 1; // result code
1036 SendI2CPMessage (I2CP_HOST_REPLY_MESSAGE, buf, 7);
1037 }
1038 }
1039
1040 void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t len)
1041 {

Callers 1

Calls 4

htobe16bufFunction · 0.85
htobe32bufFunction · 0.85
GetFullLenMethod · 0.45
ToBufferMethod · 0.45

Tested by

no test coverage detected