🏗️」 wip: started file up

This commit is contained in:
2025-05-15 11:04:49 +02:00
parent 773e7855b0
commit 3300dcd057
2 changed files with 34 additions and 33 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/29 14:20:09 by mmoussou #+# #+# */ /* Created: 2025/04/29 14:20:09 by mmoussou #+# #+# */
/* Updated: 2025/05/13 10:11:34 by adjoly ### ########.fr */ /* Updated: 2025/05/13 18:27:46 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,33 +18,29 @@
namespace webserv { namespace webserv {
namespace server { namespace server {
enum clientResType { enum clientResType { CGI, UP_FILE };
CGI,
UP_FILE
};
class AClientResource { class AClientResource {
public: public:
virtual ~AClientResource() {} virtual ~AClientResource() {}
bool operator==(int i) const { bool operator==(int i) const {
if (i == _res_id) if (i == _res_id)
return true; return true;
return false; return false;
} }
void addFileDescriptor(struct pollfd fd); void setFileDescriptor(struct pollfd *fd) { _fd = fd; }
struct pollfd getFileDescriptor(); struct pollfd getFileDescriptor(void) const { return *_fd; }
virtual clientResType type(void); virtual clientResType type(void) const ;
int getId(void) const { return _res_id; } int getId(void) const { return _res_id; }
protected: protected:
struct pollfd _fd; struct pollfd *_fd;
int _res_id;
int _res_id;
}; };
} // -namepsace server } // namespace server
} // -namespace webserv } // namespace webserv

View File

@ -1,27 +1,32 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* ::: :::::::: */
/* AResource.cpp :+: :+: :+: */ /* FileUpload.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/29 14:42:01 by mmoussou #+# #+# */ /* Created: 2025/05/13 18:14:45 by adjoly #+# #+# */
/* Updated: 2025/04/29 15:45:19 by adjoly ### ########.fr */ /* Updated: 2025/05/13 18:56:25 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include <server/AResource.hpp> #pragma once
using namespace webserv; #include "server/AResource.hpp"
using namespace server;
void AClientResource::addFileDescriptor(struct pollfd fd) namespace webserv {
{ namespace server {
this->_fd = fd;
}
class FileUpload : public AClientResource {
public:
FileUpload(int id) { _res_id = id; }
~FileUpload(void) {}
struct pollfd AClientResource::getFileDescriptor() clientResType type(void) const { return UP_FILE; }
{
return (this->_fd); protected:
} private:
};
} // namespace server
} // namespace webserv