Commit | Line | Data |
---|---|---|
dd366728 SC |
1 | #ifndef CLIENT_H |
2 | #define CLIENT_H | |
3 | ||
0f92bd20 JA |
4 | #include <sys/socket.h> |
5 | #include <sys/un.h> | |
6 | #include <netinet/in.h> | |
7 | #include <arpa/inet.h> | |
8 | ||
3e47bd25 JA |
9 | #include "stat.h" |
10 | ||
dd366728 | 11 | struct fio_net_cmd; |
a5276616 | 12 | struct client_ops; |
dd366728 | 13 | |
0f92bd20 JA |
14 | struct fio_client { |
15 | struct flist_head list; | |
16 | struct flist_head hash_list; | |
17 | struct flist_head arg_list; | |
18 | union { | |
19 | struct sockaddr_in addr; | |
20 | struct sockaddr_in6 addr6; | |
21 | struct sockaddr_un addr_un; | |
22 | }; | |
23 | char *hostname; | |
24 | int port; | |
25 | int fd; | |
5121a9aa | 26 | unsigned int refs; |
0f92bd20 JA |
27 | |
28 | char *name; | |
29 | ||
30 | int state; | |
31 | ||
32 | int skip_newline; | |
33 | int is_sock; | |
34 | int disk_stats_shown; | |
35 | unsigned int jobs; | |
36 | int error; | |
37 | int ipv6; | |
38 | int sent_job; | |
39 | ||
40 | struct flist_head eta_list; | |
41 | struct client_eta *eta_in_flight; | |
42 | ||
43 | struct flist_head cmd_list; | |
44 | ||
45 | uint16_t argc; | |
46 | char **argv; | |
3ec62ec4 | 47 | |
a5276616 | 48 | struct client_ops *ops; |
3ec62ec4 | 49 | void *client_data; |
0f92bd20 JA |
50 | }; |
51 | ||
084d1c6f | 52 | typedef void (*client_text_op_func)(struct fio_client *client, struct fio_net_cmd *cmd); |
dd366728 | 53 | typedef void (*client_disk_util_op_func)(struct fio_client *client, struct fio_net_cmd *cmd); |
89e5fad9 JA |
54 | typedef void (*client_thread_status_op)(struct fio_client *client, struct fio_net_cmd *cmd); |
55 | typedef void (*client_group_stats_op)(struct fio_client *client, struct fio_net_cmd *cmd); | |
a5276616 | 56 | typedef void (*client_eta_op)(struct jobs_eta *je); |
dd366728 | 57 | typedef void (*client_probe_op)(struct fio_client *client, struct fio_net_cmd *cmd); |
04cc6b77 | 58 | typedef void (*client_thread_status_display_op)(char *status_message, double perc); |
3ec62ec4 | 59 | typedef void (*client_quit_op)(struct fio_client *); |
807f9971 | 60 | typedef void (*client_add_job_op)(struct fio_client *, struct fio_net_cmd *); |
ed727a46 | 61 | typedef void (*client_timed_out)(struct fio_client *); |
6b79c80c | 62 | typedef void (*client_stop_op)(struct fio_client *, struct fio_net_cmd *); |
3ec62ec4 | 63 | |
dd366728 SC |
64 | struct client_ops { |
65 | client_text_op_func text_op; | |
66 | client_disk_util_op_func disk_util; | |
67 | client_thread_status_op thread_status; | |
68 | client_group_stats_op group_stats; | |
0420ba6a | 69 | client_eta_op eta; |
dd366728 | 70 | client_probe_op probe; |
3ec62ec4 | 71 | client_quit_op quit; |
807f9971 | 72 | client_add_job_op add_job; |
ed727a46 | 73 | client_timed_out timed_out; |
6b79c80c | 74 | client_stop_op stop; |
3ec62ec4 | 75 | int stay_connected; |
dd366728 SC |
76 | }; |
77 | ||
78 | extern struct client_ops fio_client_ops; | |
79 | ||
3e47bd25 JA |
80 | struct client_eta { |
81 | struct jobs_eta eta; | |
82 | unsigned int pending; | |
83 | }; | |
84 | ||
a5276616 JA |
85 | extern int fio_handle_client(struct fio_client *); |
86 | extern void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op fn); | |
3e47bd25 | 87 | extern void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je); |
3e47bd25 | 88 | |
3ec62ec4 JA |
89 | enum { |
90 | Fio_client_ipv4 = 1, | |
91 | Fio_client_ipv6, | |
92 | Fio_client_socket, | |
93 | }; | |
94 | ||
95 | extern int fio_clients_connect(void); | |
96 | extern int fio_clients_send_ini(const char *); | |
a5276616 JA |
97 | extern int fio_handle_clients(struct client_ops *); |
98 | extern int fio_client_add(struct client_ops *, const char *, void **); | |
99 | extern struct fio_client *fio_client_add_explicit(struct client_ops *, const char *, int, int); | |
3ec62ec4 | 100 | extern void fio_client_add_cmd_option(void *, const char *); |
df06f220 JA |
101 | extern void fio_clients_terminate(void); |
102 | ||
dd366728 SC |
103 | #endif |
104 |