lokinet/include/llarp/messages/relay_commit.hpp

77 lines
1.4 KiB
C++
Raw Normal View History

#ifndef LLARP_RELAY_COMMIT_HPP
#define LLARP_RELAY_COMMIT_HPP
#include <llarp/crypto.hpp>
2018-06-11 13:25:10 +00:00
#include <llarp/encrypted_ack.hpp>
#include <llarp/encrypted_frame.hpp>
2018-06-01 14:08:54 +00:00
#include <llarp/link_message.hpp>
2018-06-10 14:05:48 +00:00
#include <llarp/path_types.hpp>
#include <vector>
namespace llarp
{
struct LR_CommitRecord
{
PubKey commkey;
PubKey nextHop;
TunnelNonce tunnelNonce;
2018-06-10 14:05:48 +00:00
PathID_t txid;
SymmKey downstreamReplyKey;
SymmNonce downstreamReplyNonce;
uint64_t version;
bool
BDecode(llarp_buffer_t *buf);
bool
2018-06-10 14:05:48 +00:00
BEncode(llarp_buffer_t *buf) const;
2018-06-12 12:49:23 +00:00
private:
static bool
OnKey(dict_reader *r, llarp_buffer_t *buf);
};
struct LR_AcceptRecord
{
uint64_t pathid;
uint64_t version;
std::vector< byte_t > padding;
bool
2018-06-10 14:05:48 +00:00
DecodeKey(llarp_buffer_t key, llarp_buffer_t *buf);
bool
2018-06-10 14:05:48 +00:00
BEncode(llarp_buffer_t *buf) const;
};
2018-06-01 14:08:54 +00:00
struct LR_CommitMessage : public ILinkMessage
{
std::vector< EncryptedFrame > frames;
EncryptedFrame lasthopFrame;
2018-06-11 13:25:10 +00:00
std::vector< EncryptedAck > acks;
uint64_t version;
2018-06-12 16:45:12 +00:00
LR_CommitMessage() : ILinkMessage()
{
}
2018-06-01 14:08:54 +00:00
LR_CommitMessage(const RouterID &from) : ILinkMessage(from)
{
}
2018-06-12 12:49:23 +00:00
2018-06-01 14:08:54 +00:00
~LR_CommitMessage();
void
Clear();
bool
2018-06-01 14:08:54 +00:00
DecodeKey(llarp_buffer_t key, llarp_buffer_t *buf);
bool
2018-06-01 14:08:54 +00:00
BEncode(llarp_buffer_t *buf) const;
bool
HandleMessage(llarp_router *router) const;
};
}
#endif