mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
add Socket class
This commit is contained in:
@@ -9,10 +9,8 @@ private:
|
||||
int _type;
|
||||
int _row;
|
||||
char *_buff;
|
||||
// std::string _respons;
|
||||
std::string _fileName;
|
||||
std::vector<std::string> _request;
|
||||
|
||||
std::map<std::string, std::string> _request;
|
||||
|
||||
public:
|
||||
enum REQ
|
||||
@@ -23,17 +21,14 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
std::vector<std::string> getRequest(void);
|
||||
// std::string getRespons(void);
|
||||
std::map<std::string, std::string> getRequest(void);
|
||||
int getType(void);
|
||||
std::string getFileName(void);
|
||||
void setFile(std::string);
|
||||
void setRequest(char *);
|
||||
// void generateRespons(void);
|
||||
|
||||
void parseBuff(void);
|
||||
void identifyType(std::string);
|
||||
void printHeaderInfo(void);
|
||||
void setFile(std::string);
|
||||
void setRequest(char *);
|
||||
void identifyType(std::string);
|
||||
void printHeaderInfo(void);
|
||||
void parseRequest(void);
|
||||
Header();
|
||||
Header(char *);
|
||||
~Header();
|
||||
|
||||
33
includes/Socket.hpp
Normal file
33
includes/Socket.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef SOCKET
|
||||
#define SOCKET
|
||||
|
||||
#include "webserv.hpp"
|
||||
class Socket
|
||||
{
|
||||
private:
|
||||
int _socketFd;
|
||||
socklen_t _addrlen;
|
||||
struct sockaddr_in _addres;
|
||||
|
||||
|
||||
public:
|
||||
Socket();
|
||||
Socket(int domain, int type, int protocol, int port);
|
||||
int getSocketFd(void);
|
||||
struct sockaddr_in getAddres(void);
|
||||
socklen_t getAddlen(void);
|
||||
struct sockaddr *getSockaddr(void);
|
||||
socklen_t *getSocklen(void);
|
||||
void setSocketFd(int);
|
||||
void setAddres(struct sockaddr_in);
|
||||
int bindingSocket(void);
|
||||
int listeningSocket(int nbr);
|
||||
int init(int nbr);
|
||||
void checkError(int fd, std::string str);
|
||||
|
||||
~Socket();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include "Socket.hpp"
|
||||
#include "Server.hpp"
|
||||
#include "Header.hpp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user