mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
31ff0ff1cb
Some checks failed
Build Debian packages / ${{ matrix.dist }} (bookworm) (push) Has been cancelled
Build Debian packages / ${{ matrix.dist }} (bullseye) (push) Has been cancelled
Build Debian packages / ${{ matrix.dist }} (buster) (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on Windows / ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Has been cancelled
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (no) (push) Has been cancelled
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Has been cancelled
Build on Windows / ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Has been cancelled
Build on Windows / ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Has been cancelled
Build on Windows / ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Has been cancelled
Build on Windows / CMake ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Has been cancelled
Build on Windows / CMake ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Has been cancelled
Build on Windows / CMake ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Has been cancelled
Build on Windows / CMake ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (no) (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (OFF) (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (ON) (push) Has been cancelled
Build containers / Building container for ${{ matrix.platform }} (amd64, linux/amd64) (push) Has been cancelled
Build containers / Building container for ${{ matrix.platform }} (arm64, linux/arm64) (push) Has been cancelled
Build containers / Building container for ${{ matrix.platform }} (armv7, linux/arm/v7) (push) Has been cancelled
Build containers / Building container for ${{ matrix.platform }} (i386, linux/386) (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2013-2024, The PurpleI2P Project
|
|
*
|
|
* This file is part of Purple i2pd project and licensed under BSD3
|
|
*
|
|
* See full license text in LICENSE file at top of project tree
|
|
*/
|
|
|
|
#ifndef TUNNEL_GATEWAY_H__
|
|
#define TUNNEL_GATEWAY_H__
|
|
|
|
#include <inttypes.h>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <future>
|
|
#include "I2NPProtocol.h"
|
|
#include "TransportSession.h"
|
|
#include "TunnelBase.h"
|
|
|
|
namespace i2p
|
|
{
|
|
namespace tunnel
|
|
{
|
|
class TunnelGatewayBuffer
|
|
{
|
|
public:
|
|
TunnelGatewayBuffer ();
|
|
~TunnelGatewayBuffer ();
|
|
void PutI2NPMsg (const TunnelMessageBlock& block);
|
|
const std::vector<std::shared_ptr<const I2NPMessage> >& GetTunnelDataMsgs () const { return m_TunnelDataMsgs; };
|
|
void ClearTunnelDataMsgs ();
|
|
void CompleteCurrentTunnelDataMessage ();
|
|
|
|
private:
|
|
|
|
void CreateCurrentTunnelDataMessage ();
|
|
|
|
private:
|
|
|
|
std::vector<std::shared_ptr<const I2NPMessage> > m_TunnelDataMsgs;
|
|
std::shared_ptr<I2NPMessage> m_CurrentTunnelDataMsg;
|
|
size_t m_RemainingSize;
|
|
uint8_t * m_NonZeroRandomBuffer;
|
|
};
|
|
|
|
class TunnelGateway
|
|
{
|
|
public:
|
|
|
|
TunnelGateway (TunnelBase& tunnel):
|
|
m_Tunnel (tunnel), m_NumSentBytes (0) {};
|
|
void SendTunnelDataMsg (const TunnelMessageBlock& block);
|
|
void PutTunnelDataMsg (const TunnelMessageBlock& block);
|
|
void SendBuffer ();
|
|
size_t GetNumSentBytes () const { return m_NumSentBytes; };
|
|
|
|
private:
|
|
|
|
TunnelBase& m_Tunnel;
|
|
TunnelGatewayBuffer m_Buffer;
|
|
size_t m_NumSentBytes;
|
|
std::weak_ptr<i2p::transport::TransportSession> m_CurrentTransport;
|
|
std::future<std::shared_ptr<i2p::transport::TransportSession> > m_PendingTransport;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|