mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
new class Server
This commit is contained in:
41
includes/Server.hpp
Normal file
41
includes/Server.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SERVER_HPP
|
||||
#define SERVER_HPP
|
||||
|
||||
#include "webserv.hpp"
|
||||
|
||||
#define BUFFSIZE 1024
|
||||
|
||||
class Server
|
||||
{
|
||||
private:
|
||||
int _port;
|
||||
int _serverSocket;
|
||||
int _clientSocket;
|
||||
// int _bufferSize;
|
||||
struct sockaddr_in _addres;
|
||||
std::string _ip;
|
||||
|
||||
private:
|
||||
void checkError(int fd, std::string str);
|
||||
void sendFile(std::string str);
|
||||
void sendHeader(void);
|
||||
void printRed(std::string str);
|
||||
void printYellow(std::string str);
|
||||
void printBlue(std::string str);
|
||||
void printPink(std::string str);
|
||||
void printGreen(std::string str);
|
||||
void printTurguoise(std::string str);
|
||||
|
||||
public:
|
||||
Server();
|
||||
Server(std::string path);
|
||||
|
||||
void readConfig(void);
|
||||
void setupConfig(void);
|
||||
void start(void);
|
||||
void end(void);
|
||||
~Server();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -12,5 +12,8 @@
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "Server.hpp"
|
||||
#include <stdlib.h>
|
||||
#include <fstream>
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user