mirror of https://github.com/oxen-io/lokinet
more hidden service stuff
parent
97e11a28f6
commit
7fbc21207f
@ -1,7 +1,7 @@
|
||||
#ifndef LLARP_CODEL_QUEUE_HPP
|
||||
#define LLARP_CODEL_QUEUE_HPP
|
||||
#include <llarp/time.h>
|
||||
#include "llarp/logger.hpp"
|
||||
#include <llarp/logger.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <functional>
|
@ -0,0 +1,56 @@
|
||||
#ifndef LLARP_SERVICE_PROTOCOL_HPP
|
||||
#define LLARP_SERVICE_PROTOCOL_HPP
|
||||
#include <llarp/time.h>
|
||||
#include <llarp/bencode.hpp>
|
||||
#include <llarp/crypto.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
namespace service
|
||||
{
|
||||
enum ProtocolType
|
||||
{
|
||||
eProtocolText = 0,
|
||||
eProtocolTraffic = 1
|
||||
};
|
||||
|
||||
struct ProtocolMessage : public llarp::IBEncodeMessage
|
||||
{
|
||||
ProtocolMessage(ProtocolType t);
|
||||
~ProtocolMessage();
|
||||
ProtocolType proto;
|
||||
llarp_time_t queued = 0;
|
||||
std::vector< byte_t > payload;
|
||||
llarp::KeyExchangeNonce N;
|
||||
|
||||
bool
|
||||
DecodeKey(llarp_buffer_t key, llarp_buffer_t* val);
|
||||
bool
|
||||
BEncode(llarp_buffer_t* buf) const;
|
||||
|
||||
void
|
||||
PutBuffer(llarp_buffer_t payload);
|
||||
|
||||
struct GetTime
|
||||
{
|
||||
llarp_time_t
|
||||
operator()(const ProtocolMessage* msg) const
|
||||
{
|
||||
return msg->queued;
|
||||
}
|
||||
};
|
||||
|
||||
struct PutTime
|
||||
{
|
||||
void
|
||||
operator()(ProtocolMessage* msg, llarp_time_t now) const
|
||||
{
|
||||
msg->queued = now;
|
||||
}
|
||||
};
|
||||
};
|
||||
} // namespace service
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
#include <llarp/service/protocol.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
namespace service
|
||||
{
|
||||
ProtocolMessage::ProtocolMessage(ProtocolType t) : proto(t)
|
||||
{
|
||||
}
|
||||
|
||||
ProtocolMessage::~ProtocolMessage()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ProtocolMessage::BEncode(llarp_buffer_t* buf) const
|
||||
{
|
||||
// TODO: implement me
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ProtocolMessage::DecodeKey(llarp_buffer_t key, llarp_buffer_t* val)
|
||||
{
|
||||
// TODO: implement me
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ProtocolMessage::PutBuffer(llarp_buffer_t buf)
|
||||
{
|
||||
payload.resize(buf.sz);
|
||||
memcpy(payload.data(), buf.base, buf.sz);
|
||||
}
|
||||
} // namespace service
|
||||
} // namespace llarp
|
Loading…
Reference in New Issue