2024-09-18 09:37:34 +02:00
|
|
|
#ifndef SERVER_H_
|
|
|
|
#define SERVER_H_
|
|
|
|
|
2024-09-20 19:53:00 +02:00
|
|
|
extern int debug;
|
|
|
|
|
2024-09-18 09:37:34 +02:00
|
|
|
#define CHALLENGE_SIZE 32
|
|
|
|
#define MAX_CONNECTION_QUEUE 128 /* for listen() */
|
|
|
|
#define MAX_EVENTS 64 /* Max events can be returned simulataneouly by epoll */
|
|
|
|
|
2024-09-20 19:53:00 +02:00
|
|
|
typedef struct client_t {
|
|
|
|
int fd; /* File descriptor for client socket */
|
|
|
|
uint8_t *shared_key;
|
|
|
|
char username[MAX_NAME]; /* Username of client */
|
|
|
|
} client_t;
|
|
|
|
|
|
|
|
typedef struct thread_t {
|
|
|
|
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
|