blob: 0c0a2756e154864ed30ed0fd9b14b5bc28e0e888 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifndef CLIENT_CONNECTIONS_H
#define CLIENT_CONNECTIONS_H
#include <basic/basic.h>
#include <basic/string32.h>
#include <os/os.h>
#include <messages/messages.h>
#define CLIENT_CONNECTION_INVALID_ID U32_MAX
typedef struct {
u32 id;
u32 secure_stream_id;
u32 recv_buff_size_used;
u8 recv_buff[1408];
String32 *username;
u8 username_buff[sizeof(String32) + MESSAGES_MAX_USERNAME_LEN * sizeof(u32)];
} ClientConnection;
typedef struct {
EVP_PKEY *server_rsa_pri;
u32 listener_id;
int epoll_fd;
size_t max_connection_count;
ClientConnection *connections;
u32 free_id_count;
u32 *free_ids;
} ClientConnections;
ClientConnections *client_connections_create(Arena *arena, u16 port);
void client_connections_manage(ClientConnections *connections);
ClientConnection* client_connection_id_to_ptr(ClientConnections *connections, u32 id);
#endif // CLIENT_CONNECTIONS_H
|