2018-09-08 19:55:19 +00:00
|
|
|
#ifndef SOCKET_SERVER
|
|
|
|
#define SOCKET_SERVER
|
|
|
|
|
2018-09-08 21:26:34 +00:00
|
|
|
#include "../common/socket_helper.h"
|
|
|
|
|
2018-09-08 19:55:19 +00:00
|
|
|
#define BACKLOG_SIZE 8;
|
2018-09-09 21:34:26 +00:00
|
|
|
#define HTTP_VERSION "HTTP/1.1"
|
2018-09-09 23:46:31 +00:00
|
|
|
#define FILE_BUFFER_SIZE 1024
|
2018-09-08 19:55:19 +00:00
|
|
|
|
|
|
|
enum server_status {STATUS_LISTENING, STATUS_CLOSED, STATUS_ERROR};
|
|
|
|
struct server_info {
|
|
|
|
int sock_fd;
|
|
|
|
enum server_status status;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct server_info setup(int port);
|
2018-09-09 04:18:56 +00:00
|
|
|
enum socket_result serve_one_request(int sock_fd);
|
2018-09-08 19:55:19 +00:00
|
|
|
|
|
|
|
#endif
|