baked hugo version of webserv
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
|
||||
#ifndef WEBSERV_HPP
|
||||
# define WEBSERV_HPP
|
||||
|
||||
# include <string>
|
||||
# include <map>
|
||||
# include <vector>
|
||||
# include <exception>
|
||||
# include <stdexcept>
|
||||
# include <unistd.h> // close
|
||||
# include <stdlib.h> // exit
|
||||
# include <iostream> // cout, cin
|
||||
# include <cerrno> // errno
|
||||
# include <cstdio> // perror
|
||||
# include <string.h> // memset
|
||||
# include <sys/socket.h> // socket, accept, listen, send, recv, bind, connect, setsockopt, getsockname
|
||||
# include <netinet/in.h> // sockaddr_in
|
||||
# include <arpa/inet.h> // inet_ntoa, inet_addr, htonl, htons, ntohl, ntohs
|
||||
# include <poll.h> // poll
|
||||
# include <fcntl.h> // fcntl
|
||||
# include <sys/ioctl.h> // ioctl
|
||||
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
|
||||
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(int timeout, int bufsize);
|
||||
|
||||
private:
|
||||
int _socket_fd;
|
||||
std::map<std::string, std::string> _request;
|
||||
std::map<std::string, std::string> _response;
|
||||
|
||||
void _add_fd(int sd, short event);
|
||||
void _accept_connection();
|
||||
void _connect_socket(int it, int bufsize);
|
||||
void _close_fd(int it);
|
||||
|
||||
std::vector<struct pollfd> _fds;
|
||||
std::vector<struct pollfd>::iterator _it;
|
||||
std::vector<struct pollfd>::iterator _it_end;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user