This commit is contained in:
radi0dev 2026-01-30 16:48:11 +03:00
commit bd58ea66de
10 changed files with 395 additions and 0 deletions

30
inc/srv.h Normal file
View file

@ -0,0 +1,30 @@
#ifndef SRV_H
#define SRV_H
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <deque>
class Server {
public:
Server(int port, const std::vector<std::string>* questions, size_t n, const std::map<std::string, std::string>* templates);
void run();
private:
std::string getRandomQuestion();
void handleRequest(int client_socket);
void sendResponse(const std::string& response);
int port;
const std::vector<std::string>* questions;
size_t n;
std::deque<int> recentQuestions;
const std::map<std::string, std::string>* templates;
void sendAbout();
};
#endif // SRV_H