mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-07-07 10:43:54 +02:00
pass buffer as std::string_stream
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
1862f28a98
commit
181edce55a
2 changed files with 21 additions and 21 deletions
|
@ -257,21 +257,21 @@ namespace client
|
||||||
separator = eol;
|
separator = eol;
|
||||||
|
|
||||||
if (!strcmp (m_Buffer, SAM_SESSION_CREATE))
|
if (!strcmp (m_Buffer, SAM_SESSION_CREATE))
|
||||||
ProcessSessionCreate (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessSessionCreate (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_STREAM_CONNECT))
|
else if (!strcmp (m_Buffer, SAM_STREAM_CONNECT))
|
||||||
ProcessStreamConnect (separator + 1, bytes_transferred - (separator - m_Buffer) - 1, bytes_transferred - (eol - m_Buffer) - 1);
|
ProcessStreamConnect (separator + 1, bytes_transferred - (separator - m_Buffer) - 1, bytes_transferred - (eol - m_Buffer) - 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_STREAM_ACCEPT))
|
else if (!strcmp (m_Buffer, SAM_STREAM_ACCEPT))
|
||||||
ProcessStreamAccept (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessStreamAccept (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_STREAM_FORWARD))
|
else if (!strcmp (m_Buffer, SAM_STREAM_FORWARD))
|
||||||
ProcessStreamForward (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessStreamForward (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_DEST_GENERATE))
|
else if (!strcmp (m_Buffer, SAM_DEST_GENERATE))
|
||||||
ProcessDestGenerate (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessDestGenerate (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_NAMING_LOOKUP))
|
else if (!strcmp (m_Buffer, SAM_NAMING_LOOKUP))
|
||||||
ProcessNamingLookup (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessNamingLookup (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_SESSION_ADD))
|
else if (!strcmp (m_Buffer, SAM_SESSION_ADD))
|
||||||
ProcessSessionAdd (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessSessionAdd (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_SESSION_REMOVE))
|
else if (!strcmp (m_Buffer, SAM_SESSION_REMOVE))
|
||||||
ProcessSessionRemove (separator + 1, bytes_transferred - (separator - m_Buffer) - 1);
|
ProcessSessionRemove (separator + 1);
|
||||||
else if (!strcmp (m_Buffer, SAM_DATAGRAM_SEND) || !strcmp (m_Buffer, SAM_RAW_SEND))
|
else if (!strcmp (m_Buffer, SAM_DATAGRAM_SEND) || !strcmp (m_Buffer, SAM_RAW_SEND))
|
||||||
{
|
{
|
||||||
size_t len = bytes_transferred - (separator - m_Buffer) - 1;
|
size_t len = bytes_transferred - (separator - m_Buffer) - 1;
|
||||||
|
@ -327,7 +327,7 @@ namespace client
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessSessionCreate (char * buf, size_t len)
|
void SAMSocket::ProcessSessionCreate (std::string_view buf)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "SAM: Session create: ", buf);
|
LogPrint (eLogDebug, "SAM: Session create: ", buf);
|
||||||
auto params = ExtractParams (buf);
|
auto params = ExtractParams (buf);
|
||||||
|
@ -592,7 +592,7 @@ namespace client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessStreamAccept (char * buf, size_t len)
|
void SAMSocket::ProcessStreamAccept (std::string_view buf)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "SAM: Stream accept: ", buf);
|
LogPrint (eLogDebug, "SAM: Stream accept: ", buf);
|
||||||
if ( m_SocketType != eSAMSocketTypeUnknown)
|
if ( m_SocketType != eSAMSocketTypeUnknown)
|
||||||
|
@ -642,7 +642,7 @@ namespace client
|
||||||
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true);
|
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessStreamForward(char* buf, size_t len)
|
void SAMSocket::ProcessStreamForward (std::string_view buf)
|
||||||
{
|
{
|
||||||
LogPrint(eLogDebug, "SAM: Stream forward: ", buf);
|
LogPrint(eLogDebug, "SAM: Stream forward: ", buf);
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ namespace client
|
||||||
return offset + size;
|
return offset + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessDestGenerate (char * buf, size_t len)
|
void SAMSocket::ProcessDestGenerate (std::string_view buf)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "SAM: Dest generate");
|
LogPrint (eLogDebug, "SAM: Dest generate");
|
||||||
auto params = ExtractParams (buf);
|
auto params = ExtractParams (buf);
|
||||||
|
@ -804,7 +804,7 @@ namespace client
|
||||||
SendMessageReply (m_Buffer, l, false);
|
SendMessageReply (m_Buffer, l, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessNamingLookup (char * buf, size_t len)
|
void SAMSocket::ProcessNamingLookup (std::string_view buf)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "SAM: Naming lookup: ", buf);
|
LogPrint (eLogDebug, "SAM: Naming lookup: ", buf);
|
||||||
auto params = ExtractParams (buf);
|
auto params = ExtractParams (buf);
|
||||||
|
@ -846,7 +846,7 @@ namespace client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessSessionAdd (char * buf, size_t len)
|
void SAMSocket::ProcessSessionAdd (std::string_view buf)
|
||||||
{
|
{
|
||||||
auto session = m_Owner.FindSession(m_ID);
|
auto session = m_Owner.FindSession(m_ID);
|
||||||
if (session && session->Type == eSAMSessionTypeMaster)
|
if (session && session->Type == eSAMSessionTypeMaster)
|
||||||
|
@ -890,7 +890,7 @@ namespace client
|
||||||
SendSessionI2PError ("Wrong session type");
|
SendSessionI2PError ("Wrong session type");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAMSocket::ProcessSessionRemove (char * buf, size_t len)
|
void SAMSocket::ProcessSessionRemove (std::string_view buf)
|
||||||
{
|
{
|
||||||
auto session = m_Owner.FindSession(m_ID);
|
auto session = m_Owner.FindSession(m_ID);
|
||||||
if (session && session->Type == eSAMSessionTypeMaster)
|
if (session && session->Type == eSAMSessionTypeMaster)
|
||||||
|
|
|
@ -139,14 +139,14 @@ namespace client
|
||||||
void HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, 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 HandleI2PRawDatagramReceive (uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len);
|
void HandleI2PRawDatagramReceive (uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len);
|
||||||
|
|
||||||
void ProcessSessionCreate (char * buf, size_t len);
|
void ProcessSessionCreate (std::string_view buf);
|
||||||
void ProcessStreamConnect (char * buf, size_t len, size_t rem);
|
void ProcessStreamConnect (char * buf, size_t len, size_t rem);
|
||||||
void ProcessStreamAccept (char * buf, size_t len);
|
void ProcessStreamAccept (std::string_view buf);
|
||||||
void ProcessStreamForward (char * buf, size_t len);
|
void ProcessStreamForward (std::string_view buf);
|
||||||
void ProcessDestGenerate (char * buf, size_t len);
|
void ProcessDestGenerate (std::string_view buf);
|
||||||
void ProcessNamingLookup (char * buf, size_t len);
|
void ProcessNamingLookup (std::string_view buf);
|
||||||
void ProcessSessionAdd (char * buf, size_t len);
|
void ProcessSessionAdd (std::string_view buf);
|
||||||
void ProcessSessionRemove (char * buf, size_t len);
|
void ProcessSessionRemove (std::string_view buf);
|
||||||
void SendReplyWithMessage (const char * reply, const std::string & msg);
|
void SendReplyWithMessage (const char * reply, const std::string & msg);
|
||||||
void SendSessionI2PError(const std::string & msg);
|
void SendSessionI2PError(const std::string & msg);
|
||||||
void SendStreamI2PError(const std::string & msg);
|
void SendStreamI2PError(const std::string & msg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue