mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
11 years ago
|
#ifndef TUNNEL_GATEWAY_H__
|
||
|
#define TUNNEL_GATEWAY_H__
|
||
|
|
||
|
#include <inttypes.h>
|
||
|
#include <vector>
|
||
10 years ago
|
#include <memory>
|
||
11 years ago
|
#include "I2NPProtocol.h"
|
||
|
#include "TunnelBase.h"
|
||
|
|
||
|
namespace i2p
|
||
|
{
|
||
|
namespace tunnel
|
||
|
{
|
||
|
class TunnelGatewayBuffer
|
||
|
{
|
||
|
public:
|
||
8 years ago
|
TunnelGatewayBuffer ();
|
||
10 years ago
|
~TunnelGatewayBuffer ();
|
||
11 years ago
|
void PutI2NPMsg (const TunnelMessageBlock& block);
|
||
8 years ago
|
const std::vector<std::shared_ptr<const I2NPMessage> >& GetTunnelDataMsgs () const { return m_TunnelDataMsgs; };
|
||
11 years ago
|
void ClearTunnelDataMsgs ();
|
||
|
void CompleteCurrentTunnelDataMessage ();
|
||
11 years ago
|
|
||
|
private:
|
||
|
|
||
11 years ago
|
void CreateCurrentTunnelDataMessage ();
|
||
11 years ago
|
|
||
|
private:
|
||
|
|
||
8 years ago
|
std::vector<std::shared_ptr<const I2NPMessage> > m_TunnelDataMsgs;
|
||
10 years ago
|
std::shared_ptr<I2NPMessage> m_CurrentTunnelDataMsg;
|
||
11 years ago
|
size_t m_RemainingSize;
|
||
10 years ago
|
uint8_t m_NonZeroRandomBuffer[TUNNEL_DATA_MAX_PAYLOAD_SIZE];
|
||
11 years ago
|
};
|
||
11 years ago
|
|
||
|
class TunnelGateway
|
||
|
{
|
||
|
public:
|
||
|
|
||
10 years ago
|
TunnelGateway (TunnelBase * tunnel):
|
||
8 years ago
|
m_Tunnel (tunnel), m_NumSentBytes (0) {};
|
||
11 years ago
|
void SendTunnelDataMsg (const TunnelMessageBlock& block);
|
||
|
void PutTunnelDataMsg (const TunnelMessageBlock& block);
|
||
|
void SendBuffer ();
|
||
11 years ago
|
size_t GetNumSentBytes () const { return m_NumSentBytes; };
|
||
11 years ago
|
|
||
11 years ago
|
private:
|
||
|
|
||
|
TunnelBase * m_Tunnel;
|
||
|
TunnelGatewayBuffer m_Buffer;
|
||
11 years ago
|
size_t m_NumSentBytes;
|
||
11 years ago
|
};
|
||
11 years ago
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|