basic structure and client process chain done

This commit is contained in:
Afonso Franco 2024-05-10 20:34:01 +01:00
parent 77657c7078
commit 83bd6fb796
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
21 changed files with 313 additions and 7 deletions

13
libs/protocol/protocol.c Normal file
View file

@ -0,0 +1,13 @@
#include "protocol.h"
int new_message(message *m, unsigned int sender, unsigned int receiver, char *content) {
if (strlen(content) > MAX_CONTENT_SIZE) {
return 1;
}
m->header.version = VERSION;
m->header.sender = sender;
m->header.receiver = receiver;
time(&m->header.timestamp);
strncpy(m->content, content, MAX_CONTENT_SIZE);
return 0;
}