aboutsummaryrefslogtreecommitdiffstats
path: root/server/channel.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/channel.h
parent0cd383b2c444936dc2290c850c02a0cae11187cd (diff)
Renamed types, migrated to make, changed directory hierarchy
Diffstat (limited to 'server/channel.h')
-rw-r--r--server/channel.h37
1 files changed, 13 insertions, 24 deletions
diff --git a/server/channel.h b/server/channel.h
index 3916212..8068a4c 100644
--- a/server/channel.h
+++ b/server/channel.h
@@ -3,36 +3,25 @@
#include <kv.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/types.h>
#include <netinet/ip.h>
-
#include <stdbool.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <rstypes.h>
-struct user {
- long id;
- unsigned int ip;
- unsigned short port;
- unsigned long last_keepalive;
-};
-int __user_cmp(const void* a, const void* b);
+#include <pthread.h>
-struct channel_handle {
- int sockfd;
- struct user* users;
+/// Required for the calling thread to set socket file descriptor
+struct thread_loop_arg {
+ int *sock_dest;
+ pthread_mutex_t *sock_mx;
+ pthread_cond_t *sock_ready_cond;
+ u64 owner;
+ const unsigned char *pubkey;
};
// main function that manages every channel
-void thread_loop(void);
-
-struct channel_handle *channel_init(void);
-void channel_uninit(struct channel_handle *handle);
-
-void send_packets_back(struct kv_packet** packets, struct channel_handle *handle);
-void handle_system_packet(struct kv_packet* packet, struct sockaddr_in *source, struct channel_handle* handle);
-
-void clear_packet_array(struct kv_packet **array);
-
+void *thread_loop(void *);
#endif // KV_SERVER_CHANNEL_H