mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.2 KiB
C++
76 lines
1.2 KiB
C++
6 years ago
|
#ifndef LLARP_RELAY_COMMIT_HPP
|
||
|
#define LLARP_RELAY_COMMIT_HPP
|
||
6 years ago
|
|
||
6 years ago
|
#include <crypto.hpp>
|
||
6 years ago
|
#include <encrypted_ack.hpp>
|
||
|
#include <encrypted_frame.hpp>
|
||
6 years ago
|
#include <link_message.hpp>
|
||
6 years ago
|
#include <path_types.hpp>
|
||
|
#include <pow.hpp>
|
||
6 years ago
|
|
||
6 years ago
|
#include <array>
|
||
6 years ago
|
|
||
|
namespace llarp
|
||
|
{
|
||
6 years ago
|
// forward declare
|
||
6 years ago
|
namespace path
|
||
|
{
|
||
|
struct PathContext;
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
struct LR_CommitRecord
|
||
|
{
|
||
6 years ago
|
PubKey commkey;
|
||
6 years ago
|
RouterID nextHop;
|
||
6 years ago
|
TunnelNonce tunnelNonce;
|
||
6 years ago
|
PathID_t txid, rxid;
|
||
|
|
||
6 years ago
|
PoW *work = nullptr;
|
||
|
uint64_t version = 0;
|
||
|
uint64_t lifetime = 0;
|
||
6 years ago
|
|
||
|
bool
|
||
|
BDecode(llarp_buffer_t *buf);
|
||
|
|
||
|
bool
|
||
6 years ago
|
BEncode(llarp_buffer_t *buf) const;
|
||
6 years ago
|
|
||
6 years ago
|
~LR_CommitRecord();
|
||
|
|
||
6 years ago
|
bool
|
||
|
operator==(const LR_CommitRecord &other) const;
|
||
|
|
||
6 years ago
|
private:
|
||
|
static bool
|
||
|
OnKey(dict_reader *r, llarp_buffer_t *buf);
|
||
6 years ago
|
};
|
||
|
|
||
6 years ago
|
struct LR_CommitMessage : public ILinkMessage
|
||
6 years ago
|
{
|
||
6 years ago
|
std::array< EncryptedFrame, 8 > frames;
|
||
6 years ago
|
|
||
6 years ago
|
LR_CommitMessage() : ILinkMessage()
|
||
|
{
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
~LR_CommitMessage();
|
||
|
|
||
6 years ago
|
void
|
||
|
Clear();
|
||
|
|
||
|
bool
|
||
6 years ago
|
DecodeKey(llarp_buffer_t key, llarp_buffer_t *buf);
|
||
6 years ago
|
|
||
|
bool
|
||
6 years ago
|
BEncode(llarp_buffer_t *buf) const;
|
||
|
|
||
|
bool
|
||
6 years ago
|
HandleMessage(llarp::Router *router) const;
|
||
6 years ago
|
|
||
|
bool
|
||
6 years ago
|
AsyncDecrypt(llarp::path::PathContext *context) const;
|
||
6 years ago
|
};
|
||
6 years ago
|
} // namespace llarp
|
||
6 years ago
|
|
||
|
#endif
|