diff options
Diffstat (limited to 'server/tcp.h')
-rw-r--r-- | server/tcp.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/tcp.h b/server/tcp.h new file mode 100644 index 0000000..e239e19 --- /dev/null +++ b/server/tcp.h @@ -0,0 +1,35 @@ +#ifndef KV_SERVER_TCP +#define KV_SERVER_TCP + +#include <netinet/in.h> +#include <pthread.h> +#include <stdbool.h> +#include <sys/socket.h> +#include <unistd.h> +#include <packet.h> +#include "channel.h" + +#include <container.h> +#include <rstypes.h> + +#define TCP_PORT 8085 +#define LISTEN_AMOUNT 128 +#define TCP_MAX_WAIT_MS 10 +#define TCP_MAX_RETRIES 0 +#define ADMIN_UID 0 + + +/* val: struct tcp_channel */ +extern struct hash_set channels; +/* val: struct tcp_user */ +extern struct hash_set users; + +void print_state(int); +void exit_tcp(int); + +void tcp_loop(void); +u64 spawn_channel(struct thread_loop_arg *arg); +u64 spawn_channel_pool(void* arg); // TODO +bool sendto_channel(size_t chid, struct kv_system_packet* packet, int wait_ack_ms, int repeat); + +#endif // KV_SERVER_TCP |