44 lines
995 B
C++
44 lines
995 B
C++
|
|
#ifndef WEBSERV_HPP
|
|
# define WEBSERV_HPP
|
|
|
|
# include <string>
|
|
# include <map>
|
|
# include <cerrno> // errno
|
|
# include <cstdio> // perror
|
|
# include <exception>
|
|
# include <stdexcept>
|
|
# include <unistd.h> // close
|
|
# 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 <poll.h> // poll
|
|
# include <fcntl.h> // fcntl
|
|
|
|
class Webserv
|
|
{
|
|
public:
|
|
Webserv();
|
|
// Webserv(Webserv const &src);
|
|
~Webserv();
|
|
// Webserv &operator=(Webserv const &rhs);
|
|
|
|
void bind(in_port_t port);
|
|
void listen(unsigned int max_connections);
|
|
void start();
|
|
|
|
private:
|
|
int _socket_fd;
|
|
struct pollfd _poll_s[42]; // 42 PLACEHOLDER
|
|
std::map<std::string, std::string> _request;
|
|
std::map<std::string, std::string> _response;
|
|
|
|
};
|
|
|
|
#endif
|