common Identity for LeaseSet and RouterInfo

This commit is contained in:
orignal 2013-12-19 21:19:44 -05:00
parent 6f1d4f4300
commit d714d7fe6c
9 changed files with 105 additions and 28 deletions

View file

@ -2,7 +2,9 @@
#define STREAMING_H__
#include <inttypes.h>
#include <map>
#include "LeaseSet.h"
#include "I2NPProtocol.h"
namespace i2p
{
@ -20,15 +22,36 @@ namespace stream
const uint16_t PACKET_FLAG_ECHO = 0x0200;
const uint16_t PACKET_FLAG_NO_ACK = 0x0400;
class Stream
{
public:
Stream (const i2p::data::IdentHash& destination);
uint32_t GetSendStreamID () const { return m_SendStreamID; };
uint32_t GetRecvStreamID () const { return m_RecvStreamID; };
void HandleNextPacket (const uint8_t * buf, size_t len);
private:
uint32_t m_SendStreamID, m_RecvStreamID;
};
class StreamingDestination
{
public:
Stream * CreateNewStream (const i2p::data::IdentHash& destination);
void HandleNextPacket (const uint8_t * buf, size_t len);
};
private:
std::map<uint32_t, Stream *> m_Streams;
};
// assuming data is I2CP message
void HandleDataMessage (i2p::data::IdentHash * destination, const uint8_t * buf, size_t len);
I2NPMessage * CreateDataMessage (Stream * s, uint8_t * payload, size_t len);
}
}