This commit is contained in:
LuckyLaszlo
2022-07-07 20:13:14 +02:00
commit 8a7204b7a5
9 changed files with 158 additions and 0 deletions

27
srcs/Webserv.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "Webserv.hpp"
Webserv::Webserv()
{
_socket_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
if (_socket_fd == -1)
{
perror("socket(): ");
throw std::runtime_error("Socket init");
}
}
Webserv::Webserv(Webserv const &src)
{
}
Webserv::~Webserv()
{
}
Webserv & Webserv::operator=(Webserv const &rhs)
{
}

30
srcs/Webserv.hpp Normal file
View File

@@ -0,0 +1,30 @@
#ifndef WEBSERV_HPP
# define WEBSERV_HPP
# include <string>
# include <map>
# include <cerrno> // errno
# include <cstdio> // perror
# include <exception>
# include <stdexcept>
# include <sys/socket.h> // socket, accept, listen, send, recv, bind, connect, setsockopt, getsockname
class Webserv
{
public:
//Webserv(Placeholder);
Webserv();
Webserv(Webserv const &src);
~Webserv();
Webserv &operator=(Webserv const &rhs);
private:
int _socket_fd;
std::map<std::string, std::string> _request;
std::map<std::string, std::string> _response;
};
#endif

1
srcs/main.cpp Normal file
View File

@@ -0,0 +1 @@