diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-20 19:40:09 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-20 19:40:09 +0200 |
commit | 4fe82b42b6f6fb1a69da2fb2823831e6b3eaa036 (patch) | |
tree | f96543bf338941c20aaa761428a231db6fcd36b8 /common.h | |
parent | ff0aae89238f4d60267def24476e8b9f4cb596cf (diff) |
Added mvp implementations of the server and client for testing
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1,6 +1,19 @@ #include <stdint.h> #include <stdio.h> +#define PORT 9983 +// max buffer size sent over network +// TODO: choose a better size +#define BUF_MAX 256 +// max size for a message sent +#define MESSAGE_MAX 256 +// max length of author field +#define MESSAGE_AUTHOR_LEN 12 +// max length of timestamp field +#define MESSAGE_TIMESTAMP_LEN 9 +// current user's name +#define USERNAME "Jef Koek" + typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; @@ -8,8 +21,8 @@ typedef uint32_t u32; // To serialize the text that could be arbitrary length the lenght is encoded after the author // string and before the text. struct message { - char timestamp[9]; // HH:MM:SS - char author[12]; + char author[MESSAGE_AUTHOR_LEN]; + char timestamp[MESSAGE_TIMESTAMP_LEN]; // HH:MM:SS u16 len; char *text; }; |