diff options
author | Nathan Straz <nstraz@redhat.com> | 2013-08-28 14:16:30 -0400 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2013-09-11 17:49:33 -0400 |
commit | ceaf5360d969f2507018f51876f64aaae767e367 (patch) | |
tree | 07d3db73a4186ce2dcad660393e9265b0ff254ca /qarsh_packet.h | |
parent | 604b053a1e710f22226fcb86c34e737df1058f92 (diff) | |
download | qarsh-ceaf5360d969f2507018f51876f64aaae767e367.tar.gz qarsh-ceaf5360d969f2507018f51876f64aaae767e367.tar.xz qarsh-ceaf5360d969f2507018f51876f64aaae767e367.zip |
Get commands running over one socket
Added a new packet to limit data sent from the other side.
Diffstat (limited to 'qarsh_packet.h')
-rw-r--r-- | qarsh_packet.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/qarsh_packet.h b/qarsh_packet.h index 908a6da..8a74791 100644 --- a/qarsh_packet.h +++ b/qarsh_packet.h @@ -37,7 +37,8 @@ enum qa_packet_type { QP_RECVFILE = 8, QP_SENDFILE = 9, QP_RSTAT = 10, - QP_DATA = 11 + QP_DATA = 11, + QP_DALLOW = 12 }; struct qp_hello_pkt { @@ -52,9 +53,6 @@ struct qp_returncode_pkt { struct qp_runcmd_pkt { char *qp_cmdline; - int qp_stdin_port; - int qp_stdout_port; - int qp_stderr_port; }; /* General packet for acknowledging a command worked */ @@ -104,6 +102,11 @@ struct qp_data_pkt { void *qp_blob; }; +struct qp_data_allow_pkt { + int qp_remfd; /* fd we're allowing data on */ + int qp_count; /* How much data the receiver is allowed to send */ +}; + struct qa_packet { enum qa_packet_type qp_type; int qp_seq; /* Sequence number for this packet */ @@ -119,6 +122,7 @@ struct qa_packet { struct qp_sendfile_pkt sendfile; struct qp_rstat_pkt rstat; struct qp_data_pkt data; + struct qp_data_allow_pkt dallow; } qp_u; }; @@ -133,6 +137,7 @@ struct qa_packet { #define qp_sendfile qp_u.sendfile #define qp_rstat qp_u.rstat #define qp_data qp_u.data +#define qp_dallow qp_u.dallow /* Prototypes */ char *qp_packet_type(enum qa_packet_type t); @@ -140,7 +145,7 @@ struct qa_packet *parse_packet(char *buf, int buflen); struct qa_packet *make_qp_hello(char *greeting); struct qa_packet *make_qp_returncode(int rc, int eno, char *strerr); struct qa_packet *make_qp_ack(enum qa_packet_type t, int i); -struct qa_packet *make_qp_runcmd(char *cmdline, int p_in, int p_out, int p_err); +struct qa_packet *make_qp_runcmd(char *cmdline); struct qa_packet *make_qp_cmdexit(pid_t pid, int status); struct qa_packet *make_qp_setuser(char *user, char *group); struct qa_packet *make_qp_kill(int sig); @@ -148,6 +153,7 @@ struct qa_packet *make_qp_recvfile(const char *path, off_t count, mode_t mode); struct qa_packet *make_qp_sendfile(const char *path, int remfd); 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); +struct qa_packet *make_qp_data_allow(const int remfd, const int count); int qptostr(struct qa_packet *qp, char *qpstr, int maxsize); void qpfree(struct qa_packet *qp); void dump_qp(struct qa_packet *qp); |