clean webserv includes
This commit is contained in:
@@ -4,29 +4,37 @@
|
||||
|
||||
# include <map>
|
||||
# include <vector>
|
||||
# include <exception>
|
||||
# include <stdexcept>
|
||||
# include <string>
|
||||
# include <sstream> // stringstream
|
||||
# include <cerrno> // errno
|
||||
# include <cstdio> // perror
|
||||
# include <unistd.h> // close, access
|
||||
# include <iostream> // cout, cin
|
||||
# include <cstring> // memset
|
||||
# include <sys/socket.h> // socket, accept, listen, send, recv, bind, connect, setsockopt, getsockname
|
||||
# include <netinet/in.h> // sockaddr_in
|
||||
// # include <netinet/ip.h> // usefull for what ?
|
||||
# include <arpa/inet.h> // htonl, htons, ntohl, ntohs, inet_addr
|
||||
# include <exception> // exception, what
|
||||
# include <stdexcept> // runtime_error, invalid_argument
|
||||
# include <sys/epoll.h> // epoll
|
||||
# include <fcntl.h> // fcntl
|
||||
# include <sys/wait.h> // waitpid
|
||||
# include <csignal> // signal
|
||||
# include <cstdlib> // itoa
|
||||
char *ft_itoa(int n);
|
||||
# include <fstream> // ifstream
|
||||
# include <sstream> // stringstream
|
||||
# include <cerrno> // errno
|
||||
# include <unistd.h> // close, access
|
||||
# include <iostream> // cout, cin
|
||||
# include <cstring> // memset
|
||||
# include <sys/socket.h> // socket, accept, listen, send, recv, bind, connect, setsockopt, getsockname
|
||||
# include <arpa/inet.h> // htonl, htons, ntohl, ntohs, inet_addr
|
||||
# include <netinet/in.h> // sockaddr_in
|
||||
// # include <netinet/ip.h> // usefull for what ? -> 'man (7) ip' says it's a superset of 'netinet/in.h'
|
||||
# include <algorithm> // find
|
||||
# include <string> // string
|
||||
# include <cstdio> // perror
|
||||
# include <cstdlib> // atoi (athough it's already cover by <string>)
|
||||
char *ft_itoa(int n);
|
||||
|
||||
# include "Client.hpp"
|
||||
# include "Server.hpp"
|
||||
# include "ServerConfig.hpp"
|
||||
|
||||
// TODO: A virer
|
||||
# include "ConfigParser.hpp"
|
||||
# include "LocationConfig.hpp"
|
||||
# include "MethodType.hpp"
|
||||
# include "utils.hpp"
|
||||
// TODO: A virer
|
||||
|
||||
extern bool g_run;
|
||||
extern int g_last_signal;
|
||||
@@ -45,24 +53,32 @@ struct s // WIP test
|
||||
};
|
||||
*/
|
||||
|
||||
// these might only be TMP
|
||||
# define FAILURE -1
|
||||
# define SUCCESS 1
|
||||
|
||||
class Webserv
|
||||
{
|
||||
public:
|
||||
// base.cpp
|
||||
Webserv();
|
||||
// Webserv(Webserv const &src);
|
||||
|
||||
// what should it take as arg, *, &, ?
|
||||
// Webserv(std::vector<ServerConfig>& servers);
|
||||
|
||||
~Webserv();
|
||||
// Webserv &operator=(Webserv const &rhs);
|
||||
|
||||
// init.cpp
|
||||
void init_virtual_servers(); // ADD config param
|
||||
void init_virtual_servers(std::vector<ServerConfig>* servers);
|
||||
// run_loop.cpp
|
||||
void run();
|
||||
|
||||
private:
|
||||
int _epfd;
|
||||
int _socket_fd; // temp, to replace with std::vector<Server>
|
||||
// std::vector<Server> _servers;
|
||||
std::vector<int> _listen_sockets;
|
||||
std::vector<ServerConfig> _servers;
|
||||
std::vector<Client> _clients;
|
||||
|
||||
// accept.cpp
|
||||
@@ -85,7 +101,7 @@ class Webserv
|
||||
void _close_client(int fd);
|
||||
void _close_all_clients();
|
||||
// init.cpp
|
||||
void _bind(int socket_fd, in_port_t port);
|
||||
void _bind(int socket_fd, in_port_t port, std::string host);
|
||||
void _listen(int socket_fd, unsigned int max_connections);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user