LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_echo.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 312 3131 10.0 %
Date: 2021-09-23 10:06:22 Functions: 20 236 8.5 %

          Line data    Source code
       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 "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_echo.h"
      12             : #include "bin/default/librpc/gen_ndr/ndr_echo_c.h"
      13             : 
      14             : /*
      15             :  * Suppress compiler warnings if the generated code does not call these
      16             :  * functions
      17             :  */
      18             : #ifndef _MAYBE_UNUSED_
      19             : #ifdef __has_attribute
      20             : #if __has_attribute(unused)
      21             : #define _MAYBE_UNUSED_ __attribute__ ((unused))
      22             : #else
      23             : #define _MAYBE_UNUSED_
      24             : #endif
      25             : #endif
      26             : #endif
      27             : /*
      28             :  * These functions are here to ensure they can be optimized out by
      29             :  * the compiler based on the constant input values
      30             :  */
      31             : 
      32          29 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34          29 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37           3 :         case 4:
      38           3 :                 return UINT32_MAX;
      39           4 :         case 2:
      40           4 :                 return UINT16_MAX;
      41          22 :         case 1:
      42          22 :                 return UINT8_MAX;
      43             :         }
      44             : 
      45           0 :         return 0;
      46             : }
      47             : 
      48             : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
      49             : {
      50             :         switch (var_size) {
      51             :         case 8:
      52             :                 return INT64_MAX;
      53             :         case 4:
      54             :                 return INT32_MAX;
      55             :         case 2:
      56             :                 return INT16_MAX;
      57             :         case 1:
      58             :                 return INT8_MAX;
      59             :         }
      60             : 
      61             :         return 0;
      62             : }
      63             : 
      64             : static PyTypeObject echo_info1_Type;
      65             : static PyTypeObject echo_info2_Type;
      66             : static PyTypeObject echo_info3_Type;
      67             : static PyTypeObject echo_info4_Type;
      68             : static PyTypeObject echo_info5_Type;
      69             : static PyTypeObject echo_info6_Type;
      70             : static PyTypeObject echo_info7_Type;
      71             : static PyTypeObject echo_Info_Type;
      72             : static PyTypeObject echo_Enum2_Type;
      73             : static PyTypeObject echo_Enum3_Type;
      74             : static PyTypeObject echo_Surrounding_Type;
      75             : static PyTypeObject rpcecho_InterfaceType;
      76             : static PyTypeObject echo_AddOne_Type;
      77             : static PyTypeObject echo_EchoData_Type;
      78             : static PyTypeObject echo_SinkData_Type;
      79             : static PyTypeObject echo_SourceData_Type;
      80             : static PyTypeObject echo_TestCall_Type;
      81             : static PyTypeObject echo_TestCall2_Type;
      82             : static PyTypeObject echo_TestSleep_Type;
      83             : static PyTypeObject echo_TestEnum_Type;
      84             : static PyTypeObject echo_TestSurrounding_Type;
      85             : static PyTypeObject echo_TestDoublePointer_Type;
      86             : 
      87             : static PyTypeObject *BaseObject_Type;
      88             : static PyTypeObject *ndr_pointer_Type;
      89             : static PyTypeObject *ClientConnection_Type;
      90             : static PyTypeObject *ndr_syntax_id_Type;
      91             : 
      92           1 : static PyObject *py_echo_info1_get_v(PyObject *obj, void *closure)
      93             : {
      94           1 :         struct echo_info1 *object = (struct echo_info1 *)pytalloc_get_ptr(obj);
      95             :         PyObject *py_v;
      96           1 :         py_v = PyLong_FromLong((uint16_t)object->v);
      97           1 :         return py_v;
      98             : }
      99             : 
     100           1 : static int py_echo_info1_set_v(PyObject *py_obj, PyObject *value, void *closure)
     101             : {
     102           1 :         struct echo_info1 *object = (struct echo_info1 *)pytalloc_get_ptr(py_obj);
     103           1 :         if (value == NULL) {
     104           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v");
     105           0 :                 return -1;
     106             :         }
     107             :         {
     108           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v));
     109           1 :                 if (PyLong_Check(value)) {
     110             :                         unsigned long long test_var;
     111           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     112           1 :                         if (PyErr_Occurred() != NULL) {
     113           0 :                                 return -1;
     114             :                         }
     115           1 :                         if (test_var > uint_max) {
     116           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     117             :                                   PyLong_Type.tp_name, uint_max, test_var);
     118           0 :                                 return -1;
     119             :                         }
     120           1 :                         object->v = test_var;
     121             :                 } else {
     122           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     123             :                           PyLong_Type.tp_name);
     124           0 :                         return -1;
     125             :                 }
     126             :         }
     127           1 :         return 0;
     128             : }
     129             : 
     130             : static PyGetSetDef py_echo_info1_getsetters[] = {
     131             :         {
     132             :                 .name = discard_const_p(char, "v"),
     133             :                 .get = py_echo_info1_get_v,
     134             :                 .set = py_echo_info1_set_v,
     135             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     136             :         },
     137             :         { .name = NULL }
     138             : };
     139             : 
     140           2 : static PyObject *py_echo_info1_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     141             : {
     142           2 :         return pytalloc_new(struct echo_info1, type);
     143             : }
     144             : 
     145           1 : static PyObject *py_echo_info1_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     146             : {
     147           1 :         struct echo_info1 *object = (struct echo_info1 *)pytalloc_get_ptr(py_obj);
     148           1 :         PyObject *ret = NULL;
     149             :         DATA_BLOB blob;
     150             :         enum ndr_err_code err;
     151           1 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     152           1 :         if (tmp_ctx == NULL) {
     153           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     154           0 :                 return NULL;
     155             :         }
     156           1 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_echo_info1);
     157           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     158           0 :                 TALLOC_FREE(tmp_ctx);
     159           0 :                 PyErr_SetNdrError(err);
     160           0 :                 return NULL;
     161             :         }
     162             : 
     163           1 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     164           1 :         TALLOC_FREE(tmp_ctx);
     165           1 :         return ret;
     166             : }
     167             : 
     168           1 : static PyObject *py_echo_info1_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     169             : {
     170           1 :         struct echo_info1 *object = (struct echo_info1 *)pytalloc_get_ptr(py_obj);
     171           1 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     172           1 :         Py_ssize_t blob_length = 0;
     173             :         enum ndr_err_code err;
     174           1 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     175           1 :         PyObject *allow_remaining_obj = NULL;
     176           1 :         bool allow_remaining = false;
     177             : 
     178           1 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     179             :                 discard_const_p(char *, kwnames),
     180             :                 &blob.data, &blob_length,
     181             :                 &allow_remaining_obj)) {
     182           0 :                 return NULL;
     183             :         }
     184           1 :         blob.length = blob_length;
     185             : 
     186           1 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     187           0 :                 allow_remaining = true;
     188             :         }
     189             : 
     190           1 :         if (allow_remaining) {
     191           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_echo_info1);
     192             :         } else {
     193           1 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_echo_info1);
     194             :         }
     195           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     196           0 :                 PyErr_SetNdrError(err);
     197           0 :                 return NULL;
     198             :         }
     199             : 
     200           1 :         Py_RETURN_NONE;
     201             : }
     202             : 
     203           0 : static PyObject *py_echo_info1_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     204             : {
     205           0 :         struct echo_info1 *object = (struct echo_info1 *)pytalloc_get_ptr(py_obj);
     206             :         PyObject *ret;
     207             :         char *retstr;
     208             : 
     209           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_echo_info1, "echo_info1", object);
     210           0 :         ret = PyUnicode_FromString(retstr);
     211           0 :         talloc_free(retstr);
     212             : 
     213           0 :         return ret;
     214             : }
     215             : 
     216             : static PyMethodDef py_echo_info1_methods[] = {
     217             :         { "__ndr_pack__", (PyCFunction)py_echo_info1_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     218             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_info1_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     219             :         { "__ndr_print__", (PyCFunction)py_echo_info1_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     220             :         { NULL, NULL, 0, NULL }
     221             : };
     222             : 
     223             : 
     224             : static PyTypeObject echo_info1_Type = {
     225             :         PyVarObject_HEAD_INIT(NULL, 0)
     226             :         .tp_name = "echo.info1",
     227             :         .tp_getset = py_echo_info1_getsetters,
     228             :         .tp_methods = py_echo_info1_methods,
     229             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     230             :         .tp_new = py_echo_info1_new,
     231             : };
     232             : 
     233             : 
     234           0 : static PyObject *py_echo_info2_get_v(PyObject *obj, void *closure)
     235             : {
     236           0 :         struct echo_info2 *object = (struct echo_info2 *)pytalloc_get_ptr(obj);
     237             :         PyObject *py_v;
     238           0 :         py_v = PyLong_FromLong((uint16_t)object->v);
     239           0 :         return py_v;
     240             : }
     241             : 
     242           0 : static int py_echo_info2_set_v(PyObject *py_obj, PyObject *value, void *closure)
     243             : {
     244           0 :         struct echo_info2 *object = (struct echo_info2 *)pytalloc_get_ptr(py_obj);
     245           0 :         if (value == NULL) {
     246           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v");
     247           0 :                 return -1;
     248             :         }
     249             :         {
     250           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v));
     251           0 :                 if (PyLong_Check(value)) {
     252             :                         unsigned long long test_var;
     253           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     254           0 :                         if (PyErr_Occurred() != NULL) {
     255           0 :                                 return -1;
     256             :                         }
     257           0 :                         if (test_var > uint_max) {
     258           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     259             :                                   PyLong_Type.tp_name, uint_max, test_var);
     260           0 :                                 return -1;
     261             :                         }
     262           0 :                         object->v = test_var;
     263             :                 } else {
     264           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     265             :                           PyLong_Type.tp_name);
     266           0 :                         return -1;
     267             :                 }
     268             :         }
     269           0 :         return 0;
     270             : }
     271             : 
     272             : static PyGetSetDef py_echo_info2_getsetters[] = {
     273             :         {
     274             :                 .name = discard_const_p(char, "v"),
     275             :                 .get = py_echo_info2_get_v,
     276             :                 .set = py_echo_info2_set_v,
     277             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
     278             :         },
     279             :         { .name = NULL }
     280             : };
     281             : 
     282           0 : static PyObject *py_echo_info2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     283             : {
     284           0 :         return pytalloc_new(struct echo_info2, type);
     285             : }
     286             : 
     287             : 
     288             : static PyTypeObject echo_info2_Type = {
     289             :         PyVarObject_HEAD_INIT(NULL, 0)
     290             :         .tp_name = "echo.info2",
     291             :         .tp_getset = py_echo_info2_getsetters,
     292             :         .tp_methods = NULL,
     293             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     294             :         .tp_new = py_echo_info2_new,
     295             : };
     296             : 
     297             : 
     298           0 : static PyObject *py_echo_info3_get_v(PyObject *obj, void *closure)
     299             : {
     300           0 :         struct echo_info3 *object = (struct echo_info3 *)pytalloc_get_ptr(obj);
     301             :         PyObject *py_v;
     302           0 :         py_v = PyLong_FromUnsignedLongLong((uint32_t)object->v);
     303           0 :         return py_v;
     304             : }
     305             : 
     306           0 : static int py_echo_info3_set_v(PyObject *py_obj, PyObject *value, void *closure)
     307             : {
     308           0 :         struct echo_info3 *object = (struct echo_info3 *)pytalloc_get_ptr(py_obj);
     309           0 :         if (value == NULL) {
     310           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v");
     311           0 :                 return -1;
     312             :         }
     313             :         {
     314           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v));
     315           0 :                 if (PyLong_Check(value)) {
     316             :                         unsigned long long test_var;
     317           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     318           0 :                         if (PyErr_Occurred() != NULL) {
     319           0 :                                 return -1;
     320             :                         }
     321           0 :                         if (test_var > uint_max) {
     322           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     323             :                                   PyLong_Type.tp_name, uint_max, test_var);
     324           0 :                                 return -1;
     325             :                         }
     326           0 :                         object->v = test_var;
     327             :                 } else {
     328           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     329             :                           PyLong_Type.tp_name);
     330           0 :                         return -1;
     331             :                 }
     332             :         }
     333           0 :         return 0;
     334             : }
     335             : 
     336             : static PyGetSetDef py_echo_info3_getsetters[] = {
     337             :         {
     338             :                 .name = discard_const_p(char, "v"),
     339             :                 .get = py_echo_info3_get_v,
     340             :                 .set = py_echo_info3_set_v,
     341             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     342             :         },
     343             :         { .name = NULL }
     344             : };
     345             : 
     346           0 : static PyObject *py_echo_info3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     347             : {
     348           0 :         return pytalloc_new(struct echo_info3, type);
     349             : }
     350             : 
     351             : 
     352             : static PyTypeObject echo_info3_Type = {
     353             :         PyVarObject_HEAD_INIT(NULL, 0)
     354             :         .tp_name = "echo.info3",
     355             :         .tp_getset = py_echo_info3_getsetters,
     356             :         .tp_methods = NULL,
     357             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     358             :         .tp_new = py_echo_info3_new,
     359             : };
     360             : 
     361             : 
     362           0 : static PyObject *py_echo_info4_get_v(PyObject *obj, void *closure)
     363             : {
     364           0 :         struct echo_info4 *object = (struct echo_info4 *)pytalloc_get_ptr(obj);
     365             :         PyObject *py_v;
     366           0 :         py_v = PyLong_FromUnsignedLongLong(object->v);
     367           0 :         return py_v;
     368             : }
     369             : 
     370           0 : static int py_echo_info4_set_v(PyObject *py_obj, PyObject *value, void *closure)
     371             : {
     372           0 :         struct echo_info4 *object = (struct echo_info4 *)pytalloc_get_ptr(py_obj);
     373           0 :         if (value == NULL) {
     374           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v");
     375           0 :                 return -1;
     376             :         }
     377             :         {
     378           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v));
     379           0 :                 if (PyLong_Check(value)) {
     380             :                         unsigned long long test_var;
     381           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     382           0 :                         if (PyErr_Occurred() != NULL) {
     383           0 :                                 return -1;
     384             :                         }
     385           0 :                         if (test_var > uint_max) {
     386           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     387             :                                   PyLong_Type.tp_name, uint_max, test_var);
     388           0 :                                 return -1;
     389             :                         }
     390           0 :                         object->v = test_var;
     391             :                 } else {
     392           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     393             :                           PyLong_Type.tp_name);
     394           0 :                         return -1;
     395             :                 }
     396             :         }
     397           0 :         return 0;
     398             : }
     399             : 
     400             : static PyGetSetDef py_echo_info4_getsetters[] = {
     401             :         {
     402             :                 .name = discard_const_p(char, "v"),
     403             :                 .get = py_echo_info4_get_v,
     404             :                 .set = py_echo_info4_set_v,
     405             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
     406             :         },
     407             :         { .name = NULL }
     408             : };
     409             : 
     410           0 : static PyObject *py_echo_info4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     411             : {
     412           0 :         return pytalloc_new(struct echo_info4, type);
     413             : }
     414             : 
     415             : 
     416             : static PyTypeObject echo_info4_Type = {
     417             :         PyVarObject_HEAD_INIT(NULL, 0)
     418             :         .tp_name = "echo.info4",
     419             :         .tp_getset = py_echo_info4_getsetters,
     420             :         .tp_methods = NULL,
     421             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     422             :         .tp_new = py_echo_info4_new,
     423             : };
     424             : 
     425             : 
     426           0 : static PyObject *py_echo_info5_get_v1(PyObject *obj, void *closure)
     427             : {
     428           0 :         struct echo_info5 *object = (struct echo_info5 *)pytalloc_get_ptr(obj);
     429             :         PyObject *py_v1;
     430           0 :         py_v1 = PyLong_FromLong((uint16_t)object->v1);
     431           0 :         return py_v1;
     432             : }
     433             : 
     434           0 : static int py_echo_info5_set_v1(PyObject *py_obj, PyObject *value, void *closure)
     435             : {
     436           0 :         struct echo_info5 *object = (struct echo_info5 *)pytalloc_get_ptr(py_obj);
     437           0 :         if (value == NULL) {
     438           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v1");
     439           0 :                 return -1;
     440             :         }
     441             :         {
     442           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v1));
     443           0 :                 if (PyLong_Check(value)) {
     444             :                         unsigned long long test_var;
     445           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     446           0 :                         if (PyErr_Occurred() != NULL) {
     447           0 :                                 return -1;
     448             :                         }
     449           0 :                         if (test_var > uint_max) {
     450           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     451             :                                   PyLong_Type.tp_name, uint_max, test_var);
     452           0 :                                 return -1;
     453             :                         }
     454           0 :                         object->v1 = test_var;
     455             :                 } else {
     456           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     457             :                           PyLong_Type.tp_name);
     458           0 :                         return -1;
     459             :                 }
     460             :         }
     461           0 :         return 0;
     462             : }
     463             : 
     464           0 : static PyObject *py_echo_info5_get_v2(PyObject *obj, void *closure)
     465             : {
     466           0 :         struct echo_info5 *object = (struct echo_info5 *)pytalloc_get_ptr(obj);
     467             :         PyObject *py_v2;
     468           0 :         py_v2 = PyLong_FromUnsignedLongLong(object->v2);
     469           0 :         return py_v2;
     470             : }
     471             : 
     472           0 : static int py_echo_info5_set_v2(PyObject *py_obj, PyObject *value, void *closure)
     473             : {
     474           0 :         struct echo_info5 *object = (struct echo_info5 *)pytalloc_get_ptr(py_obj);
     475           0 :         if (value == NULL) {
     476           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v2");
     477           0 :                 return -1;
     478             :         }
     479             :         {
     480           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v2));
     481           0 :                 if (PyLong_Check(value)) {
     482             :                         unsigned long long test_var;
     483           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     484           0 :                         if (PyErr_Occurred() != NULL) {
     485           0 :                                 return -1;
     486             :                         }
     487           0 :                         if (test_var > uint_max) {
     488           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     489             :                                   PyLong_Type.tp_name, uint_max, test_var);
     490           0 :                                 return -1;
     491             :                         }
     492           0 :                         object->v2 = test_var;
     493             :                 } else {
     494           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     495             :                           PyLong_Type.tp_name);
     496           0 :                         return -1;
     497             :                 }
     498             :         }
     499           0 :         return 0;
     500             : }
     501             : 
     502             : static PyGetSetDef py_echo_info5_getsetters[] = {
     503             :         {
     504             :                 .name = discard_const_p(char, "v1"),
     505             :                 .get = py_echo_info5_get_v1,
     506             :                 .set = py_echo_info5_set_v1,
     507             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     508             :         },
     509             :         {
     510             :                 .name = discard_const_p(char, "v2"),
     511             :                 .get = py_echo_info5_get_v2,
     512             :                 .set = py_echo_info5_set_v2,
     513             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
     514             :         },
     515             :         { .name = NULL }
     516             : };
     517             : 
     518           0 : static PyObject *py_echo_info5_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     519             : {
     520           0 :         return pytalloc_new(struct echo_info5, type);
     521             : }
     522             : 
     523             : 
     524             : static PyTypeObject echo_info5_Type = {
     525             :         PyVarObject_HEAD_INIT(NULL, 0)
     526             :         .tp_name = "echo.info5",
     527             :         .tp_getset = py_echo_info5_getsetters,
     528             :         .tp_methods = NULL,
     529             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     530             :         .tp_new = py_echo_info5_new,
     531             : };
     532             : 
     533             : 
     534           0 : static PyObject *py_echo_info6_get_v1(PyObject *obj, void *closure)
     535             : {
     536           0 :         struct echo_info6 *object = (struct echo_info6 *)pytalloc_get_ptr(obj);
     537             :         PyObject *py_v1;
     538           0 :         py_v1 = PyLong_FromLong((uint16_t)object->v1);
     539           0 :         return py_v1;
     540             : }
     541             : 
     542           0 : static int py_echo_info6_set_v1(PyObject *py_obj, PyObject *value, void *closure)
     543             : {
     544           0 :         struct echo_info6 *object = (struct echo_info6 *)pytalloc_get_ptr(py_obj);
     545           0 :         if (value == NULL) {
     546           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v1");
     547           0 :                 return -1;
     548             :         }
     549             :         {
     550           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v1));
     551           0 :                 if (PyLong_Check(value)) {
     552             :                         unsigned long long test_var;
     553           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     554           0 :                         if (PyErr_Occurred() != NULL) {
     555           0 :                                 return -1;
     556             :                         }
     557           0 :                         if (test_var > uint_max) {
     558           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     559             :                                   PyLong_Type.tp_name, uint_max, test_var);
     560           0 :                                 return -1;
     561             :                         }
     562           0 :                         object->v1 = test_var;
     563             :                 } else {
     564           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     565             :                           PyLong_Type.tp_name);
     566           0 :                         return -1;
     567             :                 }
     568             :         }
     569           0 :         return 0;
     570             : }
     571             : 
     572           0 : static PyObject *py_echo_info6_get_info1(PyObject *obj, void *closure)
     573             : {
     574           0 :         struct echo_info6 *object = (struct echo_info6 *)pytalloc_get_ptr(obj);
     575             :         PyObject *py_info1;
     576           0 :         py_info1 = pytalloc_reference_ex(&echo_info1_Type, pytalloc_get_mem_ctx(obj), &object->info1);
     577           0 :         return py_info1;
     578             : }
     579             : 
     580           0 : static int py_echo_info6_set_info1(PyObject *py_obj, PyObject *value, void *closure)
     581             : {
     582           0 :         struct echo_info6 *object = (struct echo_info6 *)pytalloc_get_ptr(py_obj);
     583           0 :         if (value == NULL) {
     584           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info1");
     585           0 :                 return -1;
     586             :         }
     587           0 :         PY_CHECK_TYPE(&echo_info1_Type, value, return -1;);
     588           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     589           0 :                 PyErr_NoMemory();
     590           0 :                 return -1;
     591             :         }
     592           0 :         object->info1 = *(struct echo_info1 *)pytalloc_get_ptr(value);
     593           0 :         return 0;
     594             : }
     595             : 
     596             : static PyGetSetDef py_echo_info6_getsetters[] = {
     597             :         {
     598             :                 .name = discard_const_p(char, "v1"),
     599             :                 .get = py_echo_info6_get_v1,
     600             :                 .set = py_echo_info6_set_v1,
     601             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     602             :         },
     603             :         {
     604             :                 .name = discard_const_p(char, "info1"),
     605             :                 .get = py_echo_info6_get_info1,
     606             :                 .set = py_echo_info6_set_info1,
     607             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_info1")
     608             :         },
     609             :         { .name = NULL }
     610             : };
     611             : 
     612           0 : static PyObject *py_echo_info6_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     613             : {
     614           0 :         return pytalloc_new(struct echo_info6, type);
     615             : }
     616             : 
     617             : 
     618             : static PyTypeObject echo_info6_Type = {
     619             :         PyVarObject_HEAD_INIT(NULL, 0)
     620             :         .tp_name = "echo.info6",
     621             :         .tp_getset = py_echo_info6_getsetters,
     622             :         .tp_methods = NULL,
     623             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     624             :         .tp_new = py_echo_info6_new,
     625             : };
     626             : 
     627             : 
     628           0 : static PyObject *py_echo_info7_get_v1(PyObject *obj, void *closure)
     629             : {
     630           0 :         struct echo_info7 *object = (struct echo_info7 *)pytalloc_get_ptr(obj);
     631             :         PyObject *py_v1;
     632           0 :         py_v1 = PyLong_FromLong((uint16_t)object->v1);
     633           0 :         return py_v1;
     634             : }
     635             : 
     636           0 : static int py_echo_info7_set_v1(PyObject *py_obj, PyObject *value, void *closure)
     637             : {
     638           0 :         struct echo_info7 *object = (struct echo_info7 *)pytalloc_get_ptr(py_obj);
     639           0 :         if (value == NULL) {
     640           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v1");
     641           0 :                 return -1;
     642             :         }
     643             :         {
     644           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->v1));
     645           0 :                 if (PyLong_Check(value)) {
     646             :                         unsigned long long test_var;
     647           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     648           0 :                         if (PyErr_Occurred() != NULL) {
     649           0 :                                 return -1;
     650             :                         }
     651           0 :                         if (test_var > uint_max) {
     652           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     653             :                                   PyLong_Type.tp_name, uint_max, test_var);
     654           0 :                                 return -1;
     655             :                         }
     656           0 :                         object->v1 = test_var;
     657             :                 } else {
     658           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     659             :                           PyLong_Type.tp_name);
     660           0 :                         return -1;
     661             :                 }
     662             :         }
     663           0 :         return 0;
     664             : }
     665             : 
     666           0 : static PyObject *py_echo_info7_get_info4(PyObject *obj, void *closure)
     667             : {
     668           0 :         struct echo_info7 *object = (struct echo_info7 *)pytalloc_get_ptr(obj);
     669             :         PyObject *py_info4;
     670           0 :         py_info4 = pytalloc_reference_ex(&echo_info4_Type, pytalloc_get_mem_ctx(obj), &object->info4);
     671           0 :         return py_info4;
     672             : }
     673             : 
     674           0 : static int py_echo_info7_set_info4(PyObject *py_obj, PyObject *value, void *closure)
     675             : {
     676           0 :         struct echo_info7 *object = (struct echo_info7 *)pytalloc_get_ptr(py_obj);
     677           0 :         if (value == NULL) {
     678           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info4");
     679           0 :                 return -1;
     680             :         }
     681           0 :         PY_CHECK_TYPE(&echo_info4_Type, value, return -1;);
     682           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     683           0 :                 PyErr_NoMemory();
     684           0 :                 return -1;
     685             :         }
     686           0 :         object->info4 = *(struct echo_info4 *)pytalloc_get_ptr(value);
     687           0 :         return 0;
     688             : }
     689             : 
     690             : static PyGetSetDef py_echo_info7_getsetters[] = {
     691             :         {
     692             :                 .name = discard_const_p(char, "v1"),
     693             :                 .get = py_echo_info7_get_v1,
     694             :                 .set = py_echo_info7_set_v1,
     695             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     696             :         },
     697             :         {
     698             :                 .name = discard_const_p(char, "info4"),
     699             :                 .get = py_echo_info7_get_info4,
     700             :                 .set = py_echo_info7_set_info4,
     701             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_info4")
     702             :         },
     703             :         { .name = NULL }
     704             : };
     705             : 
     706           0 : static PyObject *py_echo_info7_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     707             : {
     708           0 :         return pytalloc_new(struct echo_info7, type);
     709             : }
     710             : 
     711             : 
     712             : static PyTypeObject echo_info7_Type = {
     713             :         PyVarObject_HEAD_INIT(NULL, 0)
     714             :         .tp_name = "echo.info7",
     715             :         .tp_getset = py_echo_info7_getsetters,
     716             :         .tp_methods = NULL,
     717             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     718             :         .tp_new = py_echo_info7_new,
     719             : };
     720             : 
     721           0 : static PyObject *py_import_echo_Info(TALLOC_CTX *mem_ctx, int level, union echo_Info *in)
     722             : {
     723             :         PyObject *ret;
     724             : 
     725           0 :         switch (level) {
     726           0 :                 case 1:
     727           0 :                         ret = pytalloc_reference_ex(&echo_info1_Type, mem_ctx, &in->info1);
     728           0 :                         return ret;
     729             : 
     730           0 :                 case 2:
     731           0 :                         ret = pytalloc_reference_ex(&echo_info2_Type, mem_ctx, &in->info2);
     732           0 :                         return ret;
     733             : 
     734           0 :                 case 3:
     735           0 :                         ret = pytalloc_reference_ex(&echo_info3_Type, mem_ctx, &in->info3);
     736           0 :                         return ret;
     737             : 
     738           0 :                 case 4:
     739           0 :                         ret = pytalloc_reference_ex(&echo_info4_Type, mem_ctx, &in->info4);
     740           0 :                         return ret;
     741             : 
     742           0 :                 case 5:
     743           0 :                         ret = pytalloc_reference_ex(&echo_info5_Type, mem_ctx, &in->info5);
     744           0 :                         return ret;
     745             : 
     746           0 :                 case 6:
     747           0 :                         ret = pytalloc_reference_ex(&echo_info6_Type, mem_ctx, &in->info6);
     748           0 :                         return ret;
     749             : 
     750           0 :                 case 7:
     751           0 :                         ret = pytalloc_reference_ex(&echo_info7_Type, mem_ctx, &in->info7);
     752           0 :                         return ret;
     753             : 
     754             :         }
     755           0 :         PyErr_SetString(PyExc_TypeError, "unknown union level");
     756           0 :         return NULL;
     757             : }
     758             : 
     759           0 : static union echo_Info *py_export_echo_Info(TALLOC_CTX *mem_ctx, int level, PyObject *in)
     760             : {
     761           0 :         union echo_Info *ret = talloc_zero(mem_ctx, union echo_Info);
     762           0 :         switch (level) {
     763           0 :                 case 1:
     764           0 :                         if (in == NULL) {
     765           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info1");
     766           0 :                                 talloc_free(ret); return NULL;
     767             :                         }
     768           0 :                         PY_CHECK_TYPE(&echo_info1_Type, in, talloc_free(ret); return NULL;);
     769           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     770           0 :                                 PyErr_NoMemory();
     771           0 :                                 talloc_free(ret); return NULL;
     772             :                         }
     773           0 :                         ret->info1 = *(struct echo_info1 *)pytalloc_get_ptr(in);
     774           0 :                         break;
     775             : 
     776           0 :                 case 2:
     777           0 :                         if (in == NULL) {
     778           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info2");
     779           0 :                                 talloc_free(ret); return NULL;
     780             :                         }
     781           0 :                         PY_CHECK_TYPE(&echo_info2_Type, in, talloc_free(ret); return NULL;);
     782           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     783           0 :                                 PyErr_NoMemory();
     784           0 :                                 talloc_free(ret); return NULL;
     785             :                         }
     786           0 :                         ret->info2 = *(struct echo_info2 *)pytalloc_get_ptr(in);
     787           0 :                         break;
     788             : 
     789           0 :                 case 3:
     790           0 :                         if (in == NULL) {
     791           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info3");
     792           0 :                                 talloc_free(ret); return NULL;
     793             :                         }
     794           0 :                         PY_CHECK_TYPE(&echo_info3_Type, in, talloc_free(ret); return NULL;);
     795           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     796           0 :                                 PyErr_NoMemory();
     797           0 :                                 talloc_free(ret); return NULL;
     798             :                         }
     799           0 :                         ret->info3 = *(struct echo_info3 *)pytalloc_get_ptr(in);
     800           0 :                         break;
     801             : 
     802           0 :                 case 4:
     803           0 :                         if (in == NULL) {
     804           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info4");
     805           0 :                                 talloc_free(ret); return NULL;
     806             :                         }
     807           0 :                         PY_CHECK_TYPE(&echo_info4_Type, in, talloc_free(ret); return NULL;);
     808           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     809           0 :                                 PyErr_NoMemory();
     810           0 :                                 talloc_free(ret); return NULL;
     811             :                         }
     812           0 :                         ret->info4 = *(struct echo_info4 *)pytalloc_get_ptr(in);
     813           0 :                         break;
     814             : 
     815           0 :                 case 5:
     816           0 :                         if (in == NULL) {
     817           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info5");
     818           0 :                                 talloc_free(ret); return NULL;
     819             :                         }
     820           0 :                         PY_CHECK_TYPE(&echo_info5_Type, in, talloc_free(ret); return NULL;);
     821           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     822           0 :                                 PyErr_NoMemory();
     823           0 :                                 talloc_free(ret); return NULL;
     824             :                         }
     825           0 :                         ret->info5 = *(struct echo_info5 *)pytalloc_get_ptr(in);
     826           0 :                         break;
     827             : 
     828           0 :                 case 6:
     829           0 :                         if (in == NULL) {
     830           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info6");
     831           0 :                                 talloc_free(ret); return NULL;
     832             :                         }
     833           0 :                         PY_CHECK_TYPE(&echo_info6_Type, in, talloc_free(ret); return NULL;);
     834           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     835           0 :                                 PyErr_NoMemory();
     836           0 :                                 talloc_free(ret); return NULL;
     837             :                         }
     838           0 :                         ret->info6 = *(struct echo_info6 *)pytalloc_get_ptr(in);
     839           0 :                         break;
     840             : 
     841           0 :                 case 7:
     842           0 :                         if (in == NULL) {
     843           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info7");
     844           0 :                                 talloc_free(ret); return NULL;
     845             :                         }
     846           0 :                         PY_CHECK_TYPE(&echo_info7_Type, in, talloc_free(ret); return NULL;);
     847           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
     848           0 :                                 PyErr_NoMemory();
     849           0 :                                 talloc_free(ret); return NULL;
     850             :                         }
     851           0 :                         ret->info7 = *(struct echo_info7 *)pytalloc_get_ptr(in);
     852           0 :                         break;
     853             : 
     854           0 :                 default:
     855           0 :                         PyErr_SetString(PyExc_TypeError, "invalid union level value");
     856           0 :                         talloc_free(ret);
     857           0 :                         ret = NULL;
     858             :         }
     859             : 
     860           0 :         return ret;
     861             : }
     862             : 
     863           0 : static PyObject *py_echo_Info_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     864             : {
     865           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
     866           0 :         PyObject *mem_ctx_obj = NULL;
     867           0 :         TALLOC_CTX *mem_ctx = NULL;
     868           0 :         int level = 0;
     869           0 :         PyObject *in_obj = NULL;
     870           0 :         union echo_Info *in = NULL;
     871             : 
     872           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
     873             :                 discard_const_p(char *, kwnames),
     874             :                 &mem_ctx_obj,
     875             :                 &level,
     876             :                 &in_obj)) {
     877           0 :                 return NULL;
     878             :         }
     879           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
     880           0 :         if (mem_ctx == NULL) {
     881           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
     882           0 :                 return NULL;
     883             :         }
     884           0 :         in = (union echo_Info *)pytalloc_get_ptr(in_obj);
     885           0 :         if (in == NULL) {
     886           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union echo_Info!");
     887           0 :                 return NULL;
     888             :         }
     889             : 
     890           0 :         return py_import_echo_Info(mem_ctx, level, in);
     891             : }
     892             : 
     893           0 : static PyObject *py_echo_Info_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     894             : {
     895           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
     896           0 :         PyObject *mem_ctx_obj = NULL;
     897           0 :         TALLOC_CTX *mem_ctx = NULL;
     898           0 :         int level = 0;
     899           0 :         PyObject *in = NULL;
     900           0 :         union echo_Info *out = NULL;
     901             : 
     902           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
     903             :                 discard_const_p(char *, kwnames),
     904             :                 &mem_ctx_obj,
     905             :                 &level,
     906             :                 &in)) {
     907           0 :                 return NULL;
     908             :         }
     909           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
     910           0 :         if (mem_ctx == NULL) {
     911           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
     912           0 :                 return NULL;
     913             :         }
     914             : 
     915           0 :         out = py_export_echo_Info(mem_ctx, level, in);
     916           0 :         if (out == NULL) {
     917           0 :                 return NULL;
     918             :         }
     919             : 
     920           0 :         return pytalloc_GenericObject_reference(out);
     921             : }
     922             : 
     923             : static PyMethodDef py_echo_Info_methods[] = {
     924             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_Info_import),
     925             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
     926             :                 "T.__import__(mem_ctx, level, in) => ret." },
     927             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_Info_export),
     928             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
     929             :                 "T.__export__(mem_ctx, level, in) => ret." },
     930             :         { NULL, NULL, 0, NULL }
     931             : };
     932             : 
     933           0 : static PyObject *py_echo_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     934             : {
     935           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
     936           0 :         return NULL;
     937             : }
     938             : 
     939             : 
     940             : static PyTypeObject echo_Info_Type = {
     941             :         PyVarObject_HEAD_INIT(NULL, 0)
     942             :         .tp_name = "echo.Info",
     943             :         .tp_getset = NULL,
     944             :         .tp_methods = py_echo_Info_methods,
     945             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     946             :         .tp_new = py_echo_Info_new,
     947             : };
     948             : 
     949             : 
     950           0 : static PyObject *py_echo_Enum2_get_e1(PyObject *obj, void *closure)
     951             : {
     952           0 :         struct echo_Enum2 *object = (struct echo_Enum2 *)pytalloc_get_ptr(obj);
     953             :         PyObject *py_e1;
     954           0 :         py_e1 = PyLong_FromLong((uint16_t)object->e1);
     955           0 :         return py_e1;
     956             : }
     957             : 
     958           0 : static int py_echo_Enum2_set_e1(PyObject *py_obj, PyObject *value, void *closure)
     959             : {
     960           0 :         struct echo_Enum2 *object = (struct echo_Enum2 *)pytalloc_get_ptr(py_obj);
     961           0 :         if (value == NULL) {
     962           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->e1");
     963           0 :                 return -1;
     964             :         }
     965             :         {
     966           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->e1));
     967           0 :                 if (PyLong_Check(value)) {
     968             :                         unsigned long long test_var;
     969           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     970           0 :                         if (PyErr_Occurred() != NULL) {
     971           0 :                                 return -1;
     972             :                         }
     973           0 :                         if (test_var > uint_max) {
     974           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     975             :                                   PyLong_Type.tp_name, uint_max, test_var);
     976           0 :                                 return -1;
     977             :                         }
     978           0 :                         object->e1 = test_var;
     979             :                 } else {
     980           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     981             :                           PyLong_Type.tp_name);
     982           0 :                         return -1;
     983             :                 }
     984             :         }
     985           0 :         return 0;
     986             : }
     987             : 
     988           0 : static PyObject *py_echo_Enum2_get_e2(PyObject *obj, void *closure)
     989             : {
     990           0 :         struct echo_Enum2 *object = (struct echo_Enum2 *)pytalloc_get_ptr(obj);
     991             :         PyObject *py_e2;
     992           0 :         py_e2 = PyLong_FromUnsignedLongLong((uint32_t)object->e2);
     993           0 :         return py_e2;
     994             : }
     995             : 
     996           0 : static int py_echo_Enum2_set_e2(PyObject *py_obj, PyObject *value, void *closure)
     997             : {
     998           0 :         struct echo_Enum2 *object = (struct echo_Enum2 *)pytalloc_get_ptr(py_obj);
     999           0 :         if (value == NULL) {
    1000           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->e2");
    1001           0 :                 return -1;
    1002             :         }
    1003             :         {
    1004           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->e2));
    1005           0 :                 if (PyLong_Check(value)) {
    1006             :                         unsigned long long test_var;
    1007           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1008           0 :                         if (PyErr_Occurred() != NULL) {
    1009           0 :                                 return -1;
    1010             :                         }
    1011           0 :                         if (test_var > uint_max) {
    1012           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1013             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1014           0 :                                 return -1;
    1015             :                         }
    1016           0 :                         object->e2 = test_var;
    1017             :                 } else {
    1018           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1019             :                           PyLong_Type.tp_name);
    1020           0 :                         return -1;
    1021             :                 }
    1022             :         }
    1023           0 :         return 0;
    1024             : }
    1025             : 
    1026             : static PyGetSetDef py_echo_Enum2_getsetters[] = {
    1027             :         {
    1028             :                 .name = discard_const_p(char, "e1"),
    1029             :                 .get = py_echo_Enum2_get_e1,
    1030             :                 .set = py_echo_Enum2_set_e1,
    1031             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum1")
    1032             :         },
    1033             :         {
    1034             :                 .name = discard_const_p(char, "e2"),
    1035             :                 .get = py_echo_Enum2_get_e2,
    1036             :                 .set = py_echo_Enum2_set_e2,
    1037             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum1_32")
    1038             :         },
    1039             :         { .name = NULL }
    1040             : };
    1041             : 
    1042           0 : static PyObject *py_echo_Enum2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1043             : {
    1044           0 :         return pytalloc_new(struct echo_Enum2, type);
    1045             : }
    1046             : 
    1047             : 
    1048             : static PyTypeObject echo_Enum2_Type = {
    1049             :         PyVarObject_HEAD_INIT(NULL, 0)
    1050             :         .tp_name = "echo.Enum2",
    1051             :         .tp_getset = py_echo_Enum2_getsetters,
    1052             :         .tp_methods = NULL,
    1053             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1054             :         .tp_new = py_echo_Enum2_new,
    1055             : };
    1056             : 
    1057           0 : static PyObject *py_import_echo_Enum3(TALLOC_CTX *mem_ctx, int level, union echo_Enum3 *in)
    1058             : {
    1059             :         PyObject *ret;
    1060             : 
    1061           0 :         switch (level) {
    1062           0 :                 case ECHO_ENUM1:
    1063           0 :                         ret = PyLong_FromLong((uint16_t)in->e1);
    1064           0 :                         return ret;
    1065             : 
    1066           0 :                 case ECHO_ENUM2:
    1067           0 :                         ret = pytalloc_reference_ex(&echo_Enum2_Type, mem_ctx, &in->e2);
    1068           0 :                         return ret;
    1069             : 
    1070             :         }
    1071           0 :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    1072           0 :         return NULL;
    1073             : }
    1074             : 
    1075           0 : static union echo_Enum3 *py_export_echo_Enum3(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    1076             : {
    1077           0 :         union echo_Enum3 *ret = talloc_zero(mem_ctx, union echo_Enum3);
    1078           0 :         switch (level) {
    1079           0 :                 case ECHO_ENUM1:
    1080           0 :                         if (in == NULL) {
    1081           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->e1");
    1082           0 :                                 talloc_free(ret); return NULL;
    1083             :                         }
    1084             :                         {
    1085           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->e1));
    1086           0 :                                 if (PyLong_Check(in)) {
    1087             :                                         unsigned long long test_var;
    1088           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1089           0 :                                         if (PyErr_Occurred() != NULL) {
    1090           0 :                                                 talloc_free(ret); return NULL;
    1091             :                                         }
    1092           0 :                                         if (test_var > uint_max) {
    1093           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1094             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1095           0 :                                                 talloc_free(ret); return NULL;
    1096             :                                         }
    1097           0 :                                         ret->e1 = test_var;
    1098             :                                 } else {
    1099           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1100             :                                           PyLong_Type.tp_name);
    1101           0 :                                         talloc_free(ret); return NULL;
    1102             :                                 }
    1103             :                         }
    1104           0 :                         break;
    1105             : 
    1106           0 :                 case ECHO_ENUM2:
    1107           0 :                         if (in == NULL) {
    1108           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->e2");
    1109           0 :                                 talloc_free(ret); return NULL;
    1110             :                         }
    1111           0 :                         PY_CHECK_TYPE(&echo_Enum2_Type, in, talloc_free(ret); return NULL;);
    1112           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1113           0 :                                 PyErr_NoMemory();
    1114           0 :                                 talloc_free(ret); return NULL;
    1115             :                         }
    1116           0 :                         ret->e2 = *(struct echo_Enum2 *)pytalloc_get_ptr(in);
    1117           0 :                         break;
    1118             : 
    1119           0 :                 default:
    1120           0 :                         PyErr_SetString(PyExc_TypeError, "invalid union level value");
    1121           0 :                         talloc_free(ret);
    1122           0 :                         ret = NULL;
    1123             :         }
    1124             : 
    1125           0 :         return ret;
    1126             : }
    1127             : 
    1128           0 : static PyObject *py_echo_Enum3_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1129             : {
    1130           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1131           0 :         PyObject *mem_ctx_obj = NULL;
    1132           0 :         TALLOC_CTX *mem_ctx = NULL;
    1133           0 :         int level = 0;
    1134           0 :         PyObject *in_obj = NULL;
    1135           0 :         union echo_Enum3 *in = NULL;
    1136             : 
    1137           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1138             :                 discard_const_p(char *, kwnames),
    1139             :                 &mem_ctx_obj,
    1140             :                 &level,
    1141             :                 &in_obj)) {
    1142           0 :                 return NULL;
    1143             :         }
    1144           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1145           0 :         if (mem_ctx == NULL) {
    1146           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1147           0 :                 return NULL;
    1148             :         }
    1149           0 :         in = (union echo_Enum3 *)pytalloc_get_ptr(in_obj);
    1150           0 :         if (in == NULL) {
    1151           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union echo_Enum3!");
    1152           0 :                 return NULL;
    1153             :         }
    1154             : 
    1155           0 :         return py_import_echo_Enum3(mem_ctx, level, in);
    1156             : }
    1157             : 
    1158           0 : static PyObject *py_echo_Enum3_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1159             : {
    1160           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1161           0 :         PyObject *mem_ctx_obj = NULL;
    1162           0 :         TALLOC_CTX *mem_ctx = NULL;
    1163           0 :         int level = 0;
    1164           0 :         PyObject *in = NULL;
    1165           0 :         union echo_Enum3 *out = NULL;
    1166             : 
    1167           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1168             :                 discard_const_p(char *, kwnames),
    1169             :                 &mem_ctx_obj,
    1170             :                 &level,
    1171             :                 &in)) {
    1172           0 :                 return NULL;
    1173             :         }
    1174           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1175           0 :         if (mem_ctx == NULL) {
    1176           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1177           0 :                 return NULL;
    1178             :         }
    1179             : 
    1180           0 :         out = py_export_echo_Enum3(mem_ctx, level, in);
    1181           0 :         if (out == NULL) {
    1182           0 :                 return NULL;
    1183             :         }
    1184             : 
    1185           0 :         return pytalloc_GenericObject_reference(out);
    1186             : }
    1187             : 
    1188             : static PyMethodDef py_echo_Enum3_methods[] = {
    1189             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_Enum3_import),
    1190             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1191             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1192             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_Enum3_export),
    1193             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1194             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1195             :         { NULL, NULL, 0, NULL }
    1196             : };
    1197             : 
    1198           0 : static PyObject *py_echo_Enum3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1199             : {
    1200           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1201           0 :         return NULL;
    1202             : }
    1203             : 
    1204             : 
    1205             : static PyTypeObject echo_Enum3_Type = {
    1206             :         PyVarObject_HEAD_INIT(NULL, 0)
    1207             :         .tp_name = "echo.Enum3",
    1208             :         .tp_getset = NULL,
    1209             :         .tp_methods = py_echo_Enum3_methods,
    1210             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1211             :         .tp_new = py_echo_Enum3_new,
    1212             : };
    1213             : 
    1214             : 
    1215           0 : static PyObject *py_echo_Surrounding_get_x(PyObject *obj, void *closure)
    1216             : {
    1217           0 :         struct echo_Surrounding *object = (struct echo_Surrounding *)pytalloc_get_ptr(obj);
    1218             :         PyObject *py_x;
    1219           0 :         py_x = PyLong_FromUnsignedLongLong((uint32_t)object->x);
    1220           0 :         return py_x;
    1221             : }
    1222             : 
    1223           1 : static int py_echo_Surrounding_set_x(PyObject *py_obj, PyObject *value, void *closure)
    1224             : {
    1225           1 :         struct echo_Surrounding *object = (struct echo_Surrounding *)pytalloc_get_ptr(py_obj);
    1226           1 :         if (value == NULL) {
    1227           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->x");
    1228           0 :                 return -1;
    1229             :         }
    1230             :         {
    1231           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->x));
    1232           1 :                 if (PyLong_Check(value)) {
    1233             :                         unsigned long long test_var;
    1234           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1235           1 :                         if (PyErr_Occurred() != NULL) {
    1236           0 :                                 return -1;
    1237             :                         }
    1238           1 :                         if (test_var > uint_max) {
    1239           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1240             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1241           0 :                                 return -1;
    1242             :                         }
    1243           1 :                         object->x = test_var;
    1244             :                 } else {
    1245           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1246             :                           PyLong_Type.tp_name);
    1247           0 :                         return -1;
    1248             :                 }
    1249             :         }
    1250           1 :         return 0;
    1251             : }
    1252             : 
    1253           1 : static PyObject *py_echo_Surrounding_get_surrounding(PyObject *obj, void *closure)
    1254             : {
    1255           1 :         struct echo_Surrounding *object = (struct echo_Surrounding *)pytalloc_get_ptr(obj);
    1256             :         PyObject *py_surrounding;
    1257           1 :         py_surrounding = PyList_New(object->x);
    1258           1 :         if (py_surrounding == NULL) {
    1259           0 :                 return NULL;
    1260             :         }
    1261             :         {
    1262             :                 int surrounding_cntr_0;
    1263           9 :                 for (surrounding_cntr_0 = 0; surrounding_cntr_0 < (object->x); surrounding_cntr_0++) {
    1264             :                         PyObject *py_surrounding_0;
    1265           8 :                         py_surrounding_0 = PyLong_FromLong((uint16_t)object->surrounding[surrounding_cntr_0]);
    1266           8 :                         PyList_SetItem(py_surrounding, surrounding_cntr_0, py_surrounding_0);
    1267             :                 }
    1268             :         }
    1269           1 :         return py_surrounding;
    1270             : }
    1271             : 
    1272           1 : static int py_echo_Surrounding_set_surrounding(PyObject *py_obj, PyObject *value, void *closure)
    1273             : {
    1274           1 :         struct echo_Surrounding *object = (struct echo_Surrounding *)pytalloc_get_ptr(py_obj);
    1275           1 :         if (value == NULL) {
    1276           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->surrounding");
    1277           0 :                 return -1;
    1278             :         }
    1279           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1280             :         {
    1281             :                 int surrounding_cntr_0;
    1282           1 :                 object->surrounding = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->surrounding, PyList_GET_SIZE(value));
    1283           1 :                 if (!object->surrounding) { return -1;; }
    1284           1 :                 talloc_set_name_const(object->surrounding, "ARRAY: object->surrounding");
    1285           5 :                 for (surrounding_cntr_0 = 0; surrounding_cntr_0 < PyList_GET_SIZE(value); surrounding_cntr_0++) {
    1286           4 :                         if (PyList_GET_ITEM(value, surrounding_cntr_0) == NULL) {
    1287           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->surrounding[surrounding_cntr_0]");
    1288           0 :                                 return -1;
    1289             :                         }
    1290             :                         {
    1291           4 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->surrounding[surrounding_cntr_0]));
    1292           4 :                                 if (PyLong_Check(PyList_GET_ITEM(value, surrounding_cntr_0))) {
    1293             :                                         unsigned long long test_var;
    1294           4 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, surrounding_cntr_0));
    1295           4 :                                         if (PyErr_Occurred() != NULL) {
    1296           0 :                                                 return -1;
    1297             :                                         }
    1298           4 :                                         if (test_var > uint_max) {
    1299           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1300             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1301           0 :                                                 return -1;
    1302             :                                         }
    1303           4 :                                         object->surrounding[surrounding_cntr_0] = test_var;
    1304             :                                 } else {
    1305           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1306             :                                           PyLong_Type.tp_name);
    1307           0 :                                         return -1;
    1308             :                                 }
    1309             :                         }
    1310             :                 }
    1311             :         }
    1312           1 :         return 0;
    1313             : }
    1314             : 
    1315             : static PyGetSetDef py_echo_Surrounding_getsetters[] = {
    1316             :         {
    1317             :                 .name = discard_const_p(char, "x"),
    1318             :                 .get = py_echo_Surrounding_get_x,
    1319             :                 .set = py_echo_Surrounding_set_x,
    1320             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1321             :         },
    1322             :         {
    1323             :                 .name = discard_const_p(char, "surrounding"),
    1324             :                 .get = py_echo_Surrounding_get_surrounding,
    1325             :                 .set = py_echo_Surrounding_set_surrounding,
    1326             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    1327             :         },
    1328             :         { .name = NULL }
    1329             : };
    1330             : 
    1331           1 : static PyObject *py_echo_Surrounding_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1332             : {
    1333           1 :         return pytalloc_new(struct echo_Surrounding, type);
    1334             : }
    1335             : 
    1336             : 
    1337             : static PyTypeObject echo_Surrounding_Type = {
    1338             :         PyVarObject_HEAD_INIT(NULL, 0)
    1339             :         .tp_name = "echo.Surrounding",
    1340             :         .tp_getset = py_echo_Surrounding_getsetters,
    1341             :         .tp_methods = NULL,
    1342             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1343             :         .tp_new = py_echo_Surrounding_new,
    1344             : };
    1345             : 
    1346             : 
    1347             : 
    1348           0 : static PyObject *py_echo_AddOne_in_get_in_data(PyObject *obj, void *closure)
    1349             : {
    1350           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(obj);
    1351             :         PyObject *py_in_data;
    1352           0 :         py_in_data = PyLong_FromUnsignedLongLong((uint32_t)object->in.in_data);
    1353           0 :         return py_in_data;
    1354             : }
    1355             : 
    1356           0 : static int py_echo_AddOne_in_set_in_data(PyObject *py_obj, PyObject *value, void *closure)
    1357             : {
    1358           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(py_obj);
    1359           0 :         if (value == NULL) {
    1360           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.in_data");
    1361           0 :                 return -1;
    1362             :         }
    1363             :         {
    1364           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.in_data));
    1365           0 :                 if (PyLong_Check(value)) {
    1366             :                         unsigned long long test_var;
    1367           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1368           0 :                         if (PyErr_Occurred() != NULL) {
    1369           0 :                                 return -1;
    1370             :                         }
    1371           0 :                         if (test_var > uint_max) {
    1372           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1373             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1374           0 :                                 return -1;
    1375             :                         }
    1376           0 :                         object->in.in_data = test_var;
    1377             :                 } else {
    1378           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1379             :                           PyLong_Type.tp_name);
    1380           0 :                         return -1;
    1381             :                 }
    1382             :         }
    1383           0 :         return 0;
    1384             : }
    1385             : 
    1386           0 : static PyObject *py_echo_AddOne_out_get_out_data(PyObject *obj, void *closure)
    1387             : {
    1388           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(obj);
    1389             :         PyObject *py_out_data;
    1390           0 :         if (object->out.out_data == NULL) {
    1391           0 :                 Py_RETURN_NONE;
    1392             :         }
    1393           0 :         py_out_data = PyLong_FromUnsignedLongLong((uint32_t)*object->out.out_data);
    1394           0 :         return py_out_data;
    1395             : }
    1396             : 
    1397           0 : static int py_echo_AddOne_out_set_out_data(PyObject *py_obj, PyObject *value, void *closure)
    1398             : {
    1399           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(py_obj);
    1400           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.out_data));
    1401           0 :         if (value == NULL) {
    1402           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.out_data");
    1403           0 :                 return -1;
    1404             :         }
    1405           0 :         object->out.out_data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.out_data);
    1406           0 :         if (object->out.out_data == NULL) {
    1407           0 :                 PyErr_NoMemory();
    1408           0 :                 return -1;
    1409             :         }
    1410             :         {
    1411           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.out_data));
    1412           0 :                 if (PyLong_Check(value)) {
    1413             :                         unsigned long long test_var;
    1414           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1415           0 :                         if (PyErr_Occurred() != NULL) {
    1416           0 :                                 return -1;
    1417             :                         }
    1418           0 :                         if (test_var > uint_max) {
    1419           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1420             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1421           0 :                                 return -1;
    1422             :                         }
    1423           0 :                         *object->out.out_data = test_var;
    1424             :                 } else {
    1425           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1426             :                           PyLong_Type.tp_name);
    1427           0 :                         return -1;
    1428             :                 }
    1429             :         }
    1430           0 :         return 0;
    1431             : }
    1432             : 
    1433             : static PyGetSetDef py_echo_AddOne_getsetters[] = {
    1434             :         {
    1435             :                 .name = discard_const_p(char, "in_in_data"),
    1436             :                 .get = py_echo_AddOne_in_get_in_data,
    1437             :                 .set = py_echo_AddOne_in_set_in_data,
    1438             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1439             :         },
    1440             :         {
    1441             :                 .name = discard_const_p(char, "out_out_data"),
    1442             :                 .get = py_echo_AddOne_out_get_out_data,
    1443             :                 .set = py_echo_AddOne_out_set_out_data,
    1444             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1445             :         },
    1446             :         { .name = NULL }
    1447             : };
    1448             : 
    1449           0 : static PyObject *py_echo_AddOne_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1450             : {
    1451           0 :         PyObject *self = pytalloc_new(struct echo_AddOne, type);
    1452           0 :         struct echo_AddOne *_self = (struct echo_AddOne *)pytalloc_get_ptr(self);
    1453           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    1454           0 :         _self->out.out_data = talloc_zero(mem_ctx, uint32_t);
    1455           0 :         return self;
    1456             : }
    1457             : 
    1458           0 : static PyObject *py_echo_AddOne_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1459             : {
    1460             : 
    1461             : 
    1462           0 :         return PyLong_FromLong(0);
    1463             : }
    1464             : 
    1465           0 : static PyObject *py_echo_AddOne_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1466             : {
    1467           0 :         const struct ndr_interface_call *call = NULL;
    1468           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(py_obj);
    1469           0 :         PyObject *ret = NULL;
    1470           0 :         struct ndr_push *push = NULL;
    1471             :         DATA_BLOB blob;
    1472             :         enum ndr_err_code err;
    1473             : 
    1474           0 :         if (ndr_table_rpcecho.num_calls < 1) {
    1475           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_AddOne_ndr_pack");
    1476           0 :                 return NULL;
    1477             :         }
    1478           0 :         call = &ndr_table_rpcecho.calls[0];
    1479             : 
    1480           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1481           0 :         if (push == NULL) {
    1482           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1483           0 :                 return NULL;
    1484             :         }
    1485             : 
    1486           0 :         push->flags |= ndr_push_flags;
    1487             : 
    1488           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1489           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1490           0 :                 TALLOC_FREE(push);
    1491           0 :                 PyErr_SetNdrError(err);
    1492           0 :                 return NULL;
    1493             :         }
    1494           0 :         blob = ndr_push_blob(push);
    1495           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1496           0 :         TALLOC_FREE(push);
    1497           0 :         return ret;
    1498             : }
    1499             : 
    1500           0 : static PyObject *py_echo_AddOne_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1501             : {
    1502           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1503           0 :         PyObject *bigendian_obj = NULL;
    1504           0 :         PyObject *ndr64_obj = NULL;
    1505           0 :         uint32_t ndr_push_flags = 0;
    1506             : 
    1507           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    1508             :                 discard_const_p(char *, kwnames),
    1509             :                 &bigendian_obj,
    1510             :                 &ndr64_obj)) {
    1511           0 :                 return NULL;
    1512             :         }
    1513             : 
    1514           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1515           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1516             :         }
    1517           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1518           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1519             :         }
    1520             : 
    1521           0 :         return py_echo_AddOne_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1522             : }
    1523             : 
    1524           0 : static PyObject *py_echo_AddOne_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1525             : {
    1526           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1527           0 :         PyObject *bigendian_obj = NULL;
    1528           0 :         PyObject *ndr64_obj = NULL;
    1529           0 :         uint32_t ndr_push_flags = 0;
    1530             : 
    1531           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1532             :                 discard_const_p(char *, kwnames),
    1533             :                 &bigendian_obj,
    1534             :                 &ndr64_obj)) {
    1535           0 :                 return NULL;
    1536             :         }
    1537             : 
    1538           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1539           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1540             :         }
    1541           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1542           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1543             :         }
    1544             : 
    1545           0 :         return py_echo_AddOne_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1546             : }
    1547             : 
    1548           0 : static PyObject *py_echo_AddOne_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1549             : {
    1550           0 :         const struct ndr_interface_call *call = NULL;
    1551           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(py_obj);
    1552           0 :         struct ndr_pull *pull = NULL;
    1553             :         enum ndr_err_code err;
    1554             : 
    1555           0 :         if (ndr_table_rpcecho.num_calls < 1) {
    1556           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_AddOne_ndr_unpack");
    1557           0 :                 return NULL;
    1558             :         }
    1559           0 :         call = &ndr_table_rpcecho.calls[0];
    1560             : 
    1561           0 :         pull = ndr_pull_init_blob(blob, object);
    1562           0 :         if (pull == NULL) {
    1563           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1564           0 :                 return NULL;
    1565             :         }
    1566             : 
    1567           0 :         pull->flags |= ndr_pull_flags;
    1568             : 
    1569           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1570           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1571           0 :                 TALLOC_FREE(pull);
    1572           0 :                 PyErr_SetNdrError(err);
    1573           0 :                 return NULL;
    1574             :         }
    1575           0 :         if (!allow_remaining) {
    1576             :                 uint32_t highest_ofs;
    1577             : 
    1578           0 :                 if (pull->offset > pull->relative_highest_offset) {
    1579           0 :                         highest_ofs = pull->offset;
    1580             :                 } else {
    1581           0 :                         highest_ofs = pull->relative_highest_offset;
    1582             :                 }
    1583           0 :                 if (highest_ofs < pull->data_size) {
    1584           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1585             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1586             :                                 highest_ofs, pull->data_size);
    1587           0 :                         TALLOC_FREE(pull);
    1588           0 :                         PyErr_SetNdrError(err);
    1589           0 :                         return NULL;
    1590             :                 }
    1591             :         }
    1592             : 
    1593           0 :         TALLOC_FREE(pull);
    1594           0 :         Py_RETURN_NONE;
    1595             : }
    1596             : 
    1597           0 : static PyObject *py_echo_AddOne_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1598             : {
    1599             :         DATA_BLOB blob;
    1600           0 :         Py_ssize_t blob_length = 0;
    1601           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1602           0 :         PyObject *bigendian_obj = NULL;
    1603           0 :         PyObject *ndr64_obj = NULL;
    1604           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1605           0 :         PyObject *allow_remaining_obj = NULL;
    1606           0 :         bool allow_remaining = false;
    1607             : 
    1608           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1609             :                 discard_const_p(char *, kwnames),
    1610             :                 &blob.data, &blob_length,
    1611             :                 &bigendian_obj,
    1612             :                 &ndr64_obj,
    1613             :                 &allow_remaining_obj)) {
    1614           0 :                 return NULL;
    1615             :         }
    1616           0 :         blob.length = blob_length;
    1617             : 
    1618           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1619           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1620             :         }
    1621           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1622           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1623             :         }
    1624             : 
    1625           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1626           0 :                 allow_remaining = true;
    1627             :         }
    1628             : 
    1629           0 :         return py_echo_AddOne_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1630             : }
    1631             : 
    1632           0 : static PyObject *py_echo_AddOne_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1633             : {
    1634             :         DATA_BLOB blob;
    1635           0 :         Py_ssize_t blob_length = 0;
    1636           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1637           0 :         PyObject *bigendian_obj = NULL;
    1638           0 :         PyObject *ndr64_obj = NULL;
    1639           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1640           0 :         PyObject *allow_remaining_obj = NULL;
    1641           0 :         bool allow_remaining = false;
    1642             : 
    1643           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1644             :                 discard_const_p(char *, kwnames),
    1645             :                 &blob.data, &blob_length,
    1646             :                 &bigendian_obj,
    1647             :                 &ndr64_obj,
    1648             :                 &allow_remaining_obj)) {
    1649           0 :                 return NULL;
    1650             :         }
    1651           0 :         blob.length = blob_length;
    1652             : 
    1653           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1654           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1655             :         }
    1656           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1657           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1658             :         }
    1659             : 
    1660           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1661           0 :                 allow_remaining = true;
    1662             :         }
    1663             : 
    1664           0 :         return py_echo_AddOne_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1665             : }
    1666             : 
    1667           0 : static PyObject *py_echo_AddOne_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1668             : {
    1669           0 :         const struct ndr_interface_call *call = NULL;
    1670           0 :         struct echo_AddOne *object = (struct echo_AddOne *)pytalloc_get_ptr(py_obj);
    1671             :         PyObject *ret;
    1672             :         char *retstr;
    1673             : 
    1674           0 :         if (ndr_table_rpcecho.num_calls < 1) {
    1675           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_AddOne_ndr_print");
    1676           0 :                 return NULL;
    1677             :         }
    1678           0 :         call = &ndr_table_rpcecho.calls[0];
    1679             : 
    1680           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1681           0 :         ret = PyUnicode_FromString(retstr);
    1682           0 :         TALLOC_FREE(retstr);
    1683             : 
    1684           0 :         return ret;
    1685             : }
    1686             : 
    1687           0 : static PyObject *py_echo_AddOne_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1688             : {
    1689           0 :         return py_echo_AddOne_ndr_print(py_obj, "echo_AddOne_in", NDR_IN);
    1690             : }
    1691             : 
    1692           0 : static PyObject *py_echo_AddOne_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1693             : {
    1694           0 :         return py_echo_AddOne_ndr_print(py_obj, "echo_AddOne_out", NDR_OUT);
    1695             : }
    1696             : 
    1697             : static PyMethodDef py_echo_AddOne_methods[] = {
    1698             :         { "opnum", (PyCFunction)py_echo_AddOne_ndr_opnum, METH_NOARGS|METH_CLASS,
    1699             :                 "echo.AddOne.opnum() -> 0 (0x00) " },
    1700             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_AddOne_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1701             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1702             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_AddOne_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1703             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1704             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_AddOne_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1705             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1706             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_AddOne_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1707             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1708             :         { "__ndr_print_in__", (PyCFunction)py_echo_AddOne_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1709             :         { "__ndr_print_out__", (PyCFunction)py_echo_AddOne_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1710             :         { NULL, NULL, 0, NULL }
    1711             : };
    1712             : 
    1713             : 
    1714             : static PyTypeObject echo_AddOne_Type = {
    1715             :         PyVarObject_HEAD_INIT(NULL, 0)
    1716             :         .tp_name = "echo.AddOne",
    1717             :         .tp_getset = py_echo_AddOne_getsetters,
    1718             :         .tp_methods = py_echo_AddOne_methods,
    1719             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1720             :         .tp_new = py_echo_AddOne_new,
    1721             : };
    1722             : 
    1723           2 : static bool pack_py_echo_AddOne_args_in(PyObject *args, PyObject *kwargs, struct echo_AddOne *r)
    1724             : {
    1725             :         PyObject *py_in_data;
    1726           2 :         const char *kwnames[] = {
    1727             :                 "in_data", NULL
    1728             :         };
    1729             : 
    1730           2 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_AddOne", discard_const_p(char *, kwnames), &py_in_data)) {
    1731           0 :                 return false;
    1732             :         }
    1733             : 
    1734           2 :         if (py_in_data == NULL) {
    1735           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.in_data");
    1736           0 :                 return false;
    1737             :         }
    1738             :         {
    1739           2 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.in_data));
    1740           2 :                 if (PyLong_Check(py_in_data)) {
    1741             :                         unsigned long long test_var;
    1742           2 :                         test_var = PyLong_AsUnsignedLongLong(py_in_data);
    1743           2 :                         if (PyErr_Occurred() != NULL) {
    1744           0 :                                 return false;
    1745             :                         }
    1746           2 :                         if (test_var > uint_max) {
    1747           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1748             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1749           0 :                                 return false;
    1750             :                         }
    1751           2 :                         r->in.in_data = test_var;
    1752             :                 } else {
    1753           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1754             :                           PyLong_Type.tp_name);
    1755           0 :                         return false;
    1756             :                 }
    1757             :         }
    1758           2 :         return true;
    1759             : }
    1760             : 
    1761           2 : static PyObject *unpack_py_echo_AddOne_args_out(struct echo_AddOne *r)
    1762             : {
    1763             :         PyObject *result;
    1764             :         PyObject *py_out_data;
    1765           2 :         py_out_data = PyLong_FromUnsignedLongLong((uint32_t)*r->out.out_data);
    1766           2 :         result = py_out_data;
    1767           2 :         return result;
    1768             : }
    1769             : 
    1770             : 
    1771           0 : static PyObject *py_echo_EchoData_in_get_len(PyObject *obj, void *closure)
    1772             : {
    1773           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(obj);
    1774             :         PyObject *py_len;
    1775           0 :         py_len = PyLong_FromUnsignedLongLong((uint32_t)object->in.len);
    1776           0 :         return py_len;
    1777             : }
    1778             : 
    1779           0 : static int py_echo_EchoData_in_set_len(PyObject *py_obj, PyObject *value, void *closure)
    1780             : {
    1781           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    1782           0 :         if (value == NULL) {
    1783           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.len");
    1784           0 :                 return -1;
    1785             :         }
    1786             :         {
    1787           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.len));
    1788           0 :                 if (PyLong_Check(value)) {
    1789             :                         unsigned long long test_var;
    1790           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1791           0 :                         if (PyErr_Occurred() != NULL) {
    1792           0 :                                 return -1;
    1793             :                         }
    1794           0 :                         if (test_var > uint_max) {
    1795           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1796             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1797           0 :                                 return -1;
    1798             :                         }
    1799           0 :                         object->in.len = test_var;
    1800             :                 } else {
    1801           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1802             :                           PyLong_Type.tp_name);
    1803           0 :                         return -1;
    1804             :                 }
    1805             :         }
    1806           0 :         return 0;
    1807             : }
    1808             : 
    1809           0 : static PyObject *py_echo_EchoData_in_get_in_data(PyObject *obj, void *closure)
    1810             : {
    1811           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(obj);
    1812             :         PyObject *py_in_data;
    1813           0 :         py_in_data = PyList_New(object->in.len);
    1814           0 :         if (py_in_data == NULL) {
    1815           0 :                 return NULL;
    1816             :         }
    1817             :         {
    1818             :                 int in_data_cntr_0;
    1819           0 :                 for (in_data_cntr_0 = 0; in_data_cntr_0 < (object->in.len); in_data_cntr_0++) {
    1820             :                         PyObject *py_in_data_0;
    1821           0 :                         py_in_data_0 = PyLong_FromLong((uint16_t)object->in.in_data[in_data_cntr_0]);
    1822           0 :                         PyList_SetItem(py_in_data, in_data_cntr_0, py_in_data_0);
    1823             :                 }
    1824             :         }
    1825           0 :         return py_in_data;
    1826             : }
    1827             : 
    1828           0 : static int py_echo_EchoData_in_set_in_data(PyObject *py_obj, PyObject *value, void *closure)
    1829             : {
    1830           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    1831           0 :         if (value == NULL) {
    1832           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.in_data");
    1833           0 :                 return -1;
    1834             :         }
    1835           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1836             :         {
    1837             :                 int in_data_cntr_0;
    1838           0 :                 object->in.in_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.in_data, PyList_GET_SIZE(value));
    1839           0 :                 if (!object->in.in_data) { return -1;; }
    1840           0 :                 talloc_set_name_const(object->in.in_data, "ARRAY: object->in.in_data");
    1841           0 :                 for (in_data_cntr_0 = 0; in_data_cntr_0 < PyList_GET_SIZE(value); in_data_cntr_0++) {
    1842           0 :                         if (PyList_GET_ITEM(value, in_data_cntr_0) == NULL) {
    1843           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.in_data[in_data_cntr_0]");
    1844           0 :                                 return -1;
    1845             :                         }
    1846             :                         {
    1847           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.in_data[in_data_cntr_0]));
    1848           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, in_data_cntr_0))) {
    1849             :                                         unsigned long long test_var;
    1850           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, in_data_cntr_0));
    1851           0 :                                         if (PyErr_Occurred() != NULL) {
    1852           0 :                                                 return -1;
    1853             :                                         }
    1854           0 :                                         if (test_var > uint_max) {
    1855           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1856             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1857           0 :                                                 return -1;
    1858             :                                         }
    1859           0 :                                         object->in.in_data[in_data_cntr_0] = test_var;
    1860             :                                 } else {
    1861           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1862             :                                           PyLong_Type.tp_name);
    1863           0 :                                         return -1;
    1864             :                                 }
    1865             :                         }
    1866             :                 }
    1867             :         }
    1868           0 :         return 0;
    1869             : }
    1870             : 
    1871           0 : static PyObject *py_echo_EchoData_out_get_out_data(PyObject *obj, void *closure)
    1872             : {
    1873           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(obj);
    1874             :         PyObject *py_out_data;
    1875           0 :         py_out_data = PyList_New(object->in.len);
    1876           0 :         if (py_out_data == NULL) {
    1877           0 :                 return NULL;
    1878             :         }
    1879             :         {
    1880             :                 int out_data_cntr_0;
    1881           0 :                 for (out_data_cntr_0 = 0; out_data_cntr_0 < (object->in.len); out_data_cntr_0++) {
    1882             :                         PyObject *py_out_data_0;
    1883           0 :                         py_out_data_0 = PyLong_FromLong((uint16_t)object->out.out_data[out_data_cntr_0]);
    1884           0 :                         PyList_SetItem(py_out_data, out_data_cntr_0, py_out_data_0);
    1885             :                 }
    1886             :         }
    1887           0 :         return py_out_data;
    1888             : }
    1889             : 
    1890           0 : static int py_echo_EchoData_out_set_out_data(PyObject *py_obj, PyObject *value, void *closure)
    1891             : {
    1892           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    1893           0 :         if (value == NULL) {
    1894           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.out_data");
    1895           0 :                 return -1;
    1896             :         }
    1897           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1898             :         {
    1899             :                 int out_data_cntr_0;
    1900           0 :                 object->out.out_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.out_data, PyList_GET_SIZE(value));
    1901           0 :                 if (!object->out.out_data) { return -1;; }
    1902           0 :                 talloc_set_name_const(object->out.out_data, "ARRAY: object->out.out_data");
    1903           0 :                 for (out_data_cntr_0 = 0; out_data_cntr_0 < PyList_GET_SIZE(value); out_data_cntr_0++) {
    1904           0 :                         if (PyList_GET_ITEM(value, out_data_cntr_0) == NULL) {
    1905           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.out_data[out_data_cntr_0]");
    1906           0 :                                 return -1;
    1907             :                         }
    1908             :                         {
    1909           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.out_data[out_data_cntr_0]));
    1910           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, out_data_cntr_0))) {
    1911             :                                         unsigned long long test_var;
    1912           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, out_data_cntr_0));
    1913           0 :                                         if (PyErr_Occurred() != NULL) {
    1914           0 :                                                 return -1;
    1915             :                                         }
    1916           0 :                                         if (test_var > uint_max) {
    1917           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1918             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1919           0 :                                                 return -1;
    1920             :                                         }
    1921           0 :                                         object->out.out_data[out_data_cntr_0] = test_var;
    1922             :                                 } else {
    1923           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1924             :                                           PyLong_Type.tp_name);
    1925           0 :                                         return -1;
    1926             :                                 }
    1927             :                         }
    1928             :                 }
    1929             :         }
    1930           0 :         return 0;
    1931             : }
    1932             : 
    1933             : static PyGetSetDef py_echo_EchoData_getsetters[] = {
    1934             :         {
    1935             :                 .name = discard_const_p(char, "in_len"),
    1936             :                 .get = py_echo_EchoData_in_get_len,
    1937             :                 .set = py_echo_EchoData_in_set_len,
    1938             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1939             :         },
    1940             :         {
    1941             :                 .name = discard_const_p(char, "in_in_data"),
    1942             :                 .get = py_echo_EchoData_in_get_in_data,
    1943             :                 .set = py_echo_EchoData_in_set_in_data,
    1944             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1945             :         },
    1946             :         {
    1947             :                 .name = discard_const_p(char, "out_out_data"),
    1948             :                 .get = py_echo_EchoData_out_get_out_data,
    1949             :                 .set = py_echo_EchoData_out_set_out_data,
    1950             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1951             :         },
    1952             :         { .name = NULL }
    1953             : };
    1954             : 
    1955           0 : static PyObject *py_echo_EchoData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1956             : {
    1957           0 :         PyObject *self = pytalloc_new(struct echo_EchoData, type);
    1958           0 :         return self;
    1959             : }
    1960             : 
    1961           0 : static PyObject *py_echo_EchoData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1962             : {
    1963             : 
    1964             : 
    1965           0 :         return PyLong_FromLong(1);
    1966             : }
    1967             : 
    1968           0 : static PyObject *py_echo_EchoData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1969             : {
    1970           0 :         const struct ndr_interface_call *call = NULL;
    1971           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    1972           0 :         PyObject *ret = NULL;
    1973           0 :         struct ndr_push *push = NULL;
    1974             :         DATA_BLOB blob;
    1975             :         enum ndr_err_code err;
    1976             : 
    1977           0 :         if (ndr_table_rpcecho.num_calls < 2) {
    1978           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_EchoData_ndr_pack");
    1979           0 :                 return NULL;
    1980             :         }
    1981           0 :         call = &ndr_table_rpcecho.calls[1];
    1982             : 
    1983           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1984           0 :         if (push == NULL) {
    1985           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1986           0 :                 return NULL;
    1987             :         }
    1988             : 
    1989           0 :         push->flags |= ndr_push_flags;
    1990             : 
    1991           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1992           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1993           0 :                 TALLOC_FREE(push);
    1994           0 :                 PyErr_SetNdrError(err);
    1995           0 :                 return NULL;
    1996             :         }
    1997           0 :         blob = ndr_push_blob(push);
    1998           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1999           0 :         TALLOC_FREE(push);
    2000           0 :         return ret;
    2001             : }
    2002             : 
    2003           0 : static PyObject *py_echo_EchoData_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2004             : {
    2005           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2006           0 :         PyObject *bigendian_obj = NULL;
    2007           0 :         PyObject *ndr64_obj = NULL;
    2008           0 :         uint32_t ndr_push_flags = 0;
    2009             : 
    2010           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2011             :                 discard_const_p(char *, kwnames),
    2012             :                 &bigendian_obj,
    2013             :                 &ndr64_obj)) {
    2014           0 :                 return NULL;
    2015             :         }
    2016             : 
    2017           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2018           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2019             :         }
    2020           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2021           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2022             :         }
    2023             : 
    2024           0 :         return py_echo_EchoData_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2025             : }
    2026             : 
    2027           0 : static PyObject *py_echo_EchoData_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2028             : {
    2029           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2030           0 :         PyObject *bigendian_obj = NULL;
    2031           0 :         PyObject *ndr64_obj = NULL;
    2032           0 :         uint32_t ndr_push_flags = 0;
    2033             : 
    2034           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2035             :                 discard_const_p(char *, kwnames),
    2036             :                 &bigendian_obj,
    2037             :                 &ndr64_obj)) {
    2038           0 :                 return NULL;
    2039             :         }
    2040             : 
    2041           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2042           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2043             :         }
    2044           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2045           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2046             :         }
    2047             : 
    2048           0 :         return py_echo_EchoData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2049             : }
    2050             : 
    2051           0 : static PyObject *py_echo_EchoData_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    2052             : {
    2053           0 :         const struct ndr_interface_call *call = NULL;
    2054           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    2055           0 :         struct ndr_pull *pull = NULL;
    2056             :         enum ndr_err_code err;
    2057             : 
    2058           0 :         if (ndr_table_rpcecho.num_calls < 2) {
    2059           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_EchoData_ndr_unpack");
    2060           0 :                 return NULL;
    2061             :         }
    2062           0 :         call = &ndr_table_rpcecho.calls[1];
    2063             : 
    2064           0 :         pull = ndr_pull_init_blob(blob, object);
    2065           0 :         if (pull == NULL) {
    2066           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2067           0 :                 return NULL;
    2068             :         }
    2069             : 
    2070           0 :         pull->flags |= ndr_pull_flags;
    2071             : 
    2072           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2073           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2074           0 :                 TALLOC_FREE(pull);
    2075           0 :                 PyErr_SetNdrError(err);
    2076           0 :                 return NULL;
    2077             :         }
    2078           0 :         if (!allow_remaining) {
    2079             :                 uint32_t highest_ofs;
    2080             : 
    2081           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2082           0 :                         highest_ofs = pull->offset;
    2083             :                 } else {
    2084           0 :                         highest_ofs = pull->relative_highest_offset;
    2085             :                 }
    2086           0 :                 if (highest_ofs < pull->data_size) {
    2087           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2088             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2089             :                                 highest_ofs, pull->data_size);
    2090           0 :                         TALLOC_FREE(pull);
    2091           0 :                         PyErr_SetNdrError(err);
    2092           0 :                         return NULL;
    2093             :                 }
    2094             :         }
    2095             : 
    2096           0 :         TALLOC_FREE(pull);
    2097           0 :         Py_RETURN_NONE;
    2098             : }
    2099             : 
    2100           0 : static PyObject *py_echo_EchoData_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2101             : {
    2102             :         DATA_BLOB blob;
    2103           0 :         Py_ssize_t blob_length = 0;
    2104           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2105           0 :         PyObject *bigendian_obj = NULL;
    2106           0 :         PyObject *ndr64_obj = NULL;
    2107           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2108           0 :         PyObject *allow_remaining_obj = NULL;
    2109           0 :         bool allow_remaining = false;
    2110             : 
    2111           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    2112             :                 discard_const_p(char *, kwnames),
    2113             :                 &blob.data, &blob_length,
    2114             :                 &bigendian_obj,
    2115             :                 &ndr64_obj,
    2116             :                 &allow_remaining_obj)) {
    2117           0 :                 return NULL;
    2118             :         }
    2119           0 :         blob.length = blob_length;
    2120             : 
    2121           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2122           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2123             :         }
    2124           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2125           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2126             :         }
    2127             : 
    2128           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2129           0 :                 allow_remaining = true;
    2130             :         }
    2131             : 
    2132           0 :         return py_echo_EchoData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    2133             : }
    2134             : 
    2135           0 : static PyObject *py_echo_EchoData_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2136             : {
    2137             :         DATA_BLOB blob;
    2138           0 :         Py_ssize_t blob_length = 0;
    2139           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2140           0 :         PyObject *bigendian_obj = NULL;
    2141           0 :         PyObject *ndr64_obj = NULL;
    2142           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2143           0 :         PyObject *allow_remaining_obj = NULL;
    2144           0 :         bool allow_remaining = false;
    2145             : 
    2146           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    2147             :                 discard_const_p(char *, kwnames),
    2148             :                 &blob.data, &blob_length,
    2149             :                 &bigendian_obj,
    2150             :                 &ndr64_obj,
    2151             :                 &allow_remaining_obj)) {
    2152           0 :                 return NULL;
    2153             :         }
    2154           0 :         blob.length = blob_length;
    2155             : 
    2156           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2157           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2158             :         }
    2159           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2160           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2161             :         }
    2162             : 
    2163           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2164           0 :                 allow_remaining = true;
    2165             :         }
    2166             : 
    2167           0 :         return py_echo_EchoData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    2168             : }
    2169             : 
    2170           0 : static PyObject *py_echo_EchoData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    2171             : {
    2172           0 :         const struct ndr_interface_call *call = NULL;
    2173           0 :         struct echo_EchoData *object = (struct echo_EchoData *)pytalloc_get_ptr(py_obj);
    2174             :         PyObject *ret;
    2175             :         char *retstr;
    2176             : 
    2177           0 :         if (ndr_table_rpcecho.num_calls < 2) {
    2178           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_EchoData_ndr_print");
    2179           0 :                 return NULL;
    2180             :         }
    2181           0 :         call = &ndr_table_rpcecho.calls[1];
    2182             : 
    2183           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    2184           0 :         ret = PyUnicode_FromString(retstr);
    2185           0 :         TALLOC_FREE(retstr);
    2186             : 
    2187           0 :         return ret;
    2188             : }
    2189             : 
    2190           0 : static PyObject *py_echo_EchoData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2191             : {
    2192           0 :         return py_echo_EchoData_ndr_print(py_obj, "echo_EchoData_in", NDR_IN);
    2193             : }
    2194             : 
    2195           0 : static PyObject *py_echo_EchoData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2196             : {
    2197           0 :         return py_echo_EchoData_ndr_print(py_obj, "echo_EchoData_out", NDR_OUT);
    2198             : }
    2199             : 
    2200             : static PyMethodDef py_echo_EchoData_methods[] = {
    2201             :         { "opnum", (PyCFunction)py_echo_EchoData_ndr_opnum, METH_NOARGS|METH_CLASS,
    2202             :                 "echo.EchoData.opnum() -> 1 (0x01) " },
    2203             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_EchoData_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    2204             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    2205             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_EchoData_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    2206             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    2207             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_EchoData_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    2208             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    2209             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_EchoData_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    2210             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    2211             :         { "__ndr_print_in__", (PyCFunction)py_echo_EchoData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    2212             :         { "__ndr_print_out__", (PyCFunction)py_echo_EchoData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    2213             :         { NULL, NULL, 0, NULL }
    2214             : };
    2215             : 
    2216             : 
    2217             : static PyTypeObject echo_EchoData_Type = {
    2218             :         PyVarObject_HEAD_INIT(NULL, 0)
    2219             :         .tp_name = "echo.EchoData",
    2220             :         .tp_getset = py_echo_EchoData_getsetters,
    2221             :         .tp_methods = py_echo_EchoData_methods,
    2222             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2223             :         .tp_new = py_echo_EchoData_new,
    2224             : };
    2225             : 
    2226           7 : static bool pack_py_echo_EchoData_args_in(PyObject *args, PyObject *kwargs, struct echo_EchoData *r)
    2227             : {
    2228             :         PyObject *py_in_data;
    2229           7 :         const char *kwnames[] = {
    2230             :                 "in_data", NULL
    2231             :         };
    2232             : 
    2233           7 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_EchoData", discard_const_p(char *, kwnames), &py_in_data)) {
    2234           0 :                 return false;
    2235             :         }
    2236             : 
    2237           7 :         PY_CHECK_TYPE(&PyList_Type, py_in_data, return false;);
    2238           7 :         r->in.len = PyList_GET_SIZE(py_in_data);
    2239           7 :         if (py_in_data == NULL) {
    2240           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.in_data");
    2241           0 :                 return false;
    2242             :         }
    2243           7 :         PY_CHECK_TYPE(&PyList_Type, py_in_data, return false;);
    2244             :         {
    2245             :                 int in_data_cntr_0;
    2246           7 :                 r->in.in_data = talloc_array_ptrtype(r, r->in.in_data, PyList_GET_SIZE(py_in_data));
    2247           7 :                 if (!r->in.in_data) { return false;; }
    2248           7 :                 talloc_set_name_const(r->in.in_data, "ARRAY: r->in.in_data");
    2249          28 :                 for (in_data_cntr_0 = 0; in_data_cntr_0 < PyList_GET_SIZE(py_in_data); in_data_cntr_0++) {
    2250          21 :                         if (PyList_GET_ITEM(py_in_data, in_data_cntr_0) == NULL) {
    2251           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.in_data[in_data_cntr_0]");
    2252           0 :                                 return false;
    2253             :                         }
    2254             :                         {
    2255          21 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.in_data[in_data_cntr_0]));
    2256          21 :                                 if (PyLong_Check(PyList_GET_ITEM(py_in_data, in_data_cntr_0))) {
    2257             :                                         unsigned long long test_var;
    2258          21 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_in_data, in_data_cntr_0));
    2259          21 :                                         if (PyErr_Occurred() != NULL) {
    2260           0 :                                                 return false;
    2261             :                                         }
    2262          21 :                                         if (test_var > uint_max) {
    2263           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2264             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2265           0 :                                                 return false;
    2266             :                                         }
    2267          21 :                                         r->in.in_data[in_data_cntr_0] = test_var;
    2268             :                                 } else {
    2269           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2270             :                                           PyLong_Type.tp_name);
    2271           0 :                                         return false;
    2272             :                                 }
    2273             :                         }
    2274             :                 }
    2275             :         }
    2276           7 :         return true;
    2277             : }
    2278             : 
    2279           7 : static PyObject *unpack_py_echo_EchoData_args_out(struct echo_EchoData *r)
    2280             : {
    2281             :         PyObject *result;
    2282             :         PyObject *py_out_data;
    2283           7 :         py_out_data = PyList_New(r->in.len);
    2284           7 :         if (py_out_data == NULL) {
    2285           0 :                 return NULL;
    2286             :         }
    2287             :         {
    2288             :                 int out_data_cntr_0;
    2289          28 :                 for (out_data_cntr_0 = 0; out_data_cntr_0 < (r->in.len); out_data_cntr_0++) {
    2290             :                         PyObject *py_out_data_0;
    2291          21 :                         py_out_data_0 = PyLong_FromLong((uint16_t)r->out.out_data[out_data_cntr_0]);
    2292          21 :                         PyList_SetItem(py_out_data, out_data_cntr_0, py_out_data_0);
    2293             :                 }
    2294             :         }
    2295           7 :         result = py_out_data;
    2296           7 :         return result;
    2297             : }
    2298             : 
    2299             : 
    2300           0 : static PyObject *py_echo_SinkData_in_get_len(PyObject *obj, void *closure)
    2301             : {
    2302           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(obj);
    2303             :         PyObject *py_len;
    2304           0 :         py_len = PyLong_FromUnsignedLongLong((uint32_t)object->in.len);
    2305           0 :         return py_len;
    2306             : }
    2307             : 
    2308           0 : static int py_echo_SinkData_in_set_len(PyObject *py_obj, PyObject *value, void *closure)
    2309             : {
    2310           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(py_obj);
    2311           0 :         if (value == NULL) {
    2312           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.len");
    2313           0 :                 return -1;
    2314             :         }
    2315             :         {
    2316           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.len));
    2317           0 :                 if (PyLong_Check(value)) {
    2318             :                         unsigned long long test_var;
    2319           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2320           0 :                         if (PyErr_Occurred() != NULL) {
    2321           0 :                                 return -1;
    2322             :                         }
    2323           0 :                         if (test_var > uint_max) {
    2324           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2325             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2326           0 :                                 return -1;
    2327             :                         }
    2328           0 :                         object->in.len = test_var;
    2329             :                 } else {
    2330           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2331             :                           PyLong_Type.tp_name);
    2332           0 :                         return -1;
    2333             :                 }
    2334             :         }
    2335           0 :         return 0;
    2336             : }
    2337             : 
    2338           0 : static PyObject *py_echo_SinkData_in_get_data(PyObject *obj, void *closure)
    2339             : {
    2340           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(obj);
    2341             :         PyObject *py_data;
    2342           0 :         py_data = PyList_New(object->in.len);
    2343           0 :         if (py_data == NULL) {
    2344           0 :                 return NULL;
    2345             :         }
    2346             :         {
    2347             :                 int data_cntr_0;
    2348           0 :                 for (data_cntr_0 = 0; data_cntr_0 < (object->in.len); data_cntr_0++) {
    2349             :                         PyObject *py_data_0;
    2350           0 :                         py_data_0 = PyLong_FromLong((uint16_t)object->in.data[data_cntr_0]);
    2351           0 :                         PyList_SetItem(py_data, data_cntr_0, py_data_0);
    2352             :                 }
    2353             :         }
    2354           0 :         return py_data;
    2355             : }
    2356             : 
    2357           0 : static int py_echo_SinkData_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
    2358             : {
    2359           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(py_obj);
    2360           0 :         if (value == NULL) {
    2361           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data");
    2362           0 :                 return -1;
    2363             :         }
    2364           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2365             :         {
    2366             :                 int data_cntr_0;
    2367           0 :                 object->in.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data, PyList_GET_SIZE(value));
    2368           0 :                 if (!object->in.data) { return -1;; }
    2369           0 :                 talloc_set_name_const(object->in.data, "ARRAY: object->in.data");
    2370           0 :                 for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
    2371           0 :                         if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
    2372           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data[data_cntr_0]");
    2373           0 :                                 return -1;
    2374             :                         }
    2375             :                         {
    2376           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.data[data_cntr_0]));
    2377           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
    2378             :                                         unsigned long long test_var;
    2379           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_0));
    2380           0 :                                         if (PyErr_Occurred() != NULL) {
    2381           0 :                                                 return -1;
    2382             :                                         }
    2383           0 :                                         if (test_var > uint_max) {
    2384           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2385             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2386           0 :                                                 return -1;
    2387             :                                         }
    2388           0 :                                         object->in.data[data_cntr_0] = test_var;
    2389             :                                 } else {
    2390           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2391             :                                           PyLong_Type.tp_name);
    2392           0 :                                         return -1;
    2393             :                                 }
    2394             :                         }
    2395             :                 }
    2396             :         }
    2397           0 :         return 0;
    2398             : }
    2399             : 
    2400             : static PyGetSetDef py_echo_SinkData_getsetters[] = {
    2401             :         {
    2402             :                 .name = discard_const_p(char, "in_len"),
    2403             :                 .get = py_echo_SinkData_in_get_len,
    2404             :                 .set = py_echo_SinkData_in_set_len,
    2405             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2406             :         },
    2407             :         {
    2408             :                 .name = discard_const_p(char, "in_data"),
    2409             :                 .get = py_echo_SinkData_in_get_data,
    2410             :                 .set = py_echo_SinkData_in_set_data,
    2411             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2412             :         },
    2413             :         { .name = NULL }
    2414             : };
    2415             : 
    2416           0 : static PyObject *py_echo_SinkData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2417             : {
    2418           0 :         PyObject *self = pytalloc_new(struct echo_SinkData, type);
    2419           0 :         return self;
    2420             : }
    2421             : 
    2422           0 : static PyObject *py_echo_SinkData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    2423             : {
    2424             : 
    2425             : 
    2426           0 :         return PyLong_FromLong(2);
    2427             : }
    2428             : 
    2429           0 : static PyObject *py_echo_SinkData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    2430             : {
    2431           0 :         const struct ndr_interface_call *call = NULL;
    2432           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(py_obj);
    2433           0 :         PyObject *ret = NULL;
    2434           0 :         struct ndr_push *push = NULL;
    2435             :         DATA_BLOB blob;
    2436             :         enum ndr_err_code err;
    2437             : 
    2438           0 :         if (ndr_table_rpcecho.num_calls < 3) {
    2439           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SinkData_ndr_pack");
    2440           0 :                 return NULL;
    2441             :         }
    2442           0 :         call = &ndr_table_rpcecho.calls[2];
    2443             : 
    2444           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    2445           0 :         if (push == NULL) {
    2446           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2447           0 :                 return NULL;
    2448             :         }
    2449             : 
    2450           0 :         push->flags |= ndr_push_flags;
    2451             : 
    2452           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    2453           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2454           0 :                 TALLOC_FREE(push);
    2455           0 :                 PyErr_SetNdrError(err);
    2456           0 :                 return NULL;
    2457             :         }
    2458           0 :         blob = ndr_push_blob(push);
    2459           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2460           0 :         TALLOC_FREE(push);
    2461           0 :         return ret;
    2462             : }
    2463             : 
    2464           0 : static PyObject *py_echo_SinkData_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2465             : {
    2466           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2467           0 :         PyObject *bigendian_obj = NULL;
    2468           0 :         PyObject *ndr64_obj = NULL;
    2469           0 :         uint32_t ndr_push_flags = 0;
    2470             : 
    2471           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2472             :                 discard_const_p(char *, kwnames),
    2473             :                 &bigendian_obj,
    2474             :                 &ndr64_obj)) {
    2475           0 :                 return NULL;
    2476             :         }
    2477             : 
    2478           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2479           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2480             :         }
    2481           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2482           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2483             :         }
    2484             : 
    2485           0 :         return py_echo_SinkData_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2486             : }
    2487             : 
    2488           0 : static PyObject *py_echo_SinkData_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2489             : {
    2490           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2491           0 :         PyObject *bigendian_obj = NULL;
    2492           0 :         PyObject *ndr64_obj = NULL;
    2493           0 :         uint32_t ndr_push_flags = 0;
    2494             : 
    2495           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2496             :                 discard_const_p(char *, kwnames),
    2497             :                 &bigendian_obj,
    2498             :                 &ndr64_obj)) {
    2499           0 :                 return NULL;
    2500             :         }
    2501             : 
    2502           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2503           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2504             :         }
    2505           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2506           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2507             :         }
    2508             : 
    2509           0 :         return py_echo_SinkData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2510             : }
    2511             : 
    2512           0 : static PyObject *py_echo_SinkData_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    2513             : {
    2514           0 :         const struct ndr_interface_call *call = NULL;
    2515           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(py_obj);
    2516           0 :         struct ndr_pull *pull = NULL;
    2517             :         enum ndr_err_code err;
    2518             : 
    2519           0 :         if (ndr_table_rpcecho.num_calls < 3) {
    2520           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SinkData_ndr_unpack");
    2521           0 :                 return NULL;
    2522             :         }
    2523           0 :         call = &ndr_table_rpcecho.calls[2];
    2524             : 
    2525           0 :         pull = ndr_pull_init_blob(blob, object);
    2526           0 :         if (pull == NULL) {
    2527           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2528           0 :                 return NULL;
    2529             :         }
    2530             : 
    2531           0 :         pull->flags |= ndr_pull_flags;
    2532             : 
    2533           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2534           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2535           0 :                 TALLOC_FREE(pull);
    2536           0 :                 PyErr_SetNdrError(err);
    2537           0 :                 return NULL;
    2538             :         }
    2539           0 :         if (!allow_remaining) {
    2540             :                 uint32_t highest_ofs;
    2541             : 
    2542           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2543           0 :                         highest_ofs = pull->offset;
    2544             :                 } else {
    2545           0 :                         highest_ofs = pull->relative_highest_offset;
    2546             :                 }
    2547           0 :                 if (highest_ofs < pull->data_size) {
    2548           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2549             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2550             :                                 highest_ofs, pull->data_size);
    2551           0 :                         TALLOC_FREE(pull);
    2552           0 :                         PyErr_SetNdrError(err);
    2553           0 :                         return NULL;
    2554             :                 }
    2555             :         }
    2556             : 
    2557           0 :         TALLOC_FREE(pull);
    2558           0 :         Py_RETURN_NONE;
    2559             : }
    2560             : 
    2561           0 : static PyObject *py_echo_SinkData_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2562             : {
    2563             :         DATA_BLOB blob;
    2564           0 :         Py_ssize_t blob_length = 0;
    2565           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2566           0 :         PyObject *bigendian_obj = NULL;
    2567           0 :         PyObject *ndr64_obj = NULL;
    2568           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2569           0 :         PyObject *allow_remaining_obj = NULL;
    2570           0 :         bool allow_remaining = false;
    2571             : 
    2572           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    2573             :                 discard_const_p(char *, kwnames),
    2574             :                 &blob.data, &blob_length,
    2575             :                 &bigendian_obj,
    2576             :                 &ndr64_obj,
    2577             :                 &allow_remaining_obj)) {
    2578           0 :                 return NULL;
    2579             :         }
    2580           0 :         blob.length = blob_length;
    2581             : 
    2582           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2583           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2584             :         }
    2585           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2586           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2587             :         }
    2588             : 
    2589           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2590           0 :                 allow_remaining = true;
    2591             :         }
    2592             : 
    2593           0 :         return py_echo_SinkData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    2594             : }
    2595             : 
    2596           0 : static PyObject *py_echo_SinkData_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2597             : {
    2598             :         DATA_BLOB blob;
    2599           0 :         Py_ssize_t blob_length = 0;
    2600           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2601           0 :         PyObject *bigendian_obj = NULL;
    2602           0 :         PyObject *ndr64_obj = NULL;
    2603           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2604           0 :         PyObject *allow_remaining_obj = NULL;
    2605           0 :         bool allow_remaining = false;
    2606             : 
    2607           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    2608             :                 discard_const_p(char *, kwnames),
    2609             :                 &blob.data, &blob_length,
    2610             :                 &bigendian_obj,
    2611             :                 &ndr64_obj,
    2612             :                 &allow_remaining_obj)) {
    2613           0 :                 return NULL;
    2614             :         }
    2615           0 :         blob.length = blob_length;
    2616             : 
    2617           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2618           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2619             :         }
    2620           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2621           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2622             :         }
    2623             : 
    2624           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2625           0 :                 allow_remaining = true;
    2626             :         }
    2627             : 
    2628           0 :         return py_echo_SinkData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    2629             : }
    2630             : 
    2631           0 : static PyObject *py_echo_SinkData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    2632             : {
    2633           0 :         const struct ndr_interface_call *call = NULL;
    2634           0 :         struct echo_SinkData *object = (struct echo_SinkData *)pytalloc_get_ptr(py_obj);
    2635             :         PyObject *ret;
    2636             :         char *retstr;
    2637             : 
    2638           0 :         if (ndr_table_rpcecho.num_calls < 3) {
    2639           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SinkData_ndr_print");
    2640           0 :                 return NULL;
    2641             :         }
    2642           0 :         call = &ndr_table_rpcecho.calls[2];
    2643             : 
    2644           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    2645           0 :         ret = PyUnicode_FromString(retstr);
    2646           0 :         TALLOC_FREE(retstr);
    2647             : 
    2648           0 :         return ret;
    2649             : }
    2650             : 
    2651           0 : static PyObject *py_echo_SinkData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2652             : {
    2653           0 :         return py_echo_SinkData_ndr_print(py_obj, "echo_SinkData_in", NDR_IN);
    2654             : }
    2655             : 
    2656           0 : static PyObject *py_echo_SinkData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2657             : {
    2658           0 :         return py_echo_SinkData_ndr_print(py_obj, "echo_SinkData_out", NDR_OUT);
    2659             : }
    2660             : 
    2661             : static PyMethodDef py_echo_SinkData_methods[] = {
    2662             :         { "opnum", (PyCFunction)py_echo_SinkData_ndr_opnum, METH_NOARGS|METH_CLASS,
    2663             :                 "echo.SinkData.opnum() -> 2 (0x02) " },
    2664             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SinkData_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    2665             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    2666             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SinkData_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    2667             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    2668             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SinkData_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    2669             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    2670             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SinkData_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    2671             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    2672             :         { "__ndr_print_in__", (PyCFunction)py_echo_SinkData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    2673             :         { "__ndr_print_out__", (PyCFunction)py_echo_SinkData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    2674             :         { NULL, NULL, 0, NULL }
    2675             : };
    2676             : 
    2677             : 
    2678             : static PyTypeObject echo_SinkData_Type = {
    2679             :         PyVarObject_HEAD_INIT(NULL, 0)
    2680             :         .tp_name = "echo.SinkData",
    2681             :         .tp_getset = py_echo_SinkData_getsetters,
    2682             :         .tp_methods = py_echo_SinkData_methods,
    2683             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2684             :         .tp_new = py_echo_SinkData_new,
    2685             : };
    2686             : 
    2687           0 : static bool pack_py_echo_SinkData_args_in(PyObject *args, PyObject *kwargs, struct echo_SinkData *r)
    2688             : {
    2689             :         PyObject *py_data;
    2690           0 :         const char *kwnames[] = {
    2691             :                 "data", NULL
    2692             :         };
    2693             : 
    2694           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_SinkData", discard_const_p(char *, kwnames), &py_data)) {
    2695           0 :                 return false;
    2696             :         }
    2697             : 
    2698           0 :         PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
    2699           0 :         r->in.len = PyList_GET_SIZE(py_data);
    2700           0 :         if (py_data == NULL) {
    2701           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data");
    2702           0 :                 return false;
    2703             :         }
    2704           0 :         PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
    2705             :         {
    2706             :                 int data_cntr_0;
    2707           0 :                 r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
    2708           0 :                 if (!r->in.data) { return false;; }
    2709           0 :                 talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
    2710           0 :                 for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(py_data); data_cntr_0++) {
    2711           0 :                         if (PyList_GET_ITEM(py_data, data_cntr_0) == NULL) {
    2712           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data[data_cntr_0]");
    2713           0 :                                 return false;
    2714             :                         }
    2715             :                         {
    2716           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.data[data_cntr_0]));
    2717           0 :                                 if (PyLong_Check(PyList_GET_ITEM(py_data, data_cntr_0))) {
    2718             :                                         unsigned long long test_var;
    2719           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_data, data_cntr_0));
    2720           0 :                                         if (PyErr_Occurred() != NULL) {
    2721           0 :                                                 return false;
    2722             :                                         }
    2723           0 :                                         if (test_var > uint_max) {
    2724           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2725             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2726           0 :                                                 return false;
    2727             :                                         }
    2728           0 :                                         r->in.data[data_cntr_0] = test_var;
    2729             :                                 } else {
    2730           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2731             :                                           PyLong_Type.tp_name);
    2732           0 :                                         return false;
    2733             :                                 }
    2734             :                         }
    2735             :                 }
    2736             :         }
    2737           0 :         return true;
    2738             : }
    2739             : 
    2740           0 : static PyObject *unpack_py_echo_SinkData_args_out(struct echo_SinkData *r)
    2741             : {
    2742             :         PyObject *result;
    2743           0 :         result = Py_None;
    2744           0 :         Py_INCREF(result);
    2745           0 :         return result;
    2746             : }
    2747             : 
    2748             : 
    2749           0 : static PyObject *py_echo_SourceData_in_get_len(PyObject *obj, void *closure)
    2750             : {
    2751           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(obj);
    2752             :         PyObject *py_len;
    2753           0 :         py_len = PyLong_FromUnsignedLongLong((uint32_t)object->in.len);
    2754           0 :         return py_len;
    2755             : }
    2756             : 
    2757           0 : static int py_echo_SourceData_in_set_len(PyObject *py_obj, PyObject *value, void *closure)
    2758             : {
    2759           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(py_obj);
    2760           0 :         if (value == NULL) {
    2761           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.len");
    2762           0 :                 return -1;
    2763             :         }
    2764             :         {
    2765           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.len));
    2766           0 :                 if (PyLong_Check(value)) {
    2767             :                         unsigned long long test_var;
    2768           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2769           0 :                         if (PyErr_Occurred() != NULL) {
    2770           0 :                                 return -1;
    2771             :                         }
    2772           0 :                         if (test_var > uint_max) {
    2773           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2774             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2775           0 :                                 return -1;
    2776             :                         }
    2777           0 :                         object->in.len = test_var;
    2778             :                 } else {
    2779           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2780             :                           PyLong_Type.tp_name);
    2781           0 :                         return -1;
    2782             :                 }
    2783             :         }
    2784           0 :         return 0;
    2785             : }
    2786             : 
    2787           0 : static PyObject *py_echo_SourceData_out_get_data(PyObject *obj, void *closure)
    2788             : {
    2789           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(obj);
    2790             :         PyObject *py_data;
    2791           0 :         py_data = PyList_New(object->in.len);
    2792           0 :         if (py_data == NULL) {
    2793           0 :                 return NULL;
    2794             :         }
    2795             :         {
    2796             :                 int data_cntr_0;
    2797           0 :                 for (data_cntr_0 = 0; data_cntr_0 < (object->in.len); data_cntr_0++) {
    2798             :                         PyObject *py_data_0;
    2799           0 :                         py_data_0 = PyLong_FromLong((uint16_t)object->out.data[data_cntr_0]);
    2800           0 :                         PyList_SetItem(py_data, data_cntr_0, py_data_0);
    2801             :                 }
    2802             :         }
    2803           0 :         return py_data;
    2804             : }
    2805             : 
    2806           0 : static int py_echo_SourceData_out_set_data(PyObject *py_obj, PyObject *value, void *closure)
    2807             : {
    2808           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(py_obj);
    2809           0 :         if (value == NULL) {
    2810           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data");
    2811           0 :                 return -1;
    2812             :         }
    2813           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2814             :         {
    2815             :                 int data_cntr_0;
    2816           0 :                 object->out.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data, PyList_GET_SIZE(value));
    2817           0 :                 if (!object->out.data) { return -1;; }
    2818           0 :                 talloc_set_name_const(object->out.data, "ARRAY: object->out.data");
    2819           0 :                 for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
    2820           0 :                         if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
    2821           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data[data_cntr_0]");
    2822           0 :                                 return -1;
    2823             :                         }
    2824             :                         {
    2825           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.data[data_cntr_0]));
    2826           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
    2827             :                                         unsigned long long test_var;
    2828           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_0));
    2829           0 :                                         if (PyErr_Occurred() != NULL) {
    2830           0 :                                                 return -1;
    2831             :                                         }
    2832           0 :                                         if (test_var > uint_max) {
    2833           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2834             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2835           0 :                                                 return -1;
    2836             :                                         }
    2837           0 :                                         object->out.data[data_cntr_0] = test_var;
    2838             :                                 } else {
    2839           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2840             :                                           PyLong_Type.tp_name);
    2841           0 :                                         return -1;
    2842             :                                 }
    2843             :                         }
    2844             :                 }
    2845             :         }
    2846           0 :         return 0;
    2847             : }
    2848             : 
    2849             : static PyGetSetDef py_echo_SourceData_getsetters[] = {
    2850             :         {
    2851             :                 .name = discard_const_p(char, "in_len"),
    2852             :                 .get = py_echo_SourceData_in_get_len,
    2853             :                 .set = py_echo_SourceData_in_set_len,
    2854             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2855             :         },
    2856             :         {
    2857             :                 .name = discard_const_p(char, "out_data"),
    2858             :                 .get = py_echo_SourceData_out_get_data,
    2859             :                 .set = py_echo_SourceData_out_set_data,
    2860             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2861             :         },
    2862             :         { .name = NULL }
    2863             : };
    2864             : 
    2865           0 : static PyObject *py_echo_SourceData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2866             : {
    2867           0 :         PyObject *self = pytalloc_new(struct echo_SourceData, type);
    2868           0 :         return self;
    2869             : }
    2870             : 
    2871           0 : static PyObject *py_echo_SourceData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    2872             : {
    2873             : 
    2874             : 
    2875           0 :         return PyLong_FromLong(3);
    2876             : }
    2877             : 
    2878           0 : static PyObject *py_echo_SourceData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    2879             : {
    2880           0 :         const struct ndr_interface_call *call = NULL;
    2881           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(py_obj);
    2882           0 :         PyObject *ret = NULL;
    2883           0 :         struct ndr_push *push = NULL;
    2884             :         DATA_BLOB blob;
    2885             :         enum ndr_err_code err;
    2886             : 
    2887           0 :         if (ndr_table_rpcecho.num_calls < 4) {
    2888           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SourceData_ndr_pack");
    2889           0 :                 return NULL;
    2890             :         }
    2891           0 :         call = &ndr_table_rpcecho.calls[3];
    2892             : 
    2893           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    2894           0 :         if (push == NULL) {
    2895           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2896           0 :                 return NULL;
    2897             :         }
    2898             : 
    2899           0 :         push->flags |= ndr_push_flags;
    2900             : 
    2901           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    2902           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2903           0 :                 TALLOC_FREE(push);
    2904           0 :                 PyErr_SetNdrError(err);
    2905           0 :                 return NULL;
    2906             :         }
    2907           0 :         blob = ndr_push_blob(push);
    2908           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2909           0 :         TALLOC_FREE(push);
    2910           0 :         return ret;
    2911             : }
    2912             : 
    2913           0 : static PyObject *py_echo_SourceData_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2914             : {
    2915           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2916           0 :         PyObject *bigendian_obj = NULL;
    2917           0 :         PyObject *ndr64_obj = NULL;
    2918           0 :         uint32_t ndr_push_flags = 0;
    2919             : 
    2920           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2921             :                 discard_const_p(char *, kwnames),
    2922             :                 &bigendian_obj,
    2923             :                 &ndr64_obj)) {
    2924           0 :                 return NULL;
    2925             :         }
    2926             : 
    2927           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2928           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2929             :         }
    2930           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2931           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2932             :         }
    2933             : 
    2934           0 :         return py_echo_SourceData_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2935             : }
    2936             : 
    2937           0 : static PyObject *py_echo_SourceData_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2938             : {
    2939           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2940           0 :         PyObject *bigendian_obj = NULL;
    2941           0 :         PyObject *ndr64_obj = NULL;
    2942           0 :         uint32_t ndr_push_flags = 0;
    2943             : 
    2944           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2945             :                 discard_const_p(char *, kwnames),
    2946             :                 &bigendian_obj,
    2947             :                 &ndr64_obj)) {
    2948           0 :                 return NULL;
    2949             :         }
    2950             : 
    2951           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2952           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2953             :         }
    2954           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2955           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2956             :         }
    2957             : 
    2958           0 :         return py_echo_SourceData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2959             : }
    2960             : 
    2961           0 : static PyObject *py_echo_SourceData_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    2962             : {
    2963           0 :         const struct ndr_interface_call *call = NULL;
    2964           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(py_obj);
    2965           0 :         struct ndr_pull *pull = NULL;
    2966             :         enum ndr_err_code err;
    2967             : 
    2968           0 :         if (ndr_table_rpcecho.num_calls < 4) {
    2969           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SourceData_ndr_unpack");
    2970           0 :                 return NULL;
    2971             :         }
    2972           0 :         call = &ndr_table_rpcecho.calls[3];
    2973             : 
    2974           0 :         pull = ndr_pull_init_blob(blob, object);
    2975           0 :         if (pull == NULL) {
    2976           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2977           0 :                 return NULL;
    2978             :         }
    2979             : 
    2980           0 :         pull->flags |= ndr_pull_flags;
    2981             : 
    2982           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2983           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2984           0 :                 TALLOC_FREE(pull);
    2985           0 :                 PyErr_SetNdrError(err);
    2986           0 :                 return NULL;
    2987             :         }
    2988           0 :         if (!allow_remaining) {
    2989             :                 uint32_t highest_ofs;
    2990             : 
    2991           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2992           0 :                         highest_ofs = pull->offset;
    2993             :                 } else {
    2994           0 :                         highest_ofs = pull->relative_highest_offset;
    2995             :                 }
    2996           0 :                 if (highest_ofs < pull->data_size) {
    2997           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2998             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2999             :                                 highest_ofs, pull->data_size);
    3000           0 :                         TALLOC_FREE(pull);
    3001           0 :                         PyErr_SetNdrError(err);
    3002           0 :                         return NULL;
    3003             :                 }
    3004             :         }
    3005             : 
    3006           0 :         TALLOC_FREE(pull);
    3007           0 :         Py_RETURN_NONE;
    3008             : }
    3009             : 
    3010           0 : static PyObject *py_echo_SourceData_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3011             : {
    3012             :         DATA_BLOB blob;
    3013           0 :         Py_ssize_t blob_length = 0;
    3014           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3015           0 :         PyObject *bigendian_obj = NULL;
    3016           0 :         PyObject *ndr64_obj = NULL;
    3017           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3018           0 :         PyObject *allow_remaining_obj = NULL;
    3019           0 :         bool allow_remaining = false;
    3020             : 
    3021           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    3022             :                 discard_const_p(char *, kwnames),
    3023             :                 &blob.data, &blob_length,
    3024             :                 &bigendian_obj,
    3025             :                 &ndr64_obj,
    3026             :                 &allow_remaining_obj)) {
    3027           0 :                 return NULL;
    3028             :         }
    3029           0 :         blob.length = blob_length;
    3030             : 
    3031           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3032           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3033             :         }
    3034           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3035           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3036             :         }
    3037             : 
    3038           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3039           0 :                 allow_remaining = true;
    3040             :         }
    3041             : 
    3042           0 :         return py_echo_SourceData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    3043             : }
    3044             : 
    3045           0 : static PyObject *py_echo_SourceData_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3046             : {
    3047             :         DATA_BLOB blob;
    3048           0 :         Py_ssize_t blob_length = 0;
    3049           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3050           0 :         PyObject *bigendian_obj = NULL;
    3051           0 :         PyObject *ndr64_obj = NULL;
    3052           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3053           0 :         PyObject *allow_remaining_obj = NULL;
    3054           0 :         bool allow_remaining = false;
    3055             : 
    3056           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    3057             :                 discard_const_p(char *, kwnames),
    3058             :                 &blob.data, &blob_length,
    3059             :                 &bigendian_obj,
    3060             :                 &ndr64_obj,
    3061             :                 &allow_remaining_obj)) {
    3062           0 :                 return NULL;
    3063             :         }
    3064           0 :         blob.length = blob_length;
    3065             : 
    3066           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3067           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3068             :         }
    3069           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3070           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3071             :         }
    3072             : 
    3073           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3074           0 :                 allow_remaining = true;
    3075             :         }
    3076             : 
    3077           0 :         return py_echo_SourceData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    3078             : }
    3079             : 
    3080           0 : static PyObject *py_echo_SourceData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    3081             : {
    3082           0 :         const struct ndr_interface_call *call = NULL;
    3083           0 :         struct echo_SourceData *object = (struct echo_SourceData *)pytalloc_get_ptr(py_obj);
    3084             :         PyObject *ret;
    3085             :         char *retstr;
    3086             : 
    3087           0 :         if (ndr_table_rpcecho.num_calls < 4) {
    3088           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_SourceData_ndr_print");
    3089           0 :                 return NULL;
    3090             :         }
    3091           0 :         call = &ndr_table_rpcecho.calls[3];
    3092             : 
    3093           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    3094           0 :         ret = PyUnicode_FromString(retstr);
    3095           0 :         TALLOC_FREE(retstr);
    3096             : 
    3097           0 :         return ret;
    3098             : }
    3099             : 
    3100           0 : static PyObject *py_echo_SourceData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3101             : {
    3102           0 :         return py_echo_SourceData_ndr_print(py_obj, "echo_SourceData_in", NDR_IN);
    3103             : }
    3104             : 
    3105           0 : static PyObject *py_echo_SourceData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3106             : {
    3107           0 :         return py_echo_SourceData_ndr_print(py_obj, "echo_SourceData_out", NDR_OUT);
    3108             : }
    3109             : 
    3110             : static PyMethodDef py_echo_SourceData_methods[] = {
    3111             :         { "opnum", (PyCFunction)py_echo_SourceData_ndr_opnum, METH_NOARGS|METH_CLASS,
    3112             :                 "echo.SourceData.opnum() -> 3 (0x03) " },
    3113             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SourceData_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    3114             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    3115             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SourceData_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    3116             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    3117             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SourceData_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    3118             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    3119             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_SourceData_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    3120             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    3121             :         { "__ndr_print_in__", (PyCFunction)py_echo_SourceData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    3122             :         { "__ndr_print_out__", (PyCFunction)py_echo_SourceData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    3123             :         { NULL, NULL, 0, NULL }
    3124             : };
    3125             : 
    3126             : 
    3127             : static PyTypeObject echo_SourceData_Type = {
    3128             :         PyVarObject_HEAD_INIT(NULL, 0)
    3129             :         .tp_name = "echo.SourceData",
    3130             :         .tp_getset = py_echo_SourceData_getsetters,
    3131             :         .tp_methods = py_echo_SourceData_methods,
    3132             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3133             :         .tp_new = py_echo_SourceData_new,
    3134             : };
    3135             : 
    3136           0 : static bool pack_py_echo_SourceData_args_in(PyObject *args, PyObject *kwargs, struct echo_SourceData *r)
    3137             : {
    3138             :         PyObject *py_len;
    3139           0 :         const char *kwnames[] = {
    3140             :                 "len", NULL
    3141             :         };
    3142             : 
    3143           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_SourceData", discard_const_p(char *, kwnames), &py_len)) {
    3144           0 :                 return false;
    3145             :         }
    3146             : 
    3147           0 :         if (py_len == NULL) {
    3148           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.len");
    3149           0 :                 return false;
    3150             :         }
    3151             :         {
    3152           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.len));
    3153           0 :                 if (PyLong_Check(py_len)) {
    3154             :                         unsigned long long test_var;
    3155           0 :                         test_var = PyLong_AsUnsignedLongLong(py_len);
    3156           0 :                         if (PyErr_Occurred() != NULL) {
    3157           0 :                                 return false;
    3158             :                         }
    3159           0 :                         if (test_var > uint_max) {
    3160           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3161             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3162           0 :                                 return false;
    3163             :                         }
    3164           0 :                         r->in.len = test_var;
    3165             :                 } else {
    3166           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3167             :                           PyLong_Type.tp_name);
    3168           0 :                         return false;
    3169             :                 }
    3170             :         }
    3171           0 :         return true;
    3172             : }
    3173             : 
    3174           0 : static PyObject *unpack_py_echo_SourceData_args_out(struct echo_SourceData *r)
    3175             : {
    3176             :         PyObject *result;
    3177             :         PyObject *py_data;
    3178           0 :         py_data = PyList_New(r->in.len);
    3179           0 :         if (py_data == NULL) {
    3180           0 :                 return NULL;
    3181             :         }
    3182             :         {
    3183             :                 int data_cntr_0;
    3184           0 :                 for (data_cntr_0 = 0; data_cntr_0 < (r->in.len); data_cntr_0++) {
    3185             :                         PyObject *py_data_0;
    3186           0 :                         py_data_0 = PyLong_FromLong((uint16_t)r->out.data[data_cntr_0]);
    3187           0 :                         PyList_SetItem(py_data, data_cntr_0, py_data_0);
    3188             :                 }
    3189             :         }
    3190           0 :         result = py_data;
    3191           0 :         return result;
    3192             : }
    3193             : 
    3194             : 
    3195           0 : static PyObject *py_echo_TestCall_in_get_s1(PyObject *obj, void *closure)
    3196             : {
    3197           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(obj);
    3198             :         PyObject *py_s1;
    3199           0 :         if (object->in.s1 == NULL) {
    3200           0 :                 Py_RETURN_NONE;
    3201             :         }
    3202           0 :         if (object->in.s1 == NULL) {
    3203           0 :                 py_s1 = Py_None;
    3204           0 :                 Py_INCREF(py_s1);
    3205             :         } else {
    3206           0 :                 py_s1 = PyUnicode_Decode(object->in.s1, strlen(object->in.s1), "utf-8", "ignore");
    3207             :         }
    3208           0 :         return py_s1;
    3209             : }
    3210             : 
    3211           0 : static int py_echo_TestCall_in_set_s1(PyObject *py_obj, PyObject *value, void *closure)
    3212             : {
    3213           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(py_obj);
    3214           0 :         if (value == NULL) {
    3215           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.s1");
    3216           0 :                 return -1;
    3217             :         }
    3218           0 :         object->in.s1 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.s1);
    3219           0 :         if (object->in.s1 == NULL) {
    3220           0 :                 PyErr_NoMemory();
    3221           0 :                 return -1;
    3222             :         }
    3223             :         {
    3224             :                 const char *test_str;
    3225             :                 const char *talloc_str;
    3226           0 :                 PyObject *unicode = NULL;
    3227           0 :                 if (PyUnicode_Check(value)) {
    3228           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    3229           0 :                         if (unicode == NULL) {
    3230           0 :                                 PyErr_NoMemory();
    3231           0 :                                 return -1;
    3232             :                         }
    3233           0 :                         test_str = PyBytes_AS_STRING(unicode);
    3234           0 :                 } else if (PyBytes_Check(value)) {
    3235           0 :                         test_str = PyBytes_AS_STRING(value);
    3236             :                 } else {
    3237           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    3238           0 :                         return -1;
    3239             :                 }
    3240           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    3241           0 :                 if (unicode != NULL) {
    3242           0 :                         Py_DECREF(unicode);
    3243             :                 }
    3244           0 :                 if (talloc_str == NULL) {
    3245           0 :                         PyErr_NoMemory();
    3246           0 :                         return -1;
    3247             :                 }
    3248           0 :                 object->in.s1 = talloc_str;
    3249             :         }
    3250           0 :         return 0;
    3251             : }
    3252             : 
    3253           0 : static PyObject *py_echo_TestCall_out_get_s2(PyObject *obj, void *closure)
    3254             : {
    3255           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(obj);
    3256             :         PyObject *py_s2;
    3257           0 :         if (object->out.s2 == NULL) {
    3258           0 :                 Py_RETURN_NONE;
    3259             :         }
    3260           0 :         if (*object->out.s2 == NULL) {
    3261           0 :                 py_s2 = Py_None;
    3262           0 :                 Py_INCREF(py_s2);
    3263             :         } else {
    3264           0 :                 if (*object->out.s2 == NULL) {
    3265           0 :                         py_s2 = Py_None;
    3266           0 :                         Py_INCREF(py_s2);
    3267             :                 } else {
    3268           0 :                         py_s2 = PyUnicode_Decode(*object->out.s2, strlen(*object->out.s2), "utf-8", "ignore");
    3269             :                 }
    3270             :         }
    3271           0 :         return py_s2;
    3272             : }
    3273             : 
    3274           0 : static int py_echo_TestCall_out_set_s2(PyObject *py_obj, PyObject *value, void *closure)
    3275             : {
    3276           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(py_obj);
    3277           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.s2));
    3278           0 :         if (value == NULL) {
    3279           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.s2");
    3280           0 :                 return -1;
    3281             :         }
    3282           0 :         object->out.s2 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.s2);
    3283           0 :         if (object->out.s2 == NULL) {
    3284           0 :                 PyErr_NoMemory();
    3285           0 :                 return -1;
    3286             :         }
    3287           0 :         if (value == Py_None) {
    3288           0 :                 *object->out.s2 = NULL;
    3289             :         } else {
    3290           0 :                 *object->out.s2 = NULL;
    3291             :                 {
    3292             :                         const char *test_str;
    3293             :                         const char *talloc_str;
    3294           0 :                         PyObject *unicode = NULL;
    3295           0 :                         if (PyUnicode_Check(value)) {
    3296           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    3297           0 :                                 if (unicode == NULL) {
    3298           0 :                                         PyErr_NoMemory();
    3299           0 :                                         return -1;
    3300             :                                 }
    3301           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    3302           0 :                         } else if (PyBytes_Check(value)) {
    3303           0 :                                 test_str = PyBytes_AS_STRING(value);
    3304             :                         } else {
    3305           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    3306           0 :                                 return -1;
    3307             :                         }
    3308           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    3309           0 :                         if (unicode != NULL) {
    3310           0 :                                 Py_DECREF(unicode);
    3311             :                         }
    3312           0 :                         if (talloc_str == NULL) {
    3313           0 :                                 PyErr_NoMemory();
    3314           0 :                                 return -1;
    3315             :                         }
    3316           0 :                         *object->out.s2 = talloc_str;
    3317             :                 }
    3318             :         }
    3319           0 :         return 0;
    3320             : }
    3321             : 
    3322             : static PyGetSetDef py_echo_TestCall_getsetters[] = {
    3323             :         {
    3324             :                 .name = discard_const_p(char, "in_s1"),
    3325             :                 .get = py_echo_TestCall_in_get_s1,
    3326             :                 .set = py_echo_TestCall_in_set_s1,
    3327             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    3328             :         },
    3329             :         {
    3330             :                 .name = discard_const_p(char, "out_s2"),
    3331             :                 .get = py_echo_TestCall_out_get_s2,
    3332             :                 .set = py_echo_TestCall_out_set_s2,
    3333             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    3334             :         },
    3335             :         { .name = NULL }
    3336             : };
    3337             : 
    3338           0 : static PyObject *py_echo_TestCall_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3339             : {
    3340           0 :         PyObject *self = pytalloc_new(struct echo_TestCall, type);
    3341           0 :         return self;
    3342             : }
    3343             : 
    3344           0 : static PyObject *py_echo_TestCall_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    3345             : {
    3346             : 
    3347             : 
    3348           0 :         return PyLong_FromLong(4);
    3349             : }
    3350             : 
    3351           0 : static PyObject *py_echo_TestCall_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    3352             : {
    3353           0 :         const struct ndr_interface_call *call = NULL;
    3354           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(py_obj);
    3355           0 :         PyObject *ret = NULL;
    3356           0 :         struct ndr_push *push = NULL;
    3357             :         DATA_BLOB blob;
    3358             :         enum ndr_err_code err;
    3359             : 
    3360           0 :         if (ndr_table_rpcecho.num_calls < 5) {
    3361           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall_ndr_pack");
    3362           0 :                 return NULL;
    3363             :         }
    3364           0 :         call = &ndr_table_rpcecho.calls[4];
    3365             : 
    3366           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    3367           0 :         if (push == NULL) {
    3368           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3369           0 :                 return NULL;
    3370             :         }
    3371             : 
    3372           0 :         push->flags |= ndr_push_flags;
    3373             : 
    3374           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    3375           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3376           0 :                 TALLOC_FREE(push);
    3377           0 :                 PyErr_SetNdrError(err);
    3378           0 :                 return NULL;
    3379             :         }
    3380           0 :         blob = ndr_push_blob(push);
    3381           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3382           0 :         TALLOC_FREE(push);
    3383           0 :         return ret;
    3384             : }
    3385             : 
    3386           0 : static PyObject *py_echo_TestCall_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3387             : {
    3388           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3389           0 :         PyObject *bigendian_obj = NULL;
    3390           0 :         PyObject *ndr64_obj = NULL;
    3391           0 :         uint32_t ndr_push_flags = 0;
    3392             : 
    3393           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    3394             :                 discard_const_p(char *, kwnames),
    3395             :                 &bigendian_obj,
    3396             :                 &ndr64_obj)) {
    3397           0 :                 return NULL;
    3398             :         }
    3399             : 
    3400           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3401           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3402             :         }
    3403           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3404           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3405             :         }
    3406             : 
    3407           0 :         return py_echo_TestCall_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    3408             : }
    3409             : 
    3410           0 : static PyObject *py_echo_TestCall_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3411             : {
    3412           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3413           0 :         PyObject *bigendian_obj = NULL;
    3414           0 :         PyObject *ndr64_obj = NULL;
    3415           0 :         uint32_t ndr_push_flags = 0;
    3416             : 
    3417           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    3418             :                 discard_const_p(char *, kwnames),
    3419             :                 &bigendian_obj,
    3420             :                 &ndr64_obj)) {
    3421           0 :                 return NULL;
    3422             :         }
    3423             : 
    3424           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3425           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3426             :         }
    3427           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3428           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3429             :         }
    3430             : 
    3431           0 :         return py_echo_TestCall_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    3432             : }
    3433             : 
    3434           0 : static PyObject *py_echo_TestCall_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    3435             : {
    3436           0 :         const struct ndr_interface_call *call = NULL;
    3437           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(py_obj);
    3438           0 :         struct ndr_pull *pull = NULL;
    3439             :         enum ndr_err_code err;
    3440             : 
    3441           0 :         if (ndr_table_rpcecho.num_calls < 5) {
    3442           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall_ndr_unpack");
    3443           0 :                 return NULL;
    3444             :         }
    3445           0 :         call = &ndr_table_rpcecho.calls[4];
    3446             : 
    3447           0 :         pull = ndr_pull_init_blob(blob, object);
    3448           0 :         if (pull == NULL) {
    3449           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3450           0 :                 return NULL;
    3451             :         }
    3452             : 
    3453           0 :         pull->flags |= ndr_pull_flags;
    3454             : 
    3455           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    3456           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3457           0 :                 TALLOC_FREE(pull);
    3458           0 :                 PyErr_SetNdrError(err);
    3459           0 :                 return NULL;
    3460             :         }
    3461           0 :         if (!allow_remaining) {
    3462             :                 uint32_t highest_ofs;
    3463             : 
    3464           0 :                 if (pull->offset > pull->relative_highest_offset) {
    3465           0 :                         highest_ofs = pull->offset;
    3466             :                 } else {
    3467           0 :                         highest_ofs = pull->relative_highest_offset;
    3468             :                 }
    3469           0 :                 if (highest_ofs < pull->data_size) {
    3470           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    3471             :                                 "not all bytes consumed ofs[%u] size[%u]",
    3472             :                                 highest_ofs, pull->data_size);
    3473           0 :                         TALLOC_FREE(pull);
    3474           0 :                         PyErr_SetNdrError(err);
    3475           0 :                         return NULL;
    3476             :                 }
    3477             :         }
    3478             : 
    3479           0 :         TALLOC_FREE(pull);
    3480           0 :         Py_RETURN_NONE;
    3481             : }
    3482             : 
    3483           0 : static PyObject *py_echo_TestCall_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3484             : {
    3485             :         DATA_BLOB blob;
    3486           0 :         Py_ssize_t blob_length = 0;
    3487           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3488           0 :         PyObject *bigendian_obj = NULL;
    3489           0 :         PyObject *ndr64_obj = NULL;
    3490           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3491           0 :         PyObject *allow_remaining_obj = NULL;
    3492           0 :         bool allow_remaining = false;
    3493             : 
    3494           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    3495             :                 discard_const_p(char *, kwnames),
    3496             :                 &blob.data, &blob_length,
    3497             :                 &bigendian_obj,
    3498             :                 &ndr64_obj,
    3499             :                 &allow_remaining_obj)) {
    3500           0 :                 return NULL;
    3501             :         }
    3502           0 :         blob.length = blob_length;
    3503             : 
    3504           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3505           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3506             :         }
    3507           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3508           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3509             :         }
    3510             : 
    3511           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3512           0 :                 allow_remaining = true;
    3513             :         }
    3514             : 
    3515           0 :         return py_echo_TestCall_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    3516             : }
    3517             : 
    3518           0 : static PyObject *py_echo_TestCall_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3519             : {
    3520             :         DATA_BLOB blob;
    3521           0 :         Py_ssize_t blob_length = 0;
    3522           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3523           0 :         PyObject *bigendian_obj = NULL;
    3524           0 :         PyObject *ndr64_obj = NULL;
    3525           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3526           0 :         PyObject *allow_remaining_obj = NULL;
    3527           0 :         bool allow_remaining = false;
    3528             : 
    3529           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    3530             :                 discard_const_p(char *, kwnames),
    3531             :                 &blob.data, &blob_length,
    3532             :                 &bigendian_obj,
    3533             :                 &ndr64_obj,
    3534             :                 &allow_remaining_obj)) {
    3535           0 :                 return NULL;
    3536             :         }
    3537           0 :         blob.length = blob_length;
    3538             : 
    3539           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3540           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3541             :         }
    3542           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3543           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3544             :         }
    3545             : 
    3546           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3547           0 :                 allow_remaining = true;
    3548             :         }
    3549             : 
    3550           0 :         return py_echo_TestCall_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    3551             : }
    3552             : 
    3553           0 : static PyObject *py_echo_TestCall_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    3554             : {
    3555           0 :         const struct ndr_interface_call *call = NULL;
    3556           0 :         struct echo_TestCall *object = (struct echo_TestCall *)pytalloc_get_ptr(py_obj);
    3557             :         PyObject *ret;
    3558             :         char *retstr;
    3559             : 
    3560           0 :         if (ndr_table_rpcecho.num_calls < 5) {
    3561           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall_ndr_print");
    3562           0 :                 return NULL;
    3563             :         }
    3564           0 :         call = &ndr_table_rpcecho.calls[4];
    3565             : 
    3566           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    3567           0 :         ret = PyUnicode_FromString(retstr);
    3568           0 :         TALLOC_FREE(retstr);
    3569             : 
    3570           0 :         return ret;
    3571             : }
    3572             : 
    3573           0 : static PyObject *py_echo_TestCall_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3574             : {
    3575           0 :         return py_echo_TestCall_ndr_print(py_obj, "echo_TestCall_in", NDR_IN);
    3576             : }
    3577             : 
    3578           0 : static PyObject *py_echo_TestCall_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3579             : {
    3580           0 :         return py_echo_TestCall_ndr_print(py_obj, "echo_TestCall_out", NDR_OUT);
    3581             : }
    3582             : 
    3583             : static PyMethodDef py_echo_TestCall_methods[] = {
    3584             :         { "opnum", (PyCFunction)py_echo_TestCall_ndr_opnum, METH_NOARGS|METH_CLASS,
    3585             :                 "echo.TestCall.opnum() -> 4 (0x04) " },
    3586             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    3587             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    3588             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    3589             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    3590             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    3591             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    3592             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    3593             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    3594             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestCall_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    3595             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestCall_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    3596             :         { NULL, NULL, 0, NULL }
    3597             : };
    3598             : 
    3599             : 
    3600             : static PyTypeObject echo_TestCall_Type = {
    3601             :         PyVarObject_HEAD_INIT(NULL, 0)
    3602             :         .tp_name = "echo.TestCall",
    3603             :         .tp_getset = py_echo_TestCall_getsetters,
    3604             :         .tp_methods = py_echo_TestCall_methods,
    3605             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3606             :         .tp_new = py_echo_TestCall_new,
    3607             : };
    3608             : 
    3609           1 : static bool pack_py_echo_TestCall_args_in(PyObject *args, PyObject *kwargs, struct echo_TestCall *r)
    3610             : {
    3611             :         PyObject *py_s1;
    3612           1 :         const char *kwnames[] = {
    3613             :                 "s1", NULL
    3614             :         };
    3615             : 
    3616           1 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_TestCall", discard_const_p(char *, kwnames), &py_s1)) {
    3617           0 :                 return false;
    3618             :         }
    3619             : 
    3620           1 :         if (py_s1 == NULL) {
    3621           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.s1");
    3622           0 :                 return false;
    3623             :         }
    3624           1 :         r->in.s1 = talloc_ptrtype(r, r->in.s1);
    3625           1 :         if (r->in.s1 == NULL) {
    3626           0 :                 PyErr_NoMemory();
    3627           0 :                 return false;
    3628             :         }
    3629             :         {
    3630             :                 const char *test_str;
    3631             :                 const char *talloc_str;
    3632           1 :                 PyObject *unicode = NULL;
    3633           1 :                 if (PyUnicode_Check(py_s1)) {
    3634           1 :                         unicode = PyUnicode_AsEncodedString(py_s1, "utf-8", "ignore");
    3635           1 :                         if (unicode == NULL) {
    3636           0 :                                 PyErr_NoMemory();
    3637           0 :                                 return false;
    3638             :                         }
    3639           1 :                         test_str = PyBytes_AS_STRING(unicode);
    3640           0 :                 } else if (PyBytes_Check(py_s1)) {
    3641           0 :                         test_str = PyBytes_AS_STRING(py_s1);
    3642             :                 } else {
    3643           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_s1)->tp_name);
    3644           0 :                         return false;
    3645             :                 }
    3646           1 :                 talloc_str = talloc_strdup(r, test_str);
    3647           1 :                 if (unicode != NULL) {
    3648           1 :                         Py_DECREF(unicode);
    3649             :                 }
    3650           1 :                 if (talloc_str == NULL) {
    3651           0 :                         PyErr_NoMemory();
    3652           0 :                         return false;
    3653             :                 }
    3654           1 :                 r->in.s1 = talloc_str;
    3655             :         }
    3656           1 :         return true;
    3657             : }
    3658             : 
    3659           1 : static PyObject *unpack_py_echo_TestCall_args_out(struct echo_TestCall *r)
    3660             : {
    3661             :         PyObject *result;
    3662             :         PyObject *py_s2;
    3663           1 :         if (*r->out.s2 == NULL) {
    3664           0 :                 py_s2 = Py_None;
    3665           0 :                 Py_INCREF(py_s2);
    3666             :         } else {
    3667           1 :                 if (*r->out.s2 == NULL) {
    3668           0 :                         py_s2 = Py_None;
    3669           0 :                         Py_INCREF(py_s2);
    3670             :                 } else {
    3671           1 :                         py_s2 = PyUnicode_Decode(*r->out.s2, strlen(*r->out.s2), "utf-8", "ignore");
    3672             :                 }
    3673             :         }
    3674           1 :         result = py_s2;
    3675           1 :         return result;
    3676             : }
    3677             : 
    3678             : 
    3679           0 : static PyObject *py_echo_TestCall2_in_get_level(PyObject *obj, void *closure)
    3680             : {
    3681           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(obj);
    3682             :         PyObject *py_level;
    3683           0 :         py_level = PyLong_FromLong((uint16_t)object->in.level);
    3684           0 :         return py_level;
    3685             : }
    3686             : 
    3687           0 : static int py_echo_TestCall2_in_set_level(PyObject *py_obj, PyObject *value, void *closure)
    3688             : {
    3689           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    3690           0 :         if (value == NULL) {
    3691           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.level");
    3692           0 :                 return -1;
    3693             :         }
    3694             :         {
    3695           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.level));
    3696           0 :                 if (PyLong_Check(value)) {
    3697             :                         unsigned long long test_var;
    3698           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3699           0 :                         if (PyErr_Occurred() != NULL) {
    3700           0 :                                 return -1;
    3701             :                         }
    3702           0 :                         if (test_var > uint_max) {
    3703           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3704             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3705           0 :                                 return -1;
    3706             :                         }
    3707           0 :                         object->in.level = test_var;
    3708             :                 } else {
    3709           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3710             :                           PyLong_Type.tp_name);
    3711           0 :                         return -1;
    3712             :                 }
    3713             :         }
    3714           0 :         return 0;
    3715             : }
    3716             : 
    3717           0 : static PyObject *py_echo_TestCall2_out_get_info(PyObject *obj, void *closure)
    3718             : {
    3719           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(obj);
    3720             :         PyObject *py_info;
    3721           0 :         if (object->out.info == NULL) {
    3722           0 :                 Py_RETURN_NONE;
    3723             :         }
    3724           0 :         py_info = pyrpc_import_union(&echo_Info_Type, object->out.info, object->in.level, object->out.info, "union echo_Info");
    3725           0 :         if (py_info == NULL) {
    3726           0 :                 return NULL;
    3727             :         }
    3728           0 :         return py_info;
    3729             : }
    3730             : 
    3731           0 : static int py_echo_TestCall2_out_set_info(PyObject *py_obj, PyObject *value, void *closure)
    3732             : {
    3733           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    3734           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.info));
    3735           0 :         if (value == NULL) {
    3736           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.info");
    3737           0 :                 return -1;
    3738             :         }
    3739           0 :         object->out.info = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.info);
    3740           0 :         if (object->out.info == NULL) {
    3741           0 :                 PyErr_NoMemory();
    3742           0 :                 return -1;
    3743             :         }
    3744             :         {
    3745             :                 union echo_Info *info_switch_1;
    3746           0 :                 info_switch_1 = (union echo_Info *)pyrpc_export_union(&echo_Info_Type, pytalloc_get_mem_ctx(py_obj), object->in.level, value, "union echo_Info");
    3747           0 :                 if (info_switch_1 == NULL) {
    3748           0 :                         return -1;
    3749             :                 }
    3750           0 :                 object->out.info = info_switch_1;
    3751             :         }
    3752           0 :         return 0;
    3753             : }
    3754             : 
    3755           0 : static PyObject *py_echo_TestCall2_get_result(PyObject *obj, void *closure)
    3756             : {
    3757           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(obj);
    3758             :         PyObject *py_result;
    3759           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
    3760           0 :         return py_result;
    3761             : }
    3762             : 
    3763           0 : static int py_echo_TestCall2_set_result(PyObject *py_obj, PyObject *value, void *closure)
    3764             : {
    3765           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    3766           0 :         if (value == NULL) {
    3767           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    3768           0 :                 return -1;
    3769             :         }
    3770           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
    3771           0 :         return 0;
    3772             : }
    3773             : 
    3774             : static PyGetSetDef py_echo_TestCall2_getsetters[] = {
    3775             :         {
    3776             :                 .name = discard_const_p(char, "in_level"),
    3777             :                 .get = py_echo_TestCall2_in_get_level,
    3778             :                 .set = py_echo_TestCall2_in_set_level,
    3779             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    3780             :         },
    3781             :         {
    3782             :                 .name = discard_const_p(char, "out_info"),
    3783             :                 .get = py_echo_TestCall2_out_get_info,
    3784             :                 .set = py_echo_TestCall2_out_set_info,
    3785             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Info")
    3786             :         },
    3787             :         {
    3788             :                 .name = discard_const_p(char, "result"),
    3789             :                 .get = py_echo_TestCall2_get_result,
    3790             :                 .set = py_echo_TestCall2_set_result,
    3791             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
    3792             :         },
    3793             :         { .name = NULL }
    3794             : };
    3795             : 
    3796           0 : static PyObject *py_echo_TestCall2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3797             : {
    3798           0 :         PyObject *self = pytalloc_new(struct echo_TestCall2, type);
    3799           0 :         struct echo_TestCall2 *_self = (struct echo_TestCall2 *)pytalloc_get_ptr(self);
    3800           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    3801           0 :         _self->out.info = talloc_zero(mem_ctx, union echo_Info);
    3802           0 :         return self;
    3803             : }
    3804             : 
    3805           0 : static PyObject *py_echo_TestCall2_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    3806             : {
    3807             : 
    3808             : 
    3809           0 :         return PyLong_FromLong(5);
    3810             : }
    3811             : 
    3812           0 : static PyObject *py_echo_TestCall2_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    3813             : {
    3814           0 :         const struct ndr_interface_call *call = NULL;
    3815           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    3816           0 :         PyObject *ret = NULL;
    3817           0 :         struct ndr_push *push = NULL;
    3818             :         DATA_BLOB blob;
    3819             :         enum ndr_err_code err;
    3820             : 
    3821           0 :         if (ndr_table_rpcecho.num_calls < 6) {
    3822           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall2_ndr_pack");
    3823           0 :                 return NULL;
    3824             :         }
    3825           0 :         call = &ndr_table_rpcecho.calls[5];
    3826             : 
    3827           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    3828           0 :         if (push == NULL) {
    3829           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3830           0 :                 return NULL;
    3831             :         }
    3832             : 
    3833           0 :         push->flags |= ndr_push_flags;
    3834             : 
    3835           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    3836           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3837           0 :                 TALLOC_FREE(push);
    3838           0 :                 PyErr_SetNdrError(err);
    3839           0 :                 return NULL;
    3840             :         }
    3841           0 :         blob = ndr_push_blob(push);
    3842           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3843           0 :         TALLOC_FREE(push);
    3844           0 :         return ret;
    3845             : }
    3846             : 
    3847           0 : static PyObject *py_echo_TestCall2_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3848             : {
    3849           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3850           0 :         PyObject *bigendian_obj = NULL;
    3851           0 :         PyObject *ndr64_obj = NULL;
    3852           0 :         uint32_t ndr_push_flags = 0;
    3853             : 
    3854           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    3855             :                 discard_const_p(char *, kwnames),
    3856             :                 &bigendian_obj,
    3857             :                 &ndr64_obj)) {
    3858           0 :                 return NULL;
    3859             :         }
    3860             : 
    3861           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3862           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3863             :         }
    3864           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3865           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3866             :         }
    3867             : 
    3868           0 :         return py_echo_TestCall2_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    3869             : }
    3870             : 
    3871           0 : static PyObject *py_echo_TestCall2_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3872             : {
    3873           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3874           0 :         PyObject *bigendian_obj = NULL;
    3875           0 :         PyObject *ndr64_obj = NULL;
    3876           0 :         uint32_t ndr_push_flags = 0;
    3877             : 
    3878           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    3879             :                 discard_const_p(char *, kwnames),
    3880             :                 &bigendian_obj,
    3881             :                 &ndr64_obj)) {
    3882           0 :                 return NULL;
    3883             :         }
    3884             : 
    3885           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3886           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3887             :         }
    3888           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3889           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3890             :         }
    3891             : 
    3892           0 :         return py_echo_TestCall2_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    3893             : }
    3894             : 
    3895           0 : static PyObject *py_echo_TestCall2_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    3896             : {
    3897           0 :         const struct ndr_interface_call *call = NULL;
    3898           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    3899           0 :         struct ndr_pull *pull = NULL;
    3900             :         enum ndr_err_code err;
    3901             : 
    3902           0 :         if (ndr_table_rpcecho.num_calls < 6) {
    3903           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall2_ndr_unpack");
    3904           0 :                 return NULL;
    3905             :         }
    3906           0 :         call = &ndr_table_rpcecho.calls[5];
    3907             : 
    3908           0 :         pull = ndr_pull_init_blob(blob, object);
    3909           0 :         if (pull == NULL) {
    3910           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3911           0 :                 return NULL;
    3912             :         }
    3913             : 
    3914           0 :         pull->flags |= ndr_pull_flags;
    3915             : 
    3916           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    3917           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3918           0 :                 TALLOC_FREE(pull);
    3919           0 :                 PyErr_SetNdrError(err);
    3920           0 :                 return NULL;
    3921             :         }
    3922           0 :         if (!allow_remaining) {
    3923             :                 uint32_t highest_ofs;
    3924             : 
    3925           0 :                 if (pull->offset > pull->relative_highest_offset) {
    3926           0 :                         highest_ofs = pull->offset;
    3927             :                 } else {
    3928           0 :                         highest_ofs = pull->relative_highest_offset;
    3929             :                 }
    3930           0 :                 if (highest_ofs < pull->data_size) {
    3931           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    3932             :                                 "not all bytes consumed ofs[%u] size[%u]",
    3933             :                                 highest_ofs, pull->data_size);
    3934           0 :                         TALLOC_FREE(pull);
    3935           0 :                         PyErr_SetNdrError(err);
    3936           0 :                         return NULL;
    3937             :                 }
    3938             :         }
    3939             : 
    3940           0 :         TALLOC_FREE(pull);
    3941           0 :         Py_RETURN_NONE;
    3942             : }
    3943             : 
    3944           0 : static PyObject *py_echo_TestCall2_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3945             : {
    3946             :         DATA_BLOB blob;
    3947           0 :         Py_ssize_t blob_length = 0;
    3948           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3949           0 :         PyObject *bigendian_obj = NULL;
    3950           0 :         PyObject *ndr64_obj = NULL;
    3951           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3952           0 :         PyObject *allow_remaining_obj = NULL;
    3953           0 :         bool allow_remaining = false;
    3954             : 
    3955           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    3956             :                 discard_const_p(char *, kwnames),
    3957             :                 &blob.data, &blob_length,
    3958             :                 &bigendian_obj,
    3959             :                 &ndr64_obj,
    3960             :                 &allow_remaining_obj)) {
    3961           0 :                 return NULL;
    3962             :         }
    3963           0 :         blob.length = blob_length;
    3964             : 
    3965           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3966           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3967             :         }
    3968           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3969           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3970             :         }
    3971             : 
    3972           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3973           0 :                 allow_remaining = true;
    3974             :         }
    3975             : 
    3976           0 :         return py_echo_TestCall2_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    3977             : }
    3978             : 
    3979           0 : static PyObject *py_echo_TestCall2_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3980             : {
    3981             :         DATA_BLOB blob;
    3982           0 :         Py_ssize_t blob_length = 0;
    3983           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3984           0 :         PyObject *bigendian_obj = NULL;
    3985           0 :         PyObject *ndr64_obj = NULL;
    3986           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3987           0 :         PyObject *allow_remaining_obj = NULL;
    3988           0 :         bool allow_remaining = false;
    3989             : 
    3990           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    3991             :                 discard_const_p(char *, kwnames),
    3992             :                 &blob.data, &blob_length,
    3993             :                 &bigendian_obj,
    3994             :                 &ndr64_obj,
    3995             :                 &allow_remaining_obj)) {
    3996           0 :                 return NULL;
    3997             :         }
    3998           0 :         blob.length = blob_length;
    3999             : 
    4000           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4001           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    4002             :         }
    4003           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4004           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    4005             :         }
    4006             : 
    4007           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4008           0 :                 allow_remaining = true;
    4009             :         }
    4010             : 
    4011           0 :         return py_echo_TestCall2_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    4012             : }
    4013             : 
    4014           0 : static PyObject *py_echo_TestCall2_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    4015             : {
    4016           0 :         const struct ndr_interface_call *call = NULL;
    4017           0 :         struct echo_TestCall2 *object = (struct echo_TestCall2 *)pytalloc_get_ptr(py_obj);
    4018             :         PyObject *ret;
    4019             :         char *retstr;
    4020             : 
    4021           0 :         if (ndr_table_rpcecho.num_calls < 6) {
    4022           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestCall2_ndr_print");
    4023           0 :                 return NULL;
    4024             :         }
    4025           0 :         call = &ndr_table_rpcecho.calls[5];
    4026             : 
    4027           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    4028           0 :         ret = PyUnicode_FromString(retstr);
    4029           0 :         TALLOC_FREE(retstr);
    4030             : 
    4031           0 :         return ret;
    4032             : }
    4033             : 
    4034           0 : static PyObject *py_echo_TestCall2_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4035             : {
    4036           0 :         return py_echo_TestCall2_ndr_print(py_obj, "echo_TestCall2_in", NDR_IN);
    4037             : }
    4038             : 
    4039           0 : static PyObject *py_echo_TestCall2_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4040             : {
    4041           0 :         return py_echo_TestCall2_ndr_print(py_obj, "echo_TestCall2_out", NDR_OUT);
    4042             : }
    4043             : 
    4044             : static PyMethodDef py_echo_TestCall2_methods[] = {
    4045             :         { "opnum", (PyCFunction)py_echo_TestCall2_ndr_opnum, METH_NOARGS|METH_CLASS,
    4046             :                 "echo.TestCall2.opnum() -> 5 (0x05) " },
    4047             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall2_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    4048             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    4049             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall2_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    4050             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    4051             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall2_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    4052             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    4053             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestCall2_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    4054             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    4055             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestCall2_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    4056             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestCall2_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    4057             :         { NULL, NULL, 0, NULL }
    4058             : };
    4059             : 
    4060             : 
    4061             : static PyTypeObject echo_TestCall2_Type = {
    4062             :         PyVarObject_HEAD_INIT(NULL, 0)
    4063             :         .tp_name = "echo.TestCall2",
    4064             :         .tp_getset = py_echo_TestCall2_getsetters,
    4065             :         .tp_methods = py_echo_TestCall2_methods,
    4066             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4067             :         .tp_new = py_echo_TestCall2_new,
    4068             : };
    4069             : 
    4070           0 : static bool pack_py_echo_TestCall2_args_in(PyObject *args, PyObject *kwargs, struct echo_TestCall2 *r)
    4071             : {
    4072             :         PyObject *py_level;
    4073           0 :         const char *kwnames[] = {
    4074             :                 "level", NULL
    4075             :         };
    4076             : 
    4077           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_TestCall2", discard_const_p(char *, kwnames), &py_level)) {
    4078           0 :                 return false;
    4079             :         }
    4080             : 
    4081           0 :         if (py_level == NULL) {
    4082           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.level");
    4083           0 :                 return false;
    4084             :         }
    4085             :         {
    4086           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.level));
    4087           0 :                 if (PyLong_Check(py_level)) {
    4088             :                         unsigned long long test_var;
    4089           0 :                         test_var = PyLong_AsUnsignedLongLong(py_level);
    4090           0 :                         if (PyErr_Occurred() != NULL) {
    4091           0 :                                 return false;
    4092             :                         }
    4093           0 :                         if (test_var > uint_max) {
    4094           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4095             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4096           0 :                                 return false;
    4097             :                         }
    4098           0 :                         r->in.level = test_var;
    4099             :                 } else {
    4100           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4101             :                           PyLong_Type.tp_name);
    4102           0 :                         return false;
    4103             :                 }
    4104             :         }
    4105           0 :         return true;
    4106             : }
    4107             : 
    4108           0 : static PyObject *unpack_py_echo_TestCall2_args_out(struct echo_TestCall2 *r)
    4109             : {
    4110             :         PyObject *result;
    4111             :         PyObject *py_info;
    4112           0 :         py_info = pyrpc_import_union(&echo_Info_Type, r->out.info, r->in.level, r->out.info, "union echo_Info");
    4113           0 :         if (py_info == NULL) {
    4114           0 :                 return NULL;
    4115             :         }
    4116           0 :         result = py_info;
    4117           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
    4118           0 :                 PyErr_SetNTSTATUS(r->out.result);
    4119           0 :                 return NULL;
    4120             :         }
    4121             : 
    4122           0 :         return result;
    4123             : }
    4124             : 
    4125             : 
    4126           0 : static PyObject *py_echo_TestSleep_in_get_seconds(PyObject *obj, void *closure)
    4127             : {
    4128           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(obj);
    4129             :         PyObject *py_seconds;
    4130           0 :         py_seconds = PyLong_FromUnsignedLongLong((uint32_t)object->in.seconds);
    4131           0 :         return py_seconds;
    4132             : }
    4133             : 
    4134           0 : static int py_echo_TestSleep_in_set_seconds(PyObject *py_obj, PyObject *value, void *closure)
    4135             : {
    4136           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(py_obj);
    4137           0 :         if (value == NULL) {
    4138           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.seconds");
    4139           0 :                 return -1;
    4140             :         }
    4141             :         {
    4142           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.seconds));
    4143           0 :                 if (PyLong_Check(value)) {
    4144             :                         unsigned long long test_var;
    4145           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4146           0 :                         if (PyErr_Occurred() != NULL) {
    4147           0 :                                 return -1;
    4148             :                         }
    4149           0 :                         if (test_var > uint_max) {
    4150           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4151             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4152           0 :                                 return -1;
    4153             :                         }
    4154           0 :                         object->in.seconds = test_var;
    4155             :                 } else {
    4156           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4157             :                           PyLong_Type.tp_name);
    4158           0 :                         return -1;
    4159             :                 }
    4160             :         }
    4161           0 :         return 0;
    4162             : }
    4163             : 
    4164           0 : static PyObject *py_echo_TestSleep_get_result(PyObject *obj, void *closure)
    4165             : {
    4166           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(obj);
    4167             :         PyObject *py_result;
    4168           0 :         py_result = PyLong_FromUnsignedLongLong((uint32_t)object->out.result);
    4169           0 :         return py_result;
    4170             : }
    4171             : 
    4172           0 : static int py_echo_TestSleep_set_result(PyObject *py_obj, PyObject *value, void *closure)
    4173             : {
    4174           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(py_obj);
    4175           0 :         if (value == NULL) {
    4176           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    4177           0 :                 return -1;
    4178             :         }
    4179             :         {
    4180           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.result));
    4181           0 :                 if (PyLong_Check(value)) {
    4182             :                         unsigned long long test_var;
    4183           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4184           0 :                         if (PyErr_Occurred() != NULL) {
    4185           0 :                                 return -1;
    4186             :                         }
    4187           0 :                         if (test_var > uint_max) {
    4188           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4189             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4190           0 :                                 return -1;
    4191             :                         }
    4192           0 :                         object->out.result = test_var;
    4193             :                 } else {
    4194           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4195             :                           PyLong_Type.tp_name);
    4196           0 :                         return -1;
    4197             :                 }
    4198             :         }
    4199           0 :         return 0;
    4200             : }
    4201             : 
    4202             : static PyGetSetDef py_echo_TestSleep_getsetters[] = {
    4203             :         {
    4204             :                 .name = discard_const_p(char, "in_seconds"),
    4205             :                 .get = py_echo_TestSleep_in_get_seconds,
    4206             :                 .set = py_echo_TestSleep_in_set_seconds,
    4207             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4208             :         },
    4209             :         {
    4210             :                 .name = discard_const_p(char, "result"),
    4211             :                 .get = py_echo_TestSleep_get_result,
    4212             :                 .set = py_echo_TestSleep_set_result,
    4213             :                 .doc = discard_const_p(char, "PIDL-generated element of type uint32")
    4214             :         },
    4215             :         { .name = NULL }
    4216             : };
    4217             : 
    4218           0 : static PyObject *py_echo_TestSleep_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4219             : {
    4220           0 :         PyObject *self = pytalloc_new(struct echo_TestSleep, type);
    4221           0 :         return self;
    4222             : }
    4223             : 
    4224           0 : static PyObject *py_echo_TestSleep_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    4225             : {
    4226             : 
    4227             : 
    4228           0 :         return PyLong_FromLong(6);
    4229             : }
    4230             : 
    4231           0 : static PyObject *py_echo_TestSleep_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    4232             : {
    4233           0 :         const struct ndr_interface_call *call = NULL;
    4234           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(py_obj);
    4235           0 :         PyObject *ret = NULL;
    4236           0 :         struct ndr_push *push = NULL;
    4237             :         DATA_BLOB blob;
    4238             :         enum ndr_err_code err;
    4239             : 
    4240           0 :         if (ndr_table_rpcecho.num_calls < 7) {
    4241           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSleep_ndr_pack");
    4242           0 :                 return NULL;
    4243             :         }
    4244           0 :         call = &ndr_table_rpcecho.calls[6];
    4245             : 
    4246           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    4247           0 :         if (push == NULL) {
    4248           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4249           0 :                 return NULL;
    4250             :         }
    4251             : 
    4252           0 :         push->flags |= ndr_push_flags;
    4253             : 
    4254           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    4255           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4256           0 :                 TALLOC_FREE(push);
    4257           0 :                 PyErr_SetNdrError(err);
    4258           0 :                 return NULL;
    4259             :         }
    4260           0 :         blob = ndr_push_blob(push);
    4261           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4262           0 :         TALLOC_FREE(push);
    4263           0 :         return ret;
    4264             : }
    4265             : 
    4266           0 : static PyObject *py_echo_TestSleep_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4267             : {
    4268           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    4269           0 :         PyObject *bigendian_obj = NULL;
    4270           0 :         PyObject *ndr64_obj = NULL;
    4271           0 :         uint32_t ndr_push_flags = 0;
    4272             : 
    4273           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    4274             :                 discard_const_p(char *, kwnames),
    4275             :                 &bigendian_obj,
    4276             :                 &ndr64_obj)) {
    4277           0 :                 return NULL;
    4278             :         }
    4279             : 
    4280           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4281           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    4282             :         }
    4283           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4284           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    4285             :         }
    4286             : 
    4287           0 :         return py_echo_TestSleep_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    4288             : }
    4289             : 
    4290           0 : static PyObject *py_echo_TestSleep_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4291             : {
    4292           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    4293           0 :         PyObject *bigendian_obj = NULL;
    4294           0 :         PyObject *ndr64_obj = NULL;
    4295           0 :         uint32_t ndr_push_flags = 0;
    4296             : 
    4297           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    4298             :                 discard_const_p(char *, kwnames),
    4299             :                 &bigendian_obj,
    4300             :                 &ndr64_obj)) {
    4301           0 :                 return NULL;
    4302             :         }
    4303             : 
    4304           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4305           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    4306             :         }
    4307           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4308           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    4309             :         }
    4310             : 
    4311           0 :         return py_echo_TestSleep_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    4312             : }
    4313             : 
    4314           0 : static PyObject *py_echo_TestSleep_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    4315             : {
    4316           0 :         const struct ndr_interface_call *call = NULL;
    4317           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(py_obj);
    4318           0 :         struct ndr_pull *pull = NULL;
    4319             :         enum ndr_err_code err;
    4320             : 
    4321           0 :         if (ndr_table_rpcecho.num_calls < 7) {
    4322           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSleep_ndr_unpack");
    4323           0 :                 return NULL;
    4324             :         }
    4325           0 :         call = &ndr_table_rpcecho.calls[6];
    4326             : 
    4327           0 :         pull = ndr_pull_init_blob(blob, object);
    4328           0 :         if (pull == NULL) {
    4329           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4330           0 :                 return NULL;
    4331             :         }
    4332             : 
    4333           0 :         pull->flags |= ndr_pull_flags;
    4334             : 
    4335           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    4336           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4337           0 :                 TALLOC_FREE(pull);
    4338           0 :                 PyErr_SetNdrError(err);
    4339           0 :                 return NULL;
    4340             :         }
    4341           0 :         if (!allow_remaining) {
    4342             :                 uint32_t highest_ofs;
    4343             : 
    4344           0 :                 if (pull->offset > pull->relative_highest_offset) {
    4345           0 :                         highest_ofs = pull->offset;
    4346             :                 } else {
    4347           0 :                         highest_ofs = pull->relative_highest_offset;
    4348             :                 }
    4349           0 :                 if (highest_ofs < pull->data_size) {
    4350           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    4351             :                                 "not all bytes consumed ofs[%u] size[%u]",
    4352             :                                 highest_ofs, pull->data_size);
    4353           0 :                         TALLOC_FREE(pull);
    4354           0 :                         PyErr_SetNdrError(err);
    4355           0 :                         return NULL;
    4356             :                 }
    4357             :         }
    4358             : 
    4359           0 :         TALLOC_FREE(pull);
    4360           0 :         Py_RETURN_NONE;
    4361             : }
    4362             : 
    4363           0 : static PyObject *py_echo_TestSleep_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4364             : {
    4365             :         DATA_BLOB blob;
    4366           0 :         Py_ssize_t blob_length = 0;
    4367           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    4368           0 :         PyObject *bigendian_obj = NULL;
    4369           0 :         PyObject *ndr64_obj = NULL;
    4370           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    4371           0 :         PyObject *allow_remaining_obj = NULL;
    4372           0 :         bool allow_remaining = false;
    4373             : 
    4374           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    4375             :                 discard_const_p(char *, kwnames),
    4376             :                 &blob.data, &blob_length,
    4377             :                 &bigendian_obj,
    4378             :                 &ndr64_obj,
    4379             :                 &allow_remaining_obj)) {
    4380           0 :                 return NULL;
    4381             :         }
    4382           0 :         blob.length = blob_length;
    4383             : 
    4384           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4385           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    4386             :         }
    4387           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4388           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    4389             :         }
    4390             : 
    4391           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4392           0 :                 allow_remaining = true;
    4393             :         }
    4394             : 
    4395           0 :         return py_echo_TestSleep_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    4396             : }
    4397             : 
    4398           0 : static PyObject *py_echo_TestSleep_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4399             : {
    4400             :         DATA_BLOB blob;
    4401           0 :         Py_ssize_t blob_length = 0;
    4402           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    4403           0 :         PyObject *bigendian_obj = NULL;
    4404           0 :         PyObject *ndr64_obj = NULL;
    4405           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    4406           0 :         PyObject *allow_remaining_obj = NULL;
    4407           0 :         bool allow_remaining = false;
    4408             : 
    4409           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    4410             :                 discard_const_p(char *, kwnames),
    4411             :                 &blob.data, &blob_length,
    4412             :                 &bigendian_obj,
    4413             :                 &ndr64_obj,
    4414             :                 &allow_remaining_obj)) {
    4415           0 :                 return NULL;
    4416             :         }
    4417           0 :         blob.length = blob_length;
    4418             : 
    4419           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4420           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    4421             :         }
    4422           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4423           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    4424             :         }
    4425             : 
    4426           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4427           0 :                 allow_remaining = true;
    4428             :         }
    4429             : 
    4430           0 :         return py_echo_TestSleep_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    4431             : }
    4432             : 
    4433           0 : static PyObject *py_echo_TestSleep_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    4434             : {
    4435           0 :         const struct ndr_interface_call *call = NULL;
    4436           0 :         struct echo_TestSleep *object = (struct echo_TestSleep *)pytalloc_get_ptr(py_obj);
    4437             :         PyObject *ret;
    4438             :         char *retstr;
    4439             : 
    4440           0 :         if (ndr_table_rpcecho.num_calls < 7) {
    4441           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSleep_ndr_print");
    4442           0 :                 return NULL;
    4443             :         }
    4444           0 :         call = &ndr_table_rpcecho.calls[6];
    4445             : 
    4446           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    4447           0 :         ret = PyUnicode_FromString(retstr);
    4448           0 :         TALLOC_FREE(retstr);
    4449             : 
    4450           0 :         return ret;
    4451             : }
    4452             : 
    4453           0 : static PyObject *py_echo_TestSleep_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4454             : {
    4455           0 :         return py_echo_TestSleep_ndr_print(py_obj, "echo_TestSleep_in", NDR_IN);
    4456             : }
    4457             : 
    4458           0 : static PyObject *py_echo_TestSleep_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4459             : {
    4460           0 :         return py_echo_TestSleep_ndr_print(py_obj, "echo_TestSleep_out", NDR_OUT);
    4461             : }
    4462             : 
    4463             : static PyMethodDef py_echo_TestSleep_methods[] = {
    4464             :         { "opnum", (PyCFunction)py_echo_TestSleep_ndr_opnum, METH_NOARGS|METH_CLASS,
    4465             :                 "echo.TestSleep.opnum() -> 6 (0x06) " },
    4466             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSleep_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    4467             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    4468             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSleep_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    4469             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    4470             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSleep_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    4471             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    4472             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSleep_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    4473             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    4474             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestSleep_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    4475             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestSleep_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    4476             :         { NULL, NULL, 0, NULL }
    4477             : };
    4478             : 
    4479             : 
    4480             : static PyTypeObject echo_TestSleep_Type = {
    4481             :         PyVarObject_HEAD_INIT(NULL, 0)
    4482             :         .tp_name = "echo.TestSleep",
    4483             :         .tp_getset = py_echo_TestSleep_getsetters,
    4484             :         .tp_methods = py_echo_TestSleep_methods,
    4485             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4486             :         .tp_new = py_echo_TestSleep_new,
    4487             : };
    4488             : 
    4489           0 : static bool pack_py_echo_TestSleep_args_in(PyObject *args, PyObject *kwargs, struct echo_TestSleep *r)
    4490             : {
    4491             :         PyObject *py_seconds;
    4492           0 :         const char *kwnames[] = {
    4493             :                 "seconds", NULL
    4494             :         };
    4495             : 
    4496           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_TestSleep", discard_const_p(char *, kwnames), &py_seconds)) {
    4497           0 :                 return false;
    4498             :         }
    4499             : 
    4500           0 :         if (py_seconds == NULL) {
    4501           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.seconds");
    4502           0 :                 return false;
    4503             :         }
    4504             :         {
    4505           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.seconds));
    4506           0 :                 if (PyLong_Check(py_seconds)) {
    4507             :                         unsigned long long test_var;
    4508           0 :                         test_var = PyLong_AsUnsignedLongLong(py_seconds);
    4509           0 :                         if (PyErr_Occurred() != NULL) {
    4510           0 :                                 return false;
    4511             :                         }
    4512           0 :                         if (test_var > uint_max) {
    4513           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4514             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4515           0 :                                 return false;
    4516             :                         }
    4517           0 :                         r->in.seconds = test_var;
    4518             :                 } else {
    4519           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4520             :                           PyLong_Type.tp_name);
    4521           0 :                         return false;
    4522             :                 }
    4523             :         }
    4524           0 :         return true;
    4525             : }
    4526             : 
    4527           0 : static PyObject *unpack_py_echo_TestSleep_args_out(struct echo_TestSleep *r)
    4528             : {
    4529             :         PyObject *result;
    4530           0 :         result = PyLong_FromUnsignedLongLong((uint32_t)r->out.result);
    4531           0 :         return result;
    4532             : }
    4533             : 
    4534             : 
    4535           0 : static PyObject *py_echo_TestEnum_in_get_foo1(PyObject *obj, void *closure)
    4536             : {
    4537           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4538             :         PyObject *py_foo1;
    4539           0 :         if (object->in.foo1 == NULL) {
    4540           0 :                 Py_RETURN_NONE;
    4541             :         }
    4542           0 :         py_foo1 = PyLong_FromLong((uint16_t)*object->in.foo1);
    4543           0 :         return py_foo1;
    4544             : }
    4545             : 
    4546           0 : static int py_echo_TestEnum_in_set_foo1(PyObject *py_obj, PyObject *value, void *closure)
    4547             : {
    4548           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4549           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.foo1));
    4550           0 :         if (value == NULL) {
    4551           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.foo1");
    4552           0 :                 return -1;
    4553             :         }
    4554           0 :         object->in.foo1 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.foo1);
    4555           0 :         if (object->in.foo1 == NULL) {
    4556           0 :                 PyErr_NoMemory();
    4557           0 :                 return -1;
    4558             :         }
    4559             :         {
    4560           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.foo1));
    4561           0 :                 if (PyLong_Check(value)) {
    4562             :                         unsigned long long test_var;
    4563           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4564           0 :                         if (PyErr_Occurred() != NULL) {
    4565           0 :                                 return -1;
    4566             :                         }
    4567           0 :                         if (test_var > uint_max) {
    4568           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4569             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4570           0 :                                 return -1;
    4571             :                         }
    4572           0 :                         *object->in.foo1 = test_var;
    4573             :                 } else {
    4574           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4575             :                           PyLong_Type.tp_name);
    4576           0 :                         return -1;
    4577             :                 }
    4578             :         }
    4579           0 :         return 0;
    4580             : }
    4581             : 
    4582           0 : static PyObject *py_echo_TestEnum_out_get_foo1(PyObject *obj, void *closure)
    4583             : {
    4584           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4585             :         PyObject *py_foo1;
    4586           0 :         if (object->out.foo1 == NULL) {
    4587           0 :                 Py_RETURN_NONE;
    4588             :         }
    4589           0 :         py_foo1 = PyLong_FromLong((uint16_t)*object->out.foo1);
    4590           0 :         return py_foo1;
    4591             : }
    4592             : 
    4593           0 : static int py_echo_TestEnum_out_set_foo1(PyObject *py_obj, PyObject *value, void *closure)
    4594             : {
    4595           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4596           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.foo1));
    4597           0 :         if (value == NULL) {
    4598           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.foo1");
    4599           0 :                 return -1;
    4600             :         }
    4601           0 :         object->out.foo1 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.foo1);
    4602           0 :         if (object->out.foo1 == NULL) {
    4603           0 :                 PyErr_NoMemory();
    4604           0 :                 return -1;
    4605             :         }
    4606             :         {
    4607           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.foo1));
    4608           0 :                 if (PyLong_Check(value)) {
    4609             :                         unsigned long long test_var;
    4610           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4611           0 :                         if (PyErr_Occurred() != NULL) {
    4612           0 :                                 return -1;
    4613             :                         }
    4614           0 :                         if (test_var > uint_max) {
    4615           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4616             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4617           0 :                                 return -1;
    4618             :                         }
    4619           0 :                         *object->out.foo1 = test_var;
    4620             :                 } else {
    4621           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4622             :                           PyLong_Type.tp_name);
    4623           0 :                         return -1;
    4624             :                 }
    4625             :         }
    4626           0 :         return 0;
    4627             : }
    4628             : 
    4629           0 : static PyObject *py_echo_TestEnum_in_get_foo2(PyObject *obj, void *closure)
    4630             : {
    4631           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4632             :         PyObject *py_foo2;
    4633           0 :         if (object->in.foo2 == NULL) {
    4634           0 :                 Py_RETURN_NONE;
    4635             :         }
    4636           0 :         py_foo2 = pytalloc_reference_ex(&echo_Enum2_Type, object->in.foo2, object->in.foo2);
    4637           0 :         return py_foo2;
    4638             : }
    4639             : 
    4640           0 : static int py_echo_TestEnum_in_set_foo2(PyObject *py_obj, PyObject *value, void *closure)
    4641             : {
    4642           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4643           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.foo2));
    4644           0 :         if (value == NULL) {
    4645           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.foo2");
    4646           0 :                 return -1;
    4647             :         }
    4648           0 :         object->in.foo2 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.foo2);
    4649           0 :         if (object->in.foo2 == NULL) {
    4650           0 :                 PyErr_NoMemory();
    4651           0 :                 return -1;
    4652             :         }
    4653           0 :         PY_CHECK_TYPE(&echo_Enum2_Type, value, return -1;);
    4654           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    4655           0 :                 PyErr_NoMemory();
    4656           0 :                 return -1;
    4657             :         }
    4658           0 :         object->in.foo2 = (struct echo_Enum2 *)pytalloc_get_ptr(value);
    4659           0 :         return 0;
    4660             : }
    4661             : 
    4662           0 : static PyObject *py_echo_TestEnum_out_get_foo2(PyObject *obj, void *closure)
    4663             : {
    4664           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4665             :         PyObject *py_foo2;
    4666           0 :         if (object->out.foo2 == NULL) {
    4667           0 :                 Py_RETURN_NONE;
    4668             :         }
    4669           0 :         py_foo2 = pytalloc_reference_ex(&echo_Enum2_Type, object->out.foo2, object->out.foo2);
    4670           0 :         return py_foo2;
    4671             : }
    4672             : 
    4673           0 : static int py_echo_TestEnum_out_set_foo2(PyObject *py_obj, PyObject *value, void *closure)
    4674             : {
    4675           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4676           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.foo2));
    4677           0 :         if (value == NULL) {
    4678           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.foo2");
    4679           0 :                 return -1;
    4680             :         }
    4681           0 :         object->out.foo2 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.foo2);
    4682           0 :         if (object->out.foo2 == NULL) {
    4683           0 :                 PyErr_NoMemory();
    4684           0 :                 return -1;
    4685             :         }
    4686           0 :         PY_CHECK_TYPE(&echo_Enum2_Type, value, return -1;);
    4687           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    4688           0 :                 PyErr_NoMemory();
    4689           0 :                 return -1;
    4690             :         }
    4691           0 :         object->out.foo2 = (struct echo_Enum2 *)pytalloc_get_ptr(value);
    4692           0 :         return 0;
    4693             : }
    4694             : 
    4695           0 : static PyObject *py_echo_TestEnum_in_get_foo3(PyObject *obj, void *closure)
    4696             : {
    4697           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4698             :         PyObject *py_foo3;
    4699           0 :         if (object->in.foo3 == NULL) {
    4700           0 :                 Py_RETURN_NONE;
    4701             :         }
    4702           0 :         py_foo3 = pyrpc_import_union(&echo_Enum3_Type, object->in.foo3, *object->in.foo1, object->in.foo3, "union echo_Enum3");
    4703           0 :         if (py_foo3 == NULL) {
    4704           0 :                 return NULL;
    4705             :         }
    4706           0 :         return py_foo3;
    4707             : }
    4708             : 
    4709           0 : static int py_echo_TestEnum_in_set_foo3(PyObject *py_obj, PyObject *value, void *closure)
    4710             : {
    4711           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4712           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.foo3));
    4713           0 :         if (value == NULL) {
    4714           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.foo3");
    4715           0 :                 return -1;
    4716             :         }
    4717           0 :         object->in.foo3 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.foo3);
    4718           0 :         if (object->in.foo3 == NULL) {
    4719           0 :                 PyErr_NoMemory();
    4720           0 :                 return -1;
    4721             :         }
    4722             :         {
    4723             :                 union echo_Enum3 *foo3_switch_1;
    4724           0 :                 foo3_switch_1 = (union echo_Enum3 *)pyrpc_export_union(&echo_Enum3_Type, pytalloc_get_mem_ctx(py_obj), *object->in.foo1, value, "union echo_Enum3");
    4725           0 :                 if (foo3_switch_1 == NULL) {
    4726           0 :                         return -1;
    4727             :                 }
    4728           0 :                 object->in.foo3 = foo3_switch_1;
    4729             :         }
    4730           0 :         return 0;
    4731             : }
    4732             : 
    4733           0 : static PyObject *py_echo_TestEnum_out_get_foo3(PyObject *obj, void *closure)
    4734             : {
    4735           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(obj);
    4736             :         PyObject *py_foo3;
    4737           0 :         if (object->out.foo3 == NULL) {
    4738           0 :                 Py_RETURN_NONE;
    4739             :         }
    4740           0 :         py_foo3 = pyrpc_import_union(&echo_Enum3_Type, object->out.foo3, *object->out.foo1, object->out.foo3, "union echo_Enum3");
    4741           0 :         if (py_foo3 == NULL) {
    4742           0 :                 return NULL;
    4743             :         }
    4744           0 :         return py_foo3;
    4745             : }
    4746             : 
    4747           0 : static int py_echo_TestEnum_out_set_foo3(PyObject *py_obj, PyObject *value, void *closure)
    4748             : {
    4749           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4750           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.foo3));
    4751           0 :         if (value == NULL) {
    4752           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.foo3");
    4753           0 :                 return -1;
    4754             :         }
    4755           0 :         object->out.foo3 = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.foo3);
    4756           0 :         if (object->out.foo3 == NULL) {
    4757           0 :                 PyErr_NoMemory();
    4758           0 :                 return -1;
    4759             :         }
    4760             :         {
    4761             :                 union echo_Enum3 *foo3_switch_1;
    4762           0 :                 foo3_switch_1 = (union echo_Enum3 *)pyrpc_export_union(&echo_Enum3_Type, pytalloc_get_mem_ctx(py_obj), *object->out.foo1, value, "union echo_Enum3");
    4763           0 :                 if (foo3_switch_1 == NULL) {
    4764           0 :                         return -1;
    4765             :                 }
    4766           0 :                 object->out.foo3 = foo3_switch_1;
    4767             :         }
    4768           0 :         return 0;
    4769             : }
    4770             : 
    4771             : static PyGetSetDef py_echo_TestEnum_getsetters[] = {
    4772             :         {
    4773             :                 .name = discard_const_p(char, "in_foo1"),
    4774             :                 .get = py_echo_TestEnum_in_get_foo1,
    4775             :                 .set = py_echo_TestEnum_in_set_foo1,
    4776             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum1")
    4777             :         },
    4778             :         {
    4779             :                 .name = discard_const_p(char, "out_foo1"),
    4780             :                 .get = py_echo_TestEnum_out_get_foo1,
    4781             :                 .set = py_echo_TestEnum_out_set_foo1,
    4782             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum1")
    4783             :         },
    4784             :         {
    4785             :                 .name = discard_const_p(char, "in_foo2"),
    4786             :                 .get = py_echo_TestEnum_in_get_foo2,
    4787             :                 .set = py_echo_TestEnum_in_set_foo2,
    4788             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum2")
    4789             :         },
    4790             :         {
    4791             :                 .name = discard_const_p(char, "out_foo2"),
    4792             :                 .get = py_echo_TestEnum_out_get_foo2,
    4793             :                 .set = py_echo_TestEnum_out_set_foo2,
    4794             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum2")
    4795             :         },
    4796             :         {
    4797             :                 .name = discard_const_p(char, "in_foo3"),
    4798             :                 .get = py_echo_TestEnum_in_get_foo3,
    4799             :                 .set = py_echo_TestEnum_in_set_foo3,
    4800             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum3")
    4801             :         },
    4802             :         {
    4803             :                 .name = discard_const_p(char, "out_foo3"),
    4804             :                 .get = py_echo_TestEnum_out_get_foo3,
    4805             :                 .set = py_echo_TestEnum_out_set_foo3,
    4806             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Enum3")
    4807             :         },
    4808             :         { .name = NULL }
    4809             : };
    4810             : 
    4811           0 : static PyObject *py_echo_TestEnum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4812             : {
    4813           0 :         PyObject *self = pytalloc_new(struct echo_TestEnum, type);
    4814           0 :         struct echo_TestEnum *_self = (struct echo_TestEnum *)pytalloc_get_ptr(self);
    4815           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    4816           0 :         _self->in.foo1 = talloc_zero(mem_ctx, enum echo_Enum1);
    4817           0 :         _self->out.foo1 = talloc_zero(mem_ctx, enum echo_Enum1);
    4818           0 :         _self->in.foo2 = talloc_zero(mem_ctx, struct echo_Enum2);
    4819           0 :         _self->out.foo2 = talloc_zero(mem_ctx, struct echo_Enum2);
    4820           0 :         _self->in.foo3 = talloc_zero(mem_ctx, union echo_Enum3);
    4821           0 :         _self->out.foo3 = talloc_zero(mem_ctx, union echo_Enum3);
    4822           0 :         return self;
    4823             : }
    4824             : 
    4825           0 : static PyObject *py_echo_TestEnum_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    4826             : {
    4827             : 
    4828             : 
    4829           0 :         return PyLong_FromLong(7);
    4830             : }
    4831             : 
    4832           0 : static PyObject *py_echo_TestEnum_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    4833             : {
    4834           0 :         const struct ndr_interface_call *call = NULL;
    4835           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4836           0 :         PyObject *ret = NULL;
    4837           0 :         struct ndr_push *push = NULL;
    4838             :         DATA_BLOB blob;
    4839             :         enum ndr_err_code err;
    4840             : 
    4841           0 :         if (ndr_table_rpcecho.num_calls < 8) {
    4842           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestEnum_ndr_pack");
    4843           0 :                 return NULL;
    4844             :         }
    4845           0 :         call = &ndr_table_rpcecho.calls[7];
    4846             : 
    4847           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    4848           0 :         if (push == NULL) {
    4849           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4850           0 :                 return NULL;
    4851             :         }
    4852             : 
    4853           0 :         push->flags |= ndr_push_flags;
    4854             : 
    4855           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    4856           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4857           0 :                 TALLOC_FREE(push);
    4858           0 :                 PyErr_SetNdrError(err);
    4859           0 :                 return NULL;
    4860             :         }
    4861           0 :         blob = ndr_push_blob(push);
    4862           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4863           0 :         TALLOC_FREE(push);
    4864           0 :         return ret;
    4865             : }
    4866             : 
    4867           0 : static PyObject *py_echo_TestEnum_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4868             : {
    4869           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    4870           0 :         PyObject *bigendian_obj = NULL;
    4871           0 :         PyObject *ndr64_obj = NULL;
    4872           0 :         uint32_t ndr_push_flags = 0;
    4873             : 
    4874           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    4875             :                 discard_const_p(char *, kwnames),
    4876             :                 &bigendian_obj,
    4877             :                 &ndr64_obj)) {
    4878           0 :                 return NULL;
    4879             :         }
    4880             : 
    4881           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4882           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    4883             :         }
    4884           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4885           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    4886             :         }
    4887             : 
    4888           0 :         return py_echo_TestEnum_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    4889             : }
    4890             : 
    4891           0 : static PyObject *py_echo_TestEnum_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4892             : {
    4893           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    4894           0 :         PyObject *bigendian_obj = NULL;
    4895           0 :         PyObject *ndr64_obj = NULL;
    4896           0 :         uint32_t ndr_push_flags = 0;
    4897             : 
    4898           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    4899             :                 discard_const_p(char *, kwnames),
    4900             :                 &bigendian_obj,
    4901             :                 &ndr64_obj)) {
    4902           0 :                 return NULL;
    4903             :         }
    4904             : 
    4905           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4906           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    4907             :         }
    4908           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4909           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    4910             :         }
    4911             : 
    4912           0 :         return py_echo_TestEnum_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    4913             : }
    4914             : 
    4915           0 : static PyObject *py_echo_TestEnum_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    4916             : {
    4917           0 :         const struct ndr_interface_call *call = NULL;
    4918           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    4919           0 :         struct ndr_pull *pull = NULL;
    4920             :         enum ndr_err_code err;
    4921             : 
    4922           0 :         if (ndr_table_rpcecho.num_calls < 8) {
    4923           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestEnum_ndr_unpack");
    4924           0 :                 return NULL;
    4925             :         }
    4926           0 :         call = &ndr_table_rpcecho.calls[7];
    4927             : 
    4928           0 :         pull = ndr_pull_init_blob(blob, object);
    4929           0 :         if (pull == NULL) {
    4930           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4931           0 :                 return NULL;
    4932             :         }
    4933             : 
    4934           0 :         pull->flags |= ndr_pull_flags;
    4935             : 
    4936           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    4937           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4938           0 :                 TALLOC_FREE(pull);
    4939           0 :                 PyErr_SetNdrError(err);
    4940           0 :                 return NULL;
    4941             :         }
    4942           0 :         if (!allow_remaining) {
    4943             :                 uint32_t highest_ofs;
    4944             : 
    4945           0 :                 if (pull->offset > pull->relative_highest_offset) {
    4946           0 :                         highest_ofs = pull->offset;
    4947             :                 } else {
    4948           0 :                         highest_ofs = pull->relative_highest_offset;
    4949             :                 }
    4950           0 :                 if (highest_ofs < pull->data_size) {
    4951           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    4952             :                                 "not all bytes consumed ofs[%u] size[%u]",
    4953             :                                 highest_ofs, pull->data_size);
    4954           0 :                         TALLOC_FREE(pull);
    4955           0 :                         PyErr_SetNdrError(err);
    4956           0 :                         return NULL;
    4957             :                 }
    4958             :         }
    4959             : 
    4960           0 :         TALLOC_FREE(pull);
    4961           0 :         Py_RETURN_NONE;
    4962             : }
    4963             : 
    4964           0 : static PyObject *py_echo_TestEnum_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4965             : {
    4966             :         DATA_BLOB blob;
    4967           0 :         Py_ssize_t blob_length = 0;
    4968           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    4969           0 :         PyObject *bigendian_obj = NULL;
    4970           0 :         PyObject *ndr64_obj = NULL;
    4971           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    4972           0 :         PyObject *allow_remaining_obj = NULL;
    4973           0 :         bool allow_remaining = false;
    4974             : 
    4975           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    4976             :                 discard_const_p(char *, kwnames),
    4977             :                 &blob.data, &blob_length,
    4978             :                 &bigendian_obj,
    4979             :                 &ndr64_obj,
    4980             :                 &allow_remaining_obj)) {
    4981           0 :                 return NULL;
    4982             :         }
    4983           0 :         blob.length = blob_length;
    4984             : 
    4985           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    4986           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    4987             :         }
    4988           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    4989           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    4990             :         }
    4991             : 
    4992           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4993           0 :                 allow_remaining = true;
    4994             :         }
    4995             : 
    4996           0 :         return py_echo_TestEnum_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    4997             : }
    4998             : 
    4999           0 : static PyObject *py_echo_TestEnum_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5000             : {
    5001             :         DATA_BLOB blob;
    5002           0 :         Py_ssize_t blob_length = 0;
    5003           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    5004           0 :         PyObject *bigendian_obj = NULL;
    5005           0 :         PyObject *ndr64_obj = NULL;
    5006           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    5007           0 :         PyObject *allow_remaining_obj = NULL;
    5008           0 :         bool allow_remaining = false;
    5009             : 
    5010           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    5011             :                 discard_const_p(char *, kwnames),
    5012             :                 &blob.data, &blob_length,
    5013             :                 &bigendian_obj,
    5014             :                 &ndr64_obj,
    5015             :                 &allow_remaining_obj)) {
    5016           0 :                 return NULL;
    5017             :         }
    5018           0 :         blob.length = blob_length;
    5019             : 
    5020           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5021           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    5022             :         }
    5023           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5024           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    5025             :         }
    5026             : 
    5027           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    5028           0 :                 allow_remaining = true;
    5029             :         }
    5030             : 
    5031           0 :         return py_echo_TestEnum_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    5032             : }
    5033             : 
    5034           0 : static PyObject *py_echo_TestEnum_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    5035             : {
    5036           0 :         const struct ndr_interface_call *call = NULL;
    5037           0 :         struct echo_TestEnum *object = (struct echo_TestEnum *)pytalloc_get_ptr(py_obj);
    5038             :         PyObject *ret;
    5039             :         char *retstr;
    5040             : 
    5041           0 :         if (ndr_table_rpcecho.num_calls < 8) {
    5042           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestEnum_ndr_print");
    5043           0 :                 return NULL;
    5044             :         }
    5045           0 :         call = &ndr_table_rpcecho.calls[7];
    5046             : 
    5047           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    5048           0 :         ret = PyUnicode_FromString(retstr);
    5049           0 :         TALLOC_FREE(retstr);
    5050             : 
    5051           0 :         return ret;
    5052             : }
    5053             : 
    5054           0 : static PyObject *py_echo_TestEnum_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5055             : {
    5056           0 :         return py_echo_TestEnum_ndr_print(py_obj, "echo_TestEnum_in", NDR_IN);
    5057             : }
    5058             : 
    5059           0 : static PyObject *py_echo_TestEnum_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5060             : {
    5061           0 :         return py_echo_TestEnum_ndr_print(py_obj, "echo_TestEnum_out", NDR_OUT);
    5062             : }
    5063             : 
    5064             : static PyMethodDef py_echo_TestEnum_methods[] = {
    5065             :         { "opnum", (PyCFunction)py_echo_TestEnum_ndr_opnum, METH_NOARGS|METH_CLASS,
    5066             :                 "echo.TestEnum.opnum() -> 7 (0x07) " },
    5067             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestEnum_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    5068             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    5069             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestEnum_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    5070             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    5071             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestEnum_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    5072             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    5073             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestEnum_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    5074             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    5075             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestEnum_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    5076             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestEnum_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    5077             :         { NULL, NULL, 0, NULL }
    5078             : };
    5079             : 
    5080             : 
    5081             : static PyTypeObject echo_TestEnum_Type = {
    5082             :         PyVarObject_HEAD_INIT(NULL, 0)
    5083             :         .tp_name = "echo.TestEnum",
    5084             :         .tp_getset = py_echo_TestEnum_getsetters,
    5085             :         .tp_methods = py_echo_TestEnum_methods,
    5086             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    5087             :         .tp_new = py_echo_TestEnum_new,
    5088             : };
    5089             : 
    5090           0 : static bool pack_py_echo_TestEnum_args_in(PyObject *args, PyObject *kwargs, struct echo_TestEnum *r)
    5091             : {
    5092             :         PyObject *py_foo1;
    5093             :         PyObject *py_foo2;
    5094             :         PyObject *py_foo3;
    5095           0 :         const char *kwnames[] = {
    5096             :                 "foo1", "foo2", "foo3", NULL
    5097             :         };
    5098             : 
    5099           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:echo_TestEnum", discard_const_p(char *, kwnames), &py_foo1, &py_foo2, &py_foo3)) {
    5100           0 :                 return false;
    5101             :         }
    5102             : 
    5103           0 :         if (py_foo1 == NULL) {
    5104           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.foo1");
    5105           0 :                 return false;
    5106             :         }
    5107           0 :         r->in.foo1 = talloc_ptrtype(r, r->in.foo1);
    5108           0 :         if (r->in.foo1 == NULL) {
    5109           0 :                 PyErr_NoMemory();
    5110           0 :                 return false;
    5111             :         }
    5112             :         {
    5113           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.foo1));
    5114           0 :                 if (PyLong_Check(py_foo1)) {
    5115             :                         unsigned long long test_var;
    5116           0 :                         test_var = PyLong_AsUnsignedLongLong(py_foo1);
    5117           0 :                         if (PyErr_Occurred() != NULL) {
    5118           0 :                                 return false;
    5119             :                         }
    5120           0 :                         if (test_var > uint_max) {
    5121           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    5122             :                                   PyLong_Type.tp_name, uint_max, test_var);
    5123           0 :                                 return false;
    5124             :                         }
    5125           0 :                         *r->in.foo1 = test_var;
    5126             :                 } else {
    5127           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    5128             :                           PyLong_Type.tp_name);
    5129           0 :                         return false;
    5130             :                 }
    5131             :         }
    5132           0 :         if (py_foo2 == NULL) {
    5133           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.foo2");
    5134           0 :                 return false;
    5135             :         }
    5136           0 :         r->in.foo2 = talloc_ptrtype(r, r->in.foo2);
    5137           0 :         if (r->in.foo2 == NULL) {
    5138           0 :                 PyErr_NoMemory();
    5139           0 :                 return false;
    5140             :         }
    5141           0 :         PY_CHECK_TYPE(&echo_Enum2_Type, py_foo2, return false;);
    5142           0 :         if (talloc_reference(r, pytalloc_get_mem_ctx(py_foo2)) == NULL) {
    5143           0 :                 PyErr_NoMemory();
    5144           0 :                 return false;
    5145             :         }
    5146           0 :         r->in.foo2 = (struct echo_Enum2 *)pytalloc_get_ptr(py_foo2);
    5147           0 :         if (py_foo3 == NULL) {
    5148           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.foo3");
    5149           0 :                 return false;
    5150             :         }
    5151           0 :         r->in.foo3 = talloc_ptrtype(r, r->in.foo3);
    5152           0 :         if (r->in.foo3 == NULL) {
    5153           0 :                 PyErr_NoMemory();
    5154           0 :                 return false;
    5155             :         }
    5156             :         {
    5157             :                 union echo_Enum3 *foo3_switch_1;
    5158           0 :                 foo3_switch_1 = (union echo_Enum3 *)pyrpc_export_union(&echo_Enum3_Type, r, *r->in.foo1, py_foo3, "union echo_Enum3");
    5159           0 :                 if (foo3_switch_1 == NULL) {
    5160           0 :                         return false;
    5161             :                 }
    5162           0 :                 r->in.foo3 = foo3_switch_1;
    5163             :         }
    5164           0 :         return true;
    5165             : }
    5166             : 
    5167           0 : static PyObject *unpack_py_echo_TestEnum_args_out(struct echo_TestEnum *r)
    5168             : {
    5169             :         PyObject *result;
    5170             :         PyObject *py_foo1;
    5171             :         PyObject *py_foo2;
    5172             :         PyObject *py_foo3;
    5173           0 :         result = PyTuple_New(3);
    5174           0 :         py_foo1 = PyLong_FromLong((uint16_t)*r->out.foo1);
    5175           0 :         PyTuple_SetItem(result, 0, py_foo1);
    5176           0 :         py_foo2 = pytalloc_reference_ex(&echo_Enum2_Type, r->out.foo2, r->out.foo2);
    5177           0 :         PyTuple_SetItem(result, 1, py_foo2);
    5178           0 :         py_foo3 = pyrpc_import_union(&echo_Enum3_Type, r->out.foo3, *r->out.foo1, r->out.foo3, "union echo_Enum3");
    5179           0 :         if (py_foo3 == NULL) {
    5180           0 :                 return NULL;
    5181             :         }
    5182           0 :         PyTuple_SetItem(result, 2, py_foo3);
    5183           0 :         return result;
    5184             : }
    5185             : 
    5186             : 
    5187           0 : static PyObject *py_echo_TestSurrounding_in_get_data(PyObject *obj, void *closure)
    5188             : {
    5189           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(obj);
    5190             :         PyObject *py_data;
    5191           0 :         if (object->in.data == NULL) {
    5192           0 :                 Py_RETURN_NONE;
    5193             :         }
    5194           0 :         py_data = pytalloc_reference_ex(&echo_Surrounding_Type, object->in.data, object->in.data);
    5195           0 :         return py_data;
    5196             : }
    5197             : 
    5198           0 : static int py_echo_TestSurrounding_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
    5199             : {
    5200           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(py_obj);
    5201           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
    5202           0 :         if (value == NULL) {
    5203           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data");
    5204           0 :                 return -1;
    5205             :         }
    5206           0 :         object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data);
    5207           0 :         if (object->in.data == NULL) {
    5208           0 :                 PyErr_NoMemory();
    5209           0 :                 return -1;
    5210             :         }
    5211           0 :         PY_CHECK_TYPE(&echo_Surrounding_Type, value, return -1;);
    5212           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    5213           0 :                 PyErr_NoMemory();
    5214           0 :                 return -1;
    5215             :         }
    5216           0 :         object->in.data = (struct echo_Surrounding *)pytalloc_get_ptr(value);
    5217           0 :         return 0;
    5218             : }
    5219             : 
    5220           0 : static PyObject *py_echo_TestSurrounding_out_get_data(PyObject *obj, void *closure)
    5221             : {
    5222           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(obj);
    5223             :         PyObject *py_data;
    5224           0 :         if (object->out.data == NULL) {
    5225           0 :                 Py_RETURN_NONE;
    5226             :         }
    5227           0 :         py_data = pytalloc_reference_ex(&echo_Surrounding_Type, object->out.data, object->out.data);
    5228           0 :         return py_data;
    5229             : }
    5230             : 
    5231           0 : static int py_echo_TestSurrounding_out_set_data(PyObject *py_obj, PyObject *value, void *closure)
    5232             : {
    5233           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(py_obj);
    5234           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data));
    5235           0 :         if (value == NULL) {
    5236           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data");
    5237           0 :                 return -1;
    5238             :         }
    5239           0 :         object->out.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data);
    5240           0 :         if (object->out.data == NULL) {
    5241           0 :                 PyErr_NoMemory();
    5242           0 :                 return -1;
    5243             :         }
    5244           0 :         PY_CHECK_TYPE(&echo_Surrounding_Type, value, return -1;);
    5245           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    5246           0 :                 PyErr_NoMemory();
    5247           0 :                 return -1;
    5248             :         }
    5249           0 :         object->out.data = (struct echo_Surrounding *)pytalloc_get_ptr(value);
    5250           0 :         return 0;
    5251             : }
    5252             : 
    5253             : static PyGetSetDef py_echo_TestSurrounding_getsetters[] = {
    5254             :         {
    5255             :                 .name = discard_const_p(char, "in_data"),
    5256             :                 .get = py_echo_TestSurrounding_in_get_data,
    5257             :                 .set = py_echo_TestSurrounding_in_set_data,
    5258             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Surrounding")
    5259             :         },
    5260             :         {
    5261             :                 .name = discard_const_p(char, "out_data"),
    5262             :                 .get = py_echo_TestSurrounding_out_get_data,
    5263             :                 .set = py_echo_TestSurrounding_out_set_data,
    5264             :                 .doc = discard_const_p(char, "PIDL-generated element of base type echo_Surrounding")
    5265             :         },
    5266             :         { .name = NULL }
    5267             : };
    5268             : 
    5269           0 : static PyObject *py_echo_TestSurrounding_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    5270             : {
    5271           0 :         PyObject *self = pytalloc_new(struct echo_TestSurrounding, type);
    5272           0 :         struct echo_TestSurrounding *_self = (struct echo_TestSurrounding *)pytalloc_get_ptr(self);
    5273           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    5274           0 :         _self->in.data = talloc_zero(mem_ctx, struct echo_Surrounding);
    5275           0 :         _self->out.data = talloc_zero(mem_ctx, struct echo_Surrounding);
    5276           0 :         return self;
    5277             : }
    5278             : 
    5279           0 : static PyObject *py_echo_TestSurrounding_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    5280             : {
    5281             : 
    5282             : 
    5283           0 :         return PyLong_FromLong(8);
    5284             : }
    5285             : 
    5286           0 : static PyObject *py_echo_TestSurrounding_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    5287             : {
    5288           0 :         const struct ndr_interface_call *call = NULL;
    5289           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(py_obj);
    5290           0 :         PyObject *ret = NULL;
    5291           0 :         struct ndr_push *push = NULL;
    5292             :         DATA_BLOB blob;
    5293             :         enum ndr_err_code err;
    5294             : 
    5295           0 :         if (ndr_table_rpcecho.num_calls < 9) {
    5296           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSurrounding_ndr_pack");
    5297           0 :                 return NULL;
    5298             :         }
    5299           0 :         call = &ndr_table_rpcecho.calls[8];
    5300             : 
    5301           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    5302           0 :         if (push == NULL) {
    5303           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    5304           0 :                 return NULL;
    5305             :         }
    5306             : 
    5307           0 :         push->flags |= ndr_push_flags;
    5308             : 
    5309           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    5310           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    5311           0 :                 TALLOC_FREE(push);
    5312           0 :                 PyErr_SetNdrError(err);
    5313           0 :                 return NULL;
    5314             :         }
    5315           0 :         blob = ndr_push_blob(push);
    5316           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    5317           0 :         TALLOC_FREE(push);
    5318           0 :         return ret;
    5319             : }
    5320             : 
    5321           0 : static PyObject *py_echo_TestSurrounding_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5322             : {
    5323           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    5324           0 :         PyObject *bigendian_obj = NULL;
    5325           0 :         PyObject *ndr64_obj = NULL;
    5326           0 :         uint32_t ndr_push_flags = 0;
    5327             : 
    5328           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    5329             :                 discard_const_p(char *, kwnames),
    5330             :                 &bigendian_obj,
    5331             :                 &ndr64_obj)) {
    5332           0 :                 return NULL;
    5333             :         }
    5334             : 
    5335           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5336           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    5337             :         }
    5338           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5339           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    5340             :         }
    5341             : 
    5342           0 :         return py_echo_TestSurrounding_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    5343             : }
    5344             : 
    5345           0 : static PyObject *py_echo_TestSurrounding_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5346             : {
    5347           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    5348           0 :         PyObject *bigendian_obj = NULL;
    5349           0 :         PyObject *ndr64_obj = NULL;
    5350           0 :         uint32_t ndr_push_flags = 0;
    5351             : 
    5352           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    5353             :                 discard_const_p(char *, kwnames),
    5354             :                 &bigendian_obj,
    5355             :                 &ndr64_obj)) {
    5356           0 :                 return NULL;
    5357             :         }
    5358             : 
    5359           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5360           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    5361             :         }
    5362           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5363           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    5364             :         }
    5365             : 
    5366           0 :         return py_echo_TestSurrounding_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    5367             : }
    5368             : 
    5369           0 : static PyObject *py_echo_TestSurrounding_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    5370             : {
    5371           0 :         const struct ndr_interface_call *call = NULL;
    5372           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(py_obj);
    5373           0 :         struct ndr_pull *pull = NULL;
    5374             :         enum ndr_err_code err;
    5375             : 
    5376           0 :         if (ndr_table_rpcecho.num_calls < 9) {
    5377           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSurrounding_ndr_unpack");
    5378           0 :                 return NULL;
    5379             :         }
    5380           0 :         call = &ndr_table_rpcecho.calls[8];
    5381             : 
    5382           0 :         pull = ndr_pull_init_blob(blob, object);
    5383           0 :         if (pull == NULL) {
    5384           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    5385           0 :                 return NULL;
    5386             :         }
    5387             : 
    5388           0 :         pull->flags |= ndr_pull_flags;
    5389             : 
    5390           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    5391           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    5392           0 :                 TALLOC_FREE(pull);
    5393           0 :                 PyErr_SetNdrError(err);
    5394           0 :                 return NULL;
    5395             :         }
    5396           0 :         if (!allow_remaining) {
    5397             :                 uint32_t highest_ofs;
    5398             : 
    5399           0 :                 if (pull->offset > pull->relative_highest_offset) {
    5400           0 :                         highest_ofs = pull->offset;
    5401             :                 } else {
    5402           0 :                         highest_ofs = pull->relative_highest_offset;
    5403             :                 }
    5404           0 :                 if (highest_ofs < pull->data_size) {
    5405           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    5406             :                                 "not all bytes consumed ofs[%u] size[%u]",
    5407             :                                 highest_ofs, pull->data_size);
    5408           0 :                         TALLOC_FREE(pull);
    5409           0 :                         PyErr_SetNdrError(err);
    5410           0 :                         return NULL;
    5411             :                 }
    5412             :         }
    5413             : 
    5414           0 :         TALLOC_FREE(pull);
    5415           0 :         Py_RETURN_NONE;
    5416             : }
    5417             : 
    5418           0 : static PyObject *py_echo_TestSurrounding_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5419             : {
    5420             :         DATA_BLOB blob;
    5421           0 :         Py_ssize_t blob_length = 0;
    5422           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    5423           0 :         PyObject *bigendian_obj = NULL;
    5424           0 :         PyObject *ndr64_obj = NULL;
    5425           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    5426           0 :         PyObject *allow_remaining_obj = NULL;
    5427           0 :         bool allow_remaining = false;
    5428             : 
    5429           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    5430             :                 discard_const_p(char *, kwnames),
    5431             :                 &blob.data, &blob_length,
    5432             :                 &bigendian_obj,
    5433             :                 &ndr64_obj,
    5434             :                 &allow_remaining_obj)) {
    5435           0 :                 return NULL;
    5436             :         }
    5437           0 :         blob.length = blob_length;
    5438             : 
    5439           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5440           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    5441             :         }
    5442           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5443           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    5444             :         }
    5445             : 
    5446           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    5447           0 :                 allow_remaining = true;
    5448             :         }
    5449             : 
    5450           0 :         return py_echo_TestSurrounding_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    5451             : }
    5452             : 
    5453           0 : static PyObject *py_echo_TestSurrounding_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5454             : {
    5455             :         DATA_BLOB blob;
    5456           0 :         Py_ssize_t blob_length = 0;
    5457           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    5458           0 :         PyObject *bigendian_obj = NULL;
    5459           0 :         PyObject *ndr64_obj = NULL;
    5460           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    5461           0 :         PyObject *allow_remaining_obj = NULL;
    5462           0 :         bool allow_remaining = false;
    5463             : 
    5464           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    5465             :                 discard_const_p(char *, kwnames),
    5466             :                 &blob.data, &blob_length,
    5467             :                 &bigendian_obj,
    5468             :                 &ndr64_obj,
    5469             :                 &allow_remaining_obj)) {
    5470           0 :                 return NULL;
    5471             :         }
    5472           0 :         blob.length = blob_length;
    5473             : 
    5474           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5475           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    5476             :         }
    5477           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5478           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    5479             :         }
    5480             : 
    5481           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    5482           0 :                 allow_remaining = true;
    5483             :         }
    5484             : 
    5485           0 :         return py_echo_TestSurrounding_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    5486             : }
    5487             : 
    5488           0 : static PyObject *py_echo_TestSurrounding_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    5489             : {
    5490           0 :         const struct ndr_interface_call *call = NULL;
    5491           0 :         struct echo_TestSurrounding *object = (struct echo_TestSurrounding *)pytalloc_get_ptr(py_obj);
    5492             :         PyObject *ret;
    5493             :         char *retstr;
    5494             : 
    5495           0 :         if (ndr_table_rpcecho.num_calls < 9) {
    5496           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestSurrounding_ndr_print");
    5497           0 :                 return NULL;
    5498             :         }
    5499           0 :         call = &ndr_table_rpcecho.calls[8];
    5500             : 
    5501           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    5502           0 :         ret = PyUnicode_FromString(retstr);
    5503           0 :         TALLOC_FREE(retstr);
    5504             : 
    5505           0 :         return ret;
    5506             : }
    5507             : 
    5508           0 : static PyObject *py_echo_TestSurrounding_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5509             : {
    5510           0 :         return py_echo_TestSurrounding_ndr_print(py_obj, "echo_TestSurrounding_in", NDR_IN);
    5511             : }
    5512             : 
    5513           0 : static PyObject *py_echo_TestSurrounding_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5514             : {
    5515           0 :         return py_echo_TestSurrounding_ndr_print(py_obj, "echo_TestSurrounding_out", NDR_OUT);
    5516             : }
    5517             : 
    5518             : static PyMethodDef py_echo_TestSurrounding_methods[] = {
    5519             :         { "opnum", (PyCFunction)py_echo_TestSurrounding_ndr_opnum, METH_NOARGS|METH_CLASS,
    5520             :                 "echo.TestSurrounding.opnum() -> 8 (0x08) " },
    5521             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSurrounding_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    5522             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    5523             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSurrounding_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    5524             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    5525             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSurrounding_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    5526             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    5527             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestSurrounding_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    5528             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    5529             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestSurrounding_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    5530             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestSurrounding_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    5531             :         { NULL, NULL, 0, NULL }
    5532             : };
    5533             : 
    5534             : 
    5535             : static PyTypeObject echo_TestSurrounding_Type = {
    5536             :         PyVarObject_HEAD_INIT(NULL, 0)
    5537             :         .tp_name = "echo.TestSurrounding",
    5538             :         .tp_getset = py_echo_TestSurrounding_getsetters,
    5539             :         .tp_methods = py_echo_TestSurrounding_methods,
    5540             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    5541             :         .tp_new = py_echo_TestSurrounding_new,
    5542             : };
    5543             : 
    5544           1 : static bool pack_py_echo_TestSurrounding_args_in(PyObject *args, PyObject *kwargs, struct echo_TestSurrounding *r)
    5545             : {
    5546             :         PyObject *py_data;
    5547           1 :         const char *kwnames[] = {
    5548             :                 "data", NULL
    5549             :         };
    5550             : 
    5551           1 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_TestSurrounding", discard_const_p(char *, kwnames), &py_data)) {
    5552           0 :                 return false;
    5553             :         }
    5554             : 
    5555           1 :         if (py_data == NULL) {
    5556           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data");
    5557           0 :                 return false;
    5558             :         }
    5559           1 :         r->in.data = talloc_ptrtype(r, r->in.data);
    5560           1 :         if (r->in.data == NULL) {
    5561           0 :                 PyErr_NoMemory();
    5562           0 :                 return false;
    5563             :         }
    5564           1 :         PY_CHECK_TYPE(&echo_Surrounding_Type, py_data, return false;);
    5565           1 :         if (talloc_reference(r, pytalloc_get_mem_ctx(py_data)) == NULL) {
    5566           0 :                 PyErr_NoMemory();
    5567           0 :                 return false;
    5568             :         }
    5569           1 :         r->in.data = (struct echo_Surrounding *)pytalloc_get_ptr(py_data);
    5570           1 :         return true;
    5571             : }
    5572             : 
    5573           1 : static PyObject *unpack_py_echo_TestSurrounding_args_out(struct echo_TestSurrounding *r)
    5574             : {
    5575             :         PyObject *result;
    5576             :         PyObject *py_data;
    5577           1 :         py_data = pytalloc_reference_ex(&echo_Surrounding_Type, r->out.data, r->out.data);
    5578           1 :         result = py_data;
    5579           1 :         return result;
    5580             : }
    5581             : 
    5582             : 
    5583           0 : static PyObject *py_echo_TestDoublePointer_in_get_data(PyObject *obj, void *closure)
    5584             : {
    5585           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(obj);
    5586             :         PyObject *py_data;
    5587           0 :         if (object->in.data == NULL) {
    5588           0 :                 Py_RETURN_NONE;
    5589             :         }
    5590           0 :         if (*object->in.data == NULL) {
    5591           0 :                 py_data = Py_None;
    5592           0 :                 Py_INCREF(py_data);
    5593             :         } else {
    5594           0 :                 if (**object->in.data == NULL) {
    5595           0 :                         py_data = Py_None;
    5596           0 :                         Py_INCREF(py_data);
    5597             :                 } else {
    5598           0 :                         py_data = PyLong_FromLong((uint16_t)***object->in.data);
    5599             :                 }
    5600             :         }
    5601             :         {
    5602           0 :                 PyObject *py_data_level_1 = py_data;
    5603           0 :                 py_data = py_dcerpc_ndr_pointer_wrap(ndr_pointer_Type, py_data_level_1);
    5604           0 :                 Py_XDECREF(py_data_level_1);
    5605             :         }
    5606           0 :         return py_data;
    5607             : }
    5608             : 
    5609           0 : static int py_echo_TestDoublePointer_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
    5610             : {
    5611           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(py_obj);
    5612           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
    5613           0 :         if (value == NULL) {
    5614           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data");
    5615           0 :                 return -1;
    5616             :         }
    5617           0 :         object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data);
    5618           0 :         if (object->in.data == NULL) {
    5619           0 :                 PyErr_NoMemory();
    5620           0 :                 return -1;
    5621             :         }
    5622           0 :         if (value == Py_None) {
    5623           0 :                 *object->in.data = NULL;
    5624             :         } else {
    5625           0 :                 *object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), *object->in.data);
    5626           0 :                 if (*object->in.data == NULL) {
    5627           0 :                         PyErr_NoMemory();
    5628           0 :                         return -1;
    5629             :                 }
    5630           0 :                 value = py_dcerpc_ndr_pointer_deref(ndr_pointer_Type, value);
    5631           0 :                 if (value == NULL) {
    5632           0 :                         return -1;
    5633             :                 }
    5634           0 :                 if (value == Py_None) {
    5635           0 :                         **object->in.data = NULL;
    5636             :                 } else {
    5637           0 :                         **object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), **object->in.data);
    5638           0 :                         if (**object->in.data == NULL) {
    5639           0 :                                 PyErr_NoMemory();
    5640           0 :                                 return -1;
    5641             :                         }
    5642             :                         {
    5643           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(***object->in.data));
    5644           0 :                                 if (PyLong_Check(value)) {
    5645             :                                         unsigned long long test_var;
    5646           0 :                                         test_var = PyLong_AsUnsignedLongLong(value);
    5647           0 :                                         if (PyErr_Occurred() != NULL) {
    5648           0 :                                                 return -1;
    5649             :                                         }
    5650           0 :                                         if (test_var > uint_max) {
    5651           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    5652             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    5653           0 :                                                 return -1;
    5654             :                                         }
    5655           0 :                                         ***object->in.data = test_var;
    5656             :                                 } else {
    5657           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    5658             :                                           PyLong_Type.tp_name);
    5659           0 :                                         return -1;
    5660             :                                 }
    5661             :                         }
    5662             :                 }
    5663             :         }
    5664           0 :         return 0;
    5665             : }
    5666             : 
    5667           0 : static PyObject *py_echo_TestDoublePointer_get_result(PyObject *obj, void *closure)
    5668             : {
    5669           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(obj);
    5670             :         PyObject *py_result;
    5671           0 :         py_result = PyLong_FromLong((uint16_t)object->out.result);
    5672           0 :         return py_result;
    5673             : }
    5674             : 
    5675           0 : static int py_echo_TestDoublePointer_set_result(PyObject *py_obj, PyObject *value, void *closure)
    5676             : {
    5677           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(py_obj);
    5678           0 :         if (value == NULL) {
    5679           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    5680           0 :                 return -1;
    5681             :         }
    5682             :         {
    5683           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.result));
    5684           0 :                 if (PyLong_Check(value)) {
    5685             :                         unsigned long long test_var;
    5686           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    5687           0 :                         if (PyErr_Occurred() != NULL) {
    5688           0 :                                 return -1;
    5689             :                         }
    5690           0 :                         if (test_var > uint_max) {
    5691           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    5692             :                                   PyLong_Type.tp_name, uint_max, test_var);
    5693           0 :                                 return -1;
    5694             :                         }
    5695           0 :                         object->out.result = test_var;
    5696             :                 } else {
    5697           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    5698             :                           PyLong_Type.tp_name);
    5699           0 :                         return -1;
    5700             :                 }
    5701             :         }
    5702           0 :         return 0;
    5703             : }
    5704             : 
    5705             : static PyGetSetDef py_echo_TestDoublePointer_getsetters[] = {
    5706             :         {
    5707             :                 .name = discard_const_p(char, "in_data"),
    5708             :                 .get = py_echo_TestDoublePointer_in_get_data,
    5709             :                 .set = py_echo_TestDoublePointer_in_set_data,
    5710             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    5711             :         },
    5712             :         {
    5713             :                 .name = discard_const_p(char, "result"),
    5714             :                 .get = py_echo_TestDoublePointer_get_result,
    5715             :                 .set = py_echo_TestDoublePointer_set_result,
    5716             :                 .doc = discard_const_p(char, "PIDL-generated element of type uint16")
    5717             :         },
    5718             :         { .name = NULL }
    5719             : };
    5720             : 
    5721           0 : static PyObject *py_echo_TestDoublePointer_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    5722             : {
    5723           0 :         PyObject *self = pytalloc_new(struct echo_TestDoublePointer, type);
    5724           0 :         struct echo_TestDoublePointer *_self = (struct echo_TestDoublePointer *)pytalloc_get_ptr(self);
    5725           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    5726             :         /* a pointer to a NULL pointer */
    5727           0 :         _self->in.data = talloc_zero(mem_ctx, uint16_t **);
    5728           0 :         return self;
    5729             : }
    5730             : 
    5731           0 : static PyObject *py_echo_TestDoublePointer_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    5732             : {
    5733             : 
    5734             : 
    5735           0 :         return PyLong_FromLong(9);
    5736             : }
    5737             : 
    5738           0 : static PyObject *py_echo_TestDoublePointer_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    5739             : {
    5740           0 :         const struct ndr_interface_call *call = NULL;
    5741           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(py_obj);
    5742           0 :         PyObject *ret = NULL;
    5743           0 :         struct ndr_push *push = NULL;
    5744             :         DATA_BLOB blob;
    5745             :         enum ndr_err_code err;
    5746             : 
    5747           0 :         if (ndr_table_rpcecho.num_calls < 10) {
    5748           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestDoublePointer_ndr_pack");
    5749           0 :                 return NULL;
    5750             :         }
    5751           0 :         call = &ndr_table_rpcecho.calls[9];
    5752             : 
    5753           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    5754           0 :         if (push == NULL) {
    5755           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    5756           0 :                 return NULL;
    5757             :         }
    5758             : 
    5759           0 :         push->flags |= ndr_push_flags;
    5760             : 
    5761           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    5762           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    5763           0 :                 TALLOC_FREE(push);
    5764           0 :                 PyErr_SetNdrError(err);
    5765           0 :                 return NULL;
    5766             :         }
    5767           0 :         blob = ndr_push_blob(push);
    5768           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    5769           0 :         TALLOC_FREE(push);
    5770           0 :         return ret;
    5771             : }
    5772             : 
    5773           0 : static PyObject *py_echo_TestDoublePointer_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5774             : {
    5775           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    5776           0 :         PyObject *bigendian_obj = NULL;
    5777           0 :         PyObject *ndr64_obj = NULL;
    5778           0 :         uint32_t ndr_push_flags = 0;
    5779             : 
    5780           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    5781             :                 discard_const_p(char *, kwnames),
    5782             :                 &bigendian_obj,
    5783             :                 &ndr64_obj)) {
    5784           0 :                 return NULL;
    5785             :         }
    5786             : 
    5787           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5788           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    5789             :         }
    5790           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5791           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    5792             :         }
    5793             : 
    5794           0 :         return py_echo_TestDoublePointer_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    5795             : }
    5796             : 
    5797           0 : static PyObject *py_echo_TestDoublePointer_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5798             : {
    5799           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    5800           0 :         PyObject *bigendian_obj = NULL;
    5801           0 :         PyObject *ndr64_obj = NULL;
    5802           0 :         uint32_t ndr_push_flags = 0;
    5803             : 
    5804           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    5805             :                 discard_const_p(char *, kwnames),
    5806             :                 &bigendian_obj,
    5807             :                 &ndr64_obj)) {
    5808           0 :                 return NULL;
    5809             :         }
    5810             : 
    5811           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5812           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    5813             :         }
    5814           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5815           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    5816             :         }
    5817             : 
    5818           0 :         return py_echo_TestDoublePointer_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    5819             : }
    5820             : 
    5821           0 : static PyObject *py_echo_TestDoublePointer_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    5822             : {
    5823           0 :         const struct ndr_interface_call *call = NULL;
    5824           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(py_obj);
    5825           0 :         struct ndr_pull *pull = NULL;
    5826             :         enum ndr_err_code err;
    5827             : 
    5828           0 :         if (ndr_table_rpcecho.num_calls < 10) {
    5829           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestDoublePointer_ndr_unpack");
    5830           0 :                 return NULL;
    5831             :         }
    5832           0 :         call = &ndr_table_rpcecho.calls[9];
    5833             : 
    5834           0 :         pull = ndr_pull_init_blob(blob, object);
    5835           0 :         if (pull == NULL) {
    5836           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    5837           0 :                 return NULL;
    5838             :         }
    5839             : 
    5840           0 :         pull->flags |= ndr_pull_flags;
    5841             : 
    5842           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    5843           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    5844           0 :                 TALLOC_FREE(pull);
    5845           0 :                 PyErr_SetNdrError(err);
    5846           0 :                 return NULL;
    5847             :         }
    5848           0 :         if (!allow_remaining) {
    5849             :                 uint32_t highest_ofs;
    5850             : 
    5851           0 :                 if (pull->offset > pull->relative_highest_offset) {
    5852           0 :                         highest_ofs = pull->offset;
    5853             :                 } else {
    5854           0 :                         highest_ofs = pull->relative_highest_offset;
    5855             :                 }
    5856           0 :                 if (highest_ofs < pull->data_size) {
    5857           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    5858             :                                 "not all bytes consumed ofs[%u] size[%u]",
    5859             :                                 highest_ofs, pull->data_size);
    5860           0 :                         TALLOC_FREE(pull);
    5861           0 :                         PyErr_SetNdrError(err);
    5862           0 :                         return NULL;
    5863             :                 }
    5864             :         }
    5865             : 
    5866           0 :         TALLOC_FREE(pull);
    5867           0 :         Py_RETURN_NONE;
    5868             : }
    5869             : 
    5870           0 : static PyObject *py_echo_TestDoublePointer_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5871             : {
    5872             :         DATA_BLOB blob;
    5873           0 :         Py_ssize_t blob_length = 0;
    5874           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    5875           0 :         PyObject *bigendian_obj = NULL;
    5876           0 :         PyObject *ndr64_obj = NULL;
    5877           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    5878           0 :         PyObject *allow_remaining_obj = NULL;
    5879           0 :         bool allow_remaining = false;
    5880             : 
    5881           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    5882             :                 discard_const_p(char *, kwnames),
    5883             :                 &blob.data, &blob_length,
    5884             :                 &bigendian_obj,
    5885             :                 &ndr64_obj,
    5886             :                 &allow_remaining_obj)) {
    5887           0 :                 return NULL;
    5888             :         }
    5889           0 :         blob.length = blob_length;
    5890             : 
    5891           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5892           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    5893             :         }
    5894           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5895           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    5896             :         }
    5897             : 
    5898           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    5899           0 :                 allow_remaining = true;
    5900             :         }
    5901             : 
    5902           0 :         return py_echo_TestDoublePointer_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    5903             : }
    5904             : 
    5905           0 : static PyObject *py_echo_TestDoublePointer_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    5906             : {
    5907             :         DATA_BLOB blob;
    5908           0 :         Py_ssize_t blob_length = 0;
    5909           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    5910           0 :         PyObject *bigendian_obj = NULL;
    5911           0 :         PyObject *ndr64_obj = NULL;
    5912           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    5913           0 :         PyObject *allow_remaining_obj = NULL;
    5914           0 :         bool allow_remaining = false;
    5915             : 
    5916           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    5917             :                 discard_const_p(char *, kwnames),
    5918             :                 &blob.data, &blob_length,
    5919             :                 &bigendian_obj,
    5920             :                 &ndr64_obj,
    5921             :                 &allow_remaining_obj)) {
    5922           0 :                 return NULL;
    5923             :         }
    5924           0 :         blob.length = blob_length;
    5925             : 
    5926           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    5927           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    5928             :         }
    5929           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    5930           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    5931             :         }
    5932             : 
    5933           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    5934           0 :                 allow_remaining = true;
    5935             :         }
    5936             : 
    5937           0 :         return py_echo_TestDoublePointer_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    5938             : }
    5939             : 
    5940           0 : static PyObject *py_echo_TestDoublePointer_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    5941             : {
    5942           0 :         const struct ndr_interface_call *call = NULL;
    5943           0 :         struct echo_TestDoublePointer *object = (struct echo_TestDoublePointer *)pytalloc_get_ptr(py_obj);
    5944             :         PyObject *ret;
    5945             :         char *retstr;
    5946             : 
    5947           0 :         if (ndr_table_rpcecho.num_calls < 10) {
    5948           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_echo_TestDoublePointer_ndr_print");
    5949           0 :                 return NULL;
    5950             :         }
    5951           0 :         call = &ndr_table_rpcecho.calls[9];
    5952             : 
    5953           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    5954           0 :         ret = PyUnicode_FromString(retstr);
    5955           0 :         TALLOC_FREE(retstr);
    5956             : 
    5957           0 :         return ret;
    5958             : }
    5959             : 
    5960           0 : static PyObject *py_echo_TestDoublePointer_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5961             : {
    5962           0 :         return py_echo_TestDoublePointer_ndr_print(py_obj, "echo_TestDoublePointer_in", NDR_IN);
    5963             : }
    5964             : 
    5965           0 : static PyObject *py_echo_TestDoublePointer_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    5966             : {
    5967           0 :         return py_echo_TestDoublePointer_ndr_print(py_obj, "echo_TestDoublePointer_out", NDR_OUT);
    5968             : }
    5969             : 
    5970             : static PyMethodDef py_echo_TestDoublePointer_methods[] = {
    5971             :         { "opnum", (PyCFunction)py_echo_TestDoublePointer_ndr_opnum, METH_NOARGS|METH_CLASS,
    5972             :                 "echo.TestDoublePointer.opnum() -> 9 (0x09) " },
    5973             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestDoublePointer_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    5974             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    5975             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestDoublePointer_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    5976             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    5977             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestDoublePointer_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    5978             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    5979             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_echo_TestDoublePointer_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    5980             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    5981             :         { "__ndr_print_in__", (PyCFunction)py_echo_TestDoublePointer_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    5982             :         { "__ndr_print_out__", (PyCFunction)py_echo_TestDoublePointer_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    5983             :         { NULL, NULL, 0, NULL }
    5984             : };
    5985             : 
    5986             : 
    5987             : static PyTypeObject echo_TestDoublePointer_Type = {
    5988             :         PyVarObject_HEAD_INIT(NULL, 0)
    5989             :         .tp_name = "echo.TestDoublePointer",
    5990             :         .tp_getset = py_echo_TestDoublePointer_getsetters,
    5991             :         .tp_methods = py_echo_TestDoublePointer_methods,
    5992             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    5993             :         .tp_new = py_echo_TestDoublePointer_new,
    5994             : };
    5995             : 
    5996           0 : static bool pack_py_echo_TestDoublePointer_args_in(PyObject *args, PyObject *kwargs, struct echo_TestDoublePointer *r)
    5997             : {
    5998             :         PyObject *py_data;
    5999           0 :         const char *kwnames[] = {
    6000             :                 "data", NULL
    6001             :         };
    6002             : 
    6003           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:echo_TestDoublePointer", discard_const_p(char *, kwnames), &py_data)) {
    6004           0 :                 return false;
    6005             :         }
    6006             : 
    6007           0 :         if (py_data == NULL) {
    6008           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data");
    6009           0 :                 return false;
    6010             :         }
    6011           0 :         r->in.data = talloc_ptrtype(r, r->in.data);
    6012           0 :         if (r->in.data == NULL) {
    6013           0 :                 PyErr_NoMemory();
    6014           0 :                 return false;
    6015             :         }
    6016           0 :         if (py_data == Py_None) {
    6017           0 :                 *r->in.data = NULL;
    6018             :         } else {
    6019           0 :                 *r->in.data = talloc_ptrtype(r, *r->in.data);
    6020           0 :                 if (*r->in.data == NULL) {
    6021           0 :                         PyErr_NoMemory();
    6022           0 :                         return false;
    6023             :                 }
    6024           0 :                 py_data = py_dcerpc_ndr_pointer_deref(ndr_pointer_Type, py_data);
    6025           0 :                 if (py_data == NULL) {
    6026           0 :                         return false;
    6027             :                 }
    6028           0 :                 if (py_data == Py_None) {
    6029           0 :                         **r->in.data = NULL;
    6030             :                 } else {
    6031           0 :                         **r->in.data = talloc_ptrtype(r, **r->in.data);
    6032           0 :                         if (**r->in.data == NULL) {
    6033           0 :                                 PyErr_NoMemory();
    6034           0 :                                 return false;
    6035             :                         }
    6036             :                         {
    6037           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(***r->in.data));
    6038           0 :                                 if (PyLong_Check(py_data)) {
    6039             :                                         unsigned long long test_var;
    6040           0 :                                         test_var = PyLong_AsUnsignedLongLong(py_data);
    6041           0 :                                         if (PyErr_Occurred() != NULL) {
    6042           0 :                                                 return false;
    6043             :                                         }
    6044           0 :                                         if (test_var > uint_max) {
    6045           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    6046             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    6047           0 :                                                 return false;
    6048             :                                         }
    6049           0 :                                         ***r->in.data = test_var;
    6050             :                                 } else {
    6051           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    6052             :                                           PyLong_Type.tp_name);
    6053           0 :                                         return false;
    6054             :                                 }
    6055             :                         }
    6056             :                 }
    6057             :         }
    6058           0 :         return true;
    6059             : }
    6060             : 
    6061           0 : static PyObject *unpack_py_echo_TestDoublePointer_args_out(struct echo_TestDoublePointer *r)
    6062             : {
    6063             :         PyObject *result;
    6064           0 :         result = PyLong_FromLong((uint16_t)r->out.result);
    6065           0 :         return result;
    6066             : }
    6067             : 
    6068             : const struct PyNdrRpcMethodDef py_ndr_rpcecho_methods[] = {
    6069             :         { "AddOne", "S.AddOne(in_data) -> out_data", (py_dcerpc_call_fn)dcerpc_echo_AddOne_r, (py_data_pack_fn)pack_py_echo_AddOne_args_in, (py_data_unpack_fn)unpack_py_echo_AddOne_args_out, 0, &ndr_table_rpcecho },
    6070             :         { "EchoData", "S.EchoData(in_data) -> out_data", (py_dcerpc_call_fn)dcerpc_echo_EchoData_r, (py_data_pack_fn)pack_py_echo_EchoData_args_in, (py_data_unpack_fn)unpack_py_echo_EchoData_args_out, 1, &ndr_table_rpcecho },
    6071             :         { "SinkData", "S.SinkData(data) -> None", (py_dcerpc_call_fn)dcerpc_echo_SinkData_r, (py_data_pack_fn)pack_py_echo_SinkData_args_in, (py_data_unpack_fn)unpack_py_echo_SinkData_args_out, 2, &ndr_table_rpcecho },
    6072             :         { "SourceData", "S.SourceData(len) -> data", (py_dcerpc_call_fn)dcerpc_echo_SourceData_r, (py_data_pack_fn)pack_py_echo_SourceData_args_in, (py_data_unpack_fn)unpack_py_echo_SourceData_args_out, 3, &ndr_table_rpcecho },
    6073             :         { "TestCall", "S.TestCall(s1) -> s2", (py_dcerpc_call_fn)dcerpc_echo_TestCall_r, (py_data_pack_fn)pack_py_echo_TestCall_args_in, (py_data_unpack_fn)unpack_py_echo_TestCall_args_out, 4, &ndr_table_rpcecho },
    6074             :         { "TestCall2", "S.TestCall2(level) -> info", (py_dcerpc_call_fn)dcerpc_echo_TestCall2_r, (py_data_pack_fn)pack_py_echo_TestCall2_args_in, (py_data_unpack_fn)unpack_py_echo_TestCall2_args_out, 5, &ndr_table_rpcecho },
    6075             :         { "TestSleep", "S.TestSleep(seconds) -> result", (py_dcerpc_call_fn)dcerpc_echo_TestSleep_r, (py_data_pack_fn)pack_py_echo_TestSleep_args_in, (py_data_unpack_fn)unpack_py_echo_TestSleep_args_out, 6, &ndr_table_rpcecho },
    6076             :         { "TestEnum", "S.TestEnum(foo1, foo2, foo3) -> (foo1, foo2, foo3)", (py_dcerpc_call_fn)dcerpc_echo_TestEnum_r, (py_data_pack_fn)pack_py_echo_TestEnum_args_in, (py_data_unpack_fn)unpack_py_echo_TestEnum_args_out, 7, &ndr_table_rpcecho },
    6077             :         { "TestSurrounding", "S.TestSurrounding(data) -> data", (py_dcerpc_call_fn)dcerpc_echo_TestSurrounding_r, (py_data_pack_fn)pack_py_echo_TestSurrounding_args_in, (py_data_unpack_fn)unpack_py_echo_TestSurrounding_args_out, 8, &ndr_table_rpcecho },
    6078             :         { "TestDoublePointer", "S.TestDoublePointer(data) -> result", (py_dcerpc_call_fn)dcerpc_echo_TestDoublePointer_r, (py_data_pack_fn)pack_py_echo_TestDoublePointer_args_in, (py_data_unpack_fn)unpack_py_echo_TestDoublePointer_args_out, 9, &ndr_table_rpcecho },
    6079             :         {0}
    6080             : };
    6081             : 
    6082          15 : static PyObject *interface_rpcecho_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    6083             : {
    6084          15 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_rpcecho);
    6085             : }
    6086             : 
    6087             : #define PY_DOC_RPCECHO "Simple echo pipe"
    6088             : static PyTypeObject rpcecho_InterfaceType = {
    6089             :         PyVarObject_HEAD_INIT(NULL, 0)
    6090             :         .tp_name = "echo.rpcecho",
    6091             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    6092             :         .tp_doc = "rpcecho(binding, lp_ctx=None, credentials=None) -> connection\n"
    6093             : "\n"
    6094             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    6095             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    6096             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_RPCECHO,
    6097             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    6098             :         .tp_new = interface_rpcecho_new,
    6099             : };
    6100             : 
    6101           0 : static PyObject *syntax_rpcecho_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    6102             : {
    6103           0 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_rpcecho.syntax_id);
    6104             : }
    6105             : 
    6106             : #define PY_DOC_RPCECHO_SYNTAX "Simple echo pipe"
    6107             : static PyTypeObject rpcecho_SyntaxType = {
    6108             :         PyVarObject_HEAD_INIT(NULL, 0)
    6109             :         .tp_name = "echo.rpcecho_abstract_syntax",
    6110             :         .tp_doc = "rpcecho_abstract_syntax()\n"PY_DOC_RPCECHO_SYNTAX,
    6111             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    6112             :         .tp_new = syntax_rpcecho_new,
    6113             : };
    6114             : 
    6115             : static PyMethodDef echo_methods[] = {
    6116             :         { NULL, NULL, 0, NULL }
    6117             : };
    6118             : 
    6119             : static struct PyModuleDef moduledef = {
    6120             :         PyModuleDef_HEAD_INIT,
    6121             :         .m_name = "echo",
    6122             :         .m_doc = "echo DCE/RPC",
    6123             :         .m_size = -1,
    6124             :         .m_methods = echo_methods,
    6125             : };
    6126           2 : MODULE_INIT_FUNC(echo)
    6127             : {
    6128           2 :         PyObject *m = NULL;
    6129           2 :         PyObject *dep_talloc = NULL;
    6130           2 :         PyObject *dep_samba_dcerpc_base = NULL;
    6131           2 :         PyObject *dep_samba_dcerpc_misc = NULL;
    6132             : 
    6133           2 :         dep_talloc = PyImport_ImportModule("talloc");
    6134           2 :         if (dep_talloc == NULL)
    6135           0 :                 goto out;
    6136             : 
    6137           2 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    6138           2 :         if (dep_samba_dcerpc_base == NULL)
    6139           0 :                 goto out;
    6140             : 
    6141           2 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    6142           2 :         if (dep_samba_dcerpc_misc == NULL)
    6143           0 :                 goto out;
    6144             : 
    6145           2 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    6146           2 :         if (BaseObject_Type == NULL)
    6147           0 :                 goto out;
    6148             : 
    6149           2 :         ndr_pointer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ndr_pointer");
    6150           2 :         if (ndr_pointer_Type == NULL)
    6151           0 :                 goto out;
    6152             : 
    6153           2 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    6154           2 :         if (ClientConnection_Type == NULL)
    6155           0 :                 goto out;
    6156             : 
    6157           2 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    6158           2 :         if (ndr_syntax_id_Type == NULL)
    6159           0 :                 goto out;
    6160             : 
    6161           2 :         echo_info1_Type.tp_base = BaseObject_Type;
    6162           2 :         echo_info1_Type.tp_basicsize = pytalloc_BaseObject_size();
    6163             : 
    6164           2 :         echo_info2_Type.tp_base = BaseObject_Type;
    6165           2 :         echo_info2_Type.tp_basicsize = pytalloc_BaseObject_size();
    6166             : 
    6167           2 :         echo_info3_Type.tp_base = BaseObject_Type;
    6168           2 :         echo_info3_Type.tp_basicsize = pytalloc_BaseObject_size();
    6169             : 
    6170           2 :         echo_info4_Type.tp_base = BaseObject_Type;
    6171           2 :         echo_info4_Type.tp_basicsize = pytalloc_BaseObject_size();
    6172             : 
    6173           2 :         echo_info5_Type.tp_base = BaseObject_Type;
    6174           2 :         echo_info5_Type.tp_basicsize = pytalloc_BaseObject_size();
    6175             : 
    6176           2 :         echo_info6_Type.tp_base = BaseObject_Type;
    6177           2 :         echo_info6_Type.tp_basicsize = pytalloc_BaseObject_size();
    6178             : 
    6179           2 :         echo_info7_Type.tp_base = BaseObject_Type;
    6180           2 :         echo_info7_Type.tp_basicsize = pytalloc_BaseObject_size();
    6181             : 
    6182           2 :         echo_Info_Type.tp_base = BaseObject_Type;
    6183           2 :         echo_Info_Type.tp_basicsize = pytalloc_BaseObject_size();
    6184             : 
    6185           2 :         echo_Enum2_Type.tp_base = BaseObject_Type;
    6186           2 :         echo_Enum2_Type.tp_basicsize = pytalloc_BaseObject_size();
    6187             : 
    6188           2 :         echo_Enum3_Type.tp_base = BaseObject_Type;
    6189           2 :         echo_Enum3_Type.tp_basicsize = pytalloc_BaseObject_size();
    6190             : 
    6191           2 :         echo_Surrounding_Type.tp_base = BaseObject_Type;
    6192           2 :         echo_Surrounding_Type.tp_basicsize = pytalloc_BaseObject_size();
    6193             : 
    6194           2 :         echo_AddOne_Type.tp_base = BaseObject_Type;
    6195           2 :         echo_AddOne_Type.tp_basicsize = pytalloc_BaseObject_size();
    6196             : 
    6197           2 :         echo_EchoData_Type.tp_base = BaseObject_Type;
    6198           2 :         echo_EchoData_Type.tp_basicsize = pytalloc_BaseObject_size();
    6199             : 
    6200           2 :         echo_SinkData_Type.tp_base = BaseObject_Type;
    6201           2 :         echo_SinkData_Type.tp_basicsize = pytalloc_BaseObject_size();
    6202             : 
    6203           2 :         echo_SourceData_Type.tp_base = BaseObject_Type;
    6204           2 :         echo_SourceData_Type.tp_basicsize = pytalloc_BaseObject_size();
    6205             : 
    6206           2 :         echo_TestCall_Type.tp_base = BaseObject_Type;
    6207           2 :         echo_TestCall_Type.tp_basicsize = pytalloc_BaseObject_size();
    6208             : 
    6209           2 :         echo_TestCall2_Type.tp_base = BaseObject_Type;
    6210           2 :         echo_TestCall2_Type.tp_basicsize = pytalloc_BaseObject_size();
    6211             : 
    6212           2 :         echo_TestSleep_Type.tp_base = BaseObject_Type;
    6213           2 :         echo_TestSleep_Type.tp_basicsize = pytalloc_BaseObject_size();
    6214             : 
    6215           2 :         echo_TestEnum_Type.tp_base = BaseObject_Type;
    6216           2 :         echo_TestEnum_Type.tp_basicsize = pytalloc_BaseObject_size();
    6217             : 
    6218           2 :         echo_TestSurrounding_Type.tp_base = BaseObject_Type;
    6219           2 :         echo_TestSurrounding_Type.tp_basicsize = pytalloc_BaseObject_size();
    6220             : 
    6221           2 :         echo_TestDoublePointer_Type.tp_base = BaseObject_Type;
    6222           2 :         echo_TestDoublePointer_Type.tp_basicsize = pytalloc_BaseObject_size();
    6223             : 
    6224           2 :         rpcecho_InterfaceType.tp_base = ClientConnection_Type;
    6225             : 
    6226           2 :         rpcecho_SyntaxType.tp_base = ndr_syntax_id_Type;
    6227           2 :         rpcecho_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    6228             : 
    6229           2 :         if (PyType_Ready(&echo_info1_Type) < 0)
    6230           0 :                 goto out;
    6231           2 :         if (PyType_Ready(&echo_info2_Type) < 0)
    6232           0 :                 goto out;
    6233           2 :         if (PyType_Ready(&echo_info3_Type) < 0)
    6234           0 :                 goto out;
    6235           2 :         if (PyType_Ready(&echo_info4_Type) < 0)
    6236           0 :                 goto out;
    6237           2 :         if (PyType_Ready(&echo_info5_Type) < 0)
    6238           0 :                 goto out;
    6239           2 :         if (PyType_Ready(&echo_info6_Type) < 0)
    6240           0 :                 goto out;
    6241           2 :         if (PyType_Ready(&echo_info7_Type) < 0)
    6242           0 :                 goto out;
    6243           2 :         if (PyType_Ready(&echo_Info_Type) < 0)
    6244           0 :                 goto out;
    6245           2 :         if (PyType_Ready(&echo_Enum2_Type) < 0)
    6246           0 :                 goto out;
    6247           2 :         if (PyType_Ready(&echo_Enum3_Type) < 0)
    6248           0 :                 goto out;
    6249           2 :         if (PyType_Ready(&echo_Surrounding_Type) < 0)
    6250           0 :                 goto out;
    6251           2 :         if (PyType_Ready(&echo_AddOne_Type) < 0)
    6252           0 :                 goto out;
    6253           2 :         if (PyType_Ready(&echo_EchoData_Type) < 0)
    6254           0 :                 goto out;
    6255           2 :         if (PyType_Ready(&echo_SinkData_Type) < 0)
    6256           0 :                 goto out;
    6257           2 :         if (PyType_Ready(&echo_SourceData_Type) < 0)
    6258           0 :                 goto out;
    6259           2 :         if (PyType_Ready(&echo_TestCall_Type) < 0)
    6260           0 :                 goto out;
    6261           2 :         if (PyType_Ready(&echo_TestCall2_Type) < 0)
    6262           0 :                 goto out;
    6263           2 :         if (PyType_Ready(&echo_TestSleep_Type) < 0)
    6264           0 :                 goto out;
    6265           2 :         if (PyType_Ready(&echo_TestEnum_Type) < 0)
    6266           0 :                 goto out;
    6267           2 :         if (PyType_Ready(&echo_TestSurrounding_Type) < 0)
    6268           0 :                 goto out;
    6269           2 :         if (PyType_Ready(&echo_TestDoublePointer_Type) < 0)
    6270           0 :                 goto out;
    6271           2 :         if (PyType_Ready(&rpcecho_InterfaceType) < 0)
    6272           0 :                 goto out;
    6273           2 :         if (PyType_Ready(&rpcecho_SyntaxType) < 0)
    6274           0 :                 goto out;
    6275           2 :         if (!PyInterface_AddNdrRpcMethods(&rpcecho_InterfaceType, py_ndr_rpcecho_methods))
    6276           0 :                 return NULL;
    6277             : 
    6278             : #ifdef PY_INFO1_PATCH
    6279             :         PY_INFO1_PATCH(&echo_info1_Type);
    6280             : #endif
    6281             : #ifdef PY_INFO2_PATCH
    6282             :         PY_INFO2_PATCH(&echo_info2_Type);
    6283             : #endif
    6284             : #ifdef PY_INFO3_PATCH
    6285             :         PY_INFO3_PATCH(&echo_info3_Type);
    6286             : #endif
    6287             : #ifdef PY_INFO4_PATCH
    6288             :         PY_INFO4_PATCH(&echo_info4_Type);
    6289             : #endif
    6290             : #ifdef PY_INFO5_PATCH
    6291             :         PY_INFO5_PATCH(&echo_info5_Type);
    6292             : #endif
    6293             : #ifdef PY_INFO6_PATCH
    6294             :         PY_INFO6_PATCH(&echo_info6_Type);
    6295             : #endif
    6296             : #ifdef PY_INFO7_PATCH
    6297             :         PY_INFO7_PATCH(&echo_info7_Type);
    6298             : #endif
    6299             : #ifdef PY_INFO_PATCH
    6300             :         PY_INFO_PATCH(&echo_Info_Type);
    6301             : #endif
    6302             : #ifdef PY_ENUM2_PATCH
    6303             :         PY_ENUM2_PATCH(&echo_Enum2_Type);
    6304             : #endif
    6305             : #ifdef PY_ENUM3_PATCH
    6306             :         PY_ENUM3_PATCH(&echo_Enum3_Type);
    6307             : #endif
    6308             : #ifdef PY_SURROUNDING_PATCH
    6309             :         PY_SURROUNDING_PATCH(&echo_Surrounding_Type);
    6310             : #endif
    6311             : #ifdef PY_ADDONE_PATCH
    6312             :         PY_ADDONE_PATCH(&echo_AddOne_Type);
    6313             : #endif
    6314             : #ifdef PY_ECHODATA_PATCH
    6315             :         PY_ECHODATA_PATCH(&echo_EchoData_Type);
    6316             : #endif
    6317             : #ifdef PY_SINKDATA_PATCH
    6318             :         PY_SINKDATA_PATCH(&echo_SinkData_Type);
    6319             : #endif
    6320             : #ifdef PY_SOURCEDATA_PATCH
    6321             :         PY_SOURCEDATA_PATCH(&echo_SourceData_Type);
    6322             : #endif
    6323             : #ifdef PY_TESTCALL_PATCH
    6324             :         PY_TESTCALL_PATCH(&echo_TestCall_Type);
    6325             : #endif
    6326             : #ifdef PY_TESTCALL2_PATCH
    6327             :         PY_TESTCALL2_PATCH(&echo_TestCall2_Type);
    6328             : #endif
    6329             : #ifdef PY_TESTSLEEP_PATCH
    6330             :         PY_TESTSLEEP_PATCH(&echo_TestSleep_Type);
    6331             : #endif
    6332             : #ifdef PY_TESTENUM_PATCH
    6333             :         PY_TESTENUM_PATCH(&echo_TestEnum_Type);
    6334             : #endif
    6335             : #ifdef PY_TESTSURROUNDING_PATCH
    6336             :         PY_TESTSURROUNDING_PATCH(&echo_TestSurrounding_Type);
    6337             : #endif
    6338             : #ifdef PY_TESTDOUBLEPOINTER_PATCH
    6339             :         PY_TESTDOUBLEPOINTER_PATCH(&echo_TestDoublePointer_Type);
    6340             : #endif
    6341             : #ifdef PY_RPCECHO_PATCH
    6342             :         PY_RPCECHO_PATCH(&rpcecho_InterfaceType);
    6343             : #endif
    6344             : #ifdef PY_RPCECHO_ABSTRACT_SYNTAX_PATCH
    6345             :         PY_RPCECHO_ABSTRACT_SYNTAX_PATCH(&rpcecho_SyntaxType);
    6346             : #endif
    6347             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    6348             :         PY_ABSTRACT_SYNTAX_PATCH(&rpcecho_SyntaxType);
    6349             : #endif
    6350             : 
    6351           2 :         m = PyModule_Create(&moduledef);
    6352           2 :         if (m == NULL)
    6353           0 :                 goto out;
    6354             : 
    6355           2 :         PyModule_AddObject(m, "ECHO_ENUM1", PyLong_FromLong((uint16_t)ECHO_ENUM1));
    6356           2 :         PyModule_AddObject(m, "ECHO_ENUM2", PyLong_FromLong((uint16_t)ECHO_ENUM2));
    6357           2 :         PyModule_AddObject(m, "ECHO_ENUM1_32", PyLong_FromUnsignedLongLong((uint32_t)ECHO_ENUM1_32));
    6358           2 :         PyModule_AddObject(m, "ECHO_ENUM2_32", PyLong_FromUnsignedLongLong((uint32_t)ECHO_ENUM2_32));
    6359           2 :         Py_INCREF((PyObject *)(void *)&echo_info1_Type);
    6360           2 :         PyModule_AddObject(m, "info1", (PyObject *)(void *)&echo_info1_Type);
    6361           2 :         Py_INCREF((PyObject *)(void *)&echo_info2_Type);
    6362           2 :         PyModule_AddObject(m, "info2", (PyObject *)(void *)&echo_info2_Type);
    6363           2 :         Py_INCREF((PyObject *)(void *)&echo_info3_Type);
    6364           2 :         PyModule_AddObject(m, "info3", (PyObject *)(void *)&echo_info3_Type);
    6365           2 :         Py_INCREF((PyObject *)(void *)&echo_info4_Type);
    6366           2 :         PyModule_AddObject(m, "info4", (PyObject *)(void *)&echo_info4_Type);
    6367           2 :         Py_INCREF((PyObject *)(void *)&echo_info5_Type);
    6368           2 :         PyModule_AddObject(m, "info5", (PyObject *)(void *)&echo_info5_Type);
    6369           2 :         Py_INCREF((PyObject *)(void *)&echo_info6_Type);
    6370           2 :         PyModule_AddObject(m, "info6", (PyObject *)(void *)&echo_info6_Type);
    6371           2 :         Py_INCREF((PyObject *)(void *)&echo_info7_Type);
    6372           2 :         PyModule_AddObject(m, "info7", (PyObject *)(void *)&echo_info7_Type);
    6373           2 :         Py_INCREF((PyObject *)(void *)&echo_Info_Type);
    6374           2 :         PyModule_AddObject(m, "Info", (PyObject *)(void *)&echo_Info_Type);
    6375           2 :         Py_INCREF((PyObject *)(void *)&echo_Enum2_Type);
    6376           2 :         PyModule_AddObject(m, "Enum2", (PyObject *)(void *)&echo_Enum2_Type);
    6377           2 :         Py_INCREF((PyObject *)(void *)&echo_Enum3_Type);
    6378           2 :         PyModule_AddObject(m, "Enum3", (PyObject *)(void *)&echo_Enum3_Type);
    6379           2 :         Py_INCREF((PyObject *)(void *)&echo_Surrounding_Type);
    6380           2 :         PyModule_AddObject(m, "Surrounding", (PyObject *)(void *)&echo_Surrounding_Type);
    6381           2 :         Py_INCREF((PyObject *)(void *)&echo_AddOne_Type);
    6382           2 :         PyModule_AddObject(m, "AddOne", (PyObject *)(void *)&echo_AddOne_Type);
    6383           2 :         Py_INCREF((PyObject *)(void *)&echo_EchoData_Type);
    6384           2 :         PyModule_AddObject(m, "EchoData", (PyObject *)(void *)&echo_EchoData_Type);
    6385           2 :         Py_INCREF((PyObject *)(void *)&echo_SinkData_Type);
    6386           2 :         PyModule_AddObject(m, "SinkData", (PyObject *)(void *)&echo_SinkData_Type);
    6387           2 :         Py_INCREF((PyObject *)(void *)&echo_SourceData_Type);
    6388           2 :         PyModule_AddObject(m, "SourceData", (PyObject *)(void *)&echo_SourceData_Type);
    6389           2 :         Py_INCREF((PyObject *)(void *)&echo_TestCall_Type);
    6390           2 :         PyModule_AddObject(m, "TestCall", (PyObject *)(void *)&echo_TestCall_Type);
    6391           2 :         Py_INCREF((PyObject *)(void *)&echo_TestCall2_Type);
    6392           2 :         PyModule_AddObject(m, "TestCall2", (PyObject *)(void *)&echo_TestCall2_Type);
    6393           2 :         Py_INCREF((PyObject *)(void *)&echo_TestSleep_Type);
    6394           2 :         PyModule_AddObject(m, "TestSleep", (PyObject *)(void *)&echo_TestSleep_Type);
    6395           2 :         Py_INCREF((PyObject *)(void *)&echo_TestEnum_Type);
    6396           2 :         PyModule_AddObject(m, "TestEnum", (PyObject *)(void *)&echo_TestEnum_Type);
    6397           2 :         Py_INCREF((PyObject *)(void *)&echo_TestSurrounding_Type);
    6398           2 :         PyModule_AddObject(m, "TestSurrounding", (PyObject *)(void *)&echo_TestSurrounding_Type);
    6399           2 :         Py_INCREF((PyObject *)(void *)&echo_TestDoublePointer_Type);
    6400           2 :         PyModule_AddObject(m, "TestDoublePointer", (PyObject *)(void *)&echo_TestDoublePointer_Type);
    6401           2 :         Py_INCREF((PyObject *)(void *)&rpcecho_InterfaceType);
    6402           2 :         PyModule_AddObject(m, "rpcecho", (PyObject *)(void *)&rpcecho_InterfaceType);
    6403           2 :         Py_INCREF((PyObject *)(void *)&rpcecho_SyntaxType);
    6404           2 :         PyModule_AddObject(m, "rpcecho_abstract_syntax", (PyObject *)(void *)&rpcecho_SyntaxType);
    6405           2 :         Py_INCREF((PyObject *)(void *)&rpcecho_SyntaxType);
    6406           2 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&rpcecho_SyntaxType);
    6407             : #ifdef PY_MOD_ECHO_PATCH
    6408             :         PY_MOD_ECHO_PATCH(m);
    6409             : #endif
    6410           2 :         out:
    6411           2 :         Py_XDECREF(dep_talloc);
    6412           2 :         Py_XDECREF(dep_samba_dcerpc_base);
    6413           2 :         Py_XDECREF(dep_samba_dcerpc_misc);
    6414           2 :         return m;
    6415             : 
    6416             : }

Generated by: LCOV version 1.13