-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsynexec_master_slaveset.h
60 lines (51 loc) · 1.97 KB
/
synexec_master_slaveset.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
/*
* ------------------------------------
* synexec - Synchronised Executioner
* ------------------------------------
* synexec_master_slaveset.h
* ---------------------------
* Copyright 2014 (c) Citrix
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Read the README file for the changelog and information on how to
* compile and use this program.
*/
#ifndef SYNEXEC_MASTER_SLAVESET_H
#define SYNEXEC_MASTER_SLAVESET_H
// Header files
#include <inttypes.h>
#include <netinet/in.h>
// Slave entry
typedef struct _slave {
struct sockaddr_in slave_addr; // Slave sockaddr
int slave_fd; // TCP Socket
struct timeval slave_time[3]; // 0-started, 1-finished, 2-zero for ref
struct _slave *next; // Next slave in the linked list
} slave_t;
// Slave set
typedef struct {
int32_t slaves; // Total number of slaves REQUIRED in the set
int32_t active; // Total number of slaves ACTIVE in the set
slave_t *slave; // Pointer to the first slave
} slaveset_t;
// Related functions
int
slaveset_probe(slaveset_t *slaveset);
int
slave_in_list(slaveset_t *slaveset, struct sockaddr_in *slave_addr);
int
slave_add(slaveset_t *slaveset, struct sockaddr_in *slave_addr, int slave_sock);
void
slave_times(slaveset_t *slaveset);
#endif /* SYNEXEC_MASTER_SLAVESET_H */