1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/include/llarp/rpc.hpp

56 lines
965 B
C++
Raw Normal View History

2018-10-19 13:41:36 +02:00
#ifndef LLARP_RPC_HPP
#define LLARP_RPC_HPP
#include <llarp/time.h>
#include <llarp/ev.h>
#include <string>
2018-11-01 13:47:14 +01:00
#include <functional>
#include <llarp/crypto.hpp>
2018-10-19 13:41:36 +02:00
// forward declare
struct llarp_router;
namespace llarp
{
namespace rpc
{
struct ServerImpl;
2018-11-01 13:47:14 +01:00
/// jsonrpc server
2018-10-19 13:41:36 +02:00
struct Server
{
Server(llarp_router* r);
~Server();
bool
Start(const std::string& bindaddr);
private:
ServerImpl* m_Impl;
};
2018-11-01 13:47:14 +01:00
struct CallerImpl;
/// jsonrpc caller
struct Caller
{
Caller(llarp_router* r);
~Caller();
/// start with jsonrpc endpoint address
bool
Start(const std::string& remote);
/// async test if a router is valid via jsonrpc
void
AsyncVerifyRouter(llarp::PubKey pkey,
std::function< void(llarp::PubKey, bool) > handler);
private:
CallerImpl* m_Impl;
};
2018-10-19 13:41:36 +02:00
} // namespace rpc
} // namespace llarp
#endif