diff options
| author | iceyrazor <iceyrazor@mailfence.com> | 2026-09-25 21:12:03 -0500 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2026-09-25 21:12:03 -0500 |
| commit | 7e287a8ca7164e871965339196511fdcf0248921 (patch) | |
| tree | d69ba74fd8ec0981c681d89aadbcda8aeb75e5d5 /Server.h | |
init
Diffstat (limited to 'Server.h')
| -rwxr-xr-x | Server.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Server.h b/Server.h new file mode 100755 index 0000000..2192e2b --- /dev/null +++ b/Server.h @@ -0,0 +1,43 @@ +#ifndef Server_h +#define Server_h + +#include <sys/socket.h> +#include <netinet/in.h> +#include <stdbool.h> +#include <pthread.h> + +struct AcceptedSocket{ + int socketFD; + struct sockaddr_in address; + int error; + bool succ; + pthread_t thread_id; + bool shutdown; + + struct AcceptedSocket *next; +}; + +struct Server{ + int domain; + int service; + int protocol; + u_long interface; + int port; + int backlog; + bool running; + + struct sockaddr_in address; + + int socket; + char *html_folder; + + struct AcceptedSocket *accepted_socket; + + pthread_t (*launch)(struct Server *server); + 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, pthread_t (*launch)(struct Server *server)); + +#endif /* Server_h */ |
