aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/command.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-17 23:03:59 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-18 00:38:50 +0200
commite05f02acd583797ceb449fc501d371d45a4293c1 (patch)
tree491322cf633b67918f0361c1ce986f6b690844bc /src/command.h
parentdocker: sanitize package dependencies (diff)
downloadcimple-e05f02acd583797ceb449fc501d371d45a4293c1.tar.gz
cimple-e05f02acd583797ceb449fc501d371d45a4293c1.zip
switch to JSON-RPC as message format
Instead of the weird `struct msg` I had, I switched to the JSON-RPC format. It's basically the same, but has a well-defined semantics in case of errors.
Diffstat (limited to '')
-rw-r--r--src/command.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/command.h b/src/command.h
index 8daa912..0edba98 100644
--- a/src/command.h
+++ b/src/command.h
@@ -9,11 +9,12 @@
#define __COMMAND_H__
#include "event_loop.h"
-#include "msg.h"
+#include "json_rpc.h"
#include <stddef.h>
-typedef int (*cmd_handler)(const struct msg *request, struct msg **response, void *ctx);
+typedef int (*cmd_handler)(const struct jsonrpc_request *request,
+ struct jsonrpc_response **response, void *ctx);
struct cmd_desc {
char *name;
@@ -26,8 +27,8 @@ int cmd_dispatcher_create(struct cmd_dispatcher **, struct cmd_desc *, size_t nu
void *ctx);
void cmd_dispatcher_destroy(struct cmd_dispatcher *);
-int cmd_dispatcher_handle(const struct cmd_dispatcher *, const struct msg *command,
- struct msg **response);
+int cmd_dispatcher_handle(const struct cmd_dispatcher *, const struct jsonrpc_request *command,
+ struct jsonrpc_response **response);
struct cmd_conn_ctx {
int fd;