lokinet/llarp/router.hpp

42 lines
811 B
C++
Raw Normal View History

2018-02-01 17:06:49 +00:00
#ifndef LLARP_ROUTER_HPP
#define LLARP_ROUTER_HPP
#include <llarp/link.h>
2018-02-01 17:07:01 +00:00
#include <llarp/router.h>
2018-02-01 17:06:49 +00:00
#include <functional>
#include "mem.hpp"
2018-02-01 17:07:01 +00:00
namespace llarp {
struct router_links {
llarp_link *link = nullptr;
router_links *next = nullptr;
};
2018-02-01 17:06:49 +00:00
2018-02-01 17:07:01 +00:00
} // namespace llarp
2018-02-01 17:06:49 +00:00
2018-02-01 17:07:01 +00:00
struct llarp_router {
2018-04-05 14:23:14 +00:00
bool ready;
2018-05-16 15:30:05 +00:00
const char * transport_keyfile = "transport.key";
2018-05-17 20:00:58 +00:00
const char * transport_certfile = "transport.pem";
2018-05-16 16:41:20 +00:00
struct llarp_ev_loop * netloop;
2018-02-01 17:07:01 +00:00
struct llarp_threadpool *tp;
llarp::router_links links;
llarp_crypto crypto;
llarp_msg_muxer muxer;
llarp_path_context *paths;
2018-05-16 18:13:18 +00:00
llarp_alloc * mem;
2018-02-01 17:06:49 +00:00
2018-05-16 18:13:18 +00:00
llarp_router(llarp_alloc * mem);
2018-02-01 17:07:01 +00:00
~llarp_router();
2018-02-01 17:06:49 +00:00
2018-02-01 17:07:01 +00:00
void AddLink(struct llarp_link *link);
2018-02-01 17:06:49 +00:00
2018-02-01 17:07:01 +00:00
void ForEachLink(std::function<void(llarp_link *)> visitor);
2018-02-01 17:06:49 +00:00
2018-02-01 17:07:01 +00:00
void Close();
2018-04-05 14:23:14 +00:00
bool Ready();
2018-02-01 17:07:01 +00:00
};
2018-02-01 17:06:49 +00:00
#endif