2018-01-25 16:24:33 +00:00
|
|
|
#ifndef LLARP_ROUTER_H_
|
|
|
|
#define LLARP_ROUTER_H_
|
|
|
|
#include <llarp/config.h>
|
|
|
|
#include <llarp/ev.h>
|
2018-05-22 15:54:19 +00:00
|
|
|
#include <llarp/link.h>
|
2018-04-30 18:18:34 +00:00
|
|
|
#include <llarp/logic.h>
|
2018-06-06 12:59:15 +00:00
|
|
|
#include <llarp/nodedb.h>
|
2018-05-22 15:54:19 +00:00
|
|
|
#include <llarp/router_contact.h>
|
2018-01-27 01:18:10 +00:00
|
|
|
#include <llarp/threadpool.h>
|
2018-01-25 16:24:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-01-29 14:27:24 +00:00
|
|
|
struct llarp_router;
|
2018-01-25 16:24:33 +00:00
|
|
|
|
2018-05-22 18:41:38 +00:00
|
|
|
bool
|
2018-05-22 19:19:06 +00:00
|
|
|
llarp_findOrCreateIdentity(struct llarp_crypto *crypto, const char *path,
|
|
|
|
byte_t *secretkey);
|
2018-05-22 18:41:38 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
struct llarp_router *
|
2018-05-28 13:49:44 +00:00
|
|
|
llarp_init_router(struct llarp_threadpool *worker,
|
2018-05-22 15:54:19 +00:00
|
|
|
struct llarp_ev_loop *netloop, struct llarp_logic *logic);
|
|
|
|
void
|
|
|
|
llarp_free_router(struct llarp_router **router);
|
2018-01-25 16:24:33 +00:00
|
|
|
|
2018-06-10 14:05:48 +00:00
|
|
|
/// send raw message to router we have a session with
|
|
|
|
/// return false on message not sent becasue we don't have a session otherwise
|
|
|
|
/// return true
|
|
|
|
bool
|
|
|
|
llarp_rotuer_sendto(struct llarp_router *router, const byte_t *pubkey,
|
|
|
|
llarp_buffer_t buf);
|
|
|
|
|
2018-05-22 18:41:38 +00:00
|
|
|
bool
|
2018-06-13 12:58:51 +00:00
|
|
|
llarp_router_try_connect(struct llarp_router *router, struct llarp_rc *remote,
|
|
|
|
uint16_t numretries);
|
2018-01-25 16:24:33 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
bool
|
|
|
|
llarp_configure_router(struct llarp_router *router, struct llarp_config *conf);
|
|
|
|
|
|
|
|
void
|
2018-05-30 20:56:47 +00:00
|
|
|
llarp_run_router(struct llarp_router *router, struct llarp_nodedb *nodedb);
|
2018-05-22 18:41:38 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
void
|
|
|
|
llarp_stop_router(struct llarp_router *router);
|
|
|
|
|
|
|
|
struct llarp_router_link_iter
|
|
|
|
{
|
|
|
|
void *user;
|
|
|
|
bool (*visit)(struct llarp_router_link_iter *, struct llarp_router *,
|
|
|
|
struct llarp_link *);
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
llarp_router_iterate_links(struct llarp_router *router,
|
|
|
|
struct llarp_router_link_iter iter);
|
2018-01-27 01:18:10 +00:00
|
|
|
|
2018-01-25 16:24:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|