diff options
author | justanothercatgirl <sotov@twistea.su> | 2025-02-08 22:13:52 +0300 |
---|---|---|
committer | justanothercatgirl <sotov@twistea.su> | 2025-02-08 22:13:52 +0300 |
commit | cab382db088d9f240253466a1c5a26c62f3967c8 (patch) | |
tree | c5502f1b49211dccd3e29e163e708708495a6407 /include/packet.h | |
parent | 3eeee14d5d5c93ae3d156aabae5a96d1c09f185a (diff) |
TODO: Implement multiplexing in worker threads (UDP loops), implement
channel_pool interface.
Diffstat (limited to 'include/packet.h')
-rw-r--r-- | include/packet.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/packet.h b/include/packet.h index f1b1e60..01c006e 100644 --- a/include/packet.h +++ b/include/packet.h @@ -15,6 +15,9 @@ #define KV_PACKET_SIZE 512 +// These macros became obsolete due to log.h header in c_headers +// TODO: remove +/* #ifdef DBG # define DEBUGF(fmt, ...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__) # define DEBUG(msg) fprintf(stderr, "DEBUG: %s:%d:%s(): " msg, __FILE__, __LINE__, __func__) @@ -24,6 +27,7 @@ # define DEBUG(fmt) # define WHERE #endif +*/ #ifdef __clang__ # pragma GCC diagnostic ignored "-Wnullability-extension" // SHUT UP I'VE ALREADY PUT IT BEHIND A MACRO # define NONNULL _Nonnull @@ -33,6 +37,7 @@ # define NULLABLE #endif + #include <arpa/inet.h> #include <stddef.h> #include <rstypes.h> @@ -76,14 +81,14 @@ u32 system_packet_checksum(struct kv_system_packet *packet); u8 is_system_packet(struct kv_packet *p); enum permissions { - perm_none = 0, - perm_register_user = 1 << 1, - perm_unregister_user = 1 << 2, - perm_add_channel = 1 << 3, - perm_unadd_channel = 1 << 4, - perm_join_user = 1 << 5, - perm_kick_user = 1 << 6, - perm_admin = 0x7FFFFFFF, + PERM_NONE = 0, + PERM_REGISTER_USER = 1 << 1, + PERM_UNREGISTER_USER = 1 << 2, + PERM_ADD_CHANNEL = 1 << 3, + PERM_UNADD_CHANNEL = 1 << 4, + PERM_JOIN_USER = 1 << 5, + PERM_KICK_USER = 1 << 6, + PERM_ADMIN = 0x7FFFFFFF, }; enum commd_error { @@ -93,6 +98,8 @@ enum commd_error { ERR_SERV, // Error in parameters (e.g. nonexistant UID) ERR_PARAM, + // The command does not exist + ERR_TYPE, // Invalid parameters (e.g. not enough params) ERR_INVAL, // Access violation @@ -125,6 +132,7 @@ enum commd_type { CMD_UNREGISTER, CMD_GET_PORT, CMD_GET_CHANNELS, + CMD_LAST, }; // Somehow, this is pretty similar to linux sockaddr. struct commd { @@ -192,3 +200,4 @@ u64 ntoh64(u64 a); const char* kv_strerror(enum commd_error e); #endif // KV_PACKET_H +/* vim: set ts=8 noet: */ |