summaryrefslogtreecommitdiff
path: root/bwchat.h
diff options
context:
space:
mode:
authordefanor <defanor@thunix.net>2024-04-22 16:56:50 +0300
committerdefanor <defanor@thunix.net>2024-04-22 16:56:50 +0300
commit140f86f243005bf0fcb8ea88f183507400d138a0 (patch)
treed1a7cc04cf1921e5de387b95eb90fc5178772558 /bwchat.h
Add the initial versionHEADmaster
Error handling can be improved, probably audio retrieval in the JS part can be better as well, but it generally works, and this should suffice as the initial version.
Diffstat (limited to 'bwchat.h')
-rw-r--r--bwchat.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/bwchat.h b/bwchat.h
new file mode 100644
index 0000000..c0a3d2f
--- /dev/null
+++ b/bwchat.h
@@ -0,0 +1,27 @@
+#include <stddef.h>
+#include <time.h>
+
+#define BWC_MESSAGE_LENGTH (32 * 1024)
+#define BWC_NICK_LENGTH 32
+
+enum bwchat_command {
+ BWC_CMD_ADD_MESSAGE,
+ BWC_CMD_ALL_MESSAGES,
+ BWC_CMD_NEW_MESSAGES,
+ BWC_CMD_AUDIO_STREAM
+};
+
+enum bwchat_message_type {
+ BWC_MESSAGE_NONE,
+ BWC_MESSAGE_TEXT,
+ BWC_MESSAGE_UPLOAD,
+ BWC_MESSAGE_AUDIO
+};
+
+struct bwchat_message {
+ time_t timestamp;
+ char nick[BWC_NICK_LENGTH];
+ enum bwchat_message_type type;
+ char data[BWC_MESSAGE_LENGTH];
+ size_t data_len;
+};