2
* Unix SMB/CIFS implementation.
3
* RPC Pipe client / server routines
4
* Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
5
* Copyright (C) Gerald (Jerry) Carter 2002-2005.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
#define DBGC_CLASS DBGC_RPC_PARSE
27
/*******************************************************************
29
********************************************************************/
31
void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg,
32
uint32 timeout, BOOL do_reboot, BOOL force)
34
q_s->server = TALLOC_P( get_talloc_ctx(), uint16 );
36
smb_panic("init_shutdown_q_init: talloc fail.\n");
42
q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 );
44
smb_panic("init_shutdown_q_init: talloc fail.\n");
49
init_unistr4( q_s->message, msg, UNI_FLAGS_NONE );
51
/* Win2000 is apparently very sensitive to these lengths */
52
/* do a special case here */
54
q_s->message->string->uni_max_len++;
55
q_s->message->size += 2;
58
q_s->timeout = timeout;
60
q_s->reboot = do_reboot ? 1 : 0;
61
q_s->force = force ? 1 : 0;
64
/*******************************************************************
65
********************************************************************/
67
void init_shutdown_q_init_ex(SHUTDOWN_Q_INIT_EX * q_u_ex, const char *msg,
68
uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
74
init_shutdown_q_init( &q_u, msg, timeout, do_reboot, force );
78
q_u_ex->server = q_u.server;
79
q_u_ex->message = q_u.message;
81
q_u_ex->reboot = q_u.reboot;
82
q_u_ex->force = q_u.force;
84
q_u_ex->reason = reason;
87
/*******************************************************************
88
reads or writes a structure.
89
********************************************************************/
91
BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps,
97
prs_debug(ps, depth, desc, "shutdown_io_q_init");
103
if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
108
if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
114
if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
117
if (!prs_uint8("force ", ps, depth, &(q_s->force)))
119
if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
125
/*******************************************************************
126
reads or writes a structure.
127
********************************************************************/
128
BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps,
134
prs_debug(ps, depth, desc, "shutdown_io_r_init");
140
if(!prs_werror("status", ps, depth, &r_s->status))
146
/*******************************************************************
147
reads or writes a REG_Q_SHUTDOWN_EX structure.
148
********************************************************************/
150
BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struct *ps,
156
prs_debug(ps, depth, desc, "shutdown_io_q_init_ex");
162
if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
167
if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
173
if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
176
if (!prs_uint8("force ", ps, depth, &(q_s->force)))
178
if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
183
if (!prs_uint32("reason", ps, depth, &(q_s->reason)))
190
/*******************************************************************
191
reads or writes a REG_R_SHUTDOWN_EX structure.
192
********************************************************************/
193
BOOL shutdown_io_r_init_ex(const char *desc, SHUTDOWN_R_INIT_EX * r_s, prs_struct *ps,
199
prs_debug(ps, depth, desc, "shutdown_io_r_init_ex");
205
if(!prs_werror("status", ps, depth, &r_s->status))
212
/*******************************************************************
214
********************************************************************/
215
void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s)
217
q_s->server = TALLOC_P( get_talloc_ctx(), uint16 );
219
smb_panic("init_shutdown_q_abort: talloc fail.\n");
226
/*******************************************************************
227
reads or writes a structure.
228
********************************************************************/
229
BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s,
230
prs_struct *ps, int depth)
235
prs_debug(ps, depth, desc, "shutdown_io_q_abort");
241
if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
249
/*******************************************************************
250
reads or writes a structure.
251
********************************************************************/
252
BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s,
253
prs_struct *ps, int depth)
258
prs_debug(ps, depth, desc, "shutdown_io_r_abort");
264
if (!prs_werror("status", ps, depth, &r_s->status))