Add JSON-RPC capability

Inline nlohmann/json for the JSON parsing itself, and handle requests
with the same SCGI interface as XML-RPC.

Based off the work in https://github.com/jesec/rtorrent
This commit is contained in:
kannibalox
2025-01-04 20:50:55 -05:00
committed by Jari Sundell
parent 78915746ee
commit 9f48226663
30 changed files with 26375 additions and 307 deletions
+24
View File
@@ -0,0 +1,24 @@
#ifndef RTORRENT_RPC_JSONRPC_H
#define RTORRENT_RPC_JSONRPC_H
#include <functional>
#include <cstdint>
namespace rpc {
class JsonRpc {
public:
using slot_write = std::function<bool(const char*, uint32_t)>;
void initialize() {};
void cleanup() {};
bool process(const char* in_buffer, uint32_t length, slot_write callback);
void insert_command(const char* name, const char* parm, const char* doc) {};
};
} // namespace rpc
#endif