-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.hpp
42 lines (36 loc) · 799 Bytes
/
Client.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "json.hpp"
#include <netinet/in.h>
#include <cstdint>
#include <any>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
/* Clasa care se ocupa de comunicarea cu server-ul*/
class Client
{
public:
int sockfd;
vector<uint8_t> buffer;
unordered_map<string, any> responses;
string cookie;
string token;
public:
~Client();
Client();
/* Metode utile in ceea ce urmeaza */
private:
void connect();
void close();
bool send(string const &);
bool recv();
public:
void clear();
/* Metode ce guverneaza toate tipurile de cereri HTTP */
pair<nlohmann::json, int>
get(string);
pair<nlohmann::json, int>
post(string, nlohmann::json);
pair<nlohmann::json, int>
del(string);
};