63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Server.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: iherman- <iherman-@student.42malaga.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2026/05/06 17:18:11 by iherman- #+# #+# */
|
|
/* Updated: 2026/05/07 13:00:39 by iherman- ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef SERVER_HPP
|
|
# define SERVER_HPP
|
|
|
|
// C lib functions
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <netdb.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <poll.h>
|
|
|
|
// C++ lib functions
|
|
# include <iostream>
|
|
|
|
# include <string>
|
|
# include <cstring>
|
|
|
|
# define PORT_DEFAULT 9898
|
|
|
|
class Server
|
|
{
|
|
private:
|
|
static const int kConnectionQueueLimit;
|
|
|
|
int port_;
|
|
int serverSocket_;
|
|
|
|
std::string password_;
|
|
|
|
public:
|
|
Server();
|
|
Server(int port, const std::string& password);
|
|
~Server();
|
|
|
|
Server &operator=(const Server& other);
|
|
|
|
void run();
|
|
};
|
|
|
|
#endif // SERVER_HPP
|