aboutsummaryrefslogtreecommitdiffstats
path: root/include/packet.c
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-02-08 22:13:52 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-02-08 22:13:52 +0300
commitcab382db088d9f240253466a1c5a26c62f3967c8 (patch)
treec5502f1b49211dccd3e29e163e708708495a6407 /include/packet.c
parent3eeee14d5d5c93ae3d156aabae5a96d1c09f185a (diff)
Implemented multiplexing in main thread (TCP loop). Removed CMake files.HEADmaster
TODO: Implement multiplexing in worker threads (UDP loops), implement channel_pool interface.
Diffstat (limited to 'include/packet.c')
-rw-r--r--include/packet.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/packet.c b/include/packet.c
index a523285..45ebcd1 100644
--- a/include/packet.c
+++ b/include/packet.c
@@ -1,14 +1,17 @@
#include "packet.h"
-i64 const commd_size_lookup[64] = {[CMD_CREATE] = sizeof(struct commd_create),
- [CMD_DELETE] = sizeof(struct commd_delete),
- [CMD_JOIN] = sizeof(struct commd_join),
- [CMD_LEAVE] = sizeof(struct commd_leave),
- [CMD_REGISTER] = sizeof(struct commd_register),
- [CMD_UNREGISTER] = sizeof(struct commd_unregister),
- [CMD_GET_PORT] = sizeof(struct commd_get_port),
- [CMD_GET_CHANNELS] = 0, // You can not get a sizeof(void)
- 0};
+i64 const commd_size_lookup[64] = {
+ [CMD_CREATE] = sizeof(struct commd_create),
+ [CMD_DELETE] = sizeof(struct commd_delete),
+ [CMD_JOIN] = sizeof(struct commd_join),
+ [CMD_LEAVE] = sizeof(struct commd_leave),
+ [CMD_REGISTER] = sizeof(struct commd_register),
+ [CMD_UNREGISTER] = sizeof(struct commd_unregister),
+ [CMD_GET_PORT] = sizeof(struct commd_get_port),
+ [CMD_GET_CHANNELS] = 0, // You can not get a sizeof(void)
+ [CMD_LAST] = -1,
+ 0
+};
u32 system_packet_checksum(struct kv_system_packet *packet)
{
@@ -61,6 +64,9 @@ const char *kv_strerror(enum commd_error e)
return "Not implemented";
case ERR_DO_IT_YOURSELF:
return "You should not have recieved this error. This is either server or network fault";
+ case ERR_TYPE:
+ return "No such command";
}
return "Unknown error";
}
+/* vim: set ts=8 noet: */