Webserv
Loading...
Searching...
No Matches
webserv.hpp
Go to the documentation of this file.
1#pragma once
2#define DEBUG 1
3
4#include <arpa/inet.h>
5#include <dirent.h>
6#include <fcntl.h>
7#include <netinet/in.h>
8#include <sys/socket.h>
9#include <sys/stat.h>
10#include <sys/time.h>
11#include <sys/types.h>
12#include <sys/wait.h>
13#include <stdio.h>
14#include <unistd.h>
15
16#include <algorithm>
17#include <cctype>
18#include <cerrno>
19#include <climits>
20#include <cstdio>
21#include <cstdlib>
22#include <cstring>
23#include <fstream>
24#include <iostream>
25#include <iterator>
26#include <sstream>
27#include <string>
28#include <map>
29#include <vector>
30
31using std::cout;
32using std::strerror;
33using std::string;
34
35typedef struct ip_port_s {
36 int fd;
37 string ip;
38 int port;
40
41class JSONNode;
42class Env;
43class Server;
44class Route;
45class Master;
46class Client;
47
48typedef std::map<string, JSONNode *> JSONObject;
49typedef std::vector<JSONNode *> JSONList;
50typedef std::vector<string> vec_string;
51
52// tools
53void *ft_memset(void *b, int c, size_t len);
54bool isAPort(string str);
55vec_string split(string str, string delim);
56ip_port_t get_ip_port_t(string listen);
57ip_port_t get_ip_port_t(string ip, int port);
58string getMime(string path);
59string read_file(string path);
60
61// debug
62void debug_block(string name, string content);
63
64#include "Client.hpp"
65#include "Master.hpp"
66
67#include "Nodes.hpp"
68#include "Token.hpp"
69#include "Parser.hpp"
70#include "Route.hpp"
71#include "Server.hpp"
72#include "Env.hpp"
Definition: Client.hpp:4
Definition: Env.hpp:4
Definition: Master.hpp:4
Definition: Route.hpp:4
Definition: Server.hpp:4
int fd
Definition: webserv.hpp:36
int port
Definition: webserv.hpp:38
string ip
Definition: webserv.hpp:37
string read_file(string path)
Definition: tools.cpp:58
string getMime(string path)
Definition: tools.cpp:80
bool isAPort(string str)
Definition: tools.cpp:12
void * ft_memset(void *b, int c, size_t len)
Definition: tools.cpp:3
vec_string split(string str, string delim)
Definition: tools.cpp:20
ip_port_t get_ip_port_t(string listen)
Definition: tools.cpp:35
std::vector< JSONNode * > JSONList
Definition: webserv.hpp:49
std::vector< string > vec_string
Definition: webserv.hpp:50
struct ip_port_s ip_port_t
std::map< string, JSONNode * > JSONObject
Definition: webserv.hpp:48
void debug_block(string name, string content)
Definition: debug.cpp:3