2014-10-22 19:30:25 +00:00
|
|
|
#ifndef DATAGRAM_H__
|
|
|
|
#define DATAGRAM_H__
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
2014-10-23 20:56:50 +00:00
|
|
|
#include "LeaseSet.h"
|
|
|
|
#include "I2NPProtocol.h"
|
2014-10-22 19:30:25 +00:00
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
|
|
|
namespace client
|
|
|
|
{
|
|
|
|
class ClientDestination;
|
|
|
|
}
|
|
|
|
namespace datagram
|
|
|
|
{
|
|
|
|
const size_t MAX_DATAGRAM_SIZE = 32768;
|
|
|
|
class DatagramDestination
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-10-23 20:56:50 +00:00
|
|
|
DatagramDestination (i2p::client::ClientDestination& owner);
|
2014-10-22 19:30:25 +00:00
|
|
|
~DatagramDestination () {};
|
|
|
|
|
2014-10-23 20:56:50 +00:00
|
|
|
void SendDatagramTo (const uint8_t * payload, size_t len, const i2p::data::LeaseSet& remote);
|
2014-10-22 19:30:25 +00:00
|
|
|
void HandleDataMessagePayload (const uint8_t * buf, size_t len);
|
|
|
|
|
2014-10-23 20:56:50 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
I2NPMessage * CreateDataMessage (const uint8_t * payload, size_t len);
|
2014-10-27 20:01:22 +00:00
|
|
|
void SendMsg (I2NPMessage * msg, const i2p::data::LeaseSet& remote);
|
2014-10-27 20:30:56 +00:00
|
|
|
void HandleDatagram (const uint8_t * buf, size_t len);
|
2014-10-23 20:56:50 +00:00
|
|
|
|
2014-10-22 19:30:25 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
i2p::client::ClientDestination& m_Owner;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|