-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathClientSet.h
56 lines (50 loc) · 1.59 KB
/
ClientSet.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
/*
* License : Apache 2.0
*
* ClientSet.h
*
* Created on: Jan 28, 2015
* Author: Niraj Sharma
* Cisco Systems, Inc.
*/
#ifndef CLIENTSET_H_
#define CLIENTSET_H_
#include "application.h"
#include "ClientSRD.h"
class ClientSet {
private:
pthread_mutex_t csMutex;
clientInfo *clients;
int maxClients;
int numClients;
public:
ClientSet();
virtual ~ClientSet();
bool initialize (int maximumClients);
int newClient (int sock); // Adds a new client
bool startClient (int index);
bool waitToFinish (void); // returns only when all clients have finished their work
void checkStaleClients (void);
void terminateClient (int index);
int processFirstMessage (struct clientInfo *cinfo, char *command, char *outBuffer, int outBufferSize);
void forceTermination (void);
bool isDataStoreInUse (DataStore *ds);
void deleteClient (int index);
void saveClientBackConnectionInfo (struct clientInfo *cinfo, char *IPAddress, int port);
void saveClientBackSignalInfo (struct clientInfo *cinfo, pid_t clientPID, int signalType);
bool openBackConnection (struct clientInfo *cinfo);
void closeBackConnection (struct clientInfo *cinfo);
void signalClients (DataStore *ds);
static void *thrdMain (void *arg); // main routine for every client thread
static int ProcessMessage (
clientInfo *cinfo,
char **recvline,
int *maxInMsgSize,
char *sendline,
int maxOutMsgSize,
int *msgSize,
int *numBytesRead);
static xmlXPathObjectPtr GetNodeSet (xmlDocPtr doc, xmlChar *xpath, char *log);
static xmlChar *GetFirstNodeValue (xmlDocPtr doc, xmlChar *xpath);
};
#endif /* CLIENTSET_H_ */