mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
create SAM session
This commit is contained in:
parent
2914bb67f1
commit
393d4bc231
4 changed files with 119 additions and 1 deletions
12
SAM.h
12
SAM.h
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <thread>
|
||||
#include <boost/asio.hpp>
|
||||
#include "Streaming.h"
|
||||
|
@ -48,6 +50,13 @@ namespace stream
|
|||
Stream * m_Stream;
|
||||
};
|
||||
|
||||
struct SAMSession
|
||||
{
|
||||
StreamingDestination * localDestination;
|
||||
std::list<SAMSocket *> sockets;
|
||||
bool isTransient;
|
||||
};
|
||||
|
||||
class SAMBridge
|
||||
{
|
||||
public:
|
||||
|
@ -59,6 +68,8 @@ namespace stream
|
|||
void Stop ();
|
||||
|
||||
boost::asio::io_service& GetService () { return m_Service; };
|
||||
bool CreateSession (const std::string& id, const char * destination = nullptr, size_t len = 0); // null means transient
|
||||
void CloseSession (const std::string& id);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -74,6 +85,7 @@ namespace stream
|
|||
boost::asio::io_service m_Service;
|
||||
boost::asio::ip::tcp::acceptor m_Acceptor;
|
||||
SAMSocket * m_NewSocket;
|
||||
std::map<std::string, SAMSession> m_Sessions;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue