guard, rename endpoint to context, main_router_endpoint_iterator() implementation

This commit is contained in:
Ryan Tharp 2018-10-03 04:00:47 -07:00
parent 604c44e191
commit cc42e8e623

View File

@ -318,6 +318,11 @@ extern "C"
int int
llarp_main_run(struct llarp_main *ptr) llarp_main_run(struct llarp_main *ptr)
{ {
if(!ptr)
{
llarp::LogError("No ptr passed in");
return 0;
}
return ptr->ctx->Run(); return ptr->ctx->Run();
} }
@ -470,15 +475,24 @@ extern "C"
llarp::handlers::TunEndpoint * llarp::handlers::TunEndpoint *
main_router_getFirstTunEndpoint(struct llarp_main *ptr) main_router_getFirstTunEndpoint(struct llarp_main *ptr)
{ {
auto *endpoint = &ptr->ctx->router->hiddenServiceContext; auto *context = &ptr->ctx->router->hiddenServiceContext;
return endpoint->getFirstTun(); return context->getFirstTun();
}
//#include <llarp/service/context.hpp>
bool
main_router_endpoint_iterator(
struct llarp_main *ptr, struct llarp::service::Context::endpoint_iter &i)
{
auto *context = &ptr->ctx->router->hiddenServiceContext;
return context->iterate(i);
} }
llarp_tun_io * llarp_tun_io *
main_router_getRange(struct llarp_main *ptr) main_router_getRange(struct llarp_main *ptr)
{ {
auto *endpoint = &ptr->ctx->router->hiddenServiceContext; auto *context = &ptr->ctx->router->hiddenServiceContext;
return endpoint->getRange(); return context->getRange();
} }
const char * const char *