File: handle_client.h

package info (click to toggle)
entropybroker 2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,600 kB
  • sloc: cpp: 14,386; sh: 934; makefile: 188; java: 148; perl: 12
file content (55 lines) | stat: -rw-r--r-- 1,282 bytes parent folder | download | duplicates (5)
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
#define PIPE_CMD_HAVE_DATA 1
#define PIPE_CMD_NEED_DATA 2
#define PIPE_CMD_IS_FULL   3
#define PIPE_CMD_QUIT      4
extern const char *pipe_cmd_str[];

typedef struct
{
	int to_thread[2], to_main[2];
	pthread_t th;

	bool allow_rw;

	int socket_fd;
	std::string host, type;
	long long int id;
	bool is_server;
	int max_bits_per_interval;
	bool allow_prng;
	bool ignore_rngtest_fips140, ignore_rngtest_scc;
	std::string username, password;

	fips140 *pfips140;
	scc *pscc;

	long long unsigned int ivec_counter;
	long long unsigned int challenge;
	encrypt_stream *stream_cipher;
	hasher *mac_hasher;

	double connected_since;
	double last_message, last_put_message, last_get_message;

	pool_crypto *pc;

	int bits_sent, bits_recv;
	pthread_mutex_t stats_lck;

	// globals
	users *pu;
	config_t *config;
	pools *ppools;
	statistics_global *stats_glob;
	fips140 *output_fips140;
	scc *output_scc;
} client_t;

typedef struct
{
	int fd_sender;
	unsigned char cmd;
} msg_pair_t;

client_t *find_client_by_id(std::vector<client_t *> *clients, long long int id_in);
void main_loop(std::vector<client_t *> *clients, pthread_mutex_t *clients_mutex, pools *ppools, config_t *config, fips140 *eb_output_fips140, scc *eb_output_scc, pool_crypto *pc, statistics_global *stats, users *user_map);