mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
47 lines
865 B
C++
47 lines
865 B
C++
#ifndef TUNNEL_POOL__
|
|
#define TUNNEL_POOL__
|
|
|
|
#include <set>
|
|
#include <vector>
|
|
#include "Identity.h"
|
|
#include "LeaseSet.h"
|
|
#include "I2NPProtocol.h"
|
|
#include "TunnelBase.h"
|
|
|
|
namespace i2p
|
|
{
|
|
namespace tunnel
|
|
{
|
|
class Tunnel;
|
|
class InboundTunnel;
|
|
class OutboundTunnel;
|
|
|
|
class TunnelPool // per local destination
|
|
{
|
|
public:
|
|
|
|
TunnelPool (i2p::data::LocalDestination * owner, int numTunnels = 5);
|
|
~TunnelPool ();
|
|
|
|
void CreateTunnels ();
|
|
void TunnelCreated (InboundTunnel * createdTunnel);
|
|
void TunnelExpired (InboundTunnel * expiredTunnel);
|
|
std::vector<InboundTunnel *> GetInboundTunnels (int num) const;
|
|
|
|
private:
|
|
|
|
void CreateInboundTunnel ();
|
|
|
|
private:
|
|
|
|
i2p::data::LocalDestination * m_Owner;
|
|
int m_NumTunnels;
|
|
std::set<InboundTunnel *, TunnelCreationTimeCmp> m_InboundTunnels; // recent tunnel appears first
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|