2
/* Python wrapper functions auto-generated by pidl */
6
#include "librpc/rpc/pyrpc.h"
7
#include "librpc/rpc/pyrpc_util.h"
8
#include "librpc/gen_ndr/ndr_initshutdown.h"
9
#include "librpc/gen_ndr/ndr_initshutdown_c.h"
11
#include "librpc/gen_ndr/lsa.h"
12
staticforward PyTypeObject initshutdown_InterfaceType;
14
void initinitshutdown(void);static PyTypeObject *lsa_StringLarge_Type;
15
static PyTypeObject *ClientConnection_Type;
17
static bool pack_py_initshutdown_Init_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_Init *r)
19
PyObject *py_hostname;
22
PyObject *py_force_apps;
23
PyObject *py_do_reboot;
24
const char *kwnames[] = {
25
"hostname", "message", "timeout", "force_apps", "do_reboot", NULL
28
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:initshutdown_Init", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot)) {
32
if (py_hostname == Py_None) {
33
r->in.hostname = NULL;
35
r->in.hostname = talloc_ptrtype(r, r->in.hostname);
36
PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
37
*r->in.hostname = PyInt_AsLong(py_hostname);
39
if (py_message == Py_None) {
43
PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
44
if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
48
r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
50
PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
51
r->in.timeout = PyInt_AsLong(py_timeout);
52
PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
53
r->in.force_apps = PyInt_AsLong(py_force_apps);
54
PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
55
r->in.do_reboot = PyInt_AsLong(py_do_reboot);
59
static PyObject *unpack_py_initshutdown_Init_args_out(struct initshutdown_Init *r)
64
if (!W_ERROR_IS_OK(r->out.result)) {
65
PyErr_SetWERROR(r->out.result);
72
static bool pack_py_initshutdown_Abort_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_Abort *r)
75
const char *kwnames[] = {
79
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:initshutdown_Abort", discard_const_p(char *, kwnames), &py_server)) {
83
if (py_server == Py_None) {
86
r->in.server = talloc_ptrtype(r, r->in.server);
87
PY_CHECK_TYPE(&PyInt_Type, py_server, return false;);
88
*r->in.server = PyInt_AsLong(py_server);
93
static PyObject *unpack_py_initshutdown_Abort_args_out(struct initshutdown_Abort *r)
98
if (!W_ERROR_IS_OK(r->out.result)) {
99
PyErr_SetWERROR(r->out.result);
106
static bool pack_py_initshutdown_InitEx_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_InitEx *r)
108
PyObject *py_hostname;
109
PyObject *py_message;
110
PyObject *py_timeout;
111
PyObject *py_force_apps;
112
PyObject *py_do_reboot;
114
const char *kwnames[] = {
115
"hostname", "message", "timeout", "force_apps", "do_reboot", "reason", NULL
118
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:initshutdown_InitEx", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot, &py_reason)) {
122
if (py_hostname == Py_None) {
123
r->in.hostname = NULL;
125
r->in.hostname = talloc_ptrtype(r, r->in.hostname);
126
PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
127
*r->in.hostname = PyInt_AsLong(py_hostname);
129
if (py_message == Py_None) {
130
r->in.message = NULL;
132
r->in.message = NULL;
133
PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
134
if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
138
r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
140
PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
141
r->in.timeout = PyInt_AsLong(py_timeout);
142
PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
143
r->in.force_apps = PyInt_AsLong(py_force_apps);
144
PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
145
r->in.do_reboot = PyInt_AsLong(py_do_reboot);
146
PY_CHECK_TYPE(&PyInt_Type, py_reason, return false;);
147
r->in.reason = PyInt_AsLong(py_reason);
151
static PyObject *unpack_py_initshutdown_InitEx_args_out(struct initshutdown_InitEx *r)
156
if (!W_ERROR_IS_OK(r->out.result)) {
157
PyErr_SetWERROR(r->out.result);
164
const struct PyNdrRpcMethodDef py_ndr_initshutdown_methods[] = {
165
{ "Init", "S.Init(hostname, message, timeout, force_apps, do_reboot) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_Init_r, (py_data_pack_fn)pack_py_initshutdown_Init_args_in, (py_data_unpack_fn)unpack_py_initshutdown_Init_args_out, 0, &ndr_table_initshutdown },
166
{ "Abort", "S.Abort(server) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_Abort_r, (py_data_pack_fn)pack_py_initshutdown_Abort_args_in, (py_data_unpack_fn)unpack_py_initshutdown_Abort_args_out, 1, &ndr_table_initshutdown },
167
{ "InitEx", "S.InitEx(hostname, message, timeout, force_apps, do_reboot, reason) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_InitEx_r, (py_data_pack_fn)pack_py_initshutdown_InitEx_args_in, (py_data_unpack_fn)unpack_py_initshutdown_InitEx_args_out, 2, &ndr_table_initshutdown },
171
static PyObject *interface_initshutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
173
return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_initshutdown);
176
#define PY_DOC_INITSHUTDOWN "Init shutdown service"
177
static PyTypeObject initshutdown_InterfaceType = {
178
PyObject_HEAD_INIT(NULL) 0,
179
.tp_name = "initshutdown.initshutdown",
180
.tp_basicsize = sizeof(dcerpc_InterfaceObject),
181
.tp_doc = "initshutdown(binding, lp_ctx=None, credentials=None) -> connection\n"
183
"binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
184
"lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
185
"credentials should be a credentials.Credentials object.\n\n"PY_DOC_INITSHUTDOWN,
186
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
187
.tp_new = interface_initshutdown_new,
190
static PyMethodDef initshutdown_methods[] = {
191
{ NULL, NULL, 0, NULL }
194
void initinitshutdown(void)
197
PyObject *dep_samba_dcerpc_base;
198
PyObject *dep_samba_dcerpc_lsa;
200
dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
201
if (dep_samba_dcerpc_base == NULL)
204
dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
205
if (dep_samba_dcerpc_lsa == NULL)
208
lsa_StringLarge_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "StringLarge");
209
if (lsa_StringLarge_Type == NULL)
212
ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
213
if (ClientConnection_Type == NULL)
216
initshutdown_InterfaceType.tp_base = ClientConnection_Type;
218
if (PyType_Ready(&initshutdown_InterfaceType) < 0)
220
if (!PyInterface_AddNdrRpcMethods(&initshutdown_InterfaceType, py_ndr_initshutdown_methods))
223
#ifdef PY_INITSHUTDOWN_PATCH
224
PY_INITSHUTDOWN_PATCH(&initshutdown_InterfaceType);
227
m = Py_InitModule3("initshutdown", initshutdown_methods, "initshutdown DCE/RPC");
231
PyModule_AddObject(m, "SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY", PyInt_FromLong(SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY));
232
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_OPERATINGSYSTEM", PyInt_FromLong(SHTDN_REASON_MAJOR_OPERATINGSYSTEM));
233
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_HARDWARE", PyInt_FromLong(SHTDN_REASON_MAJOR_HARDWARE));
234
PyModule_AddObject(m, "SHTDN_REASON_MINOR_HUNG", PyInt_FromLong(SHTDN_REASON_MINOR_HUNG));
235
PyModule_AddObject(m, "SHTDN_REASON_MINOR_BLUESCREEN", PyInt_FromLong(SHTDN_REASON_MINOR_BLUESCREEN));
236
PyModule_AddObject(m, "SHTDN_REASON_MINOR_HARDWARE_DRIVER", PyInt_FromLong(SHTDN_REASON_MINOR_HARDWARE_DRIVER));
237
PyModule_AddObject(m, "SHTDN_REASON_MINOR_POWER_SUPPLY", PyInt_FromLong(SHTDN_REASON_MINOR_POWER_SUPPLY));
238
PyModule_AddObject(m, "SHTDN_REASON_MINOR_SERVICEPACK", PyInt_FromLong(SHTDN_REASON_MINOR_SERVICEPACK));
239
PyModule_AddObject(m, "SHTDN_REASON_MINOR_ENVIRONMENT", PyInt_FromLong(SHTDN_REASON_MINOR_ENVIRONMENT));
240
PyModule_AddObject(m, "SHTDN_REASON_MINOR_UPGRADE", PyInt_FromLong(SHTDN_REASON_MINOR_UPGRADE));
241
PyModule_AddObject(m, "SHTDN_REASON_MINOR_TERMSRV", PyInt_FromLong(SHTDN_REASON_MINOR_TERMSRV));
242
PyModule_AddObject(m, "SHTDN_REASON_MINOR_NETWORKCARD", PyInt_FromLong(SHTDN_REASON_MINOR_NETWORKCARD));
243
PyModule_AddObject(m, "SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL));
244
PyModule_AddObject(m, "SHTDN_REASON_MINOR_INSTALLATION", PyInt_FromLong(SHTDN_REASON_MINOR_INSTALLATION));
245
PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITYFIX", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITYFIX));
246
PyModule_AddObject(m, "SHTDN_REASON_MINOR_HOTFIX", PyInt_FromLong(SHTDN_REASON_MINOR_HOTFIX));
247
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_LEGACY_API", PyInt_FromLong(SHTDN_REASON_MAJOR_LEGACY_API));
248
PyModule_AddObject(m, "SHTDN_REASON_MINOR_OTHER", PyInt_FromLong(SHTDN_REASON_MINOR_OTHER));
249
PyModule_AddObject(m, "SHTDN_REASON_MINOR_HOTFIX_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_HOTFIX_UNINSTALL));
250
PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITY", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITY));
251
PyModule_AddObject(m, "SHTDN_REASON_MINOR_RECONFIG", PyInt_FromLong(SHTDN_REASON_MINOR_RECONFIG));
252
PyModule_AddObject(m, "SHTDN_REASON_MINOR_MMC", PyInt_FromLong(SHTDN_REASON_MINOR_MMC));
253
PyModule_AddObject(m, "SHTDN_REASON_MINOR_DISK", PyInt_FromLong(SHTDN_REASON_MINOR_DISK));
254
PyModule_AddObject(m, "SHTDN_REASON_MINOR_PROCESSOR", PyInt_FromLong(SHTDN_REASON_MINOR_PROCESSOR));
255
PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL));
256
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_OTHER", PyInt_FromLong(SHTDN_REASON_MAJOR_OTHER));
257
PyModule_AddObject(m, "SHTDN_REASON_MINOR_CORDUNPLUGGED", PyInt_FromLong(SHTDN_REASON_MINOR_CORDUNPLUGGED));
258
PyModule_AddObject(m, "SHTDN_REASON_FLAG_PLANNED", PyInt_FromLong(SHTDN_REASON_FLAG_PLANNED));
259
PyModule_AddObject(m, "SHTDN_REASON_MINOR_MAINTENANCE", PyInt_FromLong(SHTDN_REASON_MINOR_MAINTENANCE));
260
PyModule_AddObject(m, "SHTDN_REASON_FLAG_USER_DEFINED", PyInt_FromLong(SHTDN_REASON_FLAG_USER_DEFINED));
261
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_SOFTWARE", PyInt_FromLong(SHTDN_REASON_MAJOR_SOFTWARE));
262
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_APPLICATION", PyInt_FromLong(SHTDN_REASON_MAJOR_APPLICATION));
263
PyModule_AddObject(m, "SHTDN_REASON_MINOR_UNSTABLE", PyInt_FromLong(SHTDN_REASON_MINOR_UNSTABLE));
264
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_POWER", PyInt_FromLong(SHTDN_REASON_MAJOR_POWER));
265
PyModule_AddObject(m, "SHTDN_REASON_MINOR_WMI", PyInt_FromLong(SHTDN_REASON_MINOR_WMI));
266
PyModule_AddObject(m, "SHTDN_REASON_MINOR_OTHERDRIVER", PyInt_FromLong(SHTDN_REASON_MINOR_OTHERDRIVER));
267
PyModule_AddObject(m, "SHTDN_REASON_MAJOR_SYSTEM", PyInt_FromLong(SHTDN_REASON_MAJOR_SYSTEM));
268
Py_INCREF((PyObject *)(void *)&initshutdown_InterfaceType);
269
PyModule_AddObject(m, "initshutdown", (PyObject *)(void *)&initshutdown_InterfaceType);
270
#ifdef PY_MOD_INITSHUTDOWN_PATCH
271
PY_MOD_INITSHUTDOWN_PATCH(m);