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.
lokinet/llarp/dht.cpp

54 lines
1.1 KiB
C++

#include <llarp/dht.h>
#include <llarp/dht/context.hpp>
#include "router_contact.hpp"
llarp_dht_context::llarp_dht_context(llarp::Router *router)
{
parent = router;
}
struct llarp_dht_context *
llarp_dht_context_new(llarp::Router *router)
{
return new llarp_dht_context(router);
}
void
llarp_dht_context_free(struct llarp_dht_context *ctx)
{
delete ctx;
}
void
__llarp_dht_remove_peer(struct llarp_dht_context *ctx, const byte_t *id)
{
ctx->impl.nodes->DelNode(id);
}
void
llarp_dht_allow_transit(llarp_dht_context *ctx)
{
ctx->impl.allowTransit = true;
}
void
llarp_dht_context_start(struct llarp_dht_context *ctx, const byte_t *key)
{
ctx->impl.Init(key, ctx->parent, 20000);
}
void
llarp_dht_lookup_router(struct llarp_dht_context *ctx,
struct llarp_router_lookup_job *job)
{
job->dht = ctx;
job->found = false;
job->result.Clear();
// llarp_rc_clear(&job->result);
llarp::LogError("implement me llarp_dht_lookup_router");
/*
ctx->parent->logic->queue_job(
{job, &llarp::dht::Context::queue_router_lookup});
*/
}