2023-01-10 15:58:26 +00:00
|
|
|
#include "rpc_request_parser.hpp"
|
2023-01-24 17:44:02 +00:00
|
|
|
#include "llarp/rpc/rpc_request_definitions.hpp"
|
2023-01-10 15:58:26 +00:00
|
|
|
#include "param_parser.hpp"
|
|
|
|
#include <string_view>
|
|
|
|
#include <llarp/config/config.hpp>
|
|
|
|
#include <oxenmq/oxenmq.h>
|
|
|
|
#include <oxenmq/address.h>
|
|
|
|
#include <oxen/log/omq_logger.hpp>
|
|
|
|
|
|
|
|
namespace llarp::rpc
|
|
|
|
{
|
|
|
|
using nlohmann::json;
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(QuicConnect& quicconnect, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"bindAddr",
|
|
|
|
quicconnect.request.bindAddr,
|
|
|
|
"closeID",
|
|
|
|
quicconnect.request.closeID,
|
|
|
|
"endpoint",
|
|
|
|
quicconnect.request.endpoint,
|
|
|
|
"port",
|
|
|
|
quicconnect.request.port,
|
|
|
|
"remoteHost",
|
|
|
|
quicconnect.request.remoteHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(QuicListener& quiclistener, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"closeID",
|
|
|
|
quiclistener.request.closeID,
|
|
|
|
"endpoint",
|
|
|
|
quiclistener.request.endpoint,
|
|
|
|
"port",
|
|
|
|
quiclistener.request.port,
|
|
|
|
"remoteHost",
|
|
|
|
quiclistener.request.remoteHost,
|
|
|
|
"srvProto",
|
|
|
|
quiclistener.request.srvProto);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(LookupSnode& lookupsnode, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(input, "routerID", lookupsnode.request.routerID);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-01-24 17:44:02 +00:00
|
|
|
parse_request(MapExit& mapexit, rpc_input input)
|
2023-01-10 15:58:26 +00:00
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"address",
|
2023-01-24 17:44:02 +00:00
|
|
|
mapexit.request.address,
|
2023-01-10 15:58:26 +00:00
|
|
|
"IP_range",
|
2023-01-24 17:44:02 +00:00
|
|
|
mapexit.request.ip_range,
|
2023-01-10 15:58:26 +00:00
|
|
|
"token",
|
2023-01-24 17:44:02 +00:00
|
|
|
mapexit.request.token);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(UnmapExit& unmapexit, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"IP_range",
|
|
|
|
unmapexit.request.ip_range);
|
2023-01-10 15:58:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(DNSQuery& dnsquery, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"endpoint",
|
|
|
|
dnsquery.request.endpoint,
|
|
|
|
"qname",
|
|
|
|
dnsquery.request.qname,
|
|
|
|
"qtype",
|
|
|
|
dnsquery.request.qtype);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
parse_request(Config& config, rpc_input input)
|
|
|
|
{
|
|
|
|
get_values(
|
|
|
|
input,
|
|
|
|
"delete",
|
|
|
|
config.request.del,
|
|
|
|
"filename",
|
|
|
|
config.request.filename,
|
|
|
|
"ini",
|
|
|
|
config.request.ini);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llarp::rpc
|