mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-23 17:34:21 +00:00
pass source and destination ports to datagram receiver
This commit is contained in:
parent
c66ba370d5
commit
d9218134e2
@ -83,7 +83,7 @@ namespace datagram
|
|||||||
if (verified)
|
if (verified)
|
||||||
{
|
{
|
||||||
if (m_Receiver != nullptr)
|
if (m_Receiver != nullptr)
|
||||||
m_Receiver (identity, buf + headerLen, len -headerLen);
|
m_Receiver (identity, fromPort, toPort, buf + headerLen, len -headerLen);
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "Receiver for datagram is not set");
|
LogPrint (eLogWarning, "Receiver for datagram is not set");
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace datagram
|
|||||||
const size_t MAX_DATAGRAM_SIZE = 32768;
|
const size_t MAX_DATAGRAM_SIZE = 32768;
|
||||||
class DatagramDestination
|
class DatagramDestination
|
||||||
{
|
{
|
||||||
typedef std::function<void (const i2p::data::IdentityEx& ident, const uint8_t *, size_t)> Receiver;
|
typedef std::function<void (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len)> Receiver;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
6
SAM.cpp
6
SAM.cpp
@ -259,7 +259,7 @@ namespace client
|
|||||||
{
|
{
|
||||||
auto dest = m_Session->localDestination->CreateDatagramDestination ();
|
auto dest = m_Session->localDestination->CreateDatagramDestination ();
|
||||||
dest->SetReceiver (std::bind (&SAMSocket::HandleI2PDatagramReceive, shared_from_this (),
|
dest->SetReceiver (std::bind (&SAMSocket::HandleI2PDatagramReceive, shared_from_this (),
|
||||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
|
||||||
}
|
}
|
||||||
SendSessionCreateReplyOk ();
|
SendSessionCreateReplyOk ();
|
||||||
}
|
}
|
||||||
@ -577,9 +577,9 @@ namespace client
|
|||||||
LogPrint (eLogInfo, "SAM I2P acceptor has been reset");
|
LogPrint (eLogInfo, "SAM I2P acceptor has been reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& ident, const uint8_t * buf, size_t len)
|
void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
auto base64 = ident.ToBase64 ();
|
auto base64 = from.ToBase64 ();
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
size_t l = sprintf_s ((char *)m_StreamBuffer, SAM_SOCKET_BUFFER_SIZE, SAM_DATAGRAM_RECEIVED, base64.c_str (), len);
|
size_t l = sprintf_s ((char *)m_StreamBuffer, SAM_SOCKET_BUFFER_SIZE, SAM_DATAGRAM_RECEIVED, base64.c_str (), len);
|
||||||
#else
|
#else
|
||||||
|
2
SAM.h
2
SAM.h
@ -96,7 +96,7 @@ namespace client
|
|||||||
void HandleI2PReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
void HandleI2PReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||||
void HandleI2PAccept (std::shared_ptr<i2p::stream::Stream> stream);
|
void HandleI2PAccept (std::shared_ptr<i2p::stream::Stream> stream);
|
||||||
void HandleWriteI2PData (const boost::system::error_code& ecode);
|
void HandleWriteI2PData (const boost::system::error_code& ecode);
|
||||||
void HandleI2PDatagramReceive (const i2p::data::IdentityEx& ident, const uint8_t * buf, size_t len);
|
void HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len);
|
||||||
|
|
||||||
void ProcessSessionCreate (char * buf, size_t len);
|
void ProcessSessionCreate (char * buf, size_t len);
|
||||||
void ProcessStreamConnect (char * buf, size_t len);
|
void ProcessStreamConnect (char * buf, size_t len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user