2021-01-11 13:47:14 +00:00
|
|
|
#pragma once
|
2021-01-11 20:08:16 +00:00
|
|
|
#include "system.h"
|
2021-01-17 07:30:59 +00:00
|
|
|
|
|
|
|
int32_t network_init(void);
|
|
|
|
int32_t network_destroy(void);
|
|
|
|
|
2021-09-08 14:12:38 +00:00
|
|
|
// NOTE(zaklaus): client
|
2021-01-17 07:30:59 +00:00
|
|
|
int32_t network_client_connect(const char *host, uint16_t port);
|
|
|
|
int32_t network_client_disconnect(void);
|
|
|
|
int32_t network_client_tick(void);
|
|
|
|
void network_client_update(void *data);
|
|
|
|
bool network_client_is_connected();
|
2021-05-04 19:22:55 +00:00
|
|
|
|
2021-09-08 14:12:38 +00:00
|
|
|
// NOTE(zaklaus): server
|
|
|
|
int32_t network_server_start(const char *host, uint16_t port);
|
|
|
|
int32_t network_server_stop(void);
|
|
|
|
int32_t network_server_tick(void);
|
|
|
|
void network_server_assign_entity(void *peer_id, uint64_t ent_id);
|
|
|
|
uint64_t network_server_get_entity(void *peer_id);
|
|
|
|
|
|
|
|
// NOTE(zaklaus): messaging
|
2021-09-09 08:29:22 +00:00
|
|
|
int32_t network_msg_send(void *peer_id, void *data, size_t datalen, uint16_t channel_id);
|
|
|
|
int32_t network_msg_send_unreliable(void *peer_id, void *data, size_t datalen, uint16_t channel_id);
|