projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
client: initial support for multiple connections
[fio.git]
/
server.h
diff --git
a/server.h
b/server.h
index 51a84176c38c01f5485ff5cac533c8ffc1a3e92f..0f57ae85cf0994338c4958a1f8a94fecfc74c5f0 100644
(file)
--- a/
server.h
+++ b/
server.h
@@
-2,6
+2,7
@@
#define FIO_SERVER_H
#include <inttypes.h>
#define FIO_SERVER_H
#include <inttypes.h>
+#include <string.h>
#include <endian.h>
/*
#include <endian.h>
/*
@@
-12,10
+13,9
@@
struct fio_net_cmd {
uint16_t opcode; /* command opcode */
uint32_t flags; /* modifier flags */
uint64_t serial; /* serial number */
uint16_t opcode; /* command opcode */
uint32_t flags; /* modifier flags */
uint64_t serial; /* serial number */
- uint32_t pad;
uint32_t pdu_len; /* length of post-cmd layload */
uint32_t pdu_len; /* length of post-cmd layload */
- uint
32_t cmd_crc32
; /* cmd checksum */
- uint
32_t pdu_crc32
; /* payload checksum */
+ uint
16_t cmd_crc16
; /* cmd checksum */
+ uint
16_t pdu_crc16
; /* payload checksum */
uint8_t payload[0]; /* payload */
};
uint8_t payload[0]; /* payload */
};
@@
-23,23
+23,34
@@
enum {
FIO_SERVER_VER = 1,
FIO_SERVER_VER1 = 1,
FIO_SERVER_VER = 1,
FIO_SERVER_VER1 = 1,
- FIO_SERVER_MAX_PDU =
4096
,
+ FIO_SERVER_MAX_PDU =
64
,
FIO_NET_CMD_QUIT = 1,
FIO_NET_CMD_JOB = 2,
FIO_NET_CMD_QUIT = 1,
FIO_NET_CMD_JOB = 2,
- FIO_NET_CMD_JOB_END = 3,
- FIO_NET_CMD_ACK = 4,
- FIO_NET_CMD_NAK = 5,
+ FIO_NET_CMD_ACK = 3,
+ FIO_NET_CMD_NAK = 4,
+ FIO_NET_CMD_TEXT = 5,
+
+ FIO_NET_CMD_F_MORE = 1,
+
+ /* crc does not include the crc fields */
+ FIO_NET_CMD_CRC_SZ = sizeof(struct fio_net_cmd) -
+ 2 * sizeof(uint16_t),
};
extern int fio_server(void);
};
extern int fio_server(void);
+extern int fio_server_text_output(const char *, unsigned int len);
+extern int fio_server_log(const char *format, ...);
+extern int fio_net_send_cmd(int, uint16_t, const char *, off_t);
extern int fio_client_connect(const char *);
extern int fio_client_connect(const char *);
-extern int fio_client_send_ini(const char *);
+extern int fio_client_send_ini(const char *, const char *);
+extern int fio_handle_clients(void);
extern int fio_recv_data(int sk, void *p, unsigned int len);
extern int fio_send_data(int sk, const void *p, unsigned int len);
extern void fio_net_cmd_crc(struct fio_net_cmd *);
extern int fio_recv_data(int sk, void *p, unsigned int len);
extern int fio_send_data(int sk, const void *p, unsigned int len);
extern void fio_net_cmd_crc(struct fio_net_cmd *);
+extern struct fio_net_cmd *fio_net_cmd_read(int sk);
extern int exit_backend;
extern int fio_net_port;
extern int exit_backend;
extern int fio_net_port;
@@
-62,10
+73,18
@@
extern int fio_net_port;
#error "Endianness not detected"
#endif
#error "Endianness not detected"
#endif
-static inline void fio_init_net_cmd(struct fio_net_cmd *cmd)
+static inline void fio_init_net_cmd(struct fio_net_cmd *cmd, uint16_t opcode,
+ const void *pdu, uint32_t pdu_len)
{
memset(cmd, 0, sizeof(*cmd));
{
memset(cmd, 0, sizeof(*cmd));
- cmd->version = cpu_to_le16(FIO_SERVER_VER1);
+
+ cmd->version = cpu_to_le16(FIO_SERVER_VER1);
+ cmd->opcode = cpu_to_le16(opcode);
+
+ if (pdu) {
+ cmd->pdu_len = cpu_to_le32(pdu_len);
+ memcpy(&cmd->payload, pdu, pdu_len);
+ }
}
#endif
}
#endif