mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 05:17:59 +03:00
feat(socket): add min_config struct
This commit is contained in:
@@ -15,6 +15,9 @@ Socket::Socket(int domain, int type, int protocol, int port, std::string ip)
|
|||||||
_addres.sin_port = htons(port);
|
_addres.sin_port = htons(port);
|
||||||
_addres.sin_addr.s_addr = inet_addr(ip.c_str());
|
_addres.sin_addr.s_addr = inet_addr(ip.c_str());
|
||||||
_addrlen = sizeof(_addres);
|
_addrlen = sizeof(_addres);
|
||||||
|
|
||||||
|
min_config.ip = ip;
|
||||||
|
min_config.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
Socket::~Socket()
|
Socket::~Socket()
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#define SOCKET_HPP
|
#define SOCKET_HPP
|
||||||
|
|
||||||
#include "webserv.hpp"
|
#include "webserv.hpp"
|
||||||
|
#include "ServerConfig.hpp"
|
||||||
|
|
||||||
class Socket
|
class Socket
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -9,9 +11,9 @@ private:
|
|||||||
socklen_t _addrlen;
|
socklen_t _addrlen;
|
||||||
struct sockaddr_in _addres;
|
struct sockaddr_in _addres;
|
||||||
|
|
||||||
|
Socket();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Socket();
|
|
||||||
Socket(int domain, int type, int protocol, int port, std::string ip);
|
Socket(int domain, int type, int protocol, int port, std::string ip);
|
||||||
int getSocketFd(void);
|
int getSocketFd(void);
|
||||||
struct sockaddr_in getAddres(void);
|
struct sockaddr_in getAddres(void);
|
||||||
@@ -25,6 +27,8 @@ public:
|
|||||||
int init(int nbr);
|
int init(int nbr);
|
||||||
void checkError(int fd, std::string str);
|
void checkError(int fd, std::string str);
|
||||||
|
|
||||||
|
struct serverListen min_config;
|
||||||
|
|
||||||
~Socket();
|
~Socket();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user