#ifndef Server_h #define Server_h #include #include #include #include #include struct AcceptedSocket{ int socketFD; struct sockaddr_in address; int error; bool succ; pthread_t thread_id; atomic_bool shutdown; struct AcceptedSocket *next; }; struct Server{ int domain; int service; int protocol; u_long interface; int port; int backlog; atomic_bool running; pthread_t server_thread_id; pthread_t cleanup_thread_id; struct sockaddr_in address; int socket; pthread_mutex_t list_lock; struct AcceptedSocket *accepted_socket; void (*on_message)(struct Server *server, char message[], ssize_t amountRecv, int socketFD); void (*on_disconnect)(struct Server *server, int socketFD); }; struct Server server_constructor(int domain, int service, int protocol, u_long interface, int port, int backlog); #endif /* Server_h */