aboutsummaryrefslogtreecommitdiffstats
path: root/server/tcp.h
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov2070@gmail.com>2024-07-04 20:49:53 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-02-02 19:09:51 +0300
commit3eeee14d5d5c93ae3d156aabae5a96d1c09f185a (patch)
treef23794a428cf663498cff01a148a3f398d42f120 /server/tcp.h
parent0cd383b2c444936dc2290c850c02a0cae11187cd (diff)
Renamed types, migrated to make, changed directory hierarchy
Diffstat (limited to 'server/tcp.h')
-rw-r--r--server/tcp.h35
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