#ifndef SERVER_H
#define SERVER_H

#include <stdbool.h>

#define WSD_DEFAULT_PORT 4000

/* Server context */

struct server {
	int  listen_fd;
	int  port;
	bool running;
};

/* Inits the server and binds the socket. */
int server_init(struct server *srv, int port);

/* Main event loop. Blocks until stopped. */
void server_run(struct server *srv);

/* Stops the server. */
void server_stop(struct server *srv);

/* Cleans up server resources. */
void server_cleanup(struct server *srv);

#endif /* SERVER_H */
