-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.h
33 lines (28 loc) · 890 Bytes
/
server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "config.h"
#include "parser.h"
#include "source.h"
#include "transport.h"
#ifndef SERVER_H_INCLUDED
#define SERVER_H_INCLUDED
#define MAX_CONNECTIONS 8
typedef enum { UNINITIALIZED, INITIALIZED, SHUTDOWN } SeverStatus;
typedef struct {
Config *config;
ParsedInfo *parsed_info;
Source **sources;
SeverStatus status;
SOCKET server_socket;
Client *clients;
fd_set *master_set;
fd_set *working_set;
} Server;
void sync_source(Server *server, char *file_path, char *text);
Server *create_server(Config *config);
void uninitialized_error(Client *client, Request *req);
void invalid_request(Client *client, Request *req);
void invalid_params(Client *client, Request *req);
void send_error(Client *client, Request *req, char *error_msg, int err_code);
void start_server(Server *server);
void destroy_server(Server *server);
void accept_message(Server *server);
#endif