2024-09-18 09:37:34 +02:00
|
|
|
#ifndef SERVER_H_
|
|
|
|
#define SERVER_H_
|
|
|
|
|
|
|
|
#define MAX_CONNECTION_QUEUE 128 /* for listen() */
|
|
|
|
#define MAX_EVENTS 64 /* Max events can be returned simulataneouly by epoll */
|
|
|
|
|
2024-09-28 00:53:03 +02:00
|
|
|
typedef struct {
|
2024-09-20 19:53:00 +02:00
|
|
|
int fd; /* File descriptor for client socket */
|
|
|
|
uint8_t *shared_key;
|
|
|
|
char username[MAX_NAME]; /* Username of client */
|
|
|
|
} client_t;
|
|
|
|
|
2024-09-28 00:53:03 +02:00
|
|
|
typedef struct {
|
2024-09-20 19:53:00 +02:00
|
|
|
int epoll_fd; /* epoll instance for each thread */
|
|
|
|
pthread_t thread; /* POSIX thread */
|
|
|
|
int num_clients; /* Number of active clients in thread */
|
|
|
|
client_t clients[MAX_CLIENTS_PER_THREAD]; /* Active clients */
|
|
|
|
} thread_t;
|
|
|
|
|
2024-09-18 09:37:34 +02:00
|
|
|
#endif
|