Pass more arguments to fio_init_net_cmd()
[fio.git] / server.h
index c2cb9942774b8a3c11b4e930d560300b3df2ffa7..79449a635315b26c9c5aecde52751ff9dde2426f 100644 (file)
--- a/server.h
+++ b/server.h
@@ -2,6 +2,7 @@
 #define FIO_SERVER_H
 
 #include <inttypes.h>
+#include <string.h>
 #include <endian.h>
 
 /*
@@ -34,7 +35,8 @@ enum {
 };
 
 extern int fio_server(void);
-extern void fio_server_text_output(const char *, unsigned int len);
+extern int fio_server_text_output(const char *, unsigned int len);
+extern int fio_server_log(const char *format, ...);
 
 extern int fio_client_connect(const char *);
 extern int fio_client_send_ini(const char *);
@@ -66,10 +68,18 @@ extern int fio_net_port;
 #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));
-       cmd->version = cpu_to_le16(FIO_SERVER_VER1);
+
+       cmd->version    = cpu_to_le16(FIO_SERVER_VER1);
+       cmd->opcode     = cpu_to_le16(FIO_NET_CMD_TEXT);
+
+       if (pdu) {
+               cmd->pdu_len    = cpu_to_le32(pdu_len);
+               memcpy(&cmd->payload, pdu, pdu_len);
+       }
 }
 
 #endif