lokinet/include/llarp/rpc.hpp

58 lines
917 B
C++
Raw Normal View History

2018-10-19 11:41:36 +00:00
#ifndef LLARP_RPC_HPP
#define LLARP_RPC_HPP
2018-11-19 22:45:37 +00:00
#include <llarp/time.hpp>
2018-10-19 11:41:36 +00:00
#include <llarp/ev.h>
#include <string>
2018-11-01 12:47:14 +00:00
#include <functional>
2018-12-12 00:38:58 +00:00
#include <crypto.hpp>
2018-10-19 11:41:36 +00:00
namespace llarp
{
struct Router;
2018-10-19 11:41:36 +00:00
namespace rpc
{
struct ServerImpl;
2018-11-01 12:47:14 +00:00
/// jsonrpc server
2018-10-19 11:41:36 +00:00
struct Server
{
Server(llarp::Router* r);
2018-10-19 11:41:36 +00:00
~Server();
bool
Start(const std::string& bindaddr);
private:
ServerImpl* m_Impl;
};
2018-11-01 12:47:14 +00:00
struct CallerImpl;
/// jsonrpc caller
struct Caller
{
Caller(llarp::Router* r);
2018-11-01 12:47:14 +00:00
~Caller();
/// start with jsonrpc endpoint address
bool
Start(const std::string& remote);
/// test if a router is valid
2018-11-21 17:46:33 +00:00
bool
VerifyRouter(const llarp::PubKey& pk);
/// do per second tick
2018-11-01 12:47:14 +00:00
void
2018-11-21 17:46:33 +00:00
Tick(llarp_time_t now);
2018-11-01 12:47:14 +00:00
private:
CallerImpl* m_Impl;
};
2018-10-19 11:41:36 +00:00
} // namespace rpc
} // namespace llarp
#endif