Move client structure into client.h
[fio.git] / client.h
1 #ifndef CLIENT_H
2 #define CLIENT_H
3
4 #include <sys/socket.h>
5 #include <sys/un.h>
6 #include <netinet/in.h>
7 #include <arpa/inet.h>
8
9 struct fio_net_cmd;
10
11 struct fio_client {
12         struct flist_head list;
13         struct flist_head hash_list;
14         struct flist_head arg_list;
15         union {
16                 struct sockaddr_in addr;
17                 struct sockaddr_in6 addr6;
18                 struct sockaddr_un addr_un;
19         };
20         char *hostname;
21         int port;
22         int fd;
23
24         char *name;
25
26         int state;
27
28         int skip_newline;
29         int is_sock;
30         int disk_stats_shown;
31         unsigned int jobs;
32         int error;
33         int ipv6;
34         int sent_job;
35
36         struct flist_head eta_list;
37         struct client_eta *eta_in_flight;
38
39         struct flist_head cmd_list;
40
41         uint16_t argc;
42         char **argv;
43 };
44
45 typedef void (*client_text_op_func)(struct fio_client *client,
46                 FILE *f, __u16 pdu_len, const char *buf);
47
48 typedef void (*client_disk_util_op_func)(struct fio_client *client, struct fio_net_cmd *cmd);
49
50 typedef void (*client_thread_status_op)(struct fio_net_cmd *cmd);
51
52 typedef void (*client_group_stats_op)(struct fio_net_cmd *cmd);
53
54 typedef void (*client_eta_op)(struct fio_client *client, struct fio_net_cmd *cmd);
55
56 typedef void (*client_probe_op)(struct fio_client *client, struct fio_net_cmd *cmd);
57
58 typedef void (*client_thread_status_display_op)(char *status_message, double perc);
59
60 struct client_ops {
61         client_text_op_func text_op;
62         client_disk_util_op_func disk_util;
63         client_thread_status_op thread_status;
64         client_group_stats_op group_stats;
65         client_eta_op eta;
66         client_probe_op probe;
67         client_thread_status_display_op thread_status_display;
68 };
69
70 extern struct client_ops fio_client_ops;
71
72 #endif
73