|
|
|
@ -30,7 +30,9 @@ namespace garlic
@@ -30,7 +30,9 @@ namespace garlic
|
|
|
|
|
const int ECIESX25519_SEND_INACTIVITY_TIMEOUT = 5000; // number of milliseconds we can send empty(pyaload only) packet after
|
|
|
|
|
const int ECIESX25519_SEND_EXPIRATION_TIMEOUT = 480; // in seconds
|
|
|
|
|
const int ECIESX25519_RECEIVE_EXPIRATION_TIMEOUT = 600; // in seconds
|
|
|
|
|
const int ECIESX25519_PREVIOUS_TAGSET_EXPIRATION_TIMEOUT = 180; // 180
|
|
|
|
|
const int ECIESX25519_PREVIOUS_TAGSET_EXPIRATION_TIMEOUT = 180; // in seconds
|
|
|
|
|
const int ECIESX25519_ACK_REQUEST_INTERVAL = 33000; // in milliseconds
|
|
|
|
|
const int ECIESX25519_ACK_REQUEST_MAX_NUM_ATTEMPTS = 3; |
|
|
|
|
const int ECIESX25519_TAGSET_MAX_NUM_TAGS = 8192; // number of tags we request new tagset after
|
|
|
|
|
const int ECIESX25519_MIN_NUM_GENERATED_TAGS = 24; |
|
|
|
|
const int ECIESX25519_MAX_NUM_GENERATED_TAGS = 320; |
|
|
|
@ -57,6 +59,8 @@ namespace garlic
@@ -57,6 +59,8 @@ namespace garlic
|
|
|
|
|
int GetTagSetID () const { return m_TagSetID; }; |
|
|
|
|
void SetTagSetID (int tagsetID) { m_TagSetID = tagsetID; }; |
|
|
|
|
|
|
|
|
|
uint32_t GetMsgID () const { return (m_TagSetID << 16) + m_NextIndex; }; // (tagsetid << 16) + N
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
|
i2p::data::Tag<64> m_SessionTagKeyData; |
|
|
|
@ -178,6 +182,7 @@ namespace garlic
@@ -178,6 +182,7 @@ namespace garlic
|
|
|
|
|
bool IsReadyToSend () const { return m_State != eSessionStateNewSessionSent; }; |
|
|
|
|
bool IsTerminated () const { return m_IsTerminated; } |
|
|
|
|
uint64_t GetLastActivityTimestamp () const { return m_LastActivityTimestamp; }; |
|
|
|
|
bool CleanupUnconfirmedTags (); // return true if unaswered Ack requests, called from I2CP
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
|
@ -185,6 +190,7 @@ namespace garlic
@@ -185,6 +190,7 @@ namespace garlic
|
|
|
|
|
void SetNoiseState (const i2p::crypto::NoiseSymmetricState& state) { GetNoiseState () = state; }; |
|
|
|
|
void CreateNonce (uint64_t seqn, uint8_t * nonce); |
|
|
|
|
void HandlePayload (const uint8_t * buf, size_t len, const std::shared_ptr<ReceiveRatchetTagSet>& receiveTagset, int index); |
|
|
|
|
bool MessageConfirmed (uint32_t msgID); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
@ -219,11 +225,15 @@ namespace garlic
@@ -219,11 +225,15 @@ namespace garlic
|
|
|
|
|
m_LastSentTimestamp = 0; // in milliseconds
|
|
|
|
|
std::shared_ptr<RatchetTagSet> m_SendTagset, m_NSRSendTagset; |
|
|
|
|
std::unique_ptr<i2p::data::IdentHash> m_Destination;// TODO: might not need it
|
|
|
|
|
std::list<std::pair<uint16_t, int> > m_AckRequests; // (tagsetid, index)
|
|
|
|
|
std::list<std::pair<uint16_t, int> > m_AckRequests; // incoming (tagsetid, index)
|
|
|
|
|
bool m_SendReverseKey = false, m_SendForwardKey = false, m_IsTerminated = false; |
|
|
|
|
std::unique_ptr<DHRatchet> m_NextReceiveRatchet, m_NextSendRatchet; |
|
|
|
|
uint8_t m_PaddingSizes[32], m_NextPaddingSize; |
|
|
|
|
|
|
|
|
|
uint64_t m_LastAckRequestSendTime = 0; // milliseconds
|
|
|
|
|
uint32_t m_AckRequestMsgID = 0; |
|
|
|
|
int m_AckRequestNumAttempts = 0; |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
// for HTTP only
|
|
|
|
|