forked from amenesca/Weeaboos-WebServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.cpp
More file actions
60 lines (47 loc) · 1.27 KB
/
Copy pathClient.cpp
File metadata and controls
60 lines (47 loc) · 1.27 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "./Client.hpp"
Client::Client() {
_client_addr_len = sizeof(_client_addr);
}
Client::~Client() {
}
Client::Client(const Client& copy) {
*this = copy;
}
Client& Client::operator=(const Client& copy) {
if (this != ©) {
this->_bytesRead = copy._bytesRead;
this->_client_addr = copy._client_addr;
this->_client_addr_len = copy._client_addr_len;
this->_clientSocket = copy._clientSocket;
this->_requestBuffer1 = copy._requestBuffer1;
}
return *this;
}
std::string Client::getBuffer(void) {
return (_requestBuffer1);
}
sockaddr_in *Client::getClientAddrPointer(void) {
return &_client_addr;
}
socklen_t *Client::getClientAddrLenPointer(void) {
return &_client_addr_len;
}
int Client::getClientSocket(void) const {
return _clientSocket;
}
ssize_t Client::getBytesRead(void) const {
return _bytesRead;
}
void Client::setRequestBuffer(std::string requestBuffer) {
//tive que usa o new o negocio estava muito doido, dando segfault sem motivo
_requestBuffer1 = requestBuffer;
}
void Client::setClientSocket(int clientSocket) {
_clientSocket = clientSocket;
}
void Client::setClientAddrLen(socklen_t client_addr_len) {
_client_addr_len = client_addr_len;
}
void Client::setBytesRead(ssize_t bytesRead) {
_bytesRead = bytesRead;
}