diff --git a/daemon.ini b/daemon.ini index 6f47b76c0..2a379aa19 100644 --- a/daemon.ini +++ b/daemon.ini @@ -1,2 +1,4 @@ [router] - \ No newline at end of file + +[links] +eth0=ip \ No newline at end of file diff --git a/daemon/main.c b/daemon/main.c index 6f2a91a15..1082948d8 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -1,28 +1,78 @@ #include #include +#include -struct llarp_router * router; -struct llarp_config * gconfig; -struct llarp_ev_loop * mainloop; +struct llarp_main +{ + struct llarp_router * router; + struct llarp_threadpool * tp; + struct llarp_config * config; + struct llarp_ev_loop * mainloop; +}; + +void iter_main_config(struct llarp_config_iterator * itr, const char * section, const char * key, const char * val) +{ + struct llarp_main * m = (struct llarp_main *) itr->user; + if(!strcmp(section, "threadpool")) + { + if(!strcmp(key, "workers")) + { + int workers = atoi(val); + if(!m->tp && workers > 0) + { + m->tp = llarp_init_threadpool(workers); + } + } + } +} + +int shutdown_llarp(struct llarp_main * m) +{ + printf("Shutting down ."); + llarp_stop_router(m->router); + printf("."); + llarp_ev_loop_stop(m->mainloop); + printf("."); + llarp_threadpool_join(m->tp); + printf("."); + llarp_free_router(&m->router); + printf("."); + llarp_free_config(&m->config); + printf("."); + llarp_ev_loop_free(&m->mainloop); + printf("."); + llarp_free_threadpool(&m->tp); + printf(".\n"); + +} int main(int argc, char * argv[]) { + struct llarp_main llarp = { + NULL, NULL, NULL, NULL + }; const char * conffname = "daemon.ini"; if (argc > 1) conffname = argv[1]; llarp_mem_jemalloc(); - llarp_new_config(&gconfig); - llarp_ev_loop_alloc(&mainloop); + llarp_new_config(&llarp.config); + llarp_ev_loop_alloc(&llarp.mainloop); printf("%s loaded\n", LLARP_VERSION); - if(!llarp_load_config(gconfig, conffname)) + if(!llarp_load_config(llarp.config, conffname)) { printf("Loaded config %s\n", conffname); - llarp_init_router(&router); - if(!llarp_configure_router(router, gconfig)) + struct llarp_config_iterator iter; + iter.user = &llarp; + iter.visit = iter_main_config; + llarp_config_iter(llarp.config, &iter); + if(!llarp.tp) + llarp.tp = llarp_init_threadpool(2); + llarp.router = llarp_init_router(llarp.tp); + if(!llarp_configure_router(llarp.router, llarp.config)) { printf("Running\n"); - llarp_run_router(router, mainloop); - llarp_ev_loop_run(mainloop); + llarp_run_router(llarp.router, llarp.mainloop); + llarp_ev_loop_run(llarp.mainloop); } else printf("Failed to configure router\n"); @@ -30,12 +80,5 @@ int main(int argc, char * argv[]) else printf("Failed to load config %s\n", conffname); - printf("Shutting down."); - llarp_free_router(&router); - printf("."); - llarp_free_config(&gconfig); - printf("."); - llarp_ev_loop_free(&mainloop); - printf(".\n"); - return 0; + return shutdown_llarp(&llarp); } diff --git a/include/llarp/buffer.h b/include/llarp/buffer.h index 8530a9943..1e3a79248 100644 --- a/include/llarp/buffer.h +++ b/include/llarp/buffer.h @@ -1,10 +1,11 @@ #ifndef LLARP_BUFFER_H_ #define LLARP_BUFFER_H_ + +#include +#include #ifdef __cplusplus extern "C" { #endif -#include - typedef struct llarp_buffer_t { char * base; size_t sz; diff --git a/include/llarp/ev.h b/include/llarp/ev.h index 84c957df5..1e49978a9 100644 --- a/include/llarp/ev.h +++ b/include/llarp/ev.h @@ -15,6 +15,8 @@ extern "C" { void llarp_ev_loop_free(struct llarp_ev_loop ** ev); int llarp_ev_loop_run(struct llarp_ev_loop * ev); + /** stop event loop and wait for it to complete all jobs */ + void llarp_ev_loop_stop(struct llarp_ev_loop * ev); struct llarp_udp_listener { @@ -29,6 +31,18 @@ extern "C" { int llarp_ev_add_udp_listener(struct llarp_ev_loop * ev, struct llarp_udp_listener * listener); int llarp_ev_close_udp_listener(struct llarp_udp_listener * listener); + + + struct llarp_ev_job + { + struct llarp_ev_loop * loop; + void * user; + /** work is called async when ready in the event loop thread */ + void (*work)(struct llarp_ev_job *); + }; + + /** call work async in event loop thread (thread safe) */ + void llarp_ev_async(struct llarp_ev_loop * ev, struct llarp_ev_job job); #ifdef __cplusplus } diff --git a/include/llarp/ibfq.h b/include/llarp/ibfq.h new file mode 100644 index 000000000..a7404ce77 --- /dev/null +++ b/include/llarp/ibfq.h @@ -0,0 +1,30 @@ +#ifndef LLARP_IBFQ_H_ +#define LLARP_IBFQ_H_ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + // forward declare + struct llarp_msg_muxer; + + struct llarp_link_queue; + + struct llarp_link_queue * llarp_init_link_queue(); + void llarp_free_link_queue(struct llarp_link_queue ** queue); + /** + offer a full frame to the inbound frame queue + return true if successfully added + return false if the queue is full + */ + bool llarp_link_offer_frame(struct llarp_link_queue * queue, llarp_buffer_t msg); + /** return true if we have more messages to process */ + bool llarp_link_queue_process(struct llarp_link_queue * queue, struct llarp_msg_muxer * muxer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/llarp/ibmq.h b/include/llarp/ibmq.h new file mode 100644 index 000000000..9893d48d1 --- /dev/null +++ b/include/llarp/ibmq.h @@ -0,0 +1,29 @@ +#ifndef LLARP_IBMQ_H_ +#define LLARP_IBMQ_H_ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + struct llarp_mq; + + struct llarp_mq * llarp_init_mq(); + void llarp_free_mq(struct llarp_mq ** queue); + /** + offer a full message to the inbound message queue + return true if successfully added + return false if the queue is full + */ + bool llarp_mq_offer(struct llarp_mq * queue, llarp_buffer_t msg); + size_t llarp_mq_peek(struct llarp_mq * queue); + /** return true if we have more messages to process */ + bool llarp_mq_process(struct llarp_mq * queue, struct llarp_msg_muxer * muxer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/llarp/link.h b/include/llarp/link.h index 0377f0dfd..5098fbf26 100644 --- a/include/llarp/link.h +++ b/include/llarp/link.h @@ -1,24 +1,58 @@ #ifndef LLARP_LINK_H_ #define LLARP_LINK_H_ -#include #include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { #endif - struct llarp_inet_link; + struct llarp_link; - void llarp_inet_link_alloc(struct llarp_inet_link ** link, struct llarp_alloc * mem); - void llarp_inet_link_free(struct llarp_inet_link ** link); + struct llarp_link * llarp_link_alloc(); + void llarp_link_free(struct llarp_link ** link); - void llarp_inet_link_configure(struct llarp_inet_link * link, struct llarp_config * conf); + bool llarp_link_configure(struct llarp_link * link, const char * ifname, int af); - void llarp_inet_link_start(struct llarp_inet_link * link, struct llarp_router * router); + /** get link listener for events */ + struct llarp_udp_listener * llarp_link_udp_listener(struct llarp_link * link); - void llarp_inet_link_stop(struct llarp_inet_link * link); + void llarp_link_stop(struct llarp_link * link); + + struct llarp_link_session; + + struct llarp_link_session_listener + { + void * user; + /** set by llarp_try_establish_session */ + struct llarp_link * link; + /** set by llarp_try_establish_session */ + struct llarp_rc * rc; + void (*result)(struct llarp_link_session_listener *, struct llarp_link_session *); + }; + + /** information for establishing an outbound session */ + struct llarp_link_establish_job + { + struct llarp_rc * rc; + uint64_t timeout; + }; + + void llarp_link_try_establish_session(struct llarp_link * link, struct llarp_link_establish_job * job, struct llarp_link_session_listener * l); + + + struct llarp_link_session_iter + { + void * user; + struct llarp_link * link; + bool (*visit)(struct llarp_link_session_iter *, struct llarp_link_session *); + }; + + void llarp_link_iter_sessions(struct llarp_link * l, struct llarp_link_session_iter * i); + + struct llarp_rc * llarp_link_session_rc(struct llarp_link_session * s); #ifdef __cplusplus } diff --git a/include/llarp/msg_handler.h b/include/llarp/msg_handler.h new file mode 100644 index 000000000..e46e5e5e4 --- /dev/null +++ b/include/llarp/msg_handler.h @@ -0,0 +1,38 @@ +#ifndef LLARP_MSG_HANDLER_H_ +#define LLARP_MSG_HANDLER_H_ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + struct llarp_frame_handler + { + struct llarp_obmd * outbound; + struct llarp_ibmq * inbound; + bool (*process)(struct llarp_frame_handler *, struct llarp_link_session *, llarp_buffer_t); + }; + + struct llarp_msg_handler + { + struct llarp_path_context * paths; + }; + + struct llarp_msg_muxer + { + /** get a message handler for a link level message given msg.a */ + struct llarp_frame_handler * (*link_handler_for)(const char *); + /** get a message handler for a routing layer message given msg.A */ + struct llarp_msg_handler * (*routing_handler_for)(const char *); + }; + + /** fill function pointers with default values */ + void llarp_msg_handler_mux_init(struct llarp_msg_muxer * muxer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/llarp/obmd.h b/include/llarp/obmd.h new file mode 100644 index 000000000..66e7a74ee --- /dev/null +++ b/include/llarp/obmd.h @@ -0,0 +1,27 @@ +#ifndef LLARP_OBMD_H_ +#define LLARP_OBMD_H_ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + // forward declair + struct llarp_link; + + struct llarp_link_dispatcher; + + struct llarp_link_dispatcher * llarp_init_link_dispatcher(); + void llarp_free_link_dispatcher(struct llarp_link_dispatcher ** dispatcher); + + void llarp_link_sendto(struct llarp_link_dispatcher * dispatcher, llarp_pubkey_t pubkey, llarp_buffer_t msg); + + void llarp_link_register(struct llarp_link_dispatcher * dispatcher, struct llarp_link * link); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/llarp/path.h b/include/llarp/path.h new file mode 100644 index 000000000..1048acb14 --- /dev/null +++ b/include/llarp/path.h @@ -0,0 +1,19 @@ +#ifndef LLARP_PATH_H +#define LLARP_PATH_H + +#include + +typedef uint64_t llarp_path_id_t; + +struct llarp_transit_hop +{ + llarp_path_id_t id; + llarp_sharedkey_t symkey; + llarp_pubkey_t nextHop; + uint64_t started; + uint64_t lifetime; + llarp_version_t version; +}; + + +#endif diff --git a/include/llarp/router.h b/include/llarp/router.h index 7ea96c6f8..50e5d6dc6 100644 --- a/include/llarp/router.h +++ b/include/llarp/router.h @@ -2,6 +2,9 @@ #define LLARP_ROUTER_H_ #include #include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -9,7 +12,7 @@ extern "C" { struct llarp_router; - void llarp_init_router(struct llarp_router ** router); + struct llarp_router * llarp_init_router(struct llarp_threadpool * tp); void llarp_free_router(struct llarp_router ** router); int llarp_configure_router(struct llarp_router * router, struct llarp_config * conf); @@ -17,6 +20,12 @@ extern "C" { void llarp_run_router(struct llarp_router * router, struct llarp_ev_loop * loop); void llarp_stop_router(struct llarp_router * router); + + /** get router's inbound link level frame queue */ + struct llarp_link_queue * llarp_router_link_queue(struct llarp_router * router); + /** get router's outbound link level frame dispatcher */ + struct llarp_link_dispatcher * llarp_router_link_dispatcher(struct llarp_router * router); + #ifdef __cplusplus } #endif diff --git a/include/llarp/threadpool.h b/include/llarp/threadpool.h new file mode 100644 index 000000000..943a89479 --- /dev/null +++ b/include/llarp/threadpool.h @@ -0,0 +1,31 @@ +#ifndef LLARP_THREADPOOL_H +#define LLARP_THREADPOOL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + + struct llarp_threadpool; + + struct llarp_threadpool * llarp_init_threadpool(int workers); + void llarp_free_threadpool(struct llarp_threadpool ** tp); + + /** job to be done in worker thread */ + struct llarp_thread_job + { + /** calls result async after work is executed */ + struct llarp_ev_job * result; + /** called in threadpool worker thread */ + void (*work)(struct llarp_thread_job *); + }; + + void llarp_threadpool_queue_job(struct llarp_threadpool * tp, struct llarp_thread_job j); + + void llarp_threadpool_start(struct llarp_threadpool * tp); + void llarp_threadpool_join(struct llarp_threadpool * tp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/llarp/time.h b/include/llarp/time.h index 3d621bbe9..1801fbd79 100644 --- a/include/llarp/time.h +++ b/include/llarp/time.h @@ -1,12 +1,12 @@ #ifndef LLARP_TIME_H #define LLARP_TIME_H -#include +#include #ifdef __cplusplus extern "C" { #endif - uint64_t llarp_time_now_ms(); - uint64_t llarp_time_now_sec(); + llarp_time_t llarp_time_now_ms(); + llarp_seconds_t llarp_time_now_sec(); #ifdef __cplusplus } diff --git a/include/llarp/types.h b/include/llarp/types.h new file mode 100644 index 000000000..c950508f3 --- /dev/null +++ b/include/llarp/types.h @@ -0,0 +1,16 @@ +#ifndef LLARP_TYPES_H +#define LLARP_TYEPS_H +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t llarp_proto_version_t; +typedef uint64_t llarp_time_t; +typedef uint32_t llarp_seconds_t; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/llarp/address_info.hpp b/llarp/address_info.hpp index b1cc0846b..43c3a4279 100644 --- a/llarp/address_info.hpp +++ b/llarp/address_info.hpp @@ -13,7 +13,7 @@ struct llarp_ai_list static std::list ai_list_to_std(struct llarp_ai_list * l) { std::list list; - if(l->data) + if(l && l->data) { do { diff --git a/llarp/config.cpp b/llarp/config.cpp index 1be3dc6a2..c6154afc5 100644 --- a/llarp/config.cpp +++ b/llarp/config.cpp @@ -42,14 +42,14 @@ extern "C" { void llarp_new_config(struct llarp_config ** conf) { - llarp_config * c = llarp::alloc(); + llarp_config * c = new llarp_config; *conf = c; } void llarp_free_config(struct llarp_config ** conf) { if(*conf) - llarp_g_mem.free(*conf); + delete *conf; *conf = nullptr; } diff --git a/llarp/ev.cpp b/llarp/ev.cpp index 235df42bc..50dad3f0f 100644 --- a/llarp/ev.cpp +++ b/llarp/ev.cpp @@ -6,6 +6,16 @@ struct llarp_ev_loop { uv_loop_t _loop; + static void * operator new(size_t sz) + { + return llarp_g_mem.alloc(sz, llarp::alignment()); + } + + static void operator delete(void * ptr) + { + llarp_g_mem.free(ptr); + } + uv_loop_t * loop() { return &_loop; } }; @@ -13,6 +23,11 @@ namespace llarp { struct udp_listener { + static void * operator new(size_t sz) + { + return llarp_g_mem.alloc(sz, alignment()); + } + uv_udp_t _handle; struct llarp_udp_listener * listener; @@ -35,7 +50,7 @@ namespace llarp static void udp_alloc_cb(uv_handle_t * h, size_t sz, uv_buf_t * buf) { - buf->base = static_cast(llarp_g_mem.alloc(sz, 512)); + buf->base = static_cast(llarp_g_mem.alloc(sz, 1024)); buf->len = sz; } @@ -58,7 +73,7 @@ namespace llarp extern "C" { void llarp_ev_loop_alloc(struct llarp_ev_loop ** ev) { - *ev = llarp::alloc(); + *ev = new llarp_ev_loop; if (*ev) { uv_loop_init((*ev)->loop()); @@ -85,7 +100,7 @@ extern "C" { sockaddr_in6 addr; uv_ip6_addr(listener->host, listener->port, &addr); int ret = 0; - llarp::udp_listener * l = llarp::alloc(); + llarp::udp_listener * l = new llarp::udp_listener; listener->impl = l; l->udp()->data = l; l->listener = listener; @@ -113,7 +128,7 @@ extern "C" { if(!uv_udp_recv_stop(l->udp())) { l->closed(); - llarp_g_mem.free(l); + delete l; ret = 0; } } diff --git a/llarp/link.cpp b/llarp/link.cpp index a9e71f510..e83e0d0b4 100644 --- a/llarp/link.cpp +++ b/llarp/link.cpp @@ -20,7 +20,7 @@ namespace llarp auto itr = link->sessions.find(remote); if(itr == link->sessions.end()) { - link->sessions[remote] = std::make_unique(link->_crypto, remote); + link->sessions[remote] = std::make_shared(link->_crypto, remote); } link->sessions[remote]->RecvFrom(buff, sz); } @@ -32,9 +32,6 @@ namespace llarp _listener.recvfrom = link_recv_from; } - Link::~Link() - { - } PeerSession::PeerSession(llarp_crypto * crypto, sockaddr_in6 remote) : lastRX(0), diff --git a/llarp/link.hpp b/llarp/link.hpp index 6aef9d451..0752b530d 100644 --- a/llarp/link.hpp +++ b/llarp/link.hpp @@ -43,22 +43,18 @@ namespace llarp PeerSession(llarp_crypto * crypto, sockaddr_in6 remote); /** outbound session */ PeerSession(llarp_crypto * crypto, llarp_rc rc); - - PeerSession & operator=(const PeerSession & other); void SendTo(Link * link, const char * buff, std::size_t sz); void RecvFrom(const char * buff, ssize_t sz); - - }; - typedef std::unique_ptr PeerSession_ptr; - typedef std::function PeerSessionVisitor; + typedef std::shared_ptr Ptr; + }; struct Link { - typedef std::map Sessions; + typedef std::map Sessions; Sessions sessions; llarp_seckey_t transportSecKey; @@ -67,13 +63,10 @@ namespace llarp llarp_crypto * _crypto; Link(llarp_crypto * crypto); - ~Link(); llarp_udp_listener _listener; llarp_udp_listener * Listener() { return &_listener; } - - bool VisitPeerByIdent(PeerSessionVisitor v); }; } diff --git a/llarp/mem.hpp b/llarp/mem.hpp index b486eb457..f414e25be 100644 --- a/llarp/mem.hpp +++ b/llarp/mem.hpp @@ -9,13 +9,6 @@ namespace llarp { return std::exp2(1+std::floor(std::log2(sizeof(T)))); } - - template - static T * alloc(llarp_alloc * mem=nullptr) - { - if(!mem) mem = &llarp_g_mem; - return static_cast(mem->alloc(sizeof(T), alignment())); - } } #endif diff --git a/llarp/mem_jemalloc.cpp b/llarp/mem_jemalloc.cpp index 8d68d59d7..f8f9295c3 100644 --- a/llarp/mem_jemalloc.cpp +++ b/llarp/mem_jemalloc.cpp @@ -5,7 +5,7 @@ namespace llarp { static void * jem_malloc(size_t sz, size_t align) { - return mallocx(sz, MALLOCX_ZERO | MALLOCX_ALIGN(align)); + return mallocx(sz, MALLOCX_ALIGN(align)); } static void jem_free(void * ptr) diff --git a/llarp/router.cpp b/llarp/router.cpp index 9dc41500a..d36ef0e2c 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -2,55 +2,75 @@ #include #include "link.hpp" #include "mem.hpp" -#include #include "str.hpp" namespace llarp { void router_iter_config(llarp_config_iterator * iter, const char * section, const char * key, const char * val); - - - struct Router + struct router_links { - std::list Links; - llarp_crypto * crypto; - void Close() - { - if(Links.size()) - { - for(auto & itr : Links) - { - llarp_ev_close_udp_listener(itr->Listener()); - } - Links.clear(); - } - } - - bool Configured() - { - if(Links.size()) return true; - return false; - } + struct llarp_link * link = nullptr; + struct router_links * next = nullptr; }; } +struct llarp_router +{ + struct llarp_threadpool * tp; + llarp::router_links links; + llarp_crypto crypto; -extern "C" { - struct llarp_router + static void * operator new(size_t sz) { - llarp::Router impl; - llarp_crypto crypto; - }; + return llarp_g_mem.alloc(sz, llarp::alignment()); + } + + static void operator delete(void * ptr) + { + llarp_g_mem.free(ptr); + } + + void AddLink(struct llarp_link * link) + { + llarp::router_links * head = &links; + while(head->next && head->link) + head = head->next; + + if(head->link) + head->next = new llarp::router_links{link, nullptr}; + else + head->link = link; + } - void llarp_init_router(struct llarp_router ** router) + void ForEachLink(std::function visitor) { - *router = llarp::alloc(&llarp_g_mem); - if(*router) + llarp::router_links * cur = &links; + do { - llarp_crypto_libsodium_init(&(*router)->crypto); + if(cur->link) + visitor(cur->link); + cur = cur->next; } + while(cur); + } + + void Close() + { + ForEachLink(llarp_link_stop); + } +}; + + +extern "C" { + + struct llarp_router * llarp_init_router(struct llarp_threadpool * tp) + { + llarp_router * router = new llarp_router; + router->tp = tp; + llarp_crypto_libsodium_init(&router->crypto); + return router; } int llarp_configure_router(struct llarp_router * router, struct llarp_config * conf) @@ -59,14 +79,14 @@ extern "C" { iter.user = router; iter.visit = llarp::router_iter_config; llarp_config_iter(conf, &iter); - return router->impl.Configured() ? 0 : -1; + return 0; } void llarp_run_router(struct llarp_router * router, struct llarp_ev_loop * loop) { - if(router->impl.Links.size()) - for(auto & iter : router->impl.Links) - llarp_ev_add_udp_listener(loop, iter->Listener()); + router->ForEachLink([loop](llarp_link * link) { + llarp_ev_add_udp_listener(loop, llarp_link_udp_listener(link)); + }); } void llarp_free_router(struct llarp_router ** router) @@ -74,8 +94,9 @@ extern "C" { if(*router) { llarp_router * r = *router; - r->impl.Close(); - llarp_g_mem.free(r); + r->Close(); + r->ForEachLink([](llarp_link * link) { llarp_g_mem.free(link); }); + delete r; } *router = nullptr; } @@ -91,7 +112,14 @@ namespace llarp { if(StrEq(val, "ip")) { - self->impl.Links.push_back(new Link(&self->crypto)); + struct llarp_link * link = llarp_link_alloc(); + if(llarp_link_configure(link, key, AF_INET6)) + self->AddLink(link); + else + { + llarp_link_free(&link); + printf("failed to configure %s link for %s\n", val, key); + } } else if (StrEq(val, "eth")) { diff --git a/llarp/time.cpp b/llarp/time.cpp index e484ba061..279f6f445 100644 --- a/llarp/time.cpp +++ b/llarp/time.cpp @@ -5,21 +5,21 @@ namespace llarp { typedef std::chrono::steady_clock clock_t; - template - static uint64_t time_since_epoch() + template + static IntType time_since_epoch() { return std::chrono::duration_cast(llarp::clock_t::now().time_since_epoch()).count(); } } extern "C" { - uint64_t llarp_time_now_ms() + llarp_time_t llarp_time_now_ms() { - return llarp::time_since_epoch(); + return llarp::time_since_epoch(); } - uint64_t llarp_time_now_sec() + llarp_seconds_t llarp_time_now_sec() { - return llarp::time_since_epoch(); + return llarp::time_since_epoch(); } }