From b7aafc98a56966d4aab712ac0f73df0ae07ca657 Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Mon, 12 Aug 2013 13:35:17 -0400 Subject: Add new data packet type --- qarsh_packet.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'qarsh_packet.h') diff --git a/qarsh_packet.h b/qarsh_packet.h index ec391c3..42f4b61 100644 --- a/qarsh_packet.h +++ b/qarsh_packet.h @@ -36,7 +36,8 @@ enum qa_packet_type { QP_KILL = 7, QP_RECVFILE = 8, QP_SENDFILE = 9, - QP_RSTAT = 10 + QP_RSTAT = 10, + QP_DATA = 11 }; struct qp_hello_pkt { @@ -96,6 +97,13 @@ struct qp_rstat_pkt { off_t qp_st_size; }; +struct qp_data_pkt { + int qp_remfd; /* remote fd to write to */ + off_t qp_offset; /* offset in file for this data */ + int qp_count; /* length of data buffer */ + int free_blob; /* Whether qpfree should free the blob */ + void *qp_blob; +}; #define QP_VERSION 1 @@ -113,6 +121,7 @@ struct qa_packet { struct qp_recvfile_pkt recvfile; struct qp_sendfile_pkt sendfile; struct qp_rstat_pkt rstat; + struct qp_data_pkt data; } qp_u; }; @@ -126,6 +135,7 @@ struct qa_packet { #define qp_recvfile qp_u.recvfile #define qp_sendfile qp_u.sendfile #define qp_rstat qp_u.rstat +#define qp_data qp_u.data /* Prototypes */ char *qp_packet_type(enum qa_packet_type t); @@ -140,6 +150,7 @@ struct qa_packet *make_qp_kill(int sig); struct qa_packet *make_qp_recvfile(const char *path, int if_port, off_t count, mode_t mode); struct qa_packet *make_qp_sendfile(const char *path, int of_port); struct qa_packet *make_qp_rstat(const char *path, const struct stat *sb); +struct qa_packet *make_qp_data(const int remfd, const off_t offset, const int count, void *blob); int qptostr(struct qa_packet *qp, char *qpstr, int maxsize); void qpfree(struct qa_packet *qp); void dump_qp(struct qa_packet *qp); -- cgit