#include "includes.h"
NTSTATUS cli_shutdown_init(struct cli_state * cli, TALLOC_CTX *mem_ctx,
const char *msg, uint32 timeout, BOOL do_reboot,
BOOL force)
{
prs_struct qbuf;
prs_struct rbuf;
SHUTDOWN_Q_INIT q_s;
SHUTDOWN_R_INIT r_s;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (msg == NULL) return NT_STATUS_INVALID_PARAMETER;
ZERO_STRUCT (q_s);
ZERO_STRUCT (r_s);
prs_init(&qbuf , MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
init_shutdown_q_init(&q_s, msg, timeout, do_reboot, force);
if (!shutdown_io_q_init("", &q_s, &qbuf, 0) ||
!rpc_api_pipe_req(cli, SHUTDOWN_INIT, &qbuf, &rbuf))
goto done;
if(shutdown_io_r_init("", &r_s, &rbuf, 0))
result = r_s.status;
done:
prs_mem_free(&rbuf);
prs_mem_free(&qbuf);
return result;
}
NTSTATUS cli_shutdown_abort(struct cli_state * cli, TALLOC_CTX *mem_ctx)
{
prs_struct rbuf;
prs_struct qbuf;
SHUTDOWN_Q_ABORT q_s;
SHUTDOWN_R_ABORT r_s;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
ZERO_STRUCT (q_s);
ZERO_STRUCT (r_s);
prs_init(&qbuf , MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
init_shutdown_q_abort(&q_s);
if (!shutdown_io_q_abort("", &q_s, &qbuf, 0) ||
!rpc_api_pipe_req(cli, SHUTDOWN_ABORT, &qbuf, &rbuf))
goto done;
if (shutdown_io_r_abort("", &r_s, &rbuf, 0))
result = r_s.status;
done:
prs_mem_free(&rbuf);
prs_mem_free(&qbuf );
return result;
}