i2pd/TunnelEndpoint.h

44 lines
905 B
C
Raw Normal View History

2013-11-10 23:19:49 +00:00
#ifndef TUNNEL_ENDPOINT_H__
#define TUNNEL_ENDPOINT_H__
#include <inttypes.h>
#include <map>
#include <string>
#include "I2NPProtocol.h"
#include "TunnelBase.h"
namespace i2p
{
namespace tunnel
{
class TunnelEndpoint
{
2014-07-05 00:54:03 +00:00
struct TunnelMessageBlockEx: public TunnelMessageBlock
{
uint8_t nextFragmentNum;
};
2013-11-10 23:19:49 +00:00
public:
TunnelEndpoint (bool isInbound): m_IsInbound (isInbound), m_NumReceivedBytes (0) {};
2014-07-05 12:33:08 +00:00
~TunnelEndpoint ();
2013-12-10 13:10:49 +00:00
size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; };
2013-11-10 23:19:49 +00:00
void HandleDecryptedTunnelDataMsg (I2NPMessage * msg);
private:
2014-07-05 00:54:03 +00:00
void HandleFollowOnFragment (uint32_t msgID, bool isLastFragment, const TunnelMessageBlockEx& m);
2013-11-10 23:19:49 +00:00
void HandleNextMessage (const TunnelMessageBlock& msg);
2014-07-05 00:54:03 +00:00
private:
2014-06-11 14:56:20 +00:00
std::map<uint32_t, TunnelMessageBlockEx> m_IncompleteMessages;
bool m_IsInbound;
2013-12-10 13:10:49 +00:00
size_t m_NumReceivedBytes;
2013-11-10 23:19:49 +00:00
};
}
}
#endif