-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathClientService.h
63 lines (47 loc) · 2.01 KB
/
ClientService.h
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
61
62
63
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <winsock.h>
#include "functions/FCast.h"
#include "Global.h"
#define CLIENT_SERVICE_CONNECTION_KEEP_ALIVE_SECONDS_DELAY 5
#define CLIENT_SERVICE_RECV_DEFAULT_SECONDS_TIMEOUT 3
#define CLIENT_SERVICE_RECV_BUFFER_SIZE 256
#define CLIENT_SERVICE_CONNECTION_KEEP_ALIVE_PING "::PING"
using namespace std;
class ClientService {
protected:
string sTargetHostnameIP, sCryptographicSecurityProtocol, sLoginUsername, sLoginPassword, sEndCommandLine;
int nSocketId;
unsigned int nRecvSecTimeout;
unsigned int nTargetPort;
unsigned int nDefaultPort, nDefaultPortSSL, nDefaultPortTLS;
bool bAuthCryptographicSecurity, bAuthLoginUser, bReceiveOnConnect;
private:
void initializeClientService();
void setSocketTimeout(unsigned int nRecvSecTimeout);
virtual bool authCryptographicSecurity() = 0;
public:
ClientService(unsigned int nRecvSecTimeout = CLIENT_SERVICE_RECV_DEFAULT_SECONDS_TIMEOUT);
~ClientService() { }
virtual bool authLoginUser() = 0;
bool connectSocket(string sTargetHostnameIP, unsigned int nTargetPort = 0, string sCryptographicSecurityProtocol = GLOBAL_CRYPTOGRAPHIC_SECURITY_PROTOCOL_VALUE_NONE);
bool disconnectSocket();
bool sendSocketData(string sSocketData);
string recvSocketData();
void setLoginCredentials(string sLoginUsername, string sLoginPassword);
string getTargetHostnameIP();
string getCryptographicSecurityProtocol();
string getLoginUsername();
string getLoginPassword();
string getEndCommandLine();
bool getReceiveOnConnect();
unsigned int getTargetPort();
unsigned int getDefaultPort();
unsigned int getDefaultPortSSL();
unsigned int getDefaultPortTLS();
bool isConnectionKeepAlive();
bool isAuthCryptographicSecurity();
bool isAuthLoginUser();
};