From 0b77d7b80cbd699b5e79b3dcd98fd502203f98e6 Mon Sep 17 00:00:00 2001 From: adjoly Date: Thu, 17 Apr 2025 19:04:30 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20started=20client=20handling=20(need=20to=20redo=20a=20part?= =?UTF-8?q?=20of=20the=20client=20fd=20handling)=20not=20yet=20usable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/server/Client.hpp | 4 ++-- includes/server/Server.hpp | 4 ++-- src/server/Client.cpp | 27 +++++++++++++++++++++++++-- src/server/Server.cpp | 2 +- src/{socket.cpp => server/Socket.cpp} | 10 ++++++++-- 5 files changed, 38 insertions(+), 9 deletions(-) rename src/{socket.cpp => server/Socket.cpp} (87%) diff --git a/includes/server/Client.hpp b/includes/server/Client.hpp index f1d5efc..c074826 100644 --- a/includes/server/Client.hpp +++ b/includes/server/Client.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */ -/* Updated: 2025/04/17 12:46:04 by mmoussou ### ########.fr */ +/* Updated: 2025/04/17 18:48:25 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ namespace server { class Client { public: - Client(int, sockaddr_in, config::Config *); + Client(int, sockaddr_in, config::Server *); ~Client(void); void answer(void); diff --git a/includes/server/Server.hpp b/includes/server/Server.hpp index 86d3fba..d8fa556 100644 --- a/includes/server/Server.hpp +++ b/includes/server/Server.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */ -/* Updated: 2025/04/17 18:08:38 by adjoly ### ########.fr */ +/* Updated: 2025/04/17 18:45:07 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,7 +43,7 @@ class Server { * * @param The fd of the client */ - void _handle_client(int, sockaddr_in, config::Config *, struct pollfd); + void _handle_client(int, sockaddr_in, struct pollfd); /** * @brief Can be used to fill the vector passed as parameters with all the diff --git a/src/server/Client.cpp b/src/server/Client.cpp index e520e79..d0a36a3 100644 --- a/src/server/Client.cpp +++ b/src/server/Client.cpp @@ -6,7 +6,7 @@ /* By: mmoussou _fd = fd; + this->_client_addr = socket; + this->_conf = conf; + this->_log = log; + std::string received_data; char buffer[BUFFER_SIZE]; ssize_t bytes_received; diff --git a/src/server/Server.cpp b/src/server/Server.cpp index 315c7d6..a45a8a7 100644 --- a/src/server/Server.cpp +++ b/src/server/Server.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */ -/* Updated: 2025/04/17 18:21:34 by adjoly ### ########.fr */ +/* Updated: 2025/04/17 18:57:20 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/socket.cpp b/src/server/Socket.cpp similarity index 87% rename from src/socket.cpp rename to src/server/Socket.cpp index 2aac70e..edc1579 100644 --- a/src/socket.cpp +++ b/src/server/Socket.cpp @@ -1,15 +1,17 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* socket.cpp :+: :+: :+: */ +/* Socket.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */ -/* Updated: 2025/04/17 12:35:31 by adjoly ### ########.fr */ +/* Updated: 2025/04/17 19:03:27 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ +#include "server/Client.hpp" +#include #include #include @@ -69,3 +71,7 @@ int Server::_createSocket(std::string host, int port) { return (fd); } + +void Server::_handle_client(int fd, sockaddr_in client_addr, struct pollfd poll_fd) { + server::Client *client = new server::Client(fd, client_addr, ); +}