-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServerContext.hpp
68 lines (56 loc) · 1.91 KB
/
ServerContext.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ServerContext.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asepulve <asepulve@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/09 12:31:02 by asepulve #+# #+# */
/* Updated: 2024/05/23 01:13:07 by asepulve ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
/* C headers*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
/* C++ headers*/
#include <string>
#include <vector>
/* Classes */
#include "Parser.hpp"
#include <ServerError.hpp>
/* Utils */
#include <__webserv_utils.hpp>
/*
Server contexts:
All information about the server context must be hold in server class;
Since we are going to have multiple serve context definition;
*/
typedef struct s_location
{
std::string name;
std::string root;
std::string redirect;
std::vector<std::string> http_methods;
std::vector<std::string> index;
int dir_listing;
} t_location;
class ServerContext
{
private:
public:
std::string name;
std::string ip; // _ip is the string
int domain; // Domain is the ip in bits
int port;
int max_events;
int socket;
long long max_cb_size;
std::map<std::string, std::string> cgi_path;
std::map<int, std::string> error_pages;
std::vector<t_location> routes;
t_event_data *epoll_event_info;
ServerContext(t_server serverNode);
virtual ~ServerContext();
};