basic structure and client process chain done
This commit is contained in:
parent
77657c7078
commit
83bd6fb796
21 changed files with 313 additions and 7 deletions
13
libs/protocol/protocol.c
Normal file
13
libs/protocol/protocol.c
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue