wip vector version
This commit is contained in:
@@ -4,19 +4,9 @@
|
||||
|
||||
# include <string>
|
||||
# include <map>
|
||||
# include <vector>
|
||||
# include <exception>
|
||||
# include <stdexcept>
|
||||
# include <unistd.h> // close
|
||||
# include <iostream> // cout, cin
|
||||
|
||||
# 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
|
||||
|
||||
# include <unistd.h> // close
|
||||
# include <stdlib.h> // exit
|
||||
# include <iostream> // cout, cin
|
||||
@@ -30,6 +20,9 @@
|
||||
# include <fcntl.h> // fcntl
|
||||
# include <sys/ioctl.h> // ioctl
|
||||
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
|
||||
class Webserv
|
||||
{
|
||||
public:
|
||||
@@ -40,13 +33,17 @@ class Webserv
|
||||
|
||||
void bind(in_port_t port);
|
||||
void listen(unsigned int max_connections);
|
||||
void start();
|
||||
void start(int timeout);
|
||||
|
||||
private:
|
||||
int _socket_fd;
|
||||
std::map<std::string, std::string> _request;
|
||||
std::map<std::string, std::string> _response;
|
||||
|
||||
std::vector<struct pollfd> _fds;
|
||||
int _nfds;
|
||||
void _add_fd(int sd, short event);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user