blob: c03a2b8d4f555a38cd71404b3545996fa6ee05c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
*
* (C) 2010-2025 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#pragma once
#include "httpd.h"
class RPCRequest final
{
std::map<Anope::string, Anope::string> replies;
public:
Anope::string name;
Anope::string id;
std::deque<Anope::string> data;
HTTPReply &r;
RPCRequest(HTTPReply &_r) : r(_r) { }
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
};
class RPCServiceInterface;
class RPCEvent
{
public:
virtual ~RPCEvent() = default;
virtual bool Run(RPCServiceInterface *iface, HTTPClient *client, RPCRequest &request) = 0;
};
class RPCServiceInterface
: public Service
{
public:
RPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "RPCServiceInterface", sname) { }
virtual void Register(RPCEvent *event) = 0;
virtual void Unregister(RPCEvent *event) = 0;
virtual void Reply(RPCRequest &request) = 0;
};
|