2 /* Python wrapper functions auto-generated by pidl */
6 #include "librpc/rpc/pyrpc.h"
7 #include "librpc/rpc/pyrpc_util.h"
8 #include "bin/default/librpc/gen_ndr/ndr_atsvc.h"
9 #include "bin/default/librpc/gen_ndr/ndr_atsvc_c.h"
11 staticforward PyTypeObject atsvc_JobInfo_Type;
12 staticforward PyTypeObject atsvc_JobEnumInfo_Type;
13 staticforward PyTypeObject atsvc_enum_ctr_Type;
14 staticforward PyTypeObject atsvc_InterfaceType;
16 void initatsvc(void);static PyTypeObject *Object_Type;
17 static PyTypeObject *ClientConnection_Type;
19 static PyObject *py_atsvc_JobInfo_get_job_time(PyObject *obj, void *closure)
21 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(obj);
22 PyObject *py_job_time;
23 py_job_time = PyInt_FromLong(object->job_time);
27 static int py_atsvc_JobInfo_set_job_time(PyObject *py_obj, PyObject *value, void *closure)
29 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_obj);
30 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
31 object->job_time = PyInt_AsLong(value);
35 static PyObject *py_atsvc_JobInfo_get_days_of_month(PyObject *obj, void *closure)
37 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(obj);
38 PyObject *py_days_of_month;
39 py_days_of_month = PyInt_FromLong(object->days_of_month);
40 return py_days_of_month;
43 static int py_atsvc_JobInfo_set_days_of_month(PyObject *py_obj, PyObject *value, void *closure)
45 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_obj);
46 if (PyLong_Check(value)) {
47 object->days_of_month = PyLong_AsLongLong(value);
48 } else if (PyInt_Check(value)) {
49 object->days_of_month = PyInt_AsLong(value);
51 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
52 PyInt_Type.tp_name, PyLong_Type.tp_name);
58 static PyObject *py_atsvc_JobInfo_get_days_of_week(PyObject *obj, void *closure)
60 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(obj);
61 PyObject *py_days_of_week;
62 py_days_of_week = PyInt_FromLong(object->days_of_week);
63 return py_days_of_week;
66 static int py_atsvc_JobInfo_set_days_of_week(PyObject *py_obj, PyObject *value, void *closure)
68 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_obj);
69 if (PyLong_Check(value)) {
70 object->days_of_week = PyLong_AsLongLong(value);
71 } else if (PyInt_Check(value)) {
72 object->days_of_week = PyInt_AsLong(value);
74 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
75 PyInt_Type.tp_name, PyLong_Type.tp_name);
81 static PyObject *py_atsvc_JobInfo_get_flags(PyObject *obj, void *closure)
83 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(obj);
85 py_flags = PyInt_FromLong(object->flags);
89 static int py_atsvc_JobInfo_set_flags(PyObject *py_obj, PyObject *value, void *closure)
91 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_obj);
92 if (PyLong_Check(value)) {
93 object->flags = PyLong_AsLongLong(value);
94 } else if (PyInt_Check(value)) {
95 object->flags = PyInt_AsLong(value);
97 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
98 PyInt_Type.tp_name, PyLong_Type.tp_name);
104 static PyObject *py_atsvc_JobInfo_get_command(PyObject *obj, void *closure)
106 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(obj);
107 PyObject *py_command;
108 if (object->command == NULL) {
109 py_command = Py_None;
110 Py_INCREF(py_command);
112 if (object->command == NULL) {
113 py_command = Py_None;
114 Py_INCREF(py_command);
116 py_command = PyUnicode_Decode(object->command, strlen(object->command), "utf-8", "ignore");
122 static int py_atsvc_JobInfo_set_command(PyObject *py_obj, PyObject *value, void *closure)
124 struct atsvc_JobInfo *object = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_obj);
125 if (value == Py_None) {
126 object->command = NULL;
128 object->command = NULL;
129 if (PyUnicode_Check(value)) {
130 object->command = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
131 } else if (PyString_Check(value)) {
132 object->command = PyString_AS_STRING(value);
134 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
141 static PyGetSetDef py_atsvc_JobInfo_getsetters[] = {
142 { discard_const_p(char, "job_time"), py_atsvc_JobInfo_get_job_time, py_atsvc_JobInfo_set_job_time },
143 { discard_const_p(char, "days_of_month"), py_atsvc_JobInfo_get_days_of_month, py_atsvc_JobInfo_set_days_of_month },
144 { discard_const_p(char, "days_of_week"), py_atsvc_JobInfo_get_days_of_week, py_atsvc_JobInfo_set_days_of_week },
145 { discard_const_p(char, "flags"), py_atsvc_JobInfo_get_flags, py_atsvc_JobInfo_set_flags },
146 { discard_const_p(char, "command"), py_atsvc_JobInfo_get_command, py_atsvc_JobInfo_set_command },
150 static PyObject *py_atsvc_JobInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
152 return pytalloc_new(struct atsvc_JobInfo, type);
156 static PyTypeObject atsvc_JobInfo_Type = {
157 PyObject_HEAD_INIT(NULL) 0,
158 .tp_name = "atsvc.JobInfo",
159 .tp_getset = py_atsvc_JobInfo_getsetters,
161 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
162 .tp_basicsize = sizeof(pytalloc_Object),
163 .tp_new = py_atsvc_JobInfo_new,
167 static PyObject *py_atsvc_JobEnumInfo_get_job_id(PyObject *obj, void *closure)
169 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
171 py_job_id = PyInt_FromLong(object->job_id);
175 static int py_atsvc_JobEnumInfo_set_job_id(PyObject *py_obj, PyObject *value, void *closure)
177 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
178 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
179 object->job_id = PyInt_AsLong(value);
183 static PyObject *py_atsvc_JobEnumInfo_get_job_time(PyObject *obj, void *closure)
185 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
186 PyObject *py_job_time;
187 py_job_time = PyInt_FromLong(object->job_time);
191 static int py_atsvc_JobEnumInfo_set_job_time(PyObject *py_obj, PyObject *value, void *closure)
193 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
194 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
195 object->job_time = PyInt_AsLong(value);
199 static PyObject *py_atsvc_JobEnumInfo_get_days_of_month(PyObject *obj, void *closure)
201 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
202 PyObject *py_days_of_month;
203 py_days_of_month = PyInt_FromLong(object->days_of_month);
204 return py_days_of_month;
207 static int py_atsvc_JobEnumInfo_set_days_of_month(PyObject *py_obj, PyObject *value, void *closure)
209 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
210 if (PyLong_Check(value)) {
211 object->days_of_month = PyLong_AsLongLong(value);
212 } else if (PyInt_Check(value)) {
213 object->days_of_month = PyInt_AsLong(value);
215 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
216 PyInt_Type.tp_name, PyLong_Type.tp_name);
222 static PyObject *py_atsvc_JobEnumInfo_get_days_of_week(PyObject *obj, void *closure)
224 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
225 PyObject *py_days_of_week;
226 py_days_of_week = PyInt_FromLong(object->days_of_week);
227 return py_days_of_week;
230 static int py_atsvc_JobEnumInfo_set_days_of_week(PyObject *py_obj, PyObject *value, void *closure)
232 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
233 if (PyLong_Check(value)) {
234 object->days_of_week = PyLong_AsLongLong(value);
235 } else if (PyInt_Check(value)) {
236 object->days_of_week = PyInt_AsLong(value);
238 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
239 PyInt_Type.tp_name, PyLong_Type.tp_name);
245 static PyObject *py_atsvc_JobEnumInfo_get_flags(PyObject *obj, void *closure)
247 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
249 py_flags = PyInt_FromLong(object->flags);
253 static int py_atsvc_JobEnumInfo_set_flags(PyObject *py_obj, PyObject *value, void *closure)
255 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
256 if (PyLong_Check(value)) {
257 object->flags = PyLong_AsLongLong(value);
258 } else if (PyInt_Check(value)) {
259 object->flags = PyInt_AsLong(value);
261 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
262 PyInt_Type.tp_name, PyLong_Type.tp_name);
268 static PyObject *py_atsvc_JobEnumInfo_get_command(PyObject *obj, void *closure)
270 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(obj);
271 PyObject *py_command;
272 if (object->command == NULL) {
273 py_command = Py_None;
274 Py_INCREF(py_command);
276 if (object->command == NULL) {
277 py_command = Py_None;
278 Py_INCREF(py_command);
280 py_command = PyUnicode_Decode(object->command, strlen(object->command), "utf-8", "ignore");
286 static int py_atsvc_JobEnumInfo_set_command(PyObject *py_obj, PyObject *value, void *closure)
288 struct atsvc_JobEnumInfo *object = (struct atsvc_JobEnumInfo *)pytalloc_get_ptr(py_obj);
289 if (value == Py_None) {
290 object->command = NULL;
292 object->command = NULL;
293 if (PyUnicode_Check(value)) {
294 object->command = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
295 } else if (PyString_Check(value)) {
296 object->command = PyString_AS_STRING(value);
298 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
305 static PyGetSetDef py_atsvc_JobEnumInfo_getsetters[] = {
306 { discard_const_p(char, "job_id"), py_atsvc_JobEnumInfo_get_job_id, py_atsvc_JobEnumInfo_set_job_id },
307 { discard_const_p(char, "job_time"), py_atsvc_JobEnumInfo_get_job_time, py_atsvc_JobEnumInfo_set_job_time },
308 { discard_const_p(char, "days_of_month"), py_atsvc_JobEnumInfo_get_days_of_month, py_atsvc_JobEnumInfo_set_days_of_month },
309 { discard_const_p(char, "days_of_week"), py_atsvc_JobEnumInfo_get_days_of_week, py_atsvc_JobEnumInfo_set_days_of_week },
310 { discard_const_p(char, "flags"), py_atsvc_JobEnumInfo_get_flags, py_atsvc_JobEnumInfo_set_flags },
311 { discard_const_p(char, "command"), py_atsvc_JobEnumInfo_get_command, py_atsvc_JobEnumInfo_set_command },
315 static PyObject *py_atsvc_JobEnumInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
317 return pytalloc_new(struct atsvc_JobEnumInfo, type);
321 static PyTypeObject atsvc_JobEnumInfo_Type = {
322 PyObject_HEAD_INIT(NULL) 0,
323 .tp_name = "atsvc.JobEnumInfo",
324 .tp_getset = py_atsvc_JobEnumInfo_getsetters,
326 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
327 .tp_basicsize = sizeof(pytalloc_Object),
328 .tp_new = py_atsvc_JobEnumInfo_new,
332 static PyObject *py_atsvc_enum_ctr_get_entries_read(PyObject *obj, void *closure)
334 struct atsvc_enum_ctr *object = (struct atsvc_enum_ctr *)pytalloc_get_ptr(obj);
335 PyObject *py_entries_read;
336 py_entries_read = PyInt_FromLong(object->entries_read);
337 return py_entries_read;
340 static int py_atsvc_enum_ctr_set_entries_read(PyObject *py_obj, PyObject *value, void *closure)
342 struct atsvc_enum_ctr *object = (struct atsvc_enum_ctr *)pytalloc_get_ptr(py_obj);
343 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
344 object->entries_read = PyInt_AsLong(value);
348 static PyObject *py_atsvc_enum_ctr_get_first_entry(PyObject *obj, void *closure)
350 struct atsvc_enum_ctr *object = (struct atsvc_enum_ctr *)pytalloc_get_ptr(obj);
351 PyObject *py_first_entry;
352 if (object->first_entry == NULL) {
353 py_first_entry = Py_None;
354 Py_INCREF(py_first_entry);
356 py_first_entry = PyList_New(object->entries_read);
357 if (py_first_entry == NULL) {
361 int first_entry_cntr_1;
362 for (first_entry_cntr_1 = 0; first_entry_cntr_1 < object->entries_read; first_entry_cntr_1++) {
363 PyObject *py_first_entry_1;
364 py_first_entry_1 = pytalloc_reference_ex(&atsvc_JobEnumInfo_Type, object->first_entry, &object->first_entry[first_entry_cntr_1]);
365 PyList_SetItem(py_first_entry, first_entry_cntr_1, py_first_entry_1);
369 return py_first_entry;
372 static int py_atsvc_enum_ctr_set_first_entry(PyObject *py_obj, PyObject *value, void *closure)
374 struct atsvc_enum_ctr *object = (struct atsvc_enum_ctr *)pytalloc_get_ptr(py_obj);
375 talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->first_entry);
376 if (value == Py_None) {
377 object->first_entry = NULL;
379 object->first_entry = NULL;
380 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
382 int first_entry_cntr_1;
383 object->first_entry = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->first_entry, PyList_GET_SIZE(value));
384 if (!object->first_entry) { return -1;; }
385 talloc_set_name_const(object->first_entry, "ARRAY: object->first_entry");
386 for (first_entry_cntr_1 = 0; first_entry_cntr_1 < PyList_GET_SIZE(value); first_entry_cntr_1++) {
387 PY_CHECK_TYPE(&atsvc_JobEnumInfo_Type, PyList_GET_ITEM(value, first_entry_cntr_1), return -1;);
388 if (talloc_reference(object->first_entry, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, first_entry_cntr_1))) == NULL) {
392 object->first_entry[first_entry_cntr_1] = *(struct atsvc_JobEnumInfo *)pytalloc_get_ptr(PyList_GET_ITEM(value, first_entry_cntr_1));
399 static PyGetSetDef py_atsvc_enum_ctr_getsetters[] = {
400 { discard_const_p(char, "entries_read"), py_atsvc_enum_ctr_get_entries_read, py_atsvc_enum_ctr_set_entries_read },
401 { discard_const_p(char, "first_entry"), py_atsvc_enum_ctr_get_first_entry, py_atsvc_enum_ctr_set_first_entry },
405 static PyObject *py_atsvc_enum_ctr_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
407 return pytalloc_new(struct atsvc_enum_ctr, type);
411 static PyTypeObject atsvc_enum_ctr_Type = {
412 PyObject_HEAD_INIT(NULL) 0,
413 .tp_name = "atsvc.enum_ctr",
414 .tp_getset = py_atsvc_enum_ctr_getsetters,
416 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
417 .tp_basicsize = sizeof(pytalloc_Object),
418 .tp_new = py_atsvc_enum_ctr_new,
422 static bool pack_py_atsvc_JobAdd_args_in(PyObject *args, PyObject *kwargs, struct atsvc_JobAdd *r)
424 PyObject *py_servername;
425 PyObject *py_job_info;
426 const char *kwnames[] = {
427 "servername", "job_info", NULL
430 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:atsvc_JobAdd", discard_const_p(char *, kwnames), &py_servername, &py_job_info)) {
434 if (py_servername == Py_None) {
435 r->in.servername = NULL;
437 r->in.servername = NULL;
438 if (PyUnicode_Check(py_servername)) {
439 r->in.servername = PyString_AS_STRING(PyUnicode_AsEncodedString(py_servername, "utf-8", "ignore"));
440 } else if (PyString_Check(py_servername)) {
441 r->in.servername = PyString_AS_STRING(py_servername);
443 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_servername)->tp_name);
447 r->in.job_info = talloc_ptrtype(r, r->in.job_info);
448 PY_CHECK_TYPE(&atsvc_JobInfo_Type, py_job_info, return false;);
449 if (talloc_reference(r, pytalloc_get_mem_ctx(py_job_info)) == NULL) {
453 r->in.job_info = (struct atsvc_JobInfo *)pytalloc_get_ptr(py_job_info);
457 static PyObject *unpack_py_atsvc_JobAdd_args_out(struct atsvc_JobAdd *r)
461 py_job_id = PyInt_FromLong(*r->out.job_id);
463 if (NT_STATUS_IS_ERR(r->out.result)) {
464 PyErr_SetNTSTATUS(r->out.result);
471 static bool pack_py_atsvc_JobDel_args_in(PyObject *args, PyObject *kwargs, struct atsvc_JobDel *r)
473 PyObject *py_servername;
474 PyObject *py_min_job_id;
475 PyObject *py_max_job_id;
476 const char *kwnames[] = {
477 "servername", "min_job_id", "max_job_id", NULL
480 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:atsvc_JobDel", discard_const_p(char *, kwnames), &py_servername, &py_min_job_id, &py_max_job_id)) {
484 if (py_servername == Py_None) {
485 r->in.servername = NULL;
487 r->in.servername = NULL;
488 if (PyUnicode_Check(py_servername)) {
489 r->in.servername = PyString_AS_STRING(PyUnicode_AsEncodedString(py_servername, "utf-8", "ignore"));
490 } else if (PyString_Check(py_servername)) {
491 r->in.servername = PyString_AS_STRING(py_servername);
493 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_servername)->tp_name);
497 PY_CHECK_TYPE(&PyInt_Type, py_min_job_id, return false;);
498 r->in.min_job_id = PyInt_AsLong(py_min_job_id);
499 PY_CHECK_TYPE(&PyInt_Type, py_max_job_id, return false;);
500 r->in.max_job_id = PyInt_AsLong(py_max_job_id);
504 static PyObject *unpack_py_atsvc_JobDel_args_out(struct atsvc_JobDel *r)
509 if (NT_STATUS_IS_ERR(r->out.result)) {
510 PyErr_SetNTSTATUS(r->out.result);
517 static bool pack_py_atsvc_JobEnum_args_in(PyObject *args, PyObject *kwargs, struct atsvc_JobEnum *r)
519 PyObject *py_servername;
521 PyObject *py_preferred_max_len;
522 PyObject *py_resume_handle;
523 const char *kwnames[] = {
524 "servername", "ctr", "preferred_max_len", "resume_handle", NULL
527 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:atsvc_JobEnum", discard_const_p(char *, kwnames), &py_servername, &py_ctr, &py_preferred_max_len, &py_resume_handle)) {
531 if (py_servername == Py_None) {
532 r->in.servername = NULL;
534 r->in.servername = NULL;
535 if (PyUnicode_Check(py_servername)) {
536 r->in.servername = PyString_AS_STRING(PyUnicode_AsEncodedString(py_servername, "utf-8", "ignore"));
537 } else if (PyString_Check(py_servername)) {
538 r->in.servername = PyString_AS_STRING(py_servername);
540 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_servername)->tp_name);
544 r->in.ctr = talloc_ptrtype(r, r->in.ctr);
545 PY_CHECK_TYPE(&atsvc_enum_ctr_Type, py_ctr, return false;);
546 if (talloc_reference(r, pytalloc_get_mem_ctx(py_ctr)) == NULL) {
550 r->in.ctr = (struct atsvc_enum_ctr *)pytalloc_get_ptr(py_ctr);
551 PY_CHECK_TYPE(&PyInt_Type, py_preferred_max_len, return false;);
552 r->in.preferred_max_len = PyInt_AsLong(py_preferred_max_len);
553 if (py_resume_handle == Py_None) {
554 r->in.resume_handle = NULL;
556 r->in.resume_handle = talloc_ptrtype(r, r->in.resume_handle);
557 PY_CHECK_TYPE(&PyInt_Type, py_resume_handle, return false;);
558 *r->in.resume_handle = PyInt_AsLong(py_resume_handle);
563 static PyObject *unpack_py_atsvc_JobEnum_args_out(struct atsvc_JobEnum *r)
567 PyObject *py_total_entries;
568 PyObject *py_resume_handle;
569 result = PyTuple_New(3);
570 py_ctr = pytalloc_reference_ex(&atsvc_enum_ctr_Type, r->out.ctr, r->out.ctr);
571 PyTuple_SetItem(result, 0, py_ctr);
572 py_total_entries = PyInt_FromLong(*r->out.total_entries);
573 PyTuple_SetItem(result, 1, py_total_entries);
574 if (r->out.resume_handle == NULL) {
575 py_resume_handle = Py_None;
576 Py_INCREF(py_resume_handle);
578 py_resume_handle = PyInt_FromLong(*r->out.resume_handle);
580 PyTuple_SetItem(result, 2, py_resume_handle);
581 if (NT_STATUS_IS_ERR(r->out.result)) {
582 PyErr_SetNTSTATUS(r->out.result);
589 static bool pack_py_atsvc_JobGetInfo_args_in(PyObject *args, PyObject *kwargs, struct atsvc_JobGetInfo *r)
591 PyObject *py_servername;
593 const char *kwnames[] = {
594 "servername", "job_id", NULL
597 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:atsvc_JobGetInfo", discard_const_p(char *, kwnames), &py_servername, &py_job_id)) {
601 if (py_servername == Py_None) {
602 r->in.servername = NULL;
604 r->in.servername = NULL;
605 if (PyUnicode_Check(py_servername)) {
606 r->in.servername = PyString_AS_STRING(PyUnicode_AsEncodedString(py_servername, "utf-8", "ignore"));
607 } else if (PyString_Check(py_servername)) {
608 r->in.servername = PyString_AS_STRING(py_servername);
610 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_servername)->tp_name);
614 PY_CHECK_TYPE(&PyInt_Type, py_job_id, return false;);
615 r->in.job_id = PyInt_AsLong(py_job_id);
619 static PyObject *unpack_py_atsvc_JobGetInfo_args_out(struct atsvc_JobGetInfo *r)
622 PyObject *py_job_info;
623 if (*r->out.job_info == NULL) {
624 py_job_info = Py_None;
625 Py_INCREF(py_job_info);
627 py_job_info = pytalloc_reference_ex(&atsvc_JobInfo_Type, *r->out.job_info, *r->out.job_info);
629 result = py_job_info;
630 if (NT_STATUS_IS_ERR(r->out.result)) {
631 PyErr_SetNTSTATUS(r->out.result);
638 const struct PyNdrRpcMethodDef py_ndr_atsvc_methods[] = {
639 { "JobAdd", "S.JobAdd(servername, job_info) -> job_id", (py_dcerpc_call_fn)dcerpc_atsvc_JobAdd_r, (py_data_pack_fn)pack_py_atsvc_JobAdd_args_in, (py_data_unpack_fn)unpack_py_atsvc_JobAdd_args_out, 0, &ndr_table_atsvc },
640 { "JobDel", "S.JobDel(servername, min_job_id, max_job_id) -> None", (py_dcerpc_call_fn)dcerpc_atsvc_JobDel_r, (py_data_pack_fn)pack_py_atsvc_JobDel_args_in, (py_data_unpack_fn)unpack_py_atsvc_JobDel_args_out, 1, &ndr_table_atsvc },
641 { "JobEnum", "S.JobEnum(servername, ctr, preferred_max_len, resume_handle) -> (ctr, total_entries, resume_handle)", (py_dcerpc_call_fn)dcerpc_atsvc_JobEnum_r, (py_data_pack_fn)pack_py_atsvc_JobEnum_args_in, (py_data_unpack_fn)unpack_py_atsvc_JobEnum_args_out, 2, &ndr_table_atsvc },
642 { "JobGetInfo", "S.JobGetInfo(servername, job_id) -> job_info", (py_dcerpc_call_fn)dcerpc_atsvc_JobGetInfo_r, (py_data_pack_fn)pack_py_atsvc_JobGetInfo_args_in, (py_data_unpack_fn)unpack_py_atsvc_JobGetInfo_args_out, 3, &ndr_table_atsvc },
646 static PyObject *interface_atsvc_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
648 return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_atsvc);
651 #define PY_DOC_ATSVC "Microsoft AT-Scheduler Service"
652 static PyTypeObject atsvc_InterfaceType = {
653 PyObject_HEAD_INIT(NULL) 0,
654 .tp_name = "atsvc.atsvc",
655 .tp_basicsize = sizeof(dcerpc_InterfaceObject),
656 .tp_doc = "atsvc(binding, lp_ctx=None, credentials=None) -> connection\n"
658 "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
659 "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
660 "credentials should be a credentials.Credentials object.\n\n"PY_DOC_ATSVC,
661 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
662 .tp_new = interface_atsvc_new,
665 static PyMethodDef atsvc_methods[] = {
666 { NULL, NULL, 0, NULL }
672 PyObject *dep_talloc;
673 PyObject *dep_samba_dcerpc_base;
675 dep_talloc = PyImport_ImportModule("talloc");
676 if (dep_talloc == NULL)
679 dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
680 if (dep_samba_dcerpc_base == NULL)
683 Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
684 if (Object_Type == NULL)
687 ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
688 if (ClientConnection_Type == NULL)
691 atsvc_JobInfo_Type.tp_base = Object_Type;
693 atsvc_JobEnumInfo_Type.tp_base = Object_Type;
695 atsvc_enum_ctr_Type.tp_base = Object_Type;
697 atsvc_InterfaceType.tp_base = ClientConnection_Type;
699 if (PyType_Ready(&atsvc_JobInfo_Type) < 0)
701 if (PyType_Ready(&atsvc_JobEnumInfo_Type) < 0)
703 if (PyType_Ready(&atsvc_enum_ctr_Type) < 0)
705 if (PyType_Ready(&atsvc_InterfaceType) < 0)
707 if (!PyInterface_AddNdrRpcMethods(&atsvc_InterfaceType, py_ndr_atsvc_methods))
710 #ifdef PY_JOBINFO_PATCH
711 PY_JOBINFO_PATCH(&atsvc_JobInfo_Type);
713 #ifdef PY_JOBENUMINFO_PATCH
714 PY_JOBENUMINFO_PATCH(&atsvc_JobEnumInfo_Type);
716 #ifdef PY_ENUM_CTR_PATCH
717 PY_ENUM_CTR_PATCH(&atsvc_enum_ctr_Type);
719 #ifdef PY_ATSVC_PATCH
720 PY_ATSVC_PATCH(&atsvc_InterfaceType);
723 m = Py_InitModule3("atsvc", atsvc_methods, "atsvc DCE/RPC");
727 PyModule_AddObject(m, "Twentyeighth", PyInt_FromLong(Twentyeighth));
728 PyModule_AddObject(m, "Twentythird", PyInt_FromLong(Twentythird));
729 PyModule_AddObject(m, "Fifth", PyInt_FromLong(Fifth));
730 PyModule_AddObject(m, "Thitteenth", PyInt_FromLong(Thitteenth));
731 PyModule_AddObject(m, "Fourteenth", PyInt_FromLong(Fourteenth));
732 PyModule_AddObject(m, "JOB_EXEC_ERROR", PyInt_FromLong(JOB_EXEC_ERROR));
733 PyModule_AddObject(m, "Seventh", PyInt_FromLong(Seventh));
734 PyModule_AddObject(m, "DAYSOFWEEK_WEDNESDAY", PyInt_FromLong(DAYSOFWEEK_WEDNESDAY));
735 PyModule_AddObject(m, "Twentysecond", PyInt_FromLong(Twentysecond));
736 PyModule_AddObject(m, "Ninteenth", PyInt_FromLong(Ninteenth));
737 PyModule_AddObject(m, "DAYSOFWEEK_FRIDAY", PyInt_FromLong(DAYSOFWEEK_FRIDAY));
738 PyModule_AddObject(m, "Twentysixth", PyInt_FromLong(Twentysixth));
739 PyModule_AddObject(m, "Sixth", PyInt_FromLong(Sixth));
740 PyModule_AddObject(m, "JOB_RUNS_TODAY", PyInt_FromLong(JOB_RUNS_TODAY));
741 PyModule_AddObject(m, "Twelfth", PyInt_FromLong(Twelfth));
742 PyModule_AddObject(m, "Fifteenth", PyInt_FromLong(Fifteenth));
743 PyModule_AddObject(m, "JOB_ADD_CURRENT_DATE", PyInt_FromLong(JOB_ADD_CURRENT_DATE));
744 PyModule_AddObject(m, "Thirtyfirst", PyInt_FromLong(Thirtyfirst));
745 PyModule_AddObject(m, "Eighteenth", PyInt_FromLong(Eighteenth));
746 PyModule_AddObject(m, "Eight", PyInt_FromLong(Eight));
747 PyModule_AddObject(m, "JOB_RUN_PERIODICALLY", PyInt_FromLong(JOB_RUN_PERIODICALLY));
748 PyModule_AddObject(m, "Second", PyInt_FromLong(Second));
749 PyModule_AddObject(m, "Ninth", PyInt_FromLong(Ninth));
750 PyModule_AddObject(m, "Tenth", PyInt_FromLong(Tenth));
751 PyModule_AddObject(m, "Twentyfirst", PyInt_FromLong(Twentyfirst));
752 PyModule_AddObject(m, "Twentyth", PyInt_FromLong(Twentyth));
753 PyModule_AddObject(m, "DAYSOFWEEK_THURSDAY", PyInt_FromLong(DAYSOFWEEK_THURSDAY));
754 PyModule_AddObject(m, "DAYSOFWEEK_MONDAY", PyInt_FromLong(DAYSOFWEEK_MONDAY));
755 PyModule_AddObject(m, "JOB_NONINTERACTIVE", PyInt_FromLong(JOB_NONINTERACTIVE));
756 PyModule_AddObject(m, "Fourth", PyInt_FromLong(Fourth));
757 PyModule_AddObject(m, "Twentyfifth", PyInt_FromLong(Twentyfifth));
758 PyModule_AddObject(m, "Sixteenth", PyInt_FromLong(Sixteenth));
759 PyModule_AddObject(m, "DAYSOFWEEK_SUNDAY", PyInt_FromLong(DAYSOFWEEK_SUNDAY));
760 PyModule_AddObject(m, "DAYSOFWEEK_SATURDAY", PyInt_FromLong(DAYSOFWEEK_SATURDAY));
761 PyModule_AddObject(m, "Eleventh", PyInt_FromLong(Eleventh));
762 PyModule_AddObject(m, "Twentyseventh", PyInt_FromLong(Twentyseventh));
763 PyModule_AddObject(m, "Seventeenth", PyInt_FromLong(Seventeenth));
764 PyModule_AddObject(m, "Twentyfourth", PyInt_FromLong(Twentyfourth));
765 PyModule_AddObject(m, "DAYSOFWEEK_TUESDAY", PyInt_FromLong(DAYSOFWEEK_TUESDAY));
766 PyModule_AddObject(m, "Thirtieth", PyInt_FromLong(Thirtieth));
767 PyModule_AddObject(m, "First", PyInt_FromLong(First));
768 PyModule_AddObject(m, "Third", PyInt_FromLong(Third));
769 PyModule_AddObject(m, "Twentyninth", PyInt_FromLong(Twentyninth));
770 Py_INCREF((PyObject *)(void *)&atsvc_JobInfo_Type);
771 PyModule_AddObject(m, "JobInfo", (PyObject *)(void *)&atsvc_JobInfo_Type);
772 Py_INCREF((PyObject *)(void *)&atsvc_JobEnumInfo_Type);
773 PyModule_AddObject(m, "JobEnumInfo", (PyObject *)(void *)&atsvc_JobEnumInfo_Type);
774 Py_INCREF((PyObject *)(void *)&atsvc_enum_ctr_Type);
775 PyModule_AddObject(m, "enum_ctr", (PyObject *)(void *)&atsvc_enum_ctr_Type);
776 Py_INCREF((PyObject *)(void *)&atsvc_InterfaceType);
777 PyModule_AddObject(m, "atsvc", (PyObject *)(void *)&atsvc_InterfaceType);
778 #ifdef PY_MOD_ATSVC_PATCH
779 PY_MOD_ATSVC_PATCH(m);