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 );
37 q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 );
40 init_unistr4( q_s->message, msg, UNI_FLAGS_NONE );
42 /* Win2000 is apparently very sensitive to these lengths */
43 /* do a special case here */
45 q_s->message->string->uni_max_len++;
46 q_s->message->size += 2;
49 q_s->timeout = timeout;
51 q_s->reboot = do_reboot ? 1 : 0;
52 q_s->force = force ? 1 : 0;
55 /*******************************************************************
56 ********************************************************************/
58 void init_shutdown_q_init_ex(SHUTDOWN_Q_INIT_EX * q_u_ex, const char *msg,
59 uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
65 init_shutdown_q_init( &q_u, msg, timeout, do_reboot, force );
69 q_u_ex->server = q_u.server;
70 q_u_ex->message = q_u.message;
72 q_u_ex->reboot = q_u.reboot;
73 q_u_ex->force = q_u.force;
75 q_u_ex->reason = reason;
78 /*******************************************************************
79 reads or writes a structure.
80 ********************************************************************/
82 BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps,
88 prs_debug(ps, depth, desc, "shutdown_io_q_init");
94 if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
99 if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
105 if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
108 if (!prs_uint8("force ", ps, depth, &(q_s->force)))
110 if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
116 /*******************************************************************
117 reads or writes a structure.
118 ********************************************************************/
119 BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps,
125 prs_debug(ps, depth, desc, "shutdown_io_r_init");
131 if(!prs_werror("status", ps, depth, &r_s->status))
137 /*******************************************************************
138 reads or writes a REG_Q_SHUTDOWN_EX structure.
139 ********************************************************************/
141 BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struct *ps,
147 prs_debug(ps, depth, desc, "shutdown_io_q_init_ex");
153 if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
158 if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
164 if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
167 if (!prs_uint8("force ", ps, depth, &(q_s->force)))
169 if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
174 if (!prs_uint32("reason", ps, depth, &(q_s->reason)))
181 /*******************************************************************
182 reads or writes a REG_R_SHUTDOWN_EX structure.
183 ********************************************************************/
184 BOOL shutdown_io_r_init_ex(const char *desc, SHUTDOWN_R_INIT_EX * r_s, prs_struct *ps,
190 prs_debug(ps, depth, desc, "shutdown_io_r_init_ex");
196 if(!prs_werror("status", ps, depth, &r_s->status))
203 /*******************************************************************
205 ********************************************************************/
206 void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s)
208 q_s->server = TALLOC_P( get_talloc_ctx(), uint16 );
212 /*******************************************************************
213 reads or writes a structure.
214 ********************************************************************/
215 BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s,
216 prs_struct *ps, int depth)
221 prs_debug(ps, depth, desc, "shutdown_io_q_abort");
227 if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
235 /*******************************************************************
236 reads or writes a structure.
237 ********************************************************************/
238 BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s,
239 prs_struct *ps, int depth)
244 prs_debug(ps, depth, desc, "shutdown_io_r_abort");
250 if (!prs_werror("status", ps, depth, &r_s->status))