diff --git a/I2CP.cpp b/I2CP.cpp index d6ba4e42..5c718a48 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -8,6 +8,12 @@ namespace i2p { namespace client { + + I2CPDestination::I2CPDestination (I2CPSession& owner, std::shared_ptr identity, bool isPublic): + LeaseSetDestination (isPublic), m_Owner (owner), m_Identity (identity) + { + } + I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr socket): m_Owner (owner), m_Socket (socket), m_NextMessage (nullptr), m_NextMessageLen (0), m_NextMessageOffset (0) diff --git a/I2CP.h b/I2CP.h index cb17626d..020fd22a 100644 --- a/I2CP.h +++ b/I2CP.h @@ -5,6 +5,7 @@ #include #include #include +#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 identity, bool isPublic); + + protected: + + // implements LocalDestination + std::shared_ptr 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 m_Identity; + }; + class I2CPServer; class I2CPSession: public std::enable_shared_from_this { @@ -44,6 +67,8 @@ namespace client std::shared_ptr m_Socket; uint8_t m_Buffer[I2CP_SESSION_BUFFER_SIZE], * m_NextMessage; size_t m_NextMessageLen, m_NextMessageOffset; + + std::shared_ptr m_Destination; }; typedef void (I2CPSession::*I2CPMessageHandler)(const uint8_t * buf, size_t len);