mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-13 11:17:53 +00:00
I2CPDestination added
This commit is contained in:
parent
5ad10955be
commit
8622385e88
6
I2CP.cpp
6
I2CP.cpp
@ -8,6 +8,12 @@ namespace i2p
|
||||
{
|
||||
namespace client
|
||||
{
|
||||
|
||||
I2CPDestination::I2CPDestination (I2CPSession& owner, std::shared_ptr<const i2p::data::IdentityEx> identity, bool isPublic):
|
||||
LeaseSetDestination (isPublic), m_Owner (owner), m_Identity (identity)
|
||||
{
|
||||
}
|
||||
|
||||
I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr<boost::asio::ip::tcp::socket> socket):
|
||||
m_Owner (owner), m_Socket (socket),
|
||||
m_NextMessage (nullptr), m_NextMessageLen (0), m_NextMessageOffset (0)
|
||||
|
25
I2CP.h
25
I2CP.h
@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <boost/asio.hpp>
|
||||
#include "Destination.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
@ -19,6 +20,28 @@ namespace client
|
||||
|
||||
const uint8_t I2CP_GET_DATE_MESSAGE = 32;
|
||||
|
||||
class I2CPSession;
|
||||
class I2CPDestination: public LeaseSetDestination
|
||||
{
|
||||
public:
|
||||
|
||||
I2CPDestination (I2CPSession& owner, std::shared_ptr<const i2p::data::IdentityEx> identity, bool isPublic);
|
||||
|
||||
protected:
|
||||
|
||||
// implements LocalDestination
|
||||
std::shared_ptr<const i2p::data::IdentityEx> GetIdentity () const { return m_Identity; };
|
||||
void Sign (const uint8_t * buf, int len, uint8_t * signature) const { /* TODO */};
|
||||
|
||||
// I2CP
|
||||
void HandleDataMessage (const uint8_t * buf, size_t len) {};
|
||||
|
||||
private:
|
||||
|
||||
I2CPSession& m_Owner;
|
||||
std::shared_ptr<const i2p::data::IdentityEx> m_Identity;
|
||||
};
|
||||
|
||||
class I2CPServer;
|
||||
class I2CPSession: public std::enable_shared_from_this<I2CPSession>
|
||||
{
|
||||
@ -44,6 +67,8 @@ namespace client
|
||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||
uint8_t m_Buffer[I2CP_SESSION_BUFFER_SIZE], * m_NextMessage;
|
||||
size_t m_NextMessageLen, m_NextMessageOffset;
|
||||
|
||||
std::shared_ptr<I2CPDestination> m_Destination;
|
||||
};
|
||||
typedef void (I2CPSession::*I2CPMessageHandler)(const uint8_t * buf, size_t len);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user