+ int ret;
+ struct sb_context *sbc;
+ struct iovec iov[2];
+ sb_transformation trafo = band < SBD_PROCEED? NULL : sc_trafo;
+ struct sb_buffer sbb = SBB_INIT(band, buf, numbytes);
+
+ sbc = sb_new_send(&sbb, dont_free, trafo, scc->send);
+ do {
+ ret = sb_get_send_buffers(sbc, iov);
+ ret = xwritev(scc->fd, iov, ret);
+ if (ret < 0)
+ goto fail;
+ } while (sb_sent(sbc, ret) == false);
+ return 1;
+fail:
+ sb_free(sbc);
+ return ret;
+}
+
+/**
+ * Create a variable sized buffer and send it as a sideband packet.
+ *
+ * \param scc Passed to \ref send_sb.
+ * \param band See \ref send_sb.
+ * \param fmt The format string.
+ *
+ * \return The return value of the underlying call to \ref send_sb.
+ */
+__printf_3_4 int send_sb_va(struct stream_cipher_context *scc, int band,
+ const char *fmt, ...)
+{
+ va_list ap;
+ char *msg;
+ int ret;
+
+ va_start(ap, fmt);
+ ret = xvasprintf(&msg, fmt, ap);
+ va_end(ap);
+ return send_sb(scc, msg, ret, band, false);
+}
+
+/**
+ * Send an error message to a client.
+ *
+ * \param cc Client info.
+ * \param err The (positive) error code.
+ *
+ * \return The return value of the underlying call to send_sb_va().
+ */
+int send_strerror(struct command_context *cc, int err)
+{
+ return send_sb_va(&cc->scc, SBD_ERROR_LOG, "%s\n", para_strerror(err));
+}
+
+/**
+ * Send an error context to a client,
+ *
+ * \param cc Client info.
+ * \param errctx The error context string.
+ *
+ * \return The return value of the underlying call to send_sb_va().
+ *
+ * This function frees the error context string after it was sent.
+ */
+int send_errctx(struct command_context *cc, char *errctx)
+{
+ int ret;
+
+ if (!errctx)
+ return 0;
+ ret = send_sb_va(&cc->scc, SBD_ERROR_LOG, "%s\n", errctx);
+ free(errctx);
+ return ret;
+}
+
+static int check_sender_args(struct command_context *cc,
+ struct lls_parse_result *lpr, struct sender_command_data *scd)
+{
+ int i, ret;
+ const char *subcmds[] = {SENDER_SUBCOMMANDS};
+ const char *arg;
+ char *errctx;
+ unsigned num_inputs = lls_num_inputs(lpr);