aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/command.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-13 11:11:59 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-13 11:37:46 +0200
commit09df279e8ef9cb43fd6c5e77524b74eed46bd464 (patch)
tree99f62e56feb685a8612b8bfaaf3395386ded3b48 /src/command.h
parentbest practices & coding style fixes (diff)
downloadcimple-09df279e8ef9cb43fd6c5e77524b74eed46bd464.tar.gz
cimple-09df279e8ef9cb43fd6c5e77524b74eed46bd464.zip
command: refactoring
Diffstat (limited to '')
-rw-r--r--src/command.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/command.h b/src/command.h
index b4c3b40..dc798d2 100644
--- a/src/command.h
+++ b/src/command.h
@@ -12,24 +12,23 @@
#include <stdlib.h>
-typedef int (*command_processor)(int conn_fd, const struct msg *request, void *ctx,
- struct msg **response);
+typedef int (*cmd_handler)(int conn_fd, const struct msg *request, void *ctx,
+ struct msg **response);
-struct command_def {
+struct cmd_desc {
char *name;
- command_processor processor;
+ cmd_handler handler;
};
-struct command_dispatcher;
+struct cmd_dispatcher;
-int command_dispatcher_create(struct command_dispatcher **, struct command_def *, size_t numof_defs,
- void *ctx);
-void command_dispatcher_destroy(struct command_dispatcher *);
+int cmd_dispatcher_create(struct cmd_dispatcher **, struct cmd_desc *, size_t numof_defs,
+ void *ctx);
+void cmd_dispatcher_destroy(struct cmd_dispatcher *);
-int command_dispatcher_msg_handler(const struct command_dispatcher *, int conn_fd,
- const struct msg *);
+int cmd_dispatcher_handle_msg(const struct cmd_dispatcher *, int conn_fd, const struct msg *);
/* This is supposed to be used as an argument to tcp_server_accept. */
-int command_dispatcher_conn_handler(int conn_fd, void *dispatcher);
+int cmd_dispatcher_handle_conn(int conn_fd, void *dispatcher);
#endif