lokinet/include/llarp.h

86 lines
1.8 KiB
C
Raw Normal View History

2018-01-25 16:24:33 +00:00
#ifndef LLARP_H_
#define LLARP_H_
2018-06-01 14:08:54 +00:00
#include <llarp/dht.h>
2018-01-25 16:24:33 +00:00
#include <llarp/ev.h>
2018-04-30 18:18:18 +00:00
#include <llarp/logic.h>
#include <llarp/mem.h>
#include <llarp/version.h>
2018-05-27 18:03:10 +00:00
#ifdef __cplusplus
2018-07-17 04:37:50 +00:00
extern "C"
{
2018-05-27 18:03:10 +00:00
#endif
2018-07-17 04:37:50 +00:00
/// llarp application context for C api
struct llarp_main;
2018-05-27 18:03:10 +00:00
2018-07-17 04:37:50 +00:00
/// initialize application context and load config
struct llarp_main *
llarp_main_init(const char *fname, bool multiProcess);
2018-05-27 18:03:10 +00:00
2018-07-17 04:37:50 +00:00
/// handle signal for main context
void
llarp_main_signal(struct llarp_main *ptr, int sig);
2018-05-27 18:03:10 +00:00
2018-07-17 04:37:50 +00:00
/// setup main context
int
llarp_main_setup(struct llarp_main *ptr);
2018-07-17 04:37:50 +00:00
/// run main context
int
llarp_main_run(struct llarp_main *ptr);
2018-05-27 18:03:10 +00:00
2018-07-17 04:37:50 +00:00
void
llarp_main_abort(struct llarp_main *ptr);
2018-07-17 04:37:50 +00:00
/// load nodeDB into memory
int
llarp_main_loadDatabase(struct llarp_main *ptr);
2018-07-17 04:37:50 +00:00
/// iterator on nodedb entries
int
llarp_main_iterateDatabase(struct llarp_main *ptr,
struct llarp_nodedb_iter i);
2018-07-17 04:37:50 +00:00
/// put RC into nodeDB
bool
llarp_main_putDatabase(struct llarp_main *ptr, struct llarp_rc *rc);
2018-07-17 04:37:50 +00:00
/// get RC from nodeDB
struct llarp_rc *
llarp_main_getDatabase(struct llarp_main *ptr, byte_t *pk);
2018-06-21 11:11:55 +00:00
2018-07-17 04:37:50 +00:00
// fwd declr
struct check_online_request;
2018-07-17 04:37:50 +00:00
/// check_online_request hook definition
typedef void (*check_online_request_hook_func)(struct check_online_request *);
2018-07-17 04:37:50 +00:00
struct check_online_request
{
struct llarp_main *ptr;
struct llarp_router_lookup_job *job;
bool online;
size_t nodes;
bool first;
check_online_request_hook_func hook;
};
/// get RC from DHT
void
llarp_main_queryDHT(struct check_online_request *request);
struct llarp_rc *
llarp_main_getLocalRC(struct llarp_main *ptr);
void
llarp_main_free(struct llarp_main *ptr);
2018-05-27 18:03:10 +00:00
2018-07-26 10:52:23 +00:00
const char *
handleBaseCmdLineArgs(int argc, char *argv[]);
2018-05-27 18:03:10 +00:00
#ifdef __cplusplus
}
#endif
2018-01-25 16:24:33 +00:00
#endif