git add -f bin/default/librpc/gen_ndr/*.{c,h,ndr,pidl} bin/default/source*/librpc...
[metze/samba/wip.git] / bin / default / librpc / gen_ndr / py_notify.c
1
2 /* Python wrapper functions auto-generated by pidl */
3 #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 #include <Python.h>
5 #include "includes.h"
6 #include <pytalloc.h>
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"
11
12 /*
13  * These functions are here to ensure they can be optimized out by
14  * the compiler based on the constant input values
15  */
16
17 static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
18 {
19         switch (var_size) {
20         case 8:
21                 return UINT64_MAX;
22         case 4:
23                 return UINT32_MAX;
24         case 2:
25                 return UINT16_MAX;
26         case 1:
27                 return UINT8_MAX;
28         }
29
30         return 0;
31 }
32
33 static inline long long ndr_sizeof2intmax(size_t var_size)
34 {
35         switch (var_size) {
36         case 8:
37                 return INT64_MAX;
38         case 4:
39                 return INT32_MAX;
40         case 2:
41                 return INT16_MAX;
42         case 1:
43                 return INT8_MAX;
44         }
45
46         return 0;
47 }
48
49 static inline PyObject *ndr_PyLong_FromLongLong(long long v)
50 {
51         if (v > LONG_MAX || v < LONG_MIN) {
52                 return PyLong_FromLongLong(v);
53         } else {
54                 return PyInt_FromLong(v);
55         }
56 }
57
58 static inline PyObject *ndr_PyLong_FromUnsignedLongLong(unsigned long long v)
59 {
60         if (v > LONG_MAX) {
61                 return PyLong_FromUnsignedLongLong(v);
62         } else {
63                 return PyInt_FromLong(v);
64         }
65 }
66
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;
77
78 void initnotify(void);static PyTypeObject *server_id_Type;
79 static PyTypeObject *file_id_Type;
80 static PyTypeObject *BaseObject_Type;
81
82 static PyObject *py_notify_entry_get_server(PyObject *obj, void *closure)
83 {
84         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
85         PyObject *py_server;
86         py_server = pytalloc_reference_ex(server_id_Type, pytalloc_get_mem_ctx(obj), &object->server);
87         return py_server;
88 }
89
90 static int py_notify_entry_set_server(PyObject *py_obj, PyObject *value, void *closure)
91 {
92         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
93         if (value == NULL) {
94                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->server");
95                 return -1;
96         }
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) {
99                 PyErr_NoMemory();
100                 return -1;
101         }
102         object->server = *(struct server_id *)pytalloc_get_ptr(value);
103         return 0;
104 }
105
106 static PyObject *py_notify_entry_get_filter(PyObject *obj, void *closure)
107 {
108         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
109         PyObject *py_filter;
110         py_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->filter);
111         return py_filter;
112 }
113
114 static int py_notify_entry_set_filter(PyObject *py_obj, PyObject *value, void *closure)
115 {
116         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
117         if (value == NULL) {
118                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->filter");
119                 return -1;
120         }
121         {
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) {
127                                 return -1;
128                         }
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);
132                                 return -1;
133                         }
134                         object->filter = test_var;
135                 } else if (PyInt_Check(value)) {
136                         long test_var;
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);
141                                 return -1;
142                         }
143                         object->filter = test_var;
144                 } else {
145                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
146                           PyInt_Type.tp_name, PyLong_Type.tp_name);
147                         return -1;
148                 }
149         }
150         return 0;
151 }
152
153 static PyObject *py_notify_entry_get_subdir_filter(PyObject *obj, void *closure)
154 {
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;
159 }
160
161 static int py_notify_entry_set_subdir_filter(PyObject *py_obj, PyObject *value, void *closure)
162 {
163         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
164         if (value == NULL) {
165                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->subdir_filter");
166                 return -1;
167         }
168         {
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) {
174                                 return -1;
175                         }
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);
179                                 return -1;
180                         }
181                         object->subdir_filter = test_var;
182                 } else if (PyInt_Check(value)) {
183                         long test_var;
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);
188                                 return -1;
189                         }
190                         object->subdir_filter = test_var;
191                 } else {
192                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
193                           PyInt_Type.tp_name, PyLong_Type.tp_name);
194                         return -1;
195                 }
196         }
197         return 0;
198 }
199
200 static PyObject *py_notify_entry_get_dir_fd(PyObject *obj, void *closure)
201 {
202         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
203         PyObject *py_dir_fd;
204         py_dir_fd = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->dir_fd);
205         return py_dir_fd;
206 }
207
208 static int py_notify_entry_set_dir_fd(PyObject *py_obj, PyObject *value, void *closure)
209 {
210         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
211         if (value == NULL) {
212                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dir_fd");
213                 return -1;
214         }
215         {
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) {
221                                 return -1;
222                         }
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);
226                                 return -1;
227                         }
228                         object->dir_fd = test_var;
229                 } else if (PyInt_Check(value)) {
230                         long test_var;
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);
235                                 return -1;
236                         }
237                         object->dir_fd = test_var;
238                 } else {
239                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
240                           PyInt_Type.tp_name, PyLong_Type.tp_name);
241                         return -1;
242                 }
243         }
244         return 0;
245 }
246
247 static PyObject *py_notify_entry_get_dir_id(PyObject *obj, void *closure)
248 {
249         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
250         PyObject *py_dir_id;
251         py_dir_id = pytalloc_reference_ex(file_id_Type, pytalloc_get_mem_ctx(obj), &object->dir_id);
252         return py_dir_id;
253 }
254
255 static int py_notify_entry_set_dir_id(PyObject *py_obj, PyObject *value, void *closure)
256 {
257         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
258         if (value == NULL) {
259                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dir_id");
260                 return -1;
261         }
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) {
264                 PyErr_NoMemory();
265                 return -1;
266         }
267         object->dir_id = *(struct file_id *)pytalloc_get_ptr(value);
268         return 0;
269 }
270
271 static PyObject *py_notify_entry_get_path(PyObject *obj, void *closure)
272 {
273         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(obj);
274         PyObject *py_path;
275         py_path = PyString_FromStringOrNULL(object->path);
276         return py_path;
277 }
278
279 static int py_notify_entry_set_path(PyObject *py_obj, PyObject *value, void *closure)
280 {
281         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
282         if (value == NULL) {
283                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path");
284                 return -1;
285         }
286         {
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) {
293                                 PyErr_NoMemory();
294                                 return -1;
295                         }
296                         test_str = PyString_AS_STRING(unicode);
297                 } else if (PyString_Check(value)) {
298                         test_str = PyString_AS_STRING(value);
299                 } else {
300                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
301                         return -1;
302                 }
303                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
304                 if (unicode != NULL) {
305                         Py_DECREF(unicode);
306                 }
307                 if (talloc_str == NULL) {
308                         PyErr_NoMemory();
309                         return -1;
310                 }
311                 object->path = talloc_str;
312         }
313         return 0;
314 }
315
316 static PyObject *py_notify_entry_get_path_len(PyObject *obj, void *closure)
317 {
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);
321         return py_path_len;
322 }
323
324 static int py_notify_entry_set_path_len(PyObject *py_obj, PyObject *value, void *closure)
325 {
326         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
327         if (value == NULL) {
328                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->path_len");
329                 return -1;
330         }
331         {
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) {
337                                 return -1;
338                         }
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);
342                                 return -1;
343                         }
344                         object->path_len = test_var;
345                 } else if (PyInt_Check(value)) {
346                         long test_var;
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);
351                                 return -1;
352                         }
353                         object->path_len = test_var;
354                 } else {
355                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
356                           PyInt_Type.tp_name, PyLong_Type.tp_name);
357                         return -1;
358                 }
359         }
360         return 0;
361 }
362
363 static PyObject *py_notify_entry_get_private_data(PyObject *obj, void *closure)
364 {
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;
369 }
370
371 static int py_notify_entry_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
372 {
373         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
374         if (value == NULL) {
375                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->private_data");
376                 return -1;
377         }
378         object->private_data = PyCObject_AsVoidPtr(value);
379         return 0;
380 }
381
382 static PyGetSetDef py_notify_entry_getsetters[] = {
383         {
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")
388         },
389         {
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")
394         },
395         {
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")
400         },
401         {
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")
406         },
407         {
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")
412         },
413         {
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")
418         },
419         {
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")
424         },
425         {
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")
430         },
431         { .name = NULL }
432 };
433
434 static PyObject *py_notify_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
435 {
436         return pytalloc_new(struct notify_entry, type);
437 }
438
439 static PyObject *py_notify_entry_ndr_pack(PyObject *py_obj)
440 {
441         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
442         PyObject *ret = NULL;
443         DATA_BLOB blob;
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);
448                 return NULL;
449         }
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);
454                 return NULL;
455         }
456
457         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
458         TALLOC_FREE(tmp_ctx);
459         return ret;
460 }
461
462 static PyObject *py_notify_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
463 {
464         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
465         DATA_BLOB blob;
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;
471
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)) {
476                 return NULL;
477         }
478         blob.length = blob_length;
479
480         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
481                 allow_remaining = true;
482         }
483
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);
486         } else {
487                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_entry);
488         }
489         if (err != NDR_ERR_SUCCESS) {
490                 PyErr_SetNdrError(err);
491                 return NULL;
492         }
493
494         Py_RETURN_NONE;
495 }
496
497 static PyObject *py_notify_entry_ndr_print(PyObject *py_obj)
498 {
499         struct notify_entry *object = (struct notify_entry *)pytalloc_get_ptr(py_obj);
500         PyObject *ret;
501         char *retstr;
502
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);
505         talloc_free(retstr);
506
507         return ret;
508 }
509
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 }
515 };
516
517
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,
525 };
526
527
528 static PyObject *py_notify_entry_array_get_num_entries(PyObject *obj, void *closure)
529 {
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;
534 }
535
536 static int py_notify_entry_array_set_num_entries(PyObject *py_obj, PyObject *value, void *closure)
537 {
538         struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
539         if (value == NULL) {
540                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_entries");
541                 return -1;
542         }
543         {
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) {
549                                 return -1;
550                         }
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);
554                                 return -1;
555                         }
556                         object->num_entries = test_var;
557                 } else if (PyInt_Check(value)) {
558                         long test_var;
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);
563                                 return -1;
564                         }
565                         object->num_entries = test_var;
566                 } else {
567                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
568                           PyInt_Type.tp_name, PyLong_Type.tp_name);
569                         return -1;
570                 }
571         }
572         return 0;
573 }
574
575 static PyObject *py_notify_entry_array_get_entries(PyObject *obj, void *closure)
576 {
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) {
581                 return NULL;
582         }
583         {
584                 int entries_cntr_0;
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(&notify_entry_Type, object->entries, &object->entries[entries_cntr_0]);
588                         PyList_SetItem(py_entries, entries_cntr_0, py_entries_0);
589                 }
590         }
591         return py_entries;
592 }
593
594 static int py_notify_entry_array_set_entries(PyObject *py_obj, PyObject *value, void *closure)
595 {
596         struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
597         if (value == NULL) {
598                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->entries");
599                 return -1;
600         }
601         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
602         {
603                 int entries_cntr_0;
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]");
610                                 return -1;
611                         }
612                         PY_CHECK_TYPE(&notify_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) {
614                                 PyErr_NoMemory();
615                                 return -1;
616                         }
617                         object->entries[entries_cntr_0] = *(struct notify_entry *)pytalloc_get_ptr(PyList_GET_ITEM(value, entries_cntr_0));
618                 }
619         }
620         return 0;
621 }
622
623 static PyGetSetDef py_notify_entry_array_getsetters[] = {
624         {
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")
629         },
630         {
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")
635         },
636         { .name = NULL }
637 };
638
639 static PyObject *py_notify_entry_array_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
640 {
641         return pytalloc_new(struct notify_entry_array, type);
642 }
643
644 static PyObject *py_notify_entry_array_ndr_pack(PyObject *py_obj)
645 {
646         struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
647         PyObject *ret = NULL;
648         DATA_BLOB blob;
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);
653                 return NULL;
654         }
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);
659                 return NULL;
660         }
661
662         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
663         TALLOC_FREE(tmp_ctx);
664         return ret;
665 }
666
667 static PyObject *py_notify_entry_array_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
668 {
669         struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
670         DATA_BLOB blob;
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;
676
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)) {
681                 return NULL;
682         }
683         blob.length = blob_length;
684
685         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
686                 allow_remaining = true;
687         }
688
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);
691         } else {
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);
693         }
694         if (err != NDR_ERR_SUCCESS) {
695                 PyErr_SetNdrError(err);
696                 return NULL;
697         }
698
699         Py_RETURN_NONE;
700 }
701
702 static PyObject *py_notify_entry_array_ndr_print(PyObject *py_obj)
703 {
704         struct notify_entry_array *object = (struct notify_entry_array *)pytalloc_get_ptr(py_obj);
705         PyObject *ret;
706         char *retstr;
707
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);
710         talloc_free(retstr);
711
712         return ret;
713 }
714
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 }
720 };
721
722
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,
730 };
731
732
733 static PyObject *py_notify_db_entry_get_server(PyObject *obj, void *closure)
734 {
735         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
736         PyObject *py_server;
737         py_server = pytalloc_reference_ex(server_id_Type, pytalloc_get_mem_ctx(obj), &object->server);
738         return py_server;
739 }
740
741 static int py_notify_db_entry_set_server(PyObject *py_obj, PyObject *value, void *closure)
742 {
743         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
744         if (value == NULL) {
745                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->server");
746                 return -1;
747         }
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) {
750                 PyErr_NoMemory();
751                 return -1;
752         }
753         object->server = *(struct server_id *)pytalloc_get_ptr(value);
754         return 0;
755 }
756
757 static PyObject *py_notify_db_entry_get_filter(PyObject *obj, void *closure)
758 {
759         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(obj);
760         PyObject *py_filter;
761         py_filter = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->filter);
762         return py_filter;
763 }
764
765 static int py_notify_db_entry_set_filter(PyObject *py_obj, PyObject *value, void *closure)
766 {
767         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
768         if (value == NULL) {
769                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->filter");
770                 return -1;
771         }
772         {
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) {
778                                 return -1;
779                         }
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);
783                                 return -1;
784                         }
785                         object->filter = test_var;
786                 } else if (PyInt_Check(value)) {
787                         long test_var;
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);
792                                 return -1;
793                         }
794                         object->filter = test_var;
795                 } else {
796                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
797                           PyInt_Type.tp_name, PyLong_Type.tp_name);
798                         return -1;
799                 }
800         }
801         return 0;
802 }
803
804 static PyObject *py_notify_db_entry_get_subdir_filter(PyObject *obj, void *closure)
805 {
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;
810 }
811
812 static int py_notify_db_entry_set_subdir_filter(PyObject *py_obj, PyObject *value, void *closure)
813 {
814         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
815         if (value == NULL) {
816                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->subdir_filter");
817                 return -1;
818         }
819         {
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) {
825                                 return -1;
826                         }
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);
830                                 return -1;
831                         }
832                         object->subdir_filter = test_var;
833                 } else if (PyInt_Check(value)) {
834                         long test_var;
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);
839                                 return -1;
840                         }
841                         object->subdir_filter = test_var;
842                 } else {
843                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
844                           PyInt_Type.tp_name, PyLong_Type.tp_name);
845                         return -1;
846                 }
847         }
848         return 0;
849 }
850
851 static PyObject *py_notify_db_entry_get_private_data(PyObject *obj, void *closure)
852 {
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;
857 }
858
859 static int py_notify_db_entry_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
860 {
861         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
862         if (value == NULL) {
863                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->private_data");
864                 return -1;
865         }
866         object->private_data = PyCObject_AsVoidPtr(value);
867         return 0;
868 }
869
870 static PyGetSetDef py_notify_db_entry_getsetters[] = {
871         {
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")
876         },
877         {
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")
882         },
883         {
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")
888         },
889         {
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")
894         },
895         { .name = NULL }
896 };
897
898 static PyObject *py_notify_db_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
899 {
900         return pytalloc_new(struct notify_db_entry, type);
901 }
902
903 static PyObject *py_notify_db_entry_ndr_pack(PyObject *py_obj)
904 {
905         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
906         PyObject *ret = NULL;
907         DATA_BLOB blob;
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);
912                 return NULL;
913         }
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);
918                 return NULL;
919         }
920
921         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
922         TALLOC_FREE(tmp_ctx);
923         return ret;
924 }
925
926 static PyObject *py_notify_db_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
927 {
928         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
929         DATA_BLOB blob;
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;
935
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)) {
940                 return NULL;
941         }
942         blob.length = blob_length;
943
944         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
945                 allow_remaining = true;
946         }
947
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);
950         } else {
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);
952         }
953         if (err != NDR_ERR_SUCCESS) {
954                 PyErr_SetNdrError(err);
955                 return NULL;
956         }
957
958         Py_RETURN_NONE;
959 }
960
961 static PyObject *py_notify_db_entry_ndr_print(PyObject *py_obj)
962 {
963         struct notify_db_entry *object = (struct notify_db_entry *)pytalloc_get_ptr(py_obj);
964         PyObject *ret;
965         char *retstr;
966
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);
969         talloc_free(retstr);
970
971         return ret;
972 }
973
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 }
979 };
980
981
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,
989 };
990
991
992 static PyObject *py_notify_depth_get_max_mask(PyObject *obj, void *closure)
993 {
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);
997         return py_max_mask;
998 }
999
1000 static int py_notify_depth_set_max_mask(PyObject *py_obj, PyObject *value, void *closure)
1001 {
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");
1005                 return -1;
1006         }
1007         {
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) {
1013                                 return -1;
1014                         }
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);
1018                                 return -1;
1019                         }
1020                         object->max_mask = test_var;
1021                 } else if (PyInt_Check(value)) {
1022                         long test_var;
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);
1027                                 return -1;
1028                         }
1029                         object->max_mask = test_var;
1030                 } else {
1031                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1032                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1033                         return -1;
1034                 }
1035         }
1036         return 0;
1037 }
1038
1039 static PyObject *py_notify_depth_get_max_mask_subdir(PyObject *obj, void *closure)
1040 {
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;
1045 }
1046
1047 static int py_notify_depth_set_max_mask_subdir(PyObject *py_obj, PyObject *value, void *closure)
1048 {
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");
1052                 return -1;
1053         }
1054         {
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) {
1060                                 return -1;
1061                         }
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);
1065                                 return -1;
1066                         }
1067                         object->max_mask_subdir = test_var;
1068                 } else if (PyInt_Check(value)) {
1069                         long test_var;
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);
1074                                 return -1;
1075                         }
1076                         object->max_mask_subdir = test_var;
1077                 } else {
1078                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1079                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1080                         return -1;
1081                 }
1082         }
1083         return 0;
1084 }
1085
1086 static PyObject *py_notify_depth_get_num_entries(PyObject *obj, void *closure)
1087 {
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;
1092 }
1093
1094 static int py_notify_depth_set_num_entries(PyObject *py_obj, PyObject *value, void *closure)
1095 {
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");
1099                 return -1;
1100         }
1101         {
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) {
1107                                 return -1;
1108                         }
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);
1112                                 return -1;
1113                         }
1114                         object->num_entries = test_var;
1115                 } else if (PyInt_Check(value)) {
1116                         long test_var;
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);
1121                                 return -1;
1122                         }
1123                         object->num_entries = test_var;
1124                 } else {
1125                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1126                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1127                         return -1;
1128                 }
1129         }
1130         return 0;
1131 }
1132
1133 static PyObject *py_notify_depth_get_entries(PyObject *obj, void *closure)
1134 {
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) {
1139                 return NULL;
1140         }
1141         {
1142                 int entries_cntr_0;
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(&notify_entry_Type, object->entries, &object->entries[entries_cntr_0]);
1146                         PyList_SetItem(py_entries, entries_cntr_0, py_entries_0);
1147                 }
1148         }
1149         return py_entries;
1150 }
1151
1152 static int py_notify_depth_set_entries(PyObject *py_obj, PyObject *value, void *closure)
1153 {
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");
1157                 return -1;
1158         }
1159         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1160         {
1161                 int entries_cntr_0;
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]");
1168                                 return -1;
1169                         }
1170                         PY_CHECK_TYPE(&notify_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) {
1172                                 PyErr_NoMemory();
1173                                 return -1;
1174                         }
1175                         object->entries[entries_cntr_0] = *(struct notify_entry *)pytalloc_get_ptr(PyList_GET_ITEM(value, entries_cntr_0));
1176                 }
1177         }
1178         return 0;
1179 }
1180
1181 static PyGetSetDef py_notify_depth_getsetters[] = {
1182         {
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")
1187         },
1188         {
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")
1193         },
1194         {
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")
1199         },
1200         {
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")
1205         },
1206         { .name = NULL }
1207 };
1208
1209 static PyObject *py_notify_depth_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1210 {
1211         return pytalloc_new(struct notify_depth, type);
1212 }
1213
1214
1215 static PyTypeObject notify_depth_Type = {
1216         PyObject_HEAD_INIT(NULL) 0,
1217         .tp_name = "notify.depth",
1218         .tp_getset = py_notify_depth_getsetters,
1219         .tp_methods = NULL,
1220         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1221         .tp_new = py_notify_depth_new,
1222 };
1223
1224
1225 static PyObject *py_notify_array_get_num_depths(PyObject *obj, void *closure)
1226 {
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;
1231 }
1232
1233 static int py_notify_array_set_num_depths(PyObject *py_obj, PyObject *value, void *closure)
1234 {
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");
1238                 return -1;
1239         }
1240         {
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) {
1246                                 return -1;
1247                         }
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);
1251                                 return -1;
1252                         }
1253                         object->num_depths = test_var;
1254                 } else if (PyInt_Check(value)) {
1255                         long test_var;
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);
1260                                 return -1;
1261                         }
1262                         object->num_depths = test_var;
1263                 } else {
1264                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1265                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1266                         return -1;
1267                 }
1268         }
1269         return 0;
1270 }
1271
1272 static PyObject *py_notify_array_get_depth(PyObject *obj, void *closure)
1273 {
1274         struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(obj);
1275         PyObject *py_depth;
1276         py_depth = PyList_New(object->num_depths);
1277         if (py_depth == NULL) {
1278                 return NULL;
1279         }
1280         {
1281                 int depth_cntr_0;
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(&notify_depth_Type, object->depth, &object->depth[depth_cntr_0]);
1285                         PyList_SetItem(py_depth, depth_cntr_0, py_depth_0);
1286                 }
1287         }
1288         return py_depth;
1289 }
1290
1291 static int py_notify_array_set_depth(PyObject *py_obj, PyObject *value, void *closure)
1292 {
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");
1296                 return -1;
1297         }
1298         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1299         {
1300                 int depth_cntr_0;
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]");
1307                                 return -1;
1308                         }
1309                         PY_CHECK_TYPE(&notify_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) {
1311                                 PyErr_NoMemory();
1312                                 return -1;
1313                         }
1314                         object->depth[depth_cntr_0] = *(struct notify_depth *)pytalloc_get_ptr(PyList_GET_ITEM(value, depth_cntr_0));
1315                 }
1316         }
1317         return 0;
1318 }
1319
1320 static PyGetSetDef py_notify_array_getsetters[] = {
1321         {
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")
1326         },
1327         {
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")
1332         },
1333         { .name = NULL }
1334 };
1335
1336 static PyObject *py_notify_array_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1337 {
1338         return pytalloc_new(struct notify_array, type);
1339 }
1340
1341 static PyObject *py_notify_array_ndr_pack(PyObject *py_obj)
1342 {
1343         struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1344         PyObject *ret = NULL;
1345         DATA_BLOB blob;
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);
1350                 return NULL;
1351         }
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);
1356                 return NULL;
1357         }
1358
1359         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1360         TALLOC_FREE(tmp_ctx);
1361         return ret;
1362 }
1363
1364 static PyObject *py_notify_array_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1365 {
1366         struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1367         DATA_BLOB blob;
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;
1373
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)) {
1378                 return NULL;
1379         }
1380         blob.length = blob_length;
1381
1382         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1383                 allow_remaining = true;
1384         }
1385
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);
1388         } else {
1389                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_array);
1390         }
1391         if (err != NDR_ERR_SUCCESS) {
1392                 PyErr_SetNdrError(err);
1393                 return NULL;
1394         }
1395
1396         Py_RETURN_NONE;
1397 }
1398
1399 static PyObject *py_notify_array_ndr_print(PyObject *py_obj)
1400 {
1401         struct notify_array *object = (struct notify_array *)pytalloc_get_ptr(py_obj);
1402         PyObject *ret;
1403         char *retstr;
1404
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);
1408
1409         return ret;
1410 }
1411
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 }
1417 };
1418
1419
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,
1427 };
1428
1429
1430 static PyObject *py_notify_event_get_action(PyObject *obj, void *closure)
1431 {
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);
1435         return py_action;
1436 }
1437
1438 static int py_notify_event_set_action(PyObject *py_obj, PyObject *value, void *closure)
1439 {
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");
1443                 return -1;
1444         }
1445         {
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) {
1451                                 return -1;
1452                         }
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);
1456                                 return -1;
1457                         }
1458                         object->action = test_var;
1459                 } else if (PyInt_Check(value)) {
1460                         long test_var;
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);
1465                                 return -1;
1466                         }
1467                         object->action = test_var;
1468                 } else {
1469                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1470                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1471                         return -1;
1472                 }
1473         }
1474         return 0;
1475 }
1476
1477 static PyObject *py_notify_event_get_dir(PyObject *obj, void *closure)
1478 {
1479         struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1480         PyObject *py_dir;
1481         py_dir = PyString_FromStringOrNULL(object->dir);
1482         return py_dir;
1483 }
1484
1485 static int py_notify_event_set_dir(PyObject *py_obj, PyObject *value, void *closure)
1486 {
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");
1490                 return -1;
1491         }
1492         {
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) {
1499                                 PyErr_NoMemory();
1500                                 return -1;
1501                         }
1502                         test_str = PyString_AS_STRING(unicode);
1503                 } else if (PyString_Check(value)) {
1504                         test_str = PyString_AS_STRING(value);
1505                 } else {
1506                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1507                         return -1;
1508                 }
1509                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1510                 if (unicode != NULL) {
1511                         Py_DECREF(unicode);
1512                 }
1513                 if (talloc_str == NULL) {
1514                         PyErr_NoMemory();
1515                         return -1;
1516                 }
1517                 object->dir = talloc_str;
1518         }
1519         return 0;
1520 }
1521
1522 static PyObject *py_notify_event_get_path(PyObject *obj, void *closure)
1523 {
1524         struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(obj);
1525         PyObject *py_path;
1526         py_path = PyString_FromStringOrNULL(object->path);
1527         return py_path;
1528 }
1529
1530 static int py_notify_event_set_path(PyObject *py_obj, PyObject *value, void *closure)
1531 {
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");
1535                 return -1;
1536         }
1537         {
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) {
1544                                 PyErr_NoMemory();
1545                                 return -1;
1546                         }
1547                         test_str = PyString_AS_STRING(unicode);
1548                 } else if (PyString_Check(value)) {
1549                         test_str = PyString_AS_STRING(value);
1550                 } else {
1551                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1552                         return -1;
1553                 }
1554                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1555                 if (unicode != NULL) {
1556                         Py_DECREF(unicode);
1557                 }
1558                 if (talloc_str == NULL) {
1559                         PyErr_NoMemory();
1560                         return -1;
1561                 }
1562                 object->path = talloc_str;
1563         }
1564         return 0;
1565 }
1566
1567 static PyObject *py_notify_event_get_private_data(PyObject *obj, void *closure)
1568 {
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;
1573 }
1574
1575 static int py_notify_event_set_private_data(PyObject *py_obj, PyObject *value, void *closure)
1576 {
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");
1580                 return -1;
1581         }
1582         object->private_data = PyCObject_AsVoidPtr(value);
1583         return 0;
1584 }
1585
1586 static PyGetSetDef py_notify_event_getsetters[] = {
1587         {
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")
1592         },
1593         {
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")
1598         },
1599         {
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")
1604         },
1605         {
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")
1610         },
1611         { .name = NULL }
1612 };
1613
1614 static PyObject *py_notify_event_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1615 {
1616         return pytalloc_new(struct notify_event, type);
1617 }
1618
1619 static PyObject *py_notify_event_ndr_pack(PyObject *py_obj)
1620 {
1621         struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1622         PyObject *ret = NULL;
1623         DATA_BLOB blob;
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);
1628                 return NULL;
1629         }
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);
1634                 return NULL;
1635         }
1636
1637         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1638         TALLOC_FREE(tmp_ctx);
1639         return ret;
1640 }
1641
1642 static PyObject *py_notify_event_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1643 {
1644         struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1645         DATA_BLOB blob;
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;
1651
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)) {
1656                 return NULL;
1657         }
1658         blob.length = blob_length;
1659
1660         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1661                 allow_remaining = true;
1662         }
1663
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);
1666         } else {
1667                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_notify_event);
1668         }
1669         if (err != NDR_ERR_SUCCESS) {
1670                 PyErr_SetNdrError(err);
1671                 return NULL;
1672         }
1673
1674         Py_RETURN_NONE;
1675 }
1676
1677 static PyObject *py_notify_event_ndr_print(PyObject *py_obj)
1678 {
1679         struct notify_event *object = (struct notify_event *)pytalloc_get_ptr(py_obj);
1680         PyObject *ret;
1681         char *retstr;
1682
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);
1686
1687         return ret;
1688 }
1689
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 }
1695 };
1696
1697
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,
1705 };
1706
1707
1708 static PyObject *py_notify_remote_event_get_action(PyObject *obj, void *closure)
1709 {
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);
1713         return py_action;
1714 }
1715
1716 static int py_notify_remote_event_set_action(PyObject *py_obj, PyObject *value, void *closure)
1717 {
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");
1721                 return -1;
1722         }
1723         {
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) {
1729                                 return -1;
1730                         }
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);
1734                                 return -1;
1735                         }
1736                         object->action = test_var;
1737                 } else if (PyInt_Check(value)) {
1738                         long test_var;
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);
1743                                 return -1;
1744                         }
1745                         object->action = test_var;
1746                 } else {
1747                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1748                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1749                         return -1;
1750                 }
1751         }
1752         return 0;
1753 }
1754
1755 static PyObject *py_notify_remote_event_get_filter(PyObject *obj, void *closure)
1756 {
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);
1760         return py_filter;
1761 }
1762
1763 static int py_notify_remote_event_set_filter(PyObject *py_obj, PyObject *value, void *closure)
1764 {
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");
1768                 return -1;
1769         }
1770         {
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) {
1776                                 return -1;
1777                         }
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);
1781                                 return -1;
1782                         }
1783                         object->filter = test_var;
1784                 } else if (PyInt_Check(value)) {
1785                         long test_var;
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);
1790                                 return -1;
1791                         }
1792                         object->filter = test_var;
1793                 } else {
1794                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1795                           PyInt_Type.tp_name, PyLong_Type.tp_name);
1796                         return -1;
1797                 }
1798         }
1799         return 0;
1800 }
1801
1802 static PyObject *py_notify_remote_event_get_path(PyObject *obj, void *closure)
1803 {
1804         struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(obj);
1805         PyObject *py_path;
1806         py_path = PyString_FromStringOrNULL(object->path);
1807         return py_path;
1808 }
1809
1810 static int py_notify_remote_event_set_path(PyObject *py_obj, PyObject *value, void *closure)
1811 {
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");
1815                 return -1;
1816         }
1817         {
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) {
1824                                 PyErr_NoMemory();
1825                                 return -1;
1826                         }
1827                         test_str = PyString_AS_STRING(unicode);
1828                 } else if (PyString_Check(value)) {
1829                         test_str = PyString_AS_STRING(value);
1830                 } else {
1831                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1832                         return -1;
1833                 }
1834                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1835                 if (unicode != NULL) {
1836                         Py_DECREF(unicode);
1837                 }
1838                 if (talloc_str == NULL) {
1839                         PyErr_NoMemory();
1840                         return -1;
1841                 }
1842                 object->path = talloc_str;
1843         }
1844         return 0;
1845 }
1846
1847 static PyGetSetDef py_notify_remote_event_getsetters[] = {
1848         {
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")
1853         },
1854         {
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")
1859         },
1860         {
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")
1865         },
1866         { .name = NULL }
1867 };
1868
1869 static PyObject *py_notify_remote_event_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1870 {
1871         return pytalloc_new(struct notify_remote_event, type);
1872 }
1873
1874 static PyObject *py_notify_remote_event_ndr_pack(PyObject *py_obj)
1875 {
1876         struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1877         PyObject *ret = NULL;
1878         DATA_BLOB blob;
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);
1883                 return NULL;
1884         }
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);
1889                 return NULL;
1890         }
1891
1892         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
1893         TALLOC_FREE(tmp_ctx);
1894         return ret;
1895 }
1896
1897 static PyObject *py_notify_remote_event_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1898 {
1899         struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1900         DATA_BLOB blob;
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;
1906
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)) {
1911                 return NULL;
1912         }
1913         blob.length = blob_length;
1914
1915         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1916                 allow_remaining = true;
1917         }
1918
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);
1921         } else {
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);
1923         }
1924         if (err != NDR_ERR_SUCCESS) {
1925                 PyErr_SetNdrError(err);
1926                 return NULL;
1927         }
1928
1929         Py_RETURN_NONE;
1930 }
1931
1932 static PyObject *py_notify_remote_event_ndr_print(PyObject *py_obj)
1933 {
1934         struct notify_remote_event *object = (struct notify_remote_event *)pytalloc_get_ptr(py_obj);
1935         PyObject *ret;
1936         char *retstr;
1937
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);
1941
1942         return ret;
1943 }
1944
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 }
1950 };
1951
1952
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,
1960 };
1961
1962
1963 static PyObject *py_FILE_NOTIFY_INFORMATION_get_NextEntryOffset(PyObject *obj, void *closure)
1964 {
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;
1969 }
1970
1971 static int py_FILE_NOTIFY_INFORMATION_set_NextEntryOffset(PyObject *py_obj, PyObject *value, void *closure)
1972 {
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");
1976                 return -1;
1977         }
1978         {
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) {
1984                                 return -1;
1985                         }
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);
1989                                 return -1;
1990                         }
1991                         object->NextEntryOffset = test_var;
1992                 } else if (PyInt_Check(value)) {
1993                         long test_var;
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);
1998                                 return -1;
1999                         }
2000                         object->NextEntryOffset = test_var;
2001                 } else {
2002                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2003                           PyInt_Type.tp_name, PyLong_Type.tp_name);
2004                         return -1;
2005                 }
2006         }
2007         return 0;
2008 }
2009
2010 static PyObject *py_FILE_NOTIFY_INFORMATION_get_Action(PyObject *obj, void *closure)
2011 {
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);
2015         return py_Action;
2016 }
2017
2018 static int py_FILE_NOTIFY_INFORMATION_set_Action(PyObject *py_obj, PyObject *value, void *closure)
2019 {
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");
2023                 return -1;
2024         }
2025         {
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) {
2031                                 return -1;
2032                         }
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);
2036                                 return -1;
2037                         }
2038                         object->Action = test_var;
2039                 } else if (PyInt_Check(value)) {
2040                         long test_var;
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);
2045                                 return -1;
2046                         }
2047                         object->Action = test_var;
2048                 } else {
2049                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2050                           PyInt_Type.tp_name, PyLong_Type.tp_name);
2051                         return -1;
2052                 }
2053         }
2054         return 0;
2055 }
2056
2057 static PyObject *py_FILE_NOTIFY_INFORMATION_get_FileNameLength(PyObject *obj, void *closure)
2058 {
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;
2063 }
2064
2065 static int py_FILE_NOTIFY_INFORMATION_set_FileNameLength(PyObject *py_obj, PyObject *value, void *closure)
2066 {
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");
2070                 return -1;
2071         }
2072         {
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) {
2078                                 return -1;
2079                         }
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);
2083                                 return -1;
2084                         }
2085                         object->FileNameLength = test_var;
2086                 } else if (PyInt_Check(value)) {
2087                         long test_var;
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);
2092                                 return -1;
2093                         }
2094                         object->FileNameLength = test_var;
2095                 } else {
2096                         PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2097                           PyInt_Type.tp_name, PyLong_Type.tp_name);
2098                         return -1;
2099                 }
2100         }
2101         return 0;
2102 }
2103
2104 static PyObject *py_FILE_NOTIFY_INFORMATION_get_FileName1(PyObject *obj, void *closure)
2105 {
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);
2111         } else {
2112                 py_FileName1 = PyUnicode_Decode(object->FileName1, strlen(object->FileName1), "utf-8", "ignore");
2113         }
2114         return py_FileName1;
2115 }
2116
2117 static int py_FILE_NOTIFY_INFORMATION_set_FileName1(PyObject *py_obj, PyObject *value, void *closure)
2118 {
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");
2122                 return -1;
2123         }
2124         {
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) {
2131                                 PyErr_NoMemory();
2132                                 return -1;
2133                         }
2134                         test_str = PyString_AS_STRING(unicode);
2135                 } else if (PyString_Check(value)) {
2136                         test_str = PyString_AS_STRING(value);
2137                 } else {
2138                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2139                         return -1;
2140                 }
2141                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2142                 if (unicode != NULL) {
2143                         Py_DECREF(unicode);
2144                 }
2145                 if (talloc_str == NULL) {
2146                         PyErr_NoMemory();
2147                         return -1;
2148                 }
2149                 object->FileName1 = talloc_str;
2150         }
2151         return 0;
2152 }
2153
2154 static PyObject *py_FILE_NOTIFY_INFORMATION_get__pad(PyObject *obj, void *closure)
2155 {
2156         struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(obj);
2157         PyObject *py__pad;
2158         py__pad = PyString_FromStringAndSize((char *)(object->_pad).data, (object->_pad).length);
2159         return py__pad;
2160 }
2161
2162 static int py_FILE_NOTIFY_INFORMATION_set__pad(PyObject *py_obj, PyObject *value, void *closure)
2163 {
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");
2167                 return -1;
2168         }
2169         object->_pad = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
2170         return 0;
2171 }
2172
2173 static PyGetSetDef py_FILE_NOTIFY_INFORMATION_getsetters[] = {
2174         {
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")
2179         },
2180         {
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")
2185         },
2186         {
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")
2191         },
2192         {
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")
2197         },
2198         {
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")
2203         },
2204         { .name = NULL }
2205 };
2206
2207 static PyObject *py_FILE_NOTIFY_INFORMATION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2208 {
2209         return pytalloc_new(struct FILE_NOTIFY_INFORMATION, type);
2210 }
2211
2212 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_pack(PyObject *py_obj)
2213 {
2214         struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2215         PyObject *ret = NULL;
2216         DATA_BLOB blob;
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);
2221                 return NULL;
2222         }
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);
2227                 return NULL;
2228         }
2229
2230         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
2231         TALLOC_FREE(tmp_ctx);
2232         return ret;
2233 }
2234
2235 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2236 {
2237         struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2238         DATA_BLOB blob;
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;
2244
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)) {
2249                 return NULL;
2250         }
2251         blob.length = blob_length;
2252
2253         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2254                 allow_remaining = true;
2255         }
2256
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);
2259         } else {
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);
2261         }
2262         if (err != NDR_ERR_SUCCESS) {
2263                 PyErr_SetNdrError(err);
2264                 return NULL;
2265         }
2266
2267         Py_RETURN_NONE;
2268 }
2269
2270 static PyObject *py_FILE_NOTIFY_INFORMATION_ndr_print(PyObject *py_obj)
2271 {
2272         struct FILE_NOTIFY_INFORMATION *object = (struct FILE_NOTIFY_INFORMATION *)pytalloc_get_ptr(py_obj);
2273         PyObject *ret;
2274         char *retstr;
2275
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);
2279
2280         return ret;
2281 }
2282
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 }
2288 };
2289
2290
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,
2298 };
2299
2300 static PyMethodDef notify_methods[] = {
2301         { NULL, NULL, 0, NULL }
2302 };
2303
2304 void initnotify(void)
2305 {
2306         PyObject *m;
2307         PyObject *dep_samba_dcerpc_file_id;
2308         PyObject *dep_samba_dcerpc_server_id;
2309         PyObject *dep_talloc;
2310
2311         dep_samba_dcerpc_file_id = PyImport_ImportModule("samba.dcerpc.file_id");
2312         if (dep_samba_dcerpc_file_id == NULL)
2313                 return;
2314
2315         dep_samba_dcerpc_server_id = PyImport_ImportModule("samba.dcerpc.server_id");
2316         if (dep_samba_dcerpc_server_id == NULL)
2317                 return;
2318
2319         dep_talloc = PyImport_ImportModule("talloc");
2320         if (dep_talloc == NULL)
2321                 return;
2322
2323         server_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_server_id, "server_id");
2324         if (server_id_Type == NULL)
2325                 return;
2326
2327         file_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_file_id, "file_id");
2328         if (file_id_Type == NULL)
2329                 return;
2330
2331         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
2332         if (BaseObject_Type == NULL)
2333                 return;
2334
2335         notify_entry_Type.tp_base = BaseObject_Type;
2336         notify_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
2337
2338         notify_entry_array_Type.tp_base = BaseObject_Type;
2339         notify_entry_array_Type.tp_basicsize = pytalloc_BaseObject_size();
2340
2341         notify_db_entry_Type.tp_base = BaseObject_Type;
2342         notify_db_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
2343
2344         notify_depth_Type.tp_base = BaseObject_Type;
2345         notify_depth_Type.tp_basicsize = pytalloc_BaseObject_size();
2346
2347         notify_array_Type.tp_base = BaseObject_Type;
2348         notify_array_Type.tp_basicsize = pytalloc_BaseObject_size();
2349
2350         notify_event_Type.tp_base = BaseObject_Type;
2351         notify_event_Type.tp_basicsize = pytalloc_BaseObject_size();
2352
2353         notify_remote_event_Type.tp_base = BaseObject_Type;
2354         notify_remote_event_Type.tp_basicsize = pytalloc_BaseObject_size();
2355
2356         FILE_NOTIFY_INFORMATION_Type.tp_base = BaseObject_Type;
2357         FILE_NOTIFY_INFORMATION_Type.tp_basicsize = pytalloc_BaseObject_size();
2358
2359         if (PyType_Ready(&notify_entry_Type) < 0)
2360                 return;
2361         if (PyType_Ready(&notify_entry_array_Type) < 0)
2362                 return;
2363         if (PyType_Ready(&notify_db_entry_Type) < 0)
2364                 return;
2365         if (PyType_Ready(&notify_depth_Type) < 0)
2366                 return;
2367         if (PyType_Ready(&notify_array_Type) < 0)
2368                 return;
2369         if (PyType_Ready(&notify_event_Type) < 0)
2370                 return;
2371         if (PyType_Ready(&notify_remote_event_Type) < 0)
2372                 return;
2373         if (PyType_Ready(&FILE_NOTIFY_INFORMATION_Type) < 0)
2374                 return;
2375 #ifdef PY_ENTRY_PATCH
2376         PY_ENTRY_PATCH(&notify_entry_Type);
2377 #endif
2378 #ifdef PY_ENTRY_ARRAY_PATCH
2379         PY_ENTRY_ARRAY_PATCH(&notify_entry_array_Type);
2380 #endif
2381 #ifdef PY_DB_ENTRY_PATCH
2382         PY_DB_ENTRY_PATCH(&notify_db_entry_Type);
2383 #endif
2384 #ifdef PY_DEPTH_PATCH
2385         PY_DEPTH_PATCH(&notify_depth_Type);
2386 #endif
2387 #ifdef PY_ARRAY_PATCH
2388         PY_ARRAY_PATCH(&notify_array_Type);
2389 #endif
2390 #ifdef PY_EVENT_PATCH
2391         PY_EVENT_PATCH(&notify_event_Type);
2392 #endif
2393 #ifdef PY_REMOTE_EVENT_PATCH
2394         PY_REMOTE_EVENT_PATCH(&notify_remote_event_Type);
2395 #endif
2396 #ifdef PY_FILE_NOTIFY_INFORMATION_PATCH
2397         PY_FILE_NOTIFY_INFORMATION_PATCH(&FILE_NOTIFY_INFORMATION_Type);
2398 #endif
2399
2400         m = Py_InitModule3("notify", notify_methods, "notify DCE/RPC");
2401         if (m == NULL)
2402                 return;
2403
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 *)&notify_entry_Type);
2413         PyModule_AddObject(m, "entry", (PyObject *)(void *)&notify_entry_Type);
2414         Py_INCREF((PyObject *)(void *)&notify_entry_array_Type);
2415         PyModule_AddObject(m, "entry_array", (PyObject *)(void *)&notify_entry_array_Type);
2416         Py_INCREF((PyObject *)(void *)&notify_db_entry_Type);
2417         PyModule_AddObject(m, "db_entry", (PyObject *)(void *)&notify_db_entry_Type);
2418         Py_INCREF((PyObject *)(void *)&notify_depth_Type);
2419         PyModule_AddObject(m, "depth", (PyObject *)(void *)&notify_depth_Type);
2420         Py_INCREF((PyObject *)(void *)&notify_array_Type);
2421         PyModule_AddObject(m, "array", (PyObject *)(void *)&notify_array_Type);
2422         Py_INCREF((PyObject *)(void *)&notify_event_Type);
2423         PyModule_AddObject(m, "event", (PyObject *)(void *)&notify_event_Type);
2424         Py_INCREF((PyObject *)(void *)&notify_remote_event_Type);
2425         PyModule_AddObject(m, "remote_event", (PyObject *)(void *)&notify_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);
2430 #endif
2431
2432 }