mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
972 B
C++
67 lines
972 B
C++
6 years ago
|
#ifndef LLARP_RPC_HPP
|
||
|
#define LLARP_RPC_HPP
|
||
6 years ago
|
|
||
6 years ago
|
#include <util/time.hpp>
|
||
6 years ago
|
|
||
6 years ago
|
#include <string>
|
||
6 years ago
|
#include <functional>
|
||
6 years ago
|
|
||
|
namespace llarp
|
||
|
{
|
||
6 years ago
|
struct PubKey;
|
||
6 years ago
|
struct Router;
|
||
|
|
||
6 years ago
|
namespace rpc
|
||
|
{
|
||
|
struct ServerImpl;
|
||
|
|
||
6 years ago
|
/// jsonrpc server
|
||
6 years ago
|
struct Server
|
||
|
{
|
||
6 years ago
|
Server(Router* r);
|
||
6 years ago
|
~Server();
|
||
|
|
||
|
bool
|
||
|
Start(const std::string& bindaddr);
|
||
|
|
||
6 years ago
|
/// stop and close
|
||
|
void
|
||
|
Stop();
|
||
|
|
||
6 years ago
|
private:
|
||
|
ServerImpl* m_Impl;
|
||
|
};
|
||
|
|
||
6 years ago
|
struct CallerImpl;
|
||
|
|
||
|
/// jsonrpc caller
|
||
|
struct Caller
|
||
|
{
|
||
6 years ago
|
Caller(Router* r);
|
||
6 years ago
|
~Caller();
|
||
|
|
||
|
/// start with jsonrpc endpoint address
|
||
|
bool
|
||
|
Start(const std::string& remote);
|
||
|
|
||
6 years ago
|
/// stop and close
|
||
|
void
|
||
|
Stop();
|
||
|
|
||
6 years ago
|
/// test if a router is valid
|
||
6 years ago
|
bool
|
||
6 years ago
|
VerifyRouter(const PubKey& pk);
|
||
6 years ago
|
|
||
|
/// do per second tick
|
||
6 years ago
|
void
|
||
6 years ago
|
Tick(llarp_time_t now);
|
||
6 years ago
|
|
||
|
private:
|
||
|
CallerImpl* m_Impl;
|
||
|
};
|
||
|
|
||
6 years ago
|
} // namespace rpc
|
||
|
} // namespace llarp
|
||
|
|
||
|
#endif
|