-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCore.hpp
52 lines (40 loc) · 1.03 KB
/
Core.hpp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef CORE_HPP
# define CORE_HPP
#include "Library.hpp"
typedef struct s_Client
{
struct sockaddr_in client_addr;
socklen_t size_client_addr;
int listen_sock;
int sock;
int ready_to_send;
int send_end;
} t_Client;
class Core {
private:
Http *http;
ServerPairs *null_ptr1;
fd_set active_read, read_set;
fd_set active_write, write_set;
int maxFd;
int new_sock;
struct sockaddr_in client_addr;
socklen_t size_client_addr;
std::vector<Server *> vectorServers;
int count_servers;
int close_connection;
std::list<t_Client> list_clients;
std::list<t_Client>::iterator it_clients;
public:
Core(std::vector<Server *> vectorServers_);
~Core();
void run();
int createNewSocket();
int error(const char* err_type);
int writeToClient(int fd);
int readFromClient(int fd);
int getFDListenSocket(int fd);
const std::string& getRootFromConfig(int fd) const;
const ServerPairs& getServerPairs(int fd);
};
#endif