lokinet/llarp/endpoint_base.hpp
Jeff Becker 708e408c30
various fixups and cleanups
* wire up last of the quic stuff
* clean up udp packet generation code
* pass EndpointBase not quic tunnel for quic stuff
* add {n,h}uint16_t::FromString
* add nuint_t::FromString
* make AlignedBuffer::IsZero non constant time call for speed
2021-04-19 06:58:37 -04:00

61 lines
1.3 KiB
C++

#pragma once
#include "llarp/service/address.hpp"
#include "llarp/service/convotag.hpp"
#include "llarp/service/protocol_type.hpp"
#include "router_id.hpp"
#include "ev/ev.hpp"
#include <functional>
#include <memory>
#include <string>
#include <tuple>
#include <optional>
#include "oxenmq/variant.h"
namespace llarp
{
namespace quic
{
class TunnelManager;
}
class EndpointBase
{
public:
virtual ~EndpointBase() = default;
using AddressVariant_t = std::variant<service::Address, RouterID>;
virtual std::string
LocalAddress() const = 0;
virtual quic::TunnelManager*
GetQUICTunnel() = 0;
virtual std::optional<AddressVariant_t>
GetEndpointWithConvoTag(service::ConvoTag tag) const = 0;
virtual std::optional<service::ConvoTag>
GetBestConvoTagFor(AddressVariant_t addr) const = 0;
virtual bool
EnsurePathTo(
AddressVariant_t addr,
std::function<void(std::optional<service::ConvoTag>)> hook,
llarp_time_t timeout) = 0;
virtual void
LookupNameAsync(
std::string name, std::function<void(std::optional<AddressVariant_t>)> resultHandler) = 0;
virtual const EventLoop_ptr&
Loop() = 0;
virtual bool
SendToOrQueue(
service::ConvoTag tag, const llarp_buffer_t& payload, service::ProtocolType t) = 0;
};
} // namespace llarp