diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-12 15:31:26 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-12 15:31:26 +0100 |
| commit | 10ae402862df4337772fe8e35f68ee8ab5bfc224 (patch) | |
| tree | 1ac5fda82a2dd01f7f5ffdc2b337947c569afc15 /include/protocol.h | |
| parent | ec3796faff12ba7bf5f775d757ac25834549903d (diff) | |
networking
Diffstat (limited to 'include/protocol.h')
| -rw-r--r-- | include/protocol.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/protocol.h b/include/protocol.h new file mode 100644 index 0000000..316a21f --- /dev/null +++ b/include/protocol.h @@ -0,0 +1,40 @@ +#ifndef INCLUDE_PROTOCOL +#define INCLUDE_PROTOCOL + +#include <projectbase/project_base.h> + +typedef enum t_network_message_type { + MESSAGE_GET_ID_UPSTREAM, + MESSAGE_GET_ID_DOWNSTREAM, +} network_message_type; + +typedef struct t_protocol_generic_message { + network_client client; + network_message_type type; +} protocol_generic_message; + +typedef struct t_protocol_generic_client_message { + network_message_type type; +} protocol_generic_client_message; + +typedef struct t_protocol_get_id_upstream { + network_message_type type; +} protocol_get_id_upstream; + +typedef struct t_protocol_get_id_downstream { + network_message_type type; + u32 id; +} protocol_get_id_downstream; + +#define MAX_NETWORK_BUFFER_SIZE 50000 +u8 network_buffer[50000]; +network_message create_protocol_get_id_up(); +network_message create_protocol_get_id_down(u32 id); + +array messages_received_on_server; +array messages_received_on_client; + +void server_on_message_received(u8* buffer, u32 length, network_client client); +void client_on_message_received(u8* buffer, u32 length); + +#endif
\ No newline at end of file |
