mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
7caa87862e
All #ifndef guards on headers have been removed, I think, in favor of #pragma once Headers are now included as `#include "filename"` if the included file resides in the same directory as the file including it, or any subdirectory therein. Otherwise they are included as `#include <project/top/dir/relative/path/filename>` The above does not include system/os headers.
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <llarp/crypto/crypto.hpp>
|
|
#include <llarp/router_contact.hpp>
|
|
#include <llarp/util/buffer.hpp>
|
|
|
|
/**
|
|
* dht.h
|
|
*
|
|
* DHT functions
|
|
*/
|
|
|
|
struct llarp_dht_context;
|
|
|
|
namespace llarp
|
|
{
|
|
struct AbstractRouter;
|
|
}
|
|
|
|
/// allocator
|
|
struct llarp_dht_context*
|
|
llarp_dht_context_new(llarp::AbstractRouter* parent);
|
|
|
|
/// deallocator
|
|
void
|
|
llarp_dht_context_free(struct llarp_dht_context* dht);
|
|
|
|
/// start dht context with our location in keyspace
|
|
void
|
|
llarp_dht_context_start(struct llarp_dht_context* ctx, const byte_t* key);
|
|
|
|
// remove this? dns needs it atm
|
|
struct llarp_router_lookup_job;
|
|
|
|
using llarp_router_lookup_handler = void (*)(struct llarp_router_lookup_job*);
|
|
|
|
struct llarp_router_lookup_job
|
|
{
|
|
/// can be anything but usually a class context for hook
|
|
void* user;
|
|
llarp_router_lookup_handler hook;
|
|
struct llarp_dht_context* dht;
|
|
llarp::PubKey target;
|
|
bool found;
|
|
// make sure you initialize addr and exits
|
|
llarp::RouterContact result;
|
|
bool iterative;
|
|
};
|
|
// end dns requirement
|
|
|
|
/// start allowing dht participation on a context
|
|
void
|
|
llarp_dht_allow_transit(struct llarp_dht_context* ctx);
|
|
|
|
/// remove router from tracked dht peer list
|
|
/// internal function do not use
|
|
void
|
|
__llarp_dht_remove_peer(struct llarp_dht_context* ctx, const byte_t* id);
|
|
|
|
void
|
|
llarp_dht_lookup_router(struct llarp_dht_context* ctx, struct llarp_router_lookup_job* job);
|