1/* 2 * Unix SMB/CIFS implementation. 3 * RPC Pipe client / server routines 4 * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21#include "includes.h" 22 23#undef DBGC_CLASS 24#define DBGC_CLASS DBGC_RPC_PARSE 25 26/******************************************************************* 27Inits a structure. 28********************************************************************/ 29 30void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, 31 uint32 timeout, BOOL do_reboot, BOOL force) 32{ 33 q_s->ptr_server = 1; 34 q_s->server = 1; 35 q_s->ptr_msg = 1; 36 37 init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); 38 init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); 39 40 q_s->timeout = timeout; 41 42 q_s->reboot = do_reboot ? 1 : 0; 43 q_s->force = force ? 1 : 0; 44} 45 46/******************************************************************* 47reads or writes a structure. 48********************************************************************/ 49 50BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, 51 int depth) 52{ 53 if (q_s == NULL) 54 return False; 55 56 prs_debug(ps, depth, desc, "shutdown_io_q_init"); 57 depth++; 58 59 if (!prs_align(ps)) 60 return False; 61 62 if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) 63 return False; 64 if (!prs_uint16("server", ps, depth, &(q_s->server))) 65 return False; 66 67 if (!prs_align(ps)) 68 return False; 69 if (!prs_uint32("ptr_msg", ps, depth, &(q_s->ptr_msg))) 70 return False; 71 72 if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth)) 73 return False; 74 if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth)) 75 return False; 76 if (!prs_align(ps)) 77 return False; 78 79 if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) 80 return False; 81 if (!prs_uint8("force ", ps, depth, &(q_s->force))) 82 return False; 83 if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) 84 return False; 85 86 return True; 87} 88 89/******************************************************************* 90reads or writes a structure. 91********************************************************************/ 92BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps, 93 int depth) 94{ 95 if (r_s == NULL) 96 return False; 97 98 prs_debug(ps, depth, desc, "shutdown_io_r_init"); 99 depth++; 100 101 if(!prs_align(ps)) 102 return False; 103 104 if(!prs_ntstatus("status", ps, depth, &r_s->status)) 105 return False; 106 107 return True; 108} 109 110/******************************************************************* 111Inits a structure. 112********************************************************************/ 113void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s) 114{ 115 116 q_s->ptr_server = 0; 117 118} 119 120/******************************************************************* 121reads or writes a structure. 122********************************************************************/ 123BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, 124 prs_struct *ps, int depth) 125{ 126 if (q_s == NULL) 127 return False; 128 129 prs_debug(ps, depth, desc, "shutdown_io_q_abort"); 130 depth++; 131 132 if (!prs_align(ps)) 133 return False; 134 135 if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) 136 return False; 137 if (q_s->ptr_server != 0) 138 if (!prs_uint16("server", ps, depth, &(q_s->server))) 139 return False; 140 141 return True; 142} 143 144/******************************************************************* 145reads or writes a structure. 146********************************************************************/ 147BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s, 148 prs_struct *ps, int depth) 149{ 150 if (r_s == NULL) 151 return False; 152 153 prs_debug(ps, depth, desc, "shutdown_io_r_abort"); 154 depth++; 155 156 if (!prs_align(ps)) 157 return False; 158 159 if (!prs_ntstatus("status", ps, depth, &r_s->status)) 160 return False; 161 162 return True; 163} 164