2 /* Python wrapper functions auto-generated by pidl */
3 #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
7 #include "librpc/rpc/pyrpc.h"
8 #include "librpc/rpc/pyrpc_util.h"
9 #include "bin/default/librpc/gen_ndr/ndr_notify.h"
10 #include "bin/default/librpc/gen_ndr/ndr_notify_c.h"
13 * These functions are here to ensure they can be optimized out by
14 * the compiler based on the constant input values
17 static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 static inline long long ndr_sizeof2intmax(size_t var_size)
49 static inline PyObject *ndr_PyLong_FromLongLong(long long v)
51 if (v > LONG_MAX || v < LONG_MIN) {
52 return PyLong_FromLongLong(v);
54 return PyInt_FromLong(v);
58 static inline PyObject *ndr_PyLong_FromUnsignedLongLong(unsigned long long v)
61 return PyLong_FromUnsignedLongLong(v);
63 return PyInt_FromLong(v);
67 #include "librpc/gen_ndr/file_id.h"
68 #include "librpc/gen_ndr/server_id.h"
69 static PyTypeObject notify_entry_Type;
70 static PyTypeObject notify_entry_array_Type;
71 static PyTypeObject notify_db_entry_Type;
72 static PyTypeObject notify_depth_Type;
73 static PyTypeObject notify_array_Type;
74 static PyTypeObject notify_event_Type;
75 static PyTypeObject notify_remote_event_Type;
76 static PyTypeObject FILE_NOTIFY_INFORMATION_Type;
78 void initnotify(void);static PyTypeObject *server_id_Type;
79 static PyTypeObject *file_id_Type;
80 static PyTypeObject *BaseObject_Type;
82 static PyObject *py_notify_entry_get_server(PyObject *obj, void *closure)
84 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
86 py_server = pytalloc_reference_ex(server_id_Type, pytalloc_get_mem_ctx(obj), &object->server);
90 static int py_notify_entry_set_server(PyObject *py_obj, PyObject *value, void *closure)
92 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
94 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->server");
97 PY_CHECK_TYPE(server_id_Type, value, return -1;);
98 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
102 object->server = *(struct server_id *)pytalloc_get_ptr(value);
106 static PyObject *py_notify_entry_get_filter(PyObject *obj, void *closure)
108 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
110 py_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->filter);
114 static int py_notify_entry_set_filter(PyObject *py_obj, PyObject *value, void *closure)
116 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
118 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->filter");
122 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->filter));
123 if (PyLong_Check(value)) {
124 unsigned long long test_var;
125 test_var = PyLong_AsUnsignedLongLong(value);
126 if (PyErr_Occurred() != NULL) {
129 if (test_var > uint_max) {
130 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
131 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
134 object->filter = test_var;
135 } else if (PyInt_Check(value)) {
137 test_var = PyInt_AsLong(value);
138 if (test_var < 0 || test_var > uint_max) {
139 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
140 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
143 object->filter = test_var;
145 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
146 PyInt_Type.tp_name, PyLong_Type.tp_name);
153 static PyObject *py_notify_entry_get_subdir_filter(PyObject *obj, void *closure)
155 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
156 PyObject *py_subdir_filter;
157 py_subdir_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->subdir_filter);
158 return py_subdir_filter;
161 static int py_notify_entry_set_subdir_filter(PyObject *py_obj, PyObject *value, void *closure)
163 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
165 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->subdir_filter");
169 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->subdir_filter));
170 if (PyLong_Check(value)) {
171 unsigned long long test_var;
172 test_var = PyLong_AsUnsignedLongLong(value);
173 if (PyErr_Occurred() != NULL) {
176 if (test_var > uint_max) {
177 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
178 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
181 object->subdir_filter = test_var;
182 } else if (PyInt_Check(value)) {
184 test_var = PyInt_AsLong(value);
185 if (test_var < 0 || test_var > uint_max) {
186 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
187 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
190 object->subdir_filter = test_var;
192 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
193 PyInt_Type.tp_name, PyLong_Type.tp_name);
200 static PyObject *py_notify_entry_get_dir_fd(PyObject *obj, void *closure)
202 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
204 py_dir_fd = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->dir_fd);
208 static int py_notify_entry_set_dir_fd(PyObject *py_obj, PyObject *value, void *closure)
210 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
212 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dir_fd");
216 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->dir_fd));
217 if (PyLong_Check(value)) {
218 unsigned long long test_var;
219 test_var = PyLong_AsUnsignedLongLong(value);
220 if (PyErr_Occurred() != NULL) {
223 if (test_var > uint_max) {
224 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
225 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
228 object->dir_fd = test_var;
229 } else if (PyInt_Check(value)) {
231 test_var = PyInt_AsLong(value);
232 if (test_var < 0 || test_var > uint_max) {
233 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
234 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
237 object->dir_fd = test_var;
239 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
240 PyInt_Type.tp_name, PyLong_Type.tp_name);
247 static PyObject *py_notify_entry_get_dir_id(PyObject *obj, void *closure)
249 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
251 py_dir_id = pytalloc_reference_ex(file_id_Type, pytalloc_get_mem_ctx(obj), &object->dir_id);
255 static int py_notify_entry_set_dir_id(PyObject *py_obj, PyObject *value, void *closure)
257 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
259 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dir_id");
262 PY_CHECK_TYPE(file_id_Type, value, return -1;);
263 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
267 object->dir_id = *(struct file_id *)pytalloc_get_ptr(value);
271 static PyObject *py_notify_entry_get_path(PyObject *obj, void *closure)
273 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
275 py_path = PyString_FromStringOrNULL(object->path);
279 static int py_notify_entry_set_path(PyObject *py_obj, PyObject *value, void *closure)
281 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
283 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path");
287 const char *test_str;
288 const char *talloc_str;
289 PyObject *unicode = NULL;
290 if (PyUnicode_Check(value)) {
291 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
292 if (unicode == NULL) {
296 test_str = PyString_AS_STRING(unicode);
297 } else if (PyString_Check(value)) {
298 test_str = PyString_AS_STRING(value);
300 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
303 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
304 if (unicode != NULL) {
307 if (talloc_str == NULL) {
311 object->path = talloc_str;
316 static PyObject *py_notify_entry_get_path_len(PyObject *obj, void *closure)
318 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
319 PyObject *py_path_len;
320 py_path_len = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->path_len);
324 static int py_notify_entry_set_path_len(PyObject *py_obj, PyObject *value, void *closure)
326 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
328 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path_len");
332 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->path_len));
333 if (PyLong_Check(value)) {
334 unsigned long long test_var;
335 test_var = PyLong_AsUnsignedLongLong(value);
336 if (PyErr_Occurred() != NULL) {
339 if (test_var > uint_max) {
340 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
341 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
344 object->path_len = test_var;
345 } else if (PyInt_Check(value)) {
347 test_var = PyInt_AsLong(value);
348 if (test_var < 0 || test_var > uint_max) {
349 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
350 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
353 object->path_len = test_var;
355 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
356 PyInt_Type.tp_name, PyLong_Type.tp_name);
363 static PyObject *py_notify_entry_get_private_data(PyObject *obj, void *closure)
365 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
366 PyObject *py_private_data;
367 py_private_data = pytalloc_CObject_FromTallocPtr(object->private_data);
368 return py_private_data;
371 static int py_notify_entry_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
373 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
375 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->private_data");
378 object->private_data = PyCObject_AsVoidPtr(value);
382 static PyGetSetDef py_notify_entry_getsetters[] = {
384 .name = discard_const_p(char, "server"),
385 .get = py_notify_entry_get_server,
386 .set = py_notify_entry_set_server,
387 .doc = discard_const_p(char, "PIDL-generated element server")
390 .name = discard_const_p(char, "filter"),
391 .get = py_notify_entry_get_filter,
392 .set = py_notify_entry_set_filter,
393 .doc = discard_const_p(char, "PIDL-generated element filter")
396 .name = discard_const_p(char, "subdir_filter"),
397 .get = py_notify_entry_get_subdir_filter,
398 .set = py_notify_entry_set_subdir_filter,
399 .doc = discard_const_p(char, "PIDL-generated element subdir_filter")
402 .name = discard_const_p(char, "dir_fd"),
403 .get = py_notify_entry_get_dir_fd,
404 .set = py_notify_entry_set_dir_fd,
405 .doc = discard_const_p(char, "PIDL-generated element dir_fd")
408 .name = discard_const_p(char, "dir_id"),
409 .get = py_notify_entry_get_dir_id,
410 .set = py_notify_entry_set_dir_id,
411 .doc = discard_const_p(char, "PIDL-generated element dir_id")
414 .name = discard_const_p(char, "path"),
415 .get = py_notify_entry_get_path,
416 .set = py_notify_entry_set_path,
417 .doc = discard_const_p(char, "PIDL-generated element path")
420 .name = discard_const_p(char, "path_len"),
421 .get = py_notify_entry_get_path_len,
422 .set = py_notify_entry_set_path_len,
423 .doc = discard_const_p(char, "PIDL-generated element path_len")
426 .name = discard_const_p(char, "private_data"),
427 .get = py_notify_entry_get_private_data,
428 .set = py_notify_entry_set_private_data,
429 .doc = discard_const_p(char, "PIDL-generated element private_data")
434 static PyObject *py_notify_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
436 return pytalloc_new(struct notify_entry, type);
439 static PyObject *py_notify_entry_ndr_pack(PyObject *py_obj)
441 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
442 PyObject *ret = NULL;
444 enum ndr_err_code err;
445 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
446 if (tmp_ctx == NULL) {
447 PyErr_SetNdrError(NDR_ERR_ALLOC);
450 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_entry);
451 if (err != NDR_ERR_SUCCESS) {
452 TALLOC_FREE(tmp_ctx);
453 PyErr_SetNdrError(err);
457 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
458 TALLOC_FREE(tmp_ctx);
462 static PyObject *py_notify_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
464 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
466 Py_ssize_t blob_length = 0;
467 enum ndr_err_code err;
468 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
469 PyObject *allow_remaining_obj = NULL;
470 bool allow_remaining = false;
472 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
473 discard_const_p(char *, kwnames),
474 &blob.data, &blob_length,
475 &allow_remaining_obj)) {
478 blob.length = blob_length;
480 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
481 allow_remaining = true;
484 if (allow_remaining) {
485 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_entry);
487 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_entry);
489 if (err != NDR_ERR_SUCCESS) {
490 PyErr_SetNdrError(err);
497 static PyObject *py_notify_entry_ndr_print(PyObject *py_obj)
499 struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
503 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_entry, "notify_entry", object);
504 ret = PyString_FromString(retstr);
510 static PyMethodDef py_notify_entry_methods[] = {
511 { "__ndr_pack__", (PyCFunction)py_notify_entry_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
512 { "__ndr_unpack__", (PyCFunction)py_notify_entry_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
513 { "__ndr_print__", (PyCFunction)py_notify_entry_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
514 { NULL, NULL, 0, NULL }
518 static PyTypeObject notify_entry_Type = {
519 PyObject_HEAD_INIT(NULL) 0,
520 .tp_name = "notify.entry",
521 .tp_getset = py_notify_entry_getsetters,
522 .tp_methods = py_notify_entry_methods,
523 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
524 .tp_new = py_notify_entry_new,
528 static PyObject *py_notify_entry_array_get_num_entries(PyObject *obj, void *closure)
530 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(obj);
531 PyObject *py_num_entries;
532 py_num_entries = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->num_entries);
533 return py_num_entries;
536 static int py_notify_entry_array_set_num_entries(PyObject *py_obj, PyObject *value, void *closure)
538 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
540 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_entries");
544 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_entries));
545 if (PyLong_Check(value)) {
546 unsigned long long test_var;
547 test_var = PyLong_AsUnsignedLongLong(value);
548 if (PyErr_Occurred() != NULL) {
551 if (test_var > uint_max) {
552 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
553 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
556 object->num_entries = test_var;
557 } else if (PyInt_Check(value)) {
559 test_var = PyInt_AsLong(value);
560 if (test_var < 0 || test_var > uint_max) {
561 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
562 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
565 object->num_entries = test_var;
567 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
568 PyInt_Type.tp_name, PyLong_Type.tp_name);
575 static PyObject *py_notify_entry_array_get_entries(PyObject *obj, void *closure)
577 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(obj);
578 PyObject *py_entries;
579 py_entries = PyList_New(object->num_entries);
580 if (py_entries == NULL) {
585 for (entries_cntr_0 = 0; entries_cntr_0 < (object->num_entries); entries_cntr_0++) {
586 PyObject *py_entries_0;
587 py_entries_0 = pytalloc_reference_ex(¬ify_entry_Type, object->entries, &object->entries[entries_cntr_0]);
588 PyList_SetItem(py_entries, entries_cntr_0, py_entries_0);
594 static int py_notify_entry_array_set_entries(PyObject *py_obj, PyObject *value, void *closure)
596 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
598 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->entries");
601 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
604 object->entries = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->entries, PyList_GET_SIZE(value));
605 if (!object->entries) { return -1;; }
606 talloc_set_name_const(object->entries, "ARRAY: object->entries");
607 for (entries_cntr_0 = 0; entries_cntr_0 < PyList_GET_SIZE(value); entries_cntr_0++) {
608 if (PyList_GET_ITEM(value, entries_cntr_0) == NULL) {
609 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->entries[entries_cntr_0]");
612 PY_CHECK_TYPE(¬ify_entry_Type, PyList_GET_ITEM(value, entries_cntr_0), return -1;);
613 if (talloc_reference(object->entries, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, entries_cntr_0))) == NULL) {
617 object->entries[entries_cntr_0] = *(struct notify_entry *)pytalloc_get_ptr(PyList_GET_ITEM(value, entries_cntr_0));
623 static PyGetSetDef py_notify_entry_array_getsetters[] = {
625 .name = discard_const_p(char, "num_entries"),
626 .get = py_notify_entry_array_get_num_entries,
627 .set = py_notify_entry_array_set_num_entries,
628 .doc = discard_const_p(char, "PIDL-generated element num_entries")
631 .name = discard_const_p(char, "entries"),
632 .get = py_notify_entry_array_get_entries,
633 .set = py_notify_entry_array_set_entries,
634 .doc = discard_const_p(char, "PIDL-generated element entries")
639 static PyObject *py_notify_entry_array_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
641 return pytalloc_new(struct notify_entry_array, type);
644 static PyObject *py_notify_entry_array_ndr_pack(PyObject *py_obj)
646 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
647 PyObject *ret = NULL;
649 enum ndr_err_code err;
650 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
651 if (tmp_ctx == NULL) {
652 PyErr_SetNdrError(NDR_ERR_ALLOC);
655 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_entry_array);
656 if (err != NDR_ERR_SUCCESS) {
657 TALLOC_FREE(tmp_ctx);
658 PyErr_SetNdrError(err);
662 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
663 TALLOC_FREE(tmp_ctx);
667 static PyObject *py_notify_entry_array_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
669 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
671 Py_ssize_t blob_length = 0;
672 enum ndr_err_code err;
673 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
674 PyObject *allow_remaining_obj = NULL;
675 bool allow_remaining = false;
677 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
678 discard_const_p(char *, kwnames),
679 &blob.data, &blob_length,
680 &allow_remaining_obj)) {
683 blob.length = blob_length;
685 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
686 allow_remaining = true;
689 if (allow_remaining) {
690 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_entry_array);
692 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_entry_array);
694 if (err != NDR_ERR_SUCCESS) {
695 PyErr_SetNdrError(err);
702 static PyObject *py_notify_entry_array_ndr_print(PyObject *py_obj)
704 struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
708 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_entry_array, "notify_entry_array", object);
709 ret = PyString_FromString(retstr);
715 static PyMethodDef py_notify_entry_array_methods[] = {
716 { "__ndr_pack__", (PyCFunction)py_notify_entry_array_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
717 { "__ndr_unpack__", (PyCFunction)py_notify_entry_array_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
718 { "__ndr_print__", (PyCFunction)py_notify_entry_array_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
719 { NULL, NULL, 0, NULL }
723 static PyTypeObject notify_entry_array_Type = {
724 PyObject_HEAD_INIT(NULL) 0,
725 .tp_name = "notify.entry_array",
726 .tp_getset = py_notify_entry_array_getsetters,
727 .tp_methods = py_notify_entry_array_methods,
728 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
729 .tp_new = py_notify_entry_array_new,
733 static PyObject *py_notify_db_entry_get_server(PyObject *obj, void *closure)
735 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
737 py_server = pytalloc_reference_ex(server_id_Type, pytalloc_get_mem_ctx(obj), &object->server);
741 static int py_notify_db_entry_set_server(PyObject *py_obj, PyObject *value, void *closure)
743 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
745 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->server");
748 PY_CHECK_TYPE(server_id_Type, value, return -1;);
749 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
753 object->server = *(struct server_id *)pytalloc_get_ptr(value);
757 static PyObject *py_notify_db_entry_get_filter(PyObject *obj, void *closure)
759 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
761 py_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->filter);
765 static int py_notify_db_entry_set_filter(PyObject *py_obj, PyObject *value, void *closure)
767 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
769 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->filter");
773 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->filter));
774 if (PyLong_Check(value)) {
775 unsigned long long test_var;
776 test_var = PyLong_AsUnsignedLongLong(value);
777 if (PyErr_Occurred() != NULL) {
780 if (test_var > uint_max) {
781 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
782 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
785 object->filter = test_var;
786 } else if (PyInt_Check(value)) {
788 test_var = PyInt_AsLong(value);
789 if (test_var < 0 || test_var > uint_max) {
790 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
791 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
794 object->filter = test_var;
796 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
797 PyInt_Type.tp_name, PyLong_Type.tp_name);
804 static PyObject *py_notify_db_entry_get_subdir_filter(PyObject *obj, void *closure)
806 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
807 PyObject *py_subdir_filter;
808 py_subdir_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->subdir_filter);
809 return py_subdir_filter;
812 static int py_notify_db_entry_set_subdir_filter(PyObject *py_obj, PyObject *value, void *closure)
814 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
816 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->subdir_filter");
820 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->subdir_filter));
821 if (PyLong_Check(value)) {
822 unsigned long long test_var;
823 test_var = PyLong_AsUnsignedLongLong(value);
824 if (PyErr_Occurred() != NULL) {
827 if (test_var > uint_max) {
828 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
829 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
832 object->subdir_filter = test_var;
833 } else if (PyInt_Check(value)) {
835 test_var = PyInt_AsLong(value);
836 if (test_var < 0 || test_var > uint_max) {
837 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
838 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
841 object->subdir_filter = test_var;
843 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
844 PyInt_Type.tp_name, PyLong_Type.tp_name);
851 static PyObject *py_notify_db_entry_get_private_data(PyObject *obj, void *closure)
853 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
854 PyObject *py_private_data;
855 py_private_data = pytalloc_CObject_FromTallocPtr(object->private_data);
856 return py_private_data;
859 static int py_notify_db_entry_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
861 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
863 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->private_data");
866 object->private_data = PyCObject_AsVoidPtr(value);
870 static PyGetSetDef py_notify_db_entry_getsetters[] = {
872 .name = discard_const_p(char, "server"),
873 .get = py_notify_db_entry_get_server,
874 .set = py_notify_db_entry_set_server,
875 .doc = discard_const_p(char, "PIDL-generated element server")
878 .name = discard_const_p(char, "filter"),
879 .get = py_notify_db_entry_get_filter,
880 .set = py_notify_db_entry_set_filter,
881 .doc = discard_const_p(char, "PIDL-generated element filter")
884 .name = discard_const_p(char, "subdir_filter"),
885 .get = py_notify_db_entry_get_subdir_filter,
886 .set = py_notify_db_entry_set_subdir_filter,
887 .doc = discard_const_p(char, "PIDL-generated element subdir_filter")
890 .name = discard_const_p(char, "private_data"),
891 .get = py_notify_db_entry_get_private_data,
892 .set = py_notify_db_entry_set_private_data,
893 .doc = discard_const_p(char, "PIDL-generated element private_data")
898 static PyObject *py_notify_db_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
900 return pytalloc_new(struct notify_db_entry, type);
903 static PyObject *py_notify_db_entry_ndr_pack(PyObject *py_obj)
905 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
906 PyObject *ret = NULL;
908 enum ndr_err_code err;
909 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
910 if (tmp_ctx == NULL) {
911 PyErr_SetNdrError(NDR_ERR_ALLOC);
914 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_db_entry);
915 if (err != NDR_ERR_SUCCESS) {
916 TALLOC_FREE(tmp_ctx);
917 PyErr_SetNdrError(err);
921 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
922 TALLOC_FREE(tmp_ctx);
926 static PyObject *py_notify_db_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
928 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
930 Py_ssize_t blob_length = 0;
931 enum ndr_err_code err;
932 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
933 PyObject *allow_remaining_obj = NULL;
934 bool allow_remaining = false;
936 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
937 discard_const_p(char *, kwnames),
938 &blob.data, &blob_length,
939 &allow_remaining_obj)) {
942 blob.length = blob_length;
944 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
945 allow_remaining = true;
948 if (allow_remaining) {
949 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_db_entry);
951 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_db_entry);
953 if (err != NDR_ERR_SUCCESS) {
954 PyErr_SetNdrError(err);
961 static PyObject *py_notify_db_entry_ndr_print(PyObject *py_obj)
963 struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
967 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_db_entry, "notify_db_entry", object);
968 ret = PyString_FromString(retstr);
974 static PyMethodDef py_notify_db_entry_methods[] = {
975 { "__ndr_pack__", (PyCFunction)py_notify_db_entry_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
976 { "__ndr_unpack__", (PyCFunction)py_notify_db_entry_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
977 { "__ndr_print__", (PyCFunction)py_notify_db_entry_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
978 { NULL, NULL, 0, NULL }
982 static PyTypeObject notify_db_entry_Type = {
983 PyObject_HEAD_INIT(NULL) 0,
984 .tp_name = "notify.db_entry",
985 .tp_getset = py_notify_db_entry_getsetters,
986 .tp_methods = py_notify_db_entry_methods,
987 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
988 .tp_new = py_notify_db_entry_new,
992 static PyObject *py_notify_depth_get_max_mask(PyObject *obj, void *closure)
994 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(obj);
995 PyObject *py_max_mask;
996 py_max_mask = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->max_mask);
1000 static int py_notify_depth_set_max_mask(PyObject *py_obj, PyObject *value, void *closure)
1002 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(py_obj);
1003 if (value == NULL) {
1004 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->max_mask");
1008 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->max_mask));
1009 if (PyLong_Check(value)) {
1010 unsigned long long test_var;
1011 test_var = PyLong_AsUnsignedLongLong(value);
1012 if (PyErr_Occurred() != NULL) {
1015 if (test_var > uint_max) {
1016 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1017 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1020 object->max_mask = test_var;
1021 } else if (PyInt_Check(value)) {
1023 test_var = PyInt_AsLong(value);
1024 if (test_var < 0 || test_var > uint_max) {
1025 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1026 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1029 object->max_mask = test_var;
1031 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1032 PyInt_Type.tp_name, PyLong_Type.tp_name);
1039 static PyObject *py_notify_depth_get_max_mask_subdir(PyObject *obj, void *closure)
1041 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(obj);
1042 PyObject *py_max_mask_subdir;
1043 py_max_mask_subdir = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->max_mask_subdir);
1044 return py_max_mask_subdir;
1047 static int py_notify_depth_set_max_mask_subdir(PyObject *py_obj, PyObject *value, void *closure)
1049 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(py_obj);
1050 if (value == NULL) {
1051 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->max_mask_subdir");
1055 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->max_mask_subdir));
1056 if (PyLong_Check(value)) {
1057 unsigned long long test_var;
1058 test_var = PyLong_AsUnsignedLongLong(value);
1059 if (PyErr_Occurred() != NULL) {
1062 if (test_var > uint_max) {
1063 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1064 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1067 object->max_mask_subdir = test_var;
1068 } else if (PyInt_Check(value)) {
1070 test_var = PyInt_AsLong(value);
1071 if (test_var < 0 || test_var > uint_max) {
1072 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1073 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1076 object->max_mask_subdir = test_var;
1078 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1079 PyInt_Type.tp_name, PyLong_Type.tp_name);
1086 static PyObject *py_notify_depth_get_num_entries(PyObject *obj, void *closure)
1088 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(obj);
1089 PyObject *py_num_entries;
1090 py_num_entries = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->num_entries);
1091 return py_num_entries;
1094 static int py_notify_depth_set_num_entries(PyObject *py_obj, PyObject *value, void *closure)
1096 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(py_obj);
1097 if (value == NULL) {
1098 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_entries");
1102 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_entries));
1103 if (PyLong_Check(value)) {
1104 unsigned long long test_var;
1105 test_var = PyLong_AsUnsignedLongLong(value);
1106 if (PyErr_Occurred() != NULL) {
1109 if (test_var > uint_max) {
1110 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1111 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1114 object->num_entries = test_var;
1115 } else if (PyInt_Check(value)) {
1117 test_var = PyInt_AsLong(value);
1118 if (test_var < 0 || test_var > uint_max) {
1119 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1120 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1123 object->num_entries = test_var;
1125 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1126 PyInt_Type.tp_name, PyLong_Type.tp_name);
1133 static PyObject *py_notify_depth_get_entries(PyObject *obj, void *closure)
1135 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(obj);
1136 PyObject *py_entries;
1137 py_entries = PyList_New(object->num_entries);
1138 if (py_entries == NULL) {
1143 for (entries_cntr_0 = 0; entries_cntr_0 < (object->num_entries); entries_cntr_0++) {
1144 PyObject *py_entries_0;
1145 py_entries_0 = pytalloc_reference_ex(¬ify_entry_Type, object->entries, &object->entries[entries_cntr_0]);
1146 PyList_SetItem(py_entries, entries_cntr_0, py_entries_0);
1152 static int py_notify_depth_set_entries(PyObject *py_obj, PyObject *value, void *closure)
1154 struct notify_depth *object = (struct notify_depth *)pytalloc_get_ptr(py_obj);
1155 if (value == NULL) {
1156 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->entries");
1159 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1162 object->entries = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->entries, PyList_GET_SIZE(value));
1163 if (!object->entries) { return -1;; }
1164 talloc_set_name_const(object->entries, "ARRAY: object->entries");
1165 for (entries_cntr_0 = 0; entries_cntr_0 < PyList_GET_SIZE(value); entries_cntr_0++) {
1166 if (PyList_GET_ITEM(value, entries_cntr_0) == NULL) {
1167 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->entries[entries_cntr_0]");
1170 PY_CHECK_TYPE(¬ify_entry_Type, PyList_GET_ITEM(value, entries_cntr_0), return -1;);
1171 if (talloc_reference(object->entries, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, entries_cntr_0))) == NULL) {
1175 object->entries[entries_cntr_0] = *(struct notify_entry *)pytalloc_get_ptr(PyList_GET_ITEM(value, entries_cntr_0));
1181 static PyGetSetDef py_notify_depth_getsetters[] = {
1183 .name = discard_const_p(char, "max_mask"),
1184 .get = py_notify_depth_get_max_mask,
1185 .set = py_notify_depth_set_max_mask,
1186 .doc = discard_const_p(char, "PIDL-generated element max_mask")
1189 .name = discard_const_p(char, "max_mask_subdir"),
1190 .get = py_notify_depth_get_max_mask_subdir,
1191 .set = py_notify_depth_set_max_mask_subdir,
1192 .doc = discard_const_p(char, "PIDL-generated element max_mask_subdir")
1195 .name = discard_const_p(char, "num_entries"),
1196 .get = py_notify_depth_get_num_entries,
1197 .set = py_notify_depth_set_num_entries,
1198 .doc = discard_const_p(char, "PIDL-generated element num_entries")
1201 .name = discard_const_p(char, "entries"),
1202 .get = py_notify_depth_get_entries,
1203 .set = py_notify_depth_set_entries,
1204 .doc = discard_const_p(char, "PIDL-generated element entries")
1209 static PyObject *py_notify_depth_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1211 return pytalloc_new(struct notify_depth, type);
1215 static PyTypeObject notify_depth_Type = {
1216 PyObject_HEAD_INIT(NULL) 0,
1217 .tp_name = "notify.depth",
1218 .tp_getset = py_notify_depth_getsetters,
1220 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1221 .tp_new = py_notify_depth_new,
1225 static PyObject *py_notify_array_get_num_depths(PyObject *obj, void *closure)
1227 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(obj);
1228 PyObject *py_num_depths;
1229 py_num_depths = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->num_depths);
1230 return py_num_depths;
1233 static int py_notify_array_set_num_depths(PyObject *py_obj, PyObject *value, void *closure)
1235 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1236 if (value == NULL) {
1237 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_depths");
1241 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_depths));
1242 if (PyLong_Check(value)) {
1243 unsigned long long test_var;
1244 test_var = PyLong_AsUnsignedLongLong(value);
1245 if (PyErr_Occurred() != NULL) {
1248 if (test_var > uint_max) {
1249 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1250 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1253 object->num_depths = test_var;
1254 } else if (PyInt_Check(value)) {
1256 test_var = PyInt_AsLong(value);
1257 if (test_var < 0 || test_var > uint_max) {
1258 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1259 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1262 object->num_depths = test_var;
1264 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1265 PyInt_Type.tp_name, PyLong_Type.tp_name);
1272 static PyObject *py_notify_array_get_depth(PyObject *obj, void *closure)
1274 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(obj);
1276 py_depth = PyList_New(object->num_depths);
1277 if (py_depth == NULL) {
1282 for (depth_cntr_0 = 0; depth_cntr_0 < (object->num_depths); depth_cntr_0++) {
1283 PyObject *py_depth_0;
1284 py_depth_0 = pytalloc_reference_ex(¬ify_depth_Type, object->depth, &object->depth[depth_cntr_0]);
1285 PyList_SetItem(py_depth, depth_cntr_0, py_depth_0);
1291 static int py_notify_array_set_depth(PyObject *py_obj, PyObject *value, void *closure)
1293 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1294 if (value == NULL) {
1295 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->depth");
1298 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1301 object->depth = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->depth, PyList_GET_SIZE(value));
1302 if (!object->depth) { return -1;; }
1303 talloc_set_name_const(object->depth, "ARRAY: object->depth");
1304 for (depth_cntr_0 = 0; depth_cntr_0 < PyList_GET_SIZE(value); depth_cntr_0++) {
1305 if (PyList_GET_ITEM(value, depth_cntr_0) == NULL) {
1306 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->depth[depth_cntr_0]");
1309 PY_CHECK_TYPE(¬ify_depth_Type, PyList_GET_ITEM(value, depth_cntr_0), return -1;);
1310 if (talloc_reference(object->depth, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, depth_cntr_0))) == NULL) {
1314 object->depth[depth_cntr_0] = *(struct notify_depth *)pytalloc_get_ptr(PyList_GET_ITEM(value, depth_cntr_0));
1320 static PyGetSetDef py_notify_array_getsetters[] = {
1322 .name = discard_const_p(char, "num_depths"),
1323 .get = py_notify_array_get_num_depths,
1324 .set = py_notify_array_set_num_depths,
1325 .doc = discard_const_p(char, "PIDL-generated element num_depths")
1328 .name = discard_const_p(char, "depth"),
1329 .get = py_notify_array_get_depth,
1330 .set = py_notify_array_set_depth,
1331 .doc = discard_const_p(char, "PIDL-generated element depth")
1336 static PyObject *py_notify_array_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1338 return pytalloc_new(struct notify_array, type);
1341 static PyObject *py_notify_array_ndr_pack(PyObject *py_obj)
1343 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1344 PyObject *ret = NULL;
1346 enum ndr_err_code err;
1347 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1348 if (tmp_ctx == NULL) {
1349 PyErr_SetNdrError(NDR_ERR_ALLOC);
1352 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_array);
1353 if (err != NDR_ERR_SUCCESS) {
1354 TALLOC_FREE(tmp_ctx);
1355 PyErr_SetNdrError(err);
1359 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1360 TALLOC_FREE(tmp_ctx);
1364 static PyObject *py_notify_array_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1366 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1368 Py_ssize_t blob_length = 0;
1369 enum ndr_err_code err;
1370 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1371 PyObject *allow_remaining_obj = NULL;
1372 bool allow_remaining = false;
1374 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1375 discard_const_p(char *, kwnames),
1376 &blob.data, &blob_length,
1377 &allow_remaining_obj)) {
1380 blob.length = blob_length;
1382 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1383 allow_remaining = true;
1386 if (allow_remaining) {
1387 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_array);
1389 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_array);
1391 if (err != NDR_ERR_SUCCESS) {
1392 PyErr_SetNdrError(err);
1399 static PyObject *py_notify_array_ndr_print(PyObject *py_obj)
1401 struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1405 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_array, "notify_array", object);
1406 ret = PyString_FromString(retstr);
1407 talloc_free(retstr);
1412 static PyMethodDef py_notify_array_methods[] = {
1413 { "__ndr_pack__", (PyCFunction)py_notify_array_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1414 { "__ndr_unpack__", (PyCFunction)py_notify_array_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1415 { "__ndr_print__", (PyCFunction)py_notify_array_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1416 { NULL, NULL, 0, NULL }
1420 static PyTypeObject notify_array_Type = {
1421 PyObject_HEAD_INIT(NULL) 0,
1422 .tp_name = "notify.array",
1423 .tp_getset = py_notify_array_getsetters,
1424 .tp_methods = py_notify_array_methods,
1425 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1426 .tp_new = py_notify_array_new,
1430 static PyObject *py_notify_event_get_action(PyObject *obj, void *closure)
1432 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1433 PyObject *py_action;
1434 py_action = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->action);
1438 static int py_notify_event_set_action(PyObject *py_obj, PyObject *value, void *closure)
1440 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1441 if (value == NULL) {
1442 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->action");
1446 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->action));
1447 if (PyLong_Check(value)) {
1448 unsigned long long test_var;
1449 test_var = PyLong_AsUnsignedLongLong(value);
1450 if (PyErr_Occurred() != NULL) {
1453 if (test_var > uint_max) {
1454 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1455 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1458 object->action = test_var;
1459 } else if (PyInt_Check(value)) {
1461 test_var = PyInt_AsLong(value);
1462 if (test_var < 0 || test_var > uint_max) {
1463 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1464 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1467 object->action = test_var;
1469 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1470 PyInt_Type.tp_name, PyLong_Type.tp_name);
1477 static PyObject *py_notify_event_get_dir(PyObject *obj, void *closure)
1479 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1481 py_dir = PyString_FromStringOrNULL(object->dir);
1485 static int py_notify_event_set_dir(PyObject *py_obj, PyObject *value, void *closure)
1487 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1488 if (value == NULL) {
1489 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dir");
1493 const char *test_str;
1494 const char *talloc_str;
1495 PyObject *unicode = NULL;
1496 if (PyUnicode_Check(value)) {
1497 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1498 if (unicode == NULL) {
1502 test_str = PyString_AS_STRING(unicode);
1503 } else if (PyString_Check(value)) {
1504 test_str = PyString_AS_STRING(value);
1506 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1509 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1510 if (unicode != NULL) {
1513 if (talloc_str == NULL) {
1517 object->dir = talloc_str;
1522 static PyObject *py_notify_event_get_path(PyObject *obj, void *closure)
1524 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1526 py_path = PyString_FromStringOrNULL(object->path);
1530 static int py_notify_event_set_path(PyObject *py_obj, PyObject *value, void *closure)
1532 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1533 if (value == NULL) {
1534 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path");
1538 const char *test_str;
1539 const char *talloc_str;
1540 PyObject *unicode = NULL;
1541 if (PyUnicode_Check(value)) {
1542 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1543 if (unicode == NULL) {
1547 test_str = PyString_AS_STRING(unicode);
1548 } else if (PyString_Check(value)) {
1549 test_str = PyString_AS_STRING(value);
1551 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1554 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1555 if (unicode != NULL) {
1558 if (talloc_str == NULL) {
1562 object->path = talloc_str;
1567 static PyObject *py_notify_event_get_private_data(PyObject *obj, void *closure)
1569 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1570 PyObject *py_private_data;
1571 py_private_data = pytalloc_CObject_FromTallocPtr(object->private_data);
1572 return py_private_data;
1575 static int py_notify_event_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
1577 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1578 if (value == NULL) {
1579 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->private_data");
1582 object->private_data = PyCObject_AsVoidPtr(value);
1586 static PyGetSetDef py_notify_event_getsetters[] = {
1588 .name = discard_const_p(char, "action"),
1589 .get = py_notify_event_get_action,
1590 .set = py_notify_event_set_action,
1591 .doc = discard_const_p(char, "PIDL-generated element action")
1594 .name = discard_const_p(char, "dir"),
1595 .get = py_notify_event_get_dir,
1596 .set = py_notify_event_set_dir,
1597 .doc = discard_const_p(char, "PIDL-generated element dir")
1600 .name = discard_const_p(char, "path"),
1601 .get = py_notify_event_get_path,
1602 .set = py_notify_event_set_path,
1603 .doc = discard_const_p(char, "PIDL-generated element path")
1606 .name = discard_const_p(char, "private_data"),
1607 .get = py_notify_event_get_private_data,
1608 .set = py_notify_event_set_private_data,
1609 .doc = discard_const_p(char, "PIDL-generated element private_data")
1614 static PyObject *py_notify_event_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1616 return pytalloc_new(struct notify_event, type);
1619 static PyObject *py_notify_event_ndr_pack(PyObject *py_obj)
1621 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1622 PyObject *ret = NULL;
1624 enum ndr_err_code err;
1625 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1626 if (tmp_ctx == NULL) {
1627 PyErr_SetNdrError(NDR_ERR_ALLOC);
1630 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_event);
1631 if (err != NDR_ERR_SUCCESS) {
1632 TALLOC_FREE(tmp_ctx);
1633 PyErr_SetNdrError(err);
1637 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1638 TALLOC_FREE(tmp_ctx);
1642 static PyObject *py_notify_event_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1644 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1646 Py_ssize_t blob_length = 0;
1647 enum ndr_err_code err;
1648 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1649 PyObject *allow_remaining_obj = NULL;
1650 bool allow_remaining = false;
1652 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1653 discard_const_p(char *, kwnames),
1654 &blob.data, &blob_length,
1655 &allow_remaining_obj)) {
1658 blob.length = blob_length;
1660 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1661 allow_remaining = true;
1664 if (allow_remaining) {
1665 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_event);
1667 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_event);
1669 if (err != NDR_ERR_SUCCESS) {
1670 PyErr_SetNdrError(err);
1677 static PyObject *py_notify_event_ndr_print(PyObject *py_obj)
1679 struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1683 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_event, "notify_event", object);
1684 ret = PyString_FromString(retstr);
1685 talloc_free(retstr);
1690 static PyMethodDef py_notify_event_methods[] = {
1691 { "__ndr_pack__", (PyCFunction)py_notify_event_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1692 { "__ndr_unpack__", (PyCFunction)py_notify_event_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1693 { "__ndr_print__", (PyCFunction)py_notify_event_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1694 { NULL, NULL, 0, NULL }
1698 static PyTypeObject notify_event_Type = {
1699 PyObject_HEAD_INIT(NULL) 0,
1700 .tp_name = "notify.event",
1701 .tp_getset = py_notify_event_getsetters,
1702 .tp_methods = py_notify_event_methods,
1703 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1704 .tp_new = py_notify_event_new,
1708 static PyObject *py_notify_remote_event_get_action(PyObject *obj, void *closure)
1710 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(obj);
1711 PyObject *py_action;
1712 py_action = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->action);
1716 static int py_notify_remote_event_set_action(PyObject *py_obj, PyObject *value, void *closure)
1718 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1719 if (value == NULL) {
1720 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->action");
1724 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->action));
1725 if (PyLong_Check(value)) {
1726 unsigned long long test_var;
1727 test_var = PyLong_AsUnsignedLongLong(value);
1728 if (PyErr_Occurred() != NULL) {
1731 if (test_var > uint_max) {
1732 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1733 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1736 object->action = test_var;
1737 } else if (PyInt_Check(value)) {
1739 test_var = PyInt_AsLong(value);
1740 if (test_var < 0 || test_var > uint_max) {
1741 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1742 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1745 object->action = test_var;
1747 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1748 PyInt_Type.tp_name, PyLong_Type.tp_name);
1755 static PyObject *py_notify_remote_event_get_filter(PyObject *obj, void *closure)
1757 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(obj);
1758 PyObject *py_filter;
1759 py_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->filter);
1763 static int py_notify_remote_event_set_filter(PyObject *py_obj, PyObject *value, void *closure)
1765 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1766 if (value == NULL) {
1767 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->filter");
1771 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->filter));
1772 if (PyLong_Check(value)) {
1773 unsigned long long test_var;
1774 test_var = PyLong_AsUnsignedLongLong(value);
1775 if (PyErr_Occurred() != NULL) {
1778 if (test_var > uint_max) {
1779 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1780 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1783 object->filter = test_var;
1784 } else if (PyInt_Check(value)) {
1786 test_var = PyInt_AsLong(value);
1787 if (test_var < 0 || test_var > uint_max) {
1788 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1789 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1792 object->filter = test_var;
1794 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1795 PyInt_Type.tp_name, PyLong_Type.tp_name);
1802 static PyObject *py_notify_remote_event_get_path(PyObject *obj, void *closure)
1804 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(obj);
1806 py_path = PyString_FromStringOrNULL(object->path);
1810 static int py_notify_remote_event_set_path(PyObject *py_obj, PyObject *value, void *closure)
1812 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1813 if (value == NULL) {
1814 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path");
1818 const char *test_str;
1819 const char *talloc_str;
1820 PyObject *unicode = NULL;
1821 if (PyUnicode_Check(value)) {
1822 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1823 if (unicode == NULL) {
1827 test_str = PyString_AS_STRING(unicode);
1828 } else if (PyString_Check(value)) {
1829 test_str = PyString_AS_STRING(value);
1831 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1834 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1835 if (unicode != NULL) {
1838 if (talloc_str == NULL) {
1842 object->path = talloc_str;
1847 static PyGetSetDef py_notify_remote_event_getsetters[] = {
1849 .name = discard_const_p(char, "action"),
1850 .get = py_notify_remote_event_get_action,
1851 .set = py_notify_remote_event_set_action,
1852 .doc = discard_const_p(char, "PIDL-generated element action")
1855 .name = discard_const_p(char, "filter"),
1856 .get = py_notify_remote_event_get_filter,
1857 .set = py_notify_remote_event_set_filter,
1858 .doc = discard_const_p(char, "PIDL-generated element filter")
1861 .name = discard_const_p(char, "path"),
1862 .get = py_notify_remote_event_get_path,
1863 .set = py_notify_remote_event_set_path,
1864 .doc = discard_const_p(char, "PIDL-generated element path")
1869 static PyObject *py_notify_remote_event_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1871 return pytalloc_new(struct notify_remote_event, type);
1874 static PyObject *py_notify_remote_event_ndr_pack(PyObject *py_obj)
1876 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1877 PyObject *ret = NULL;
1879 enum ndr_err_code err;
1880 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1881 if (tmp_ctx == NULL) {
1882 PyErr_SetNdrError(NDR_ERR_ALLOC);
1885 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_notify_remote_event);
1886 if (err != NDR_ERR_SUCCESS) {
1887 TALLOC_FREE(tmp_ctx);
1888 PyErr_SetNdrError(err);
1892 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1893 TALLOC_FREE(tmp_ctx);
1897 static PyObject *py_notify_remote_event_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1899 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1901 Py_ssize_t blob_length = 0;
1902 enum ndr_err_code err;
1903 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1904 PyObject *allow_remaining_obj = NULL;
1905 bool allow_remaining = false;
1907 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1908 discard_const_p(char *, kwnames),
1909 &blob.data, &blob_length,
1910 &allow_remaining_obj)) {
1913 blob.length = blob_length;
1915 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1916 allow_remaining = true;
1919 if (allow_remaining) {
1920 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_remote_event);
1922 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_remote_event);
1924 if (err != NDR_ERR_SUCCESS) {
1925 PyErr_SetNdrError(err);
1932 static PyObject *py_notify_remote_event_ndr_print(PyObject *py_obj)
1934 struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1938 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_notify_remote_event, "notify_remote_event", object);
1939 ret = PyString_FromString(retstr);
1940 talloc_free(retstr);
1945 static PyMethodDef py_notify_remote_event_methods[] = {
1946 { "__ndr_pack__", (PyCFunction)py_notify_remote_event_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1947 { "__ndr_unpack__", (PyCFunction)py_notify_remote_event_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1948 { "__ndr_print__", (PyCFunction)py_notify_remote_event_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1949 { NULL, NULL, 0, NULL }
1953 static PyTypeObject notify_remote_event_Type = {
1954 PyObject_HEAD_INIT(NULL) 0,
1955 .tp_name = "notify.remote_event",
1956 .tp_getset = py_notify_remote_event_getsetters,
1957 .tp_methods = py_notify_remote_event_methods,
1958 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1959 .tp_new = py_notify_remote_event_new,
1963 static PyObject *py_FILE_NOTIFY_INFORMATION_get_NextEntryOffset(PyObject *obj, void *closure)
1965 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
1966 PyObject *py_NextEntryOffset;
1967 py_NextEntryOffset = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->NextEntryOffset);
1968 return py_NextEntryOffset;
1971 static int py_FILE_NOTIFY_INFORMATION_set_NextEntryOffset(PyObject *py_obj, PyObject *value, void *closure)
1973 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
1974 if (value == NULL) {
1975 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->NextEntryOffset");
1979 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NextEntryOffset));
1980 if (PyLong_Check(value)) {
1981 unsigned long long test_var;
1982 test_var = PyLong_AsUnsignedLongLong(value);
1983 if (PyErr_Occurred() != NULL) {
1986 if (test_var > uint_max) {
1987 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
1988 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
1991 object->NextEntryOffset = test_var;
1992 } else if (PyInt_Check(value)) {
1994 test_var = PyInt_AsLong(value);
1995 if (test_var < 0 || test_var > uint_max) {
1996 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
1997 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
2000 object->NextEntryOffset = test_var;
2002 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2003 PyInt_Type.tp_name, PyLong_Type.tp_name);
2010 static PyObject *py_FILE_NOTIFY_INFORMATION_get_Action(PyObject *obj, void *closure)
2012 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
2013 PyObject *py_Action;
2014 py_Action = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->Action);
2018 static int py_FILE_NOTIFY_INFORMATION_set_Action(PyObject *py_obj, PyObject *value, void *closure)
2020 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2021 if (value == NULL) {
2022 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->Action");
2026 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Action));
2027 if (PyLong_Check(value)) {
2028 unsigned long long test_var;
2029 test_var = PyLong_AsUnsignedLongLong(value);
2030 if (PyErr_Occurred() != NULL) {
2033 if (test_var > uint_max) {
2034 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
2035 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
2038 object->Action = test_var;
2039 } else if (PyInt_Check(value)) {
2041 test_var = PyInt_AsLong(value);
2042 if (test_var < 0 || test_var > uint_max) {
2043 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
2044 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
2047 object->Action = test_var;
2049 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2050 PyInt_Type.tp_name, PyLong_Type.tp_name);
2057 static PyObject *py_FILE_NOTIFY_INFORMATION_get_FileNameLength(PyObject *obj, void *closure)
2059 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
2060 PyObject *py_FileNameLength;
2061 py_FileNameLength = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->FileNameLength);
2062 return py_FileNameLength;
2065 static int py_FILE_NOTIFY_INFORMATION_set_FileNameLength(PyObject *py_obj, PyObject *value, void *closure)
2067 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2068 if (value == NULL) {
2069 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->FileNameLength");
2073 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->FileNameLength));
2074 if (PyLong_Check(value)) {
2075 unsigned long long test_var;
2076 test_var = PyLong_AsUnsignedLongLong(value);
2077 if (PyErr_Occurred() != NULL) {
2080 if (test_var > uint_max) {
2081 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
2082 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
2085 object->FileNameLength = test_var;
2086 } else if (PyInt_Check(value)) {
2088 test_var = PyInt_AsLong(value);
2089 if (test_var < 0 || test_var > uint_max) {
2090 PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
2091 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
2094 object->FileNameLength = test_var;
2096 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2097 PyInt_Type.tp_name, PyLong_Type.tp_name);
2104 static PyObject *py_FILE_NOTIFY_INFORMATION_get_FileName1(PyObject *obj, void *closure)
2106 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
2107 PyObject *py_FileName1;
2108 if (object->FileName1 == NULL) {
2109 py_FileName1 = Py_None;
2110 Py_INCREF(py_FileName1);
2112 py_FileName1 = PyUnicode_Decode(object->FileName1, strlen(object->FileName1), "utf-8", "ignore");
2114 return py_FileName1;
2117 static int py_FILE_NOTIFY_INFORMATION_set_FileName1(PyObject *py_obj, PyObject *value, void *closure)
2119 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2120 if (value == NULL) {
2121 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->FileName1");
2125 const char *test_str;
2126 const char *talloc_str;
2127 PyObject *unicode = NULL;
2128 if (PyUnicode_Check(value)) {
2129 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2130 if (unicode == NULL) {
2134 test_str = PyString_AS_STRING(unicode);
2135 } else if (PyString_Check(value)) {
2136 test_str = PyString_AS_STRING(value);
2138 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2141 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2142 if (unicode != NULL) {
2145 if (talloc_str == NULL) {
2149 object->FileName1 = talloc_str;
2154 static PyObject *py_FILE_NOTIFY_INFORMATION_get__pad(PyObject *obj, void *closure)
2156 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
2158 py__pad = PyString_FromStringAndSize((char *)(object->_pad).data, (object->_pad).length);
2162 static int py_FILE_NOTIFY_INFORMATION_set__pad(PyObject *py_obj, PyObject *value, void *closure)
2164 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2165 if (value == NULL) {
2166 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->_pad");
2169 object->_pad = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
2173 static PyGetSetDef py_FILE_NOTIFY_INFORMATION_getsetters[] = {
2175 .name = discard_const_p(char, "NextEntryOffset"),
2176 .get = py_FILE_NOTIFY_INFORMATION_get_NextEntryOffset,
2177 .set = py_FILE_NOTIFY_INFORMATION_set_NextEntryOffset,
2178 .doc = discard_const_p(char, "PIDL-generated element NextEntryOffset")
2181 .name = discard_const_p(char, "Action"),
2182 .get = py_FILE_NOTIFY_INFORMATION_get_Action,
2183 .set = py_FILE_NOTIFY_INFORMATION_set_Action,
2184 .doc = discard_const_p(char, "PIDL-generated element Action")
2187 .name = discard_const_p(char, "FileNameLength"),
2188 .get = py_FILE_NOTIFY_INFORMATION_get_FileNameLength,
2189 .set = py_FILE_NOTIFY_INFORMATION_set_FileNameLength,
2190 .doc = discard_const_p(char, "PIDL-generated element FileNameLength")
2193 .name = discard_const_p(char, "FileName1"),
2194 .get = py_FILE_NOTIFY_INFORMATION_get_FileName1,
2195 .set = py_FILE_NOTIFY_INFORMATION_set_FileName1,
2196 .doc = discard_const_p(char, "PIDL-generated element FileName1")
2199 .name = discard_const_p(char, "_pad"),
2200 .get = py_FILE_NOTIFY_INFORMATION_get__pad,
2201 .set = py_FILE_NOTIFY_INFORMATION_set__pad,
2202 .doc = discard_const_p(char, "PIDL-generated element _pad")
2207 static PyObject *py_FILE_NOTIFY_INFORMATION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2209 return pytalloc_new(struct FILE_NOTIFY_INFORMATION, type);
2212 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_pack(PyObject *py_obj)
2214 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2215 PyObject *ret = NULL;
2217 enum ndr_err_code err;
2218 TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2219 if (tmp_ctx == NULL) {
2220 PyErr_SetNdrError(NDR_ERR_ALLOC);
2223 err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_FILE_NOTIFY_INFORMATION);
2224 if (err != NDR_ERR_SUCCESS) {
2225 TALLOC_FREE(tmp_ctx);
2226 PyErr_SetNdrError(err);
2230 ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
2231 TALLOC_FREE(tmp_ctx);
2235 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2237 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2239 Py_ssize_t blob_length = 0;
2240 enum ndr_err_code err;
2241 const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2242 PyObject *allow_remaining_obj = NULL;
2243 bool allow_remaining = false;
2245 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
2246 discard_const_p(char *, kwnames),
2247 &blob.data, &blob_length,
2248 &allow_remaining_obj)) {
2251 blob.length = blob_length;
2253 if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2254 allow_remaining = true;
2257 if (allow_remaining) {
2258 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_FILE_NOTIFY_INFORMATION);
2260 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_FILE_NOTIFY_INFORMATION);
2262 if (err != NDR_ERR_SUCCESS) {
2263 PyErr_SetNdrError(err);
2270 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_print(PyObject *py_obj)
2272 struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2276 retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_FILE_NOTIFY_INFORMATION, "FILE_NOTIFY_INFORMATION", object);
2277 ret = PyString_FromString(retstr);
2278 talloc_free(retstr);
2283 static PyMethodDef py_FILE_NOTIFY_INFORMATION_methods[] = {
2284 { "__ndr_pack__", (PyCFunction)py_FILE_NOTIFY_INFORMATION_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2285 { "__ndr_unpack__", (PyCFunction)py_FILE_NOTIFY_INFORMATION_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2286 { "__ndr_print__", (PyCFunction)py_FILE_NOTIFY_INFORMATION_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
2287 { NULL, NULL, 0, NULL }
2291 static PyTypeObject FILE_NOTIFY_INFORMATION_Type = {
2292 PyObject_HEAD_INIT(NULL) 0,
2293 .tp_name = "notify.FILE_NOTIFY_INFORMATION",
2294 .tp_getset = py_FILE_NOTIFY_INFORMATION_getsetters,
2295 .tp_methods = py_FILE_NOTIFY_INFORMATION_methods,
2296 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2297 .tp_new = py_FILE_NOTIFY_INFORMATION_new,
2300 static PyMethodDef notify_methods[] = {
2301 { NULL, NULL, 0, NULL }
2304 void initnotify(void)
2307 PyObject *dep_samba_dcerpc_file_id;
2308 PyObject *dep_samba_dcerpc_server_id;
2309 PyObject *dep_talloc;
2311 dep_samba_dcerpc_file_id = PyImport_ImportModule("samba.dcerpc.file_id");
2312 if (dep_samba_dcerpc_file_id == NULL)
2315 dep_samba_dcerpc_server_id = PyImport_ImportModule("samba.dcerpc.server_id");
2316 if (dep_samba_dcerpc_server_id == NULL)
2319 dep_talloc = PyImport_ImportModule("talloc");
2320 if (dep_talloc == NULL)
2323 server_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_server_id, "server_id");
2324 if (server_id_Type == NULL)
2327 file_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_file_id, "file_id");
2328 if (file_id_Type == NULL)
2331 BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
2332 if (BaseObject_Type == NULL)
2335 notify_entry_Type.tp_base = BaseObject_Type;
2336 notify_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
2338 notify_entry_array_Type.tp_base = BaseObject_Type;
2339 notify_entry_array_Type.tp_basicsize = pytalloc_BaseObject_size();
2341 notify_db_entry_Type.tp_base = BaseObject_Type;
2342 notify_db_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
2344 notify_depth_Type.tp_base = BaseObject_Type;
2345 notify_depth_Type.tp_basicsize = pytalloc_BaseObject_size();
2347 notify_array_Type.tp_base = BaseObject_Type;
2348 notify_array_Type.tp_basicsize = pytalloc_BaseObject_size();
2350 notify_event_Type.tp_base = BaseObject_Type;
2351 notify_event_Type.tp_basicsize = pytalloc_BaseObject_size();
2353 notify_remote_event_Type.tp_base = BaseObject_Type;
2354 notify_remote_event_Type.tp_basicsize = pytalloc_BaseObject_size();
2356 FILE_NOTIFY_INFORMATION_Type.tp_base = BaseObject_Type;
2357 FILE_NOTIFY_INFORMATION_Type.tp_basicsize = pytalloc_BaseObject_size();
2359 if (PyType_Ready(¬ify_entry_Type) < 0)
2361 if (PyType_Ready(¬ify_entry_array_Type) < 0)
2363 if (PyType_Ready(¬ify_db_entry_Type) < 0)
2365 if (PyType_Ready(¬ify_depth_Type) < 0)
2367 if (PyType_Ready(¬ify_array_Type) < 0)
2369 if (PyType_Ready(¬ify_event_Type) < 0)
2371 if (PyType_Ready(¬ify_remote_event_Type) < 0)
2373 if (PyType_Ready(&FILE_NOTIFY_INFORMATION_Type) < 0)
2375 #ifdef PY_ENTRY_PATCH
2376 PY_ENTRY_PATCH(¬ify_entry_Type);
2378 #ifdef PY_ENTRY_ARRAY_PATCH
2379 PY_ENTRY_ARRAY_PATCH(¬ify_entry_array_Type);
2381 #ifdef PY_DB_ENTRY_PATCH
2382 PY_DB_ENTRY_PATCH(¬ify_db_entry_Type);
2384 #ifdef PY_DEPTH_PATCH
2385 PY_DEPTH_PATCH(¬ify_depth_Type);
2387 #ifdef PY_ARRAY_PATCH
2388 PY_ARRAY_PATCH(¬ify_array_Type);
2390 #ifdef PY_EVENT_PATCH
2391 PY_EVENT_PATCH(¬ify_event_Type);
2393 #ifdef PY_REMOTE_EVENT_PATCH
2394 PY_REMOTE_EVENT_PATCH(¬ify_remote_event_Type);
2396 #ifdef PY_FILE_NOTIFY_INFORMATION_PATCH
2397 PY_FILE_NOTIFY_INFORMATION_PATCH(&FILE_NOTIFY_INFORMATION_Type);
2400 m = Py_InitModule3("notify", notify_methods, "notify DCE/RPC");
2404 PyModule_AddObject(m, "FILE_ACTION_ADDED", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_ADDED));
2405 PyModule_AddObject(m, "FILE_ACTION_REMOVED", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_REMOVED));
2406 PyModule_AddObject(m, "FILE_ACTION_MODIFIED", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_MODIFIED));
2407 PyModule_AddObject(m, "FILE_ACTION_RENAMED_OLD_NAME", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_RENAMED_OLD_NAME));
2408 PyModule_AddObject(m, "FILE_ACTION_RENAMED_NEW_NAME", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_RENAMED_NEW_NAME));
2409 PyModule_AddObject(m, "FILE_ACTION_ADDED_STREAM", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_ADDED_STREAM));
2410 PyModule_AddObject(m, "FILE_ACTION_REMOVED_STREAM", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_REMOVED_STREAM));
2411 PyModule_AddObject(m, "FILE_ACTION_MODIFIED_STREAM", ndr_PyLong_FromUnsignedLongLong((uint32_t)FILE_ACTION_MODIFIED_STREAM));
2412 Py_INCREF((PyObject *)(void *)¬ify_entry_Type);
2413 PyModule_AddObject(m, "entry", (PyObject *)(void *)¬ify_entry_Type);
2414 Py_INCREF((PyObject *)(void *)¬ify_entry_array_Type);
2415 PyModule_AddObject(m, "entry_array", (PyObject *)(void *)¬ify_entry_array_Type);
2416 Py_INCREF((PyObject *)(void *)¬ify_db_entry_Type);
2417 PyModule_AddObject(m, "db_entry", (PyObject *)(void *)¬ify_db_entry_Type);
2418 Py_INCREF((PyObject *)(void *)¬ify_depth_Type);
2419 PyModule_AddObject(m, "depth", (PyObject *)(void *)¬ify_depth_Type);
2420 Py_INCREF((PyObject *)(void *)¬ify_array_Type);
2421 PyModule_AddObject(m, "array", (PyObject *)(void *)¬ify_array_Type);
2422 Py_INCREF((PyObject *)(void *)¬ify_event_Type);
2423 PyModule_AddObject(m, "event", (PyObject *)(void *)¬ify_event_Type);
2424 Py_INCREF((PyObject *)(void *)¬ify_remote_event_Type);
2425 PyModule_AddObject(m, "remote_event", (PyObject *)(void *)¬ify_remote_event_Type);
2426 Py_INCREF((PyObject *)(void *)&FILE_NOTIFY_INFORMATION_Type);
2427 PyModule_AddObject(m, "FILE_NOTIFY_INFORMATION", (PyObject *)(void *)&FILE_NOTIFY_INFORMATION_Type);
2428 #ifdef PY_MOD_NOTIFY_PATCH
2429 PY_MOD_NOTIFY_PATCH(m);