LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_mgmt.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 211 1296 16.3 %
Date: 2021-09-23 10:06:22 Functions: 14 108 13.0 %

          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_mgmt.h"
      12             : #include "bin/default/librpc/gen_ndr/ndr_mgmt_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           0 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34           0 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37           0 :         case 4:
      38           0 :                 return UINT32_MAX;
      39           0 :         case 2:
      40           0 :                 return UINT16_MAX;
      41           0 :         case 1:
      42           0 :                 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             : #include "librpc/gen_ndr/misc.h"
      65             : static PyTypeObject ndr_syntax_id_p_Type;
      66             : static PyTypeObject rpc_if_id_vector_t_Type;
      67             : static PyTypeObject mgmt_statistics_Type;
      68             : static PyTypeObject mgmt_InterfaceType;
      69             : static PyTypeObject mgmt_inq_if_ids_Type;
      70             : static PyTypeObject mgmt_inq_stats_Type;
      71             : static PyTypeObject mgmt_is_server_listening_Type;
      72             : static PyTypeObject mgmt_stop_server_listening_Type;
      73             : static PyTypeObject mgmt_inq_princ_name_Type;
      74             : 
      75             : static PyTypeObject *ndr_syntax_id_Type;
      76             : static PyTypeObject *BaseObject_Type;
      77             : static PyTypeObject *ClientConnection_Type;
      78             : 
      79           0 : static PyObject *py_ndr_syntax_id_p_get_id(PyObject *obj, void *closure)
      80             : {
      81           0 :         struct ndr_syntax_id_p *object = (struct ndr_syntax_id_p *)pytalloc_get_ptr(obj);
      82             :         PyObject *py_id;
      83           0 :         if (object->id == NULL) {
      84           0 :                 Py_RETURN_NONE;
      85             :         }
      86           0 :         if (object->id == NULL) {
      87           0 :                 py_id = Py_None;
      88           0 :                 Py_INCREF(py_id);
      89             :         } else {
      90           0 :                 py_id = pytalloc_reference_ex(ndr_syntax_id_Type, object->id, object->id);
      91             :         }
      92           0 :         return py_id;
      93             : }
      94             : 
      95           0 : static int py_ndr_syntax_id_p_set_id(PyObject *py_obj, PyObject *value, void *closure)
      96             : {
      97           0 :         struct ndr_syntax_id_p *object = (struct ndr_syntax_id_p *)pytalloc_get_ptr(py_obj);
      98           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->id));
      99           0 :         if (value == NULL) {
     100           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id");
     101           0 :                 return -1;
     102             :         }
     103           0 :         if (value == Py_None) {
     104           0 :                 object->id = NULL;
     105             :         } else {
     106           0 :                 object->id = NULL;
     107           0 :                 PY_CHECK_TYPE(ndr_syntax_id_Type, value, return -1;);
     108           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     109           0 :                         PyErr_NoMemory();
     110           0 :                         return -1;
     111             :                 }
     112           0 :                 object->id = (struct ndr_syntax_id *)pytalloc_get_ptr(value);
     113             :         }
     114           0 :         return 0;
     115             : }
     116             : 
     117             : static PyGetSetDef py_ndr_syntax_id_p_getsetters[] = {
     118             :         {
     119             :                 .name = discard_const_p(char, "id"),
     120             :                 .get = py_ndr_syntax_id_p_get_id,
     121             :                 .set = py_ndr_syntax_id_p_set_id,
     122             :                 .doc = discard_const_p(char, "PIDL-generated element of base type ndr_syntax_id")
     123             :         },
     124             :         { .name = NULL }
     125             : };
     126             : 
     127           0 : static PyObject *py_ndr_syntax_id_p_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     128             : {
     129           0 :         return pytalloc_new(struct ndr_syntax_id_p, type);
     130             : }
     131             : 
     132             : 
     133             : static PyTypeObject ndr_syntax_id_p_Type = {
     134             :         PyVarObject_HEAD_INIT(NULL, 0)
     135             :         .tp_name = "mgmt.ndr_syntax_id_p",
     136             :         .tp_getset = py_ndr_syntax_id_p_getsetters,
     137             :         .tp_methods = NULL,
     138             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     139             :         .tp_new = py_ndr_syntax_id_p_new,
     140             : };
     141             : 
     142             : 
     143           0 : static PyObject *py_rpc_if_id_vector_t_get_count(PyObject *obj, void *closure)
     144             : {
     145           0 :         struct rpc_if_id_vector_t *object = (struct rpc_if_id_vector_t *)pytalloc_get_ptr(obj);
     146             :         PyObject *py_count;
     147           0 :         py_count = PyLong_FromUnsignedLongLong((uint32_t)object->count);
     148           0 :         return py_count;
     149             : }
     150             : 
     151           0 : static int py_rpc_if_id_vector_t_set_count(PyObject *py_obj, PyObject *value, void *closure)
     152             : {
     153           0 :         struct rpc_if_id_vector_t *object = (struct rpc_if_id_vector_t *)pytalloc_get_ptr(py_obj);
     154           0 :         if (value == NULL) {
     155           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->count");
     156           0 :                 return -1;
     157             :         }
     158             :         {
     159           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
     160           0 :                 if (PyLong_Check(value)) {
     161             :                         unsigned long long test_var;
     162           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     163           0 :                         if (PyErr_Occurred() != NULL) {
     164           0 :                                 return -1;
     165             :                         }
     166           0 :                         if (test_var > uint_max) {
     167           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     168             :                                   PyLong_Type.tp_name, uint_max, test_var);
     169           0 :                                 return -1;
     170             :                         }
     171           0 :                         object->count = test_var;
     172             :                 } else {
     173           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     174             :                           PyLong_Type.tp_name);
     175           0 :                         return -1;
     176             :                 }
     177             :         }
     178           0 :         return 0;
     179             : }
     180             : 
     181           0 : static PyObject *py_rpc_if_id_vector_t_get_if_id(PyObject *obj, void *closure)
     182             : {
     183           0 :         struct rpc_if_id_vector_t *object = (struct rpc_if_id_vector_t *)pytalloc_get_ptr(obj);
     184             :         PyObject *py_if_id;
     185           0 :         py_if_id = PyList_New(object->count);
     186           0 :         if (py_if_id == NULL) {
     187           0 :                 return NULL;
     188             :         }
     189             :         {
     190             :                 int if_id_cntr_0;
     191           0 :                 for (if_id_cntr_0 = 0; if_id_cntr_0 < (object->count); if_id_cntr_0++) {
     192             :                         PyObject *py_if_id_0;
     193           0 :                         py_if_id_0 = pytalloc_reference_ex(&ndr_syntax_id_p_Type, object->if_id, &object->if_id[if_id_cntr_0]);
     194           0 :                         PyList_SetItem(py_if_id, if_id_cntr_0, py_if_id_0);
     195             :                 }
     196             :         }
     197           0 :         return py_if_id;
     198             : }
     199             : 
     200           0 : static int py_rpc_if_id_vector_t_set_if_id(PyObject *py_obj, PyObject *value, void *closure)
     201             : {
     202           0 :         struct rpc_if_id_vector_t *object = (struct rpc_if_id_vector_t *)pytalloc_get_ptr(py_obj);
     203           0 :         if (value == NULL) {
     204           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->if_id");
     205           0 :                 return -1;
     206             :         }
     207           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     208             :         {
     209             :                 int if_id_cntr_0;
     210           0 :                 object->if_id = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->if_id, PyList_GET_SIZE(value));
     211           0 :                 if (!object->if_id) { return -1;; }
     212           0 :                 talloc_set_name_const(object->if_id, "ARRAY: object->if_id");
     213           0 :                 for (if_id_cntr_0 = 0; if_id_cntr_0 < PyList_GET_SIZE(value); if_id_cntr_0++) {
     214           0 :                         if (PyList_GET_ITEM(value, if_id_cntr_0) == NULL) {
     215           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->if_id[if_id_cntr_0]");
     216           0 :                                 return -1;
     217             :                         }
     218           0 :                         PY_CHECK_TYPE(&ndr_syntax_id_p_Type, PyList_GET_ITEM(value, if_id_cntr_0), return -1;);
     219           0 :                         if (talloc_reference(object->if_id, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, if_id_cntr_0))) == NULL) {
     220           0 :                                 PyErr_NoMemory();
     221           0 :                                 return -1;
     222             :                         }
     223           0 :                         object->if_id[if_id_cntr_0] = *(struct ndr_syntax_id_p *)pytalloc_get_ptr(PyList_GET_ITEM(value, if_id_cntr_0));
     224             :                 }
     225             :         }
     226           0 :         return 0;
     227             : }
     228             : 
     229             : static PyGetSetDef py_rpc_if_id_vector_t_getsetters[] = {
     230             :         {
     231             :                 .name = discard_const_p(char, "count"),
     232             :                 .get = py_rpc_if_id_vector_t_get_count,
     233             :                 .set = py_rpc_if_id_vector_t_set_count,
     234             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     235             :         },
     236             :         {
     237             :                 .name = discard_const_p(char, "if_id"),
     238             :                 .get = py_rpc_if_id_vector_t_get_if_id,
     239             :                 .set = py_rpc_if_id_vector_t_set_if_id,
     240             :                 .doc = discard_const_p(char, "PIDL-generated element of base type ndr_syntax_id_p")
     241             :         },
     242             :         { .name = NULL }
     243             : };
     244             : 
     245           0 : static PyObject *py_rpc_if_id_vector_t_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     246             : {
     247           0 :         return pytalloc_new(struct rpc_if_id_vector_t, type);
     248             : }
     249             : 
     250             : 
     251             : static PyTypeObject rpc_if_id_vector_t_Type = {
     252             :         PyVarObject_HEAD_INIT(NULL, 0)
     253             :         .tp_name = "mgmt.rpc_if_id_vector_t",
     254             :         .tp_getset = py_rpc_if_id_vector_t_getsetters,
     255             :         .tp_methods = NULL,
     256             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     257             :         .tp_new = py_rpc_if_id_vector_t_new,
     258             : };
     259             : 
     260             : 
     261           0 : static PyObject *py_mgmt_statistics_get_count(PyObject *obj, void *closure)
     262             : {
     263           0 :         struct mgmt_statistics *object = (struct mgmt_statistics *)pytalloc_get_ptr(obj);
     264             :         PyObject *py_count;
     265           0 :         py_count = PyLong_FromUnsignedLongLong((uint32_t)object->count);
     266           0 :         return py_count;
     267             : }
     268             : 
     269           0 : static int py_mgmt_statistics_set_count(PyObject *py_obj, PyObject *value, void *closure)
     270             : {
     271           0 :         struct mgmt_statistics *object = (struct mgmt_statistics *)pytalloc_get_ptr(py_obj);
     272           0 :         if (value == NULL) {
     273           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->count");
     274           0 :                 return -1;
     275             :         }
     276             :         {
     277           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
     278           0 :                 if (PyLong_Check(value)) {
     279             :                         unsigned long long test_var;
     280           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     281           0 :                         if (PyErr_Occurred() != NULL) {
     282           0 :                                 return -1;
     283             :                         }
     284           0 :                         if (test_var > uint_max) {
     285           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     286             :                                   PyLong_Type.tp_name, uint_max, test_var);
     287           0 :                                 return -1;
     288             :                         }
     289           0 :                         object->count = test_var;
     290             :                 } else {
     291           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     292             :                           PyLong_Type.tp_name);
     293           0 :                         return -1;
     294             :                 }
     295             :         }
     296           0 :         return 0;
     297             : }
     298             : 
     299           0 : static PyObject *py_mgmt_statistics_get_statistics(PyObject *obj, void *closure)
     300             : {
     301           0 :         struct mgmt_statistics *object = (struct mgmt_statistics *)pytalloc_get_ptr(obj);
     302             :         PyObject *py_statistics;
     303           0 :         py_statistics = PyList_New(object->count);
     304           0 :         if (py_statistics == NULL) {
     305           0 :                 return NULL;
     306             :         }
     307             :         {
     308             :                 int statistics_cntr_0;
     309           0 :                 for (statistics_cntr_0 = 0; statistics_cntr_0 < (object->count); statistics_cntr_0++) {
     310             :                         PyObject *py_statistics_0;
     311           0 :                         py_statistics_0 = PyLong_FromUnsignedLongLong((uint32_t)object->statistics[statistics_cntr_0]);
     312           0 :                         PyList_SetItem(py_statistics, statistics_cntr_0, py_statistics_0);
     313             :                 }
     314             :         }
     315           0 :         return py_statistics;
     316             : }
     317             : 
     318           0 : static int py_mgmt_statistics_set_statistics(PyObject *py_obj, PyObject *value, void *closure)
     319             : {
     320           0 :         struct mgmt_statistics *object = (struct mgmt_statistics *)pytalloc_get_ptr(py_obj);
     321           0 :         if (value == NULL) {
     322           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->statistics");
     323           0 :                 return -1;
     324             :         }
     325           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     326             :         {
     327             :                 int statistics_cntr_0;
     328           0 :                 object->statistics = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->statistics, PyList_GET_SIZE(value));
     329           0 :                 if (!object->statistics) { return -1;; }
     330           0 :                 talloc_set_name_const(object->statistics, "ARRAY: object->statistics");
     331           0 :                 for (statistics_cntr_0 = 0; statistics_cntr_0 < PyList_GET_SIZE(value); statistics_cntr_0++) {
     332           0 :                         if (PyList_GET_ITEM(value, statistics_cntr_0) == NULL) {
     333           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->statistics[statistics_cntr_0]");
     334           0 :                                 return -1;
     335             :                         }
     336             :                         {
     337           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->statistics[statistics_cntr_0]));
     338           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, statistics_cntr_0))) {
     339             :                                         unsigned long long test_var;
     340           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, statistics_cntr_0));
     341           0 :                                         if (PyErr_Occurred() != NULL) {
     342           0 :                                                 return -1;
     343             :                                         }
     344           0 :                                         if (test_var > uint_max) {
     345           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     346             :                                                   PyLong_Type.tp_name, uint_max, test_var);
     347           0 :                                                 return -1;
     348             :                                         }
     349           0 :                                         object->statistics[statistics_cntr_0] = test_var;
     350             :                                 } else {
     351           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     352             :                                           PyLong_Type.tp_name);
     353           0 :                                         return -1;
     354             :                                 }
     355             :                         }
     356             :                 }
     357             :         }
     358           0 :         return 0;
     359             : }
     360             : 
     361             : static PyGetSetDef py_mgmt_statistics_getsetters[] = {
     362             :         {
     363             :                 .name = discard_const_p(char, "count"),
     364             :                 .get = py_mgmt_statistics_get_count,
     365             :                 .set = py_mgmt_statistics_set_count,
     366             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     367             :         },
     368             :         {
     369             :                 .name = discard_const_p(char, "statistics"),
     370             :                 .get = py_mgmt_statistics_get_statistics,
     371             :                 .set = py_mgmt_statistics_set_statistics,
     372             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     373             :         },
     374             :         { .name = NULL }
     375             : };
     376             : 
     377           0 : static PyObject *py_mgmt_statistics_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     378             : {
     379           0 :         return pytalloc_new(struct mgmt_statistics, type);
     380             : }
     381             : 
     382             : 
     383             : static PyTypeObject mgmt_statistics_Type = {
     384             :         PyVarObject_HEAD_INIT(NULL, 0)
     385             :         .tp_name = "mgmt.statistics",
     386             :         .tp_getset = py_mgmt_statistics_getsetters,
     387             :         .tp_methods = NULL,
     388             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     389             :         .tp_new = py_mgmt_statistics_new,
     390             : };
     391             : 
     392             : 
     393             : 
     394           0 : static PyObject *py_mgmt_inq_if_ids_out_get_if_id_vector(PyObject *obj, void *closure)
     395             : {
     396           0 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(obj);
     397             :         PyObject *py_if_id_vector;
     398           0 :         if (object->out.if_id_vector == NULL) {
     399           0 :                 Py_RETURN_NONE;
     400             :         }
     401           0 :         if (*object->out.if_id_vector == NULL) {
     402           0 :                 py_if_id_vector = Py_None;
     403           0 :                 Py_INCREF(py_if_id_vector);
     404             :         } else {
     405           0 :                 py_if_id_vector = pytalloc_reference_ex(&rpc_if_id_vector_t_Type, *object->out.if_id_vector, *object->out.if_id_vector);
     406             :         }
     407           0 :         return py_if_id_vector;
     408             : }
     409             : 
     410           0 : static int py_mgmt_inq_if_ids_out_set_if_id_vector(PyObject *py_obj, PyObject *value, void *closure)
     411             : {
     412           0 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(py_obj);
     413           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.if_id_vector));
     414           0 :         if (value == NULL) {
     415           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.if_id_vector");
     416           0 :                 return -1;
     417             :         }
     418           0 :         object->out.if_id_vector = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.if_id_vector);
     419           0 :         if (object->out.if_id_vector == NULL) {
     420           0 :                 PyErr_NoMemory();
     421           0 :                 return -1;
     422             :         }
     423           0 :         if (value == Py_None) {
     424           0 :                 *object->out.if_id_vector = NULL;
     425             :         } else {
     426           0 :                 *object->out.if_id_vector = NULL;
     427           0 :                 PY_CHECK_TYPE(&rpc_if_id_vector_t_Type, value, return -1;);
     428           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     429           0 :                         PyErr_NoMemory();
     430           0 :                         return -1;
     431             :                 }
     432           0 :                 *object->out.if_id_vector = (struct rpc_if_id_vector_t *)pytalloc_get_ptr(value);
     433             :         }
     434           0 :         return 0;
     435             : }
     436             : 
     437           0 : static PyObject *py_mgmt_inq_if_ids_get_result(PyObject *obj, void *closure)
     438             : {
     439           0 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(obj);
     440             :         PyObject *py_result;
     441           0 :         py_result = PyErr_FromWERROR(object->out.result);
     442           0 :         return py_result;
     443             : }
     444             : 
     445           0 : static int py_mgmt_inq_if_ids_set_result(PyObject *py_obj, PyObject *value, void *closure)
     446             : {
     447           0 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(py_obj);
     448           0 :         if (value == NULL) {
     449           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
     450           0 :                 return -1;
     451             :         }
     452           0 :         object->out.result = W_ERROR(PyLong_AsLong(value));
     453           0 :         return 0;
     454             : }
     455             : 
     456             : static PyGetSetDef py_mgmt_inq_if_ids_getsetters[] = {
     457             :         {
     458             :                 .name = discard_const_p(char, "out_if_id_vector"),
     459             :                 .get = py_mgmt_inq_if_ids_out_get_if_id_vector,
     460             :                 .set = py_mgmt_inq_if_ids_out_set_if_id_vector,
     461             :                 .doc = discard_const_p(char, "PIDL-generated element of base type rpc_if_id_vector_t")
     462             :         },
     463             :         {
     464             :                 .name = discard_const_p(char, "result"),
     465             :                 .get = py_mgmt_inq_if_ids_get_result,
     466             :                 .set = py_mgmt_inq_if_ids_set_result,
     467             :                 .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
     468             :         },
     469             :         { .name = NULL }
     470             : };
     471             : 
     472          23 : static PyObject *py_mgmt_inq_if_ids_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     473             : {
     474          23 :         PyObject *self = pytalloc_new(struct mgmt_inq_if_ids, type);
     475          23 :         struct mgmt_inq_if_ids *_self = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(self);
     476          23 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
     477             :         /* a pointer to a NULL pointer */
     478          23 :         _self->out.if_id_vector = talloc_zero(mem_ctx, struct rpc_if_id_vector_t *);
     479          23 :         return self;
     480             : }
     481             : 
     482          73 : static PyObject *py_mgmt_inq_if_ids_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
     483             : {
     484             : 
     485             : 
     486          73 :         return PyLong_FromLong(0);
     487             : }
     488             : 
     489          73 : static PyObject *py_mgmt_inq_if_ids_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
     490             : {
     491          73 :         const struct ndr_interface_call *call = NULL;
     492          73 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(py_obj);
     493          73 :         PyObject *ret = NULL;
     494          73 :         struct ndr_push *push = NULL;
     495             :         DATA_BLOB blob;
     496             :         enum ndr_err_code err;
     497             : 
     498          73 :         if (ndr_table_mgmt.num_calls < 1) {
     499           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_if_ids_ndr_pack");
     500           0 :                 return NULL;
     501             :         }
     502          73 :         call = &ndr_table_mgmt.calls[0];
     503             : 
     504          73 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
     505          73 :         if (push == NULL) {
     506           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     507           0 :                 return NULL;
     508             :         }
     509             : 
     510          73 :         push->flags |= ndr_push_flags;
     511             : 
     512          73 :         err = call->ndr_push(push, ndr_inout_flags, object);
     513          73 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     514           0 :                 TALLOC_FREE(push);
     515           0 :                 PyErr_SetNdrError(err);
     516           0 :                 return NULL;
     517             :         }
     518          73 :         blob = ndr_push_blob(push);
     519          73 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     520          73 :         TALLOC_FREE(push);
     521          73 :         return ret;
     522             : }
     523             : 
     524          73 : static PyObject *py_mgmt_inq_if_ids_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     525             : {
     526          73 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     527          73 :         PyObject *bigendian_obj = NULL;
     528          73 :         PyObject *ndr64_obj = NULL;
     529          73 :         uint32_t ndr_push_flags = 0;
     530             : 
     531          73 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
     532             :                 discard_const_p(char *, kwnames),
     533             :                 &bigendian_obj,
     534             :                 &ndr64_obj)) {
     535           0 :                 return NULL;
     536             :         }
     537             : 
     538          73 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     539           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     540             :         }
     541          73 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     542           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     543             :         }
     544             : 
     545          73 :         return py_mgmt_inq_if_ids_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
     546             : }
     547             : 
     548           0 : static PyObject *py_mgmt_inq_if_ids_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     549             : {
     550           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     551           0 :         PyObject *bigendian_obj = NULL;
     552           0 :         PyObject *ndr64_obj = NULL;
     553           0 :         uint32_t ndr_push_flags = 0;
     554             : 
     555           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
     556             :                 discard_const_p(char *, kwnames),
     557             :                 &bigendian_obj,
     558             :                 &ndr64_obj)) {
     559           0 :                 return NULL;
     560             :         }
     561             : 
     562           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     563           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     564             :         }
     565           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     566           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     567             :         }
     568             : 
     569           0 :         return py_mgmt_inq_if_ids_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
     570             : }
     571             : 
     572          56 : static PyObject *py_mgmt_inq_if_ids_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
     573             : {
     574          56 :         const struct ndr_interface_call *call = NULL;
     575          56 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(py_obj);
     576          56 :         struct ndr_pull *pull = NULL;
     577             :         enum ndr_err_code err;
     578             : 
     579          56 :         if (ndr_table_mgmt.num_calls < 1) {
     580           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_if_ids_ndr_unpack");
     581           0 :                 return NULL;
     582             :         }
     583          56 :         call = &ndr_table_mgmt.calls[0];
     584             : 
     585          56 :         pull = ndr_pull_init_blob(blob, object);
     586          56 :         if (pull == NULL) {
     587           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     588           0 :                 return NULL;
     589             :         }
     590             : 
     591          56 :         pull->flags |= ndr_pull_flags;
     592             : 
     593          56 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
     594          56 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     595           0 :                 TALLOC_FREE(pull);
     596           0 :                 PyErr_SetNdrError(err);
     597           0 :                 return NULL;
     598             :         }
     599          56 :         if (!allow_remaining) {
     600             :                 uint32_t highest_ofs;
     601             : 
     602          56 :                 if (pull->offset > pull->relative_highest_offset) {
     603          56 :                         highest_ofs = pull->offset;
     604             :                 } else {
     605           0 :                         highest_ofs = pull->relative_highest_offset;
     606             :                 }
     607          56 :                 if (highest_ofs < pull->data_size) {
     608           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
     609             :                                 "not all bytes consumed ofs[%u] size[%u]",
     610             :                                 highest_ofs, pull->data_size);
     611           0 :                         TALLOC_FREE(pull);
     612           0 :                         PyErr_SetNdrError(err);
     613           0 :                         return NULL;
     614             :                 }
     615             :         }
     616             : 
     617          56 :         TALLOC_FREE(pull);
     618          56 :         Py_RETURN_NONE;
     619             : }
     620             : 
     621           0 : static PyObject *py_mgmt_inq_if_ids_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     622             : {
     623             :         DATA_BLOB blob;
     624           0 :         Py_ssize_t blob_length = 0;
     625           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     626           0 :         PyObject *bigendian_obj = NULL;
     627           0 :         PyObject *ndr64_obj = NULL;
     628           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     629           0 :         PyObject *allow_remaining_obj = NULL;
     630           0 :         bool allow_remaining = false;
     631             : 
     632           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
     633             :                 discard_const_p(char *, kwnames),
     634             :                 &blob.data, &blob_length,
     635             :                 &bigendian_obj,
     636             :                 &ndr64_obj,
     637             :                 &allow_remaining_obj)) {
     638           0 :                 return NULL;
     639             :         }
     640           0 :         blob.length = blob_length;
     641             : 
     642           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     643           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     644             :         }
     645           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     646           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     647             :         }
     648             : 
     649           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     650           0 :                 allow_remaining = true;
     651             :         }
     652             : 
     653           0 :         return py_mgmt_inq_if_ids_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
     654             : }
     655             : 
     656          56 : static PyObject *py_mgmt_inq_if_ids_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     657             : {
     658             :         DATA_BLOB blob;
     659          56 :         Py_ssize_t blob_length = 0;
     660          56 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     661          56 :         PyObject *bigendian_obj = NULL;
     662          56 :         PyObject *ndr64_obj = NULL;
     663          56 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     664          56 :         PyObject *allow_remaining_obj = NULL;
     665          56 :         bool allow_remaining = false;
     666             : 
     667          56 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
     668             :                 discard_const_p(char *, kwnames),
     669             :                 &blob.data, &blob_length,
     670             :                 &bigendian_obj,
     671             :                 &ndr64_obj,
     672             :                 &allow_remaining_obj)) {
     673           0 :                 return NULL;
     674             :         }
     675          56 :         blob.length = blob_length;
     676             : 
     677          56 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     678           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     679             :         }
     680          56 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     681           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     682             :         }
     683             : 
     684          56 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     685           0 :                 allow_remaining = true;
     686             :         }
     687             : 
     688          56 :         return py_mgmt_inq_if_ids_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
     689             : }
     690             : 
     691           0 : static PyObject *py_mgmt_inq_if_ids_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
     692             : {
     693           0 :         const struct ndr_interface_call *call = NULL;
     694           0 :         struct mgmt_inq_if_ids *object = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(py_obj);
     695             :         PyObject *ret;
     696             :         char *retstr;
     697             : 
     698           0 :         if (ndr_table_mgmt.num_calls < 1) {
     699           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_if_ids_ndr_print");
     700           0 :                 return NULL;
     701             :         }
     702           0 :         call = &ndr_table_mgmt.calls[0];
     703             : 
     704           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
     705           0 :         ret = PyUnicode_FromString(retstr);
     706           0 :         TALLOC_FREE(retstr);
     707             : 
     708           0 :         return ret;
     709             : }
     710             : 
     711           0 : static PyObject *py_mgmt_inq_if_ids_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     712             : {
     713           0 :         return py_mgmt_inq_if_ids_ndr_print(py_obj, "mgmt_inq_if_ids_in", NDR_IN);
     714             : }
     715             : 
     716           0 : static PyObject *py_mgmt_inq_if_ids_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     717             : {
     718           0 :         return py_mgmt_inq_if_ids_ndr_print(py_obj, "mgmt_inq_if_ids_out", NDR_OUT);
     719             : }
     720             : 
     721             : static PyMethodDef py_mgmt_inq_if_ids_methods[] = {
     722             :         { "opnum", (PyCFunction)py_mgmt_inq_if_ids_ndr_opnum, METH_NOARGS|METH_CLASS,
     723             :                 "mgmt.inq_if_ids.opnum() -> 0 (0x00) " },
     724             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_if_ids_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
     725             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
     726             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_if_ids_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
     727             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
     728             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_if_ids_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
     729             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
     730             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_if_ids_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
     731             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
     732             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_inq_if_ids_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
     733             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_inq_if_ids_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
     734             :         { NULL, NULL, 0, NULL }
     735             : };
     736             : 
     737             : 
     738             : static PyTypeObject mgmt_inq_if_ids_Type = {
     739             :         PyVarObject_HEAD_INIT(NULL, 0)
     740             :         .tp_name = "mgmt.inq_if_ids",
     741             :         .tp_getset = py_mgmt_inq_if_ids_getsetters,
     742             :         .tp_methods = py_mgmt_inq_if_ids_methods,
     743             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     744             :         .tp_new = py_mgmt_inq_if_ids_new,
     745             : };
     746             : 
     747           0 : static bool pack_py_mgmt_inq_if_ids_args_in(PyObject *args, PyObject *kwargs, struct mgmt_inq_if_ids *r)
     748             : {
     749           0 :         const char *kwnames[] = {
     750             :                 NULL
     751             :         };
     752             : 
     753           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":mgmt_inq_if_ids", discard_const_p(char *, kwnames))) {
     754           0 :                 return false;
     755             :         }
     756             : 
     757           0 :         return true;
     758             : }
     759             : 
     760           0 : static PyObject *unpack_py_mgmt_inq_if_ids_args_out(struct mgmt_inq_if_ids *r)
     761             : {
     762             :         PyObject *result;
     763             :         PyObject *py_if_id_vector;
     764           0 :         if (*r->out.if_id_vector == NULL) {
     765           0 :                 py_if_id_vector = Py_None;
     766           0 :                 Py_INCREF(py_if_id_vector);
     767             :         } else {
     768           0 :                 py_if_id_vector = pytalloc_reference_ex(&rpc_if_id_vector_t_Type, *r->out.if_id_vector, *r->out.if_id_vector);
     769             :         }
     770           0 :         result = py_if_id_vector;
     771           0 :         if (!W_ERROR_IS_OK(r->out.result)) {
     772           0 :                 PyErr_SetWERROR(r->out.result);
     773           0 :                 return NULL;
     774             :         }
     775             : 
     776           0 :         return result;
     777             : }
     778             : 
     779             : 
     780           0 : static PyObject *py_mgmt_inq_stats_in_get_max_count(PyObject *obj, void *closure)
     781             : {
     782           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(obj);
     783             :         PyObject *py_max_count;
     784           0 :         py_max_count = PyLong_FromUnsignedLongLong((uint32_t)object->in.max_count);
     785           0 :         return py_max_count;
     786             : }
     787             : 
     788           0 : static int py_mgmt_inq_stats_in_set_max_count(PyObject *py_obj, PyObject *value, void *closure)
     789             : {
     790           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
     791           0 :         if (value == NULL) {
     792           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.max_count");
     793           0 :                 return -1;
     794             :         }
     795             :         {
     796           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.max_count));
     797           0 :                 if (PyLong_Check(value)) {
     798             :                         unsigned long long test_var;
     799           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     800           0 :                         if (PyErr_Occurred() != NULL) {
     801           0 :                                 return -1;
     802             :                         }
     803           0 :                         if (test_var > uint_max) {
     804           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     805             :                                   PyLong_Type.tp_name, uint_max, test_var);
     806           0 :                                 return -1;
     807             :                         }
     808           0 :                         object->in.max_count = test_var;
     809             :                 } else {
     810           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     811             :                           PyLong_Type.tp_name);
     812           0 :                         return -1;
     813             :                 }
     814             :         }
     815           0 :         return 0;
     816             : }
     817             : 
     818           0 : static PyObject *py_mgmt_inq_stats_in_get_unknown(PyObject *obj, void *closure)
     819             : {
     820           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(obj);
     821             :         PyObject *py_unknown;
     822           0 :         py_unknown = PyLong_FromUnsignedLongLong((uint32_t)object->in.unknown);
     823           0 :         return py_unknown;
     824             : }
     825             : 
     826           0 : static int py_mgmt_inq_stats_in_set_unknown(PyObject *py_obj, PyObject *value, void *closure)
     827             : {
     828           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
     829           0 :         if (value == NULL) {
     830           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.unknown");
     831           0 :                 return -1;
     832             :         }
     833             :         {
     834           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.unknown));
     835           0 :                 if (PyLong_Check(value)) {
     836             :                         unsigned long long test_var;
     837           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     838           0 :                         if (PyErr_Occurred() != NULL) {
     839           0 :                                 return -1;
     840             :                         }
     841           0 :                         if (test_var > uint_max) {
     842           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     843             :                                   PyLong_Type.tp_name, uint_max, test_var);
     844           0 :                                 return -1;
     845             :                         }
     846           0 :                         object->in.unknown = test_var;
     847             :                 } else {
     848           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     849             :                           PyLong_Type.tp_name);
     850           0 :                         return -1;
     851             :                 }
     852             :         }
     853           0 :         return 0;
     854             : }
     855             : 
     856           0 : static PyObject *py_mgmt_inq_stats_out_get_statistics(PyObject *obj, void *closure)
     857             : {
     858           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(obj);
     859             :         PyObject *py_statistics;
     860           0 :         if (object->out.statistics == NULL) {
     861           0 :                 Py_RETURN_NONE;
     862             :         }
     863           0 :         py_statistics = pytalloc_reference_ex(&mgmt_statistics_Type, object->out.statistics, object->out.statistics);
     864           0 :         return py_statistics;
     865             : }
     866             : 
     867           0 : static int py_mgmt_inq_stats_out_set_statistics(PyObject *py_obj, PyObject *value, void *closure)
     868             : {
     869           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
     870           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.statistics));
     871           0 :         if (value == NULL) {
     872           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.statistics");
     873           0 :                 return -1;
     874             :         }
     875           0 :         object->out.statistics = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.statistics);
     876           0 :         if (object->out.statistics == NULL) {
     877           0 :                 PyErr_NoMemory();
     878           0 :                 return -1;
     879             :         }
     880           0 :         PY_CHECK_TYPE(&mgmt_statistics_Type, value, return -1;);
     881           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     882           0 :                 PyErr_NoMemory();
     883           0 :                 return -1;
     884             :         }
     885           0 :         object->out.statistics = (struct mgmt_statistics *)pytalloc_get_ptr(value);
     886           0 :         return 0;
     887             : }
     888             : 
     889           0 : static PyObject *py_mgmt_inq_stats_get_result(PyObject *obj, void *closure)
     890             : {
     891           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(obj);
     892             :         PyObject *py_result;
     893           0 :         py_result = PyErr_FromWERROR(object->out.result);
     894           0 :         return py_result;
     895             : }
     896             : 
     897           0 : static int py_mgmt_inq_stats_set_result(PyObject *py_obj, PyObject *value, void *closure)
     898             : {
     899           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
     900           0 :         if (value == NULL) {
     901           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
     902           0 :                 return -1;
     903             :         }
     904           0 :         object->out.result = W_ERROR(PyLong_AsLong(value));
     905           0 :         return 0;
     906             : }
     907             : 
     908             : static PyGetSetDef py_mgmt_inq_stats_getsetters[] = {
     909             :         {
     910             :                 .name = discard_const_p(char, "in_max_count"),
     911             :                 .get = py_mgmt_inq_stats_in_get_max_count,
     912             :                 .set = py_mgmt_inq_stats_in_set_max_count,
     913             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     914             :         },
     915             :         {
     916             :                 .name = discard_const_p(char, "in_unknown"),
     917             :                 .get = py_mgmt_inq_stats_in_get_unknown,
     918             :                 .set = py_mgmt_inq_stats_in_set_unknown,
     919             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     920             :         },
     921             :         {
     922             :                 .name = discard_const_p(char, "out_statistics"),
     923             :                 .get = py_mgmt_inq_stats_out_get_statistics,
     924             :                 .set = py_mgmt_inq_stats_out_set_statistics,
     925             :                 .doc = discard_const_p(char, "PIDL-generated element of base type mgmt_statistics")
     926             :         },
     927             :         {
     928             :                 .name = discard_const_p(char, "result"),
     929             :                 .get = py_mgmt_inq_stats_get_result,
     930             :                 .set = py_mgmt_inq_stats_set_result,
     931             :                 .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
     932             :         },
     933             :         { .name = NULL }
     934             : };
     935             : 
     936           0 : static PyObject *py_mgmt_inq_stats_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     937             : {
     938           0 :         PyObject *self = pytalloc_new(struct mgmt_inq_stats, type);
     939           0 :         struct mgmt_inq_stats *_self = (struct mgmt_inq_stats *)pytalloc_get_ptr(self);
     940           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
     941           0 :         _self->out.statistics = talloc_zero(mem_ctx, struct mgmt_statistics);
     942           0 :         return self;
     943             : }
     944             : 
     945           0 : static PyObject *py_mgmt_inq_stats_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
     946             : {
     947             : 
     948             : 
     949           0 :         return PyLong_FromLong(1);
     950             : }
     951             : 
     952           0 : static PyObject *py_mgmt_inq_stats_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
     953             : {
     954           0 :         const struct ndr_interface_call *call = NULL;
     955           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
     956           0 :         PyObject *ret = NULL;
     957           0 :         struct ndr_push *push = NULL;
     958             :         DATA_BLOB blob;
     959             :         enum ndr_err_code err;
     960             : 
     961           0 :         if (ndr_table_mgmt.num_calls < 2) {
     962           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_stats_ndr_pack");
     963           0 :                 return NULL;
     964             :         }
     965           0 :         call = &ndr_table_mgmt.calls[1];
     966             : 
     967           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
     968           0 :         if (push == NULL) {
     969           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     970           0 :                 return NULL;
     971             :         }
     972             : 
     973           0 :         push->flags |= ndr_push_flags;
     974             : 
     975           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
     976           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     977           0 :                 TALLOC_FREE(push);
     978           0 :                 PyErr_SetNdrError(err);
     979           0 :                 return NULL;
     980             :         }
     981           0 :         blob = ndr_push_blob(push);
     982           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     983           0 :         TALLOC_FREE(push);
     984           0 :         return ret;
     985             : }
     986             : 
     987           0 : static PyObject *py_mgmt_inq_stats_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     988             : {
     989           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     990           0 :         PyObject *bigendian_obj = NULL;
     991           0 :         PyObject *ndr64_obj = NULL;
     992           0 :         uint32_t ndr_push_flags = 0;
     993             : 
     994           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
     995             :                 discard_const_p(char *, kwnames),
     996             :                 &bigendian_obj,
     997             :                 &ndr64_obj)) {
     998           0 :                 return NULL;
     999             :         }
    1000             : 
    1001           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1002           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1003             :         }
    1004           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1005           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1006             :         }
    1007             : 
    1008           0 :         return py_mgmt_inq_stats_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1009             : }
    1010             : 
    1011           0 : static PyObject *py_mgmt_inq_stats_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1012             : {
    1013           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1014           0 :         PyObject *bigendian_obj = NULL;
    1015           0 :         PyObject *ndr64_obj = NULL;
    1016           0 :         uint32_t ndr_push_flags = 0;
    1017             : 
    1018           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1019             :                 discard_const_p(char *, kwnames),
    1020             :                 &bigendian_obj,
    1021             :                 &ndr64_obj)) {
    1022           0 :                 return NULL;
    1023             :         }
    1024             : 
    1025           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1026           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1027             :         }
    1028           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1029           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1030             :         }
    1031             : 
    1032           0 :         return py_mgmt_inq_stats_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1033             : }
    1034             : 
    1035           0 : static PyObject *py_mgmt_inq_stats_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1036             : {
    1037           0 :         const struct ndr_interface_call *call = NULL;
    1038           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
    1039           0 :         struct ndr_pull *pull = NULL;
    1040             :         enum ndr_err_code err;
    1041             : 
    1042           0 :         if (ndr_table_mgmt.num_calls < 2) {
    1043           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_stats_ndr_unpack");
    1044           0 :                 return NULL;
    1045             :         }
    1046           0 :         call = &ndr_table_mgmt.calls[1];
    1047             : 
    1048           0 :         pull = ndr_pull_init_blob(blob, object);
    1049           0 :         if (pull == NULL) {
    1050           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1051           0 :                 return NULL;
    1052             :         }
    1053             : 
    1054           0 :         pull->flags |= ndr_pull_flags;
    1055             : 
    1056           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1057           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1058           0 :                 TALLOC_FREE(pull);
    1059           0 :                 PyErr_SetNdrError(err);
    1060           0 :                 return NULL;
    1061             :         }
    1062           0 :         if (!allow_remaining) {
    1063             :                 uint32_t highest_ofs;
    1064             : 
    1065           0 :                 if (pull->offset > pull->relative_highest_offset) {
    1066           0 :                         highest_ofs = pull->offset;
    1067             :                 } else {
    1068           0 :                         highest_ofs = pull->relative_highest_offset;
    1069             :                 }
    1070           0 :                 if (highest_ofs < pull->data_size) {
    1071           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1072             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1073             :                                 highest_ofs, pull->data_size);
    1074           0 :                         TALLOC_FREE(pull);
    1075           0 :                         PyErr_SetNdrError(err);
    1076           0 :                         return NULL;
    1077             :                 }
    1078             :         }
    1079             : 
    1080           0 :         TALLOC_FREE(pull);
    1081           0 :         Py_RETURN_NONE;
    1082             : }
    1083             : 
    1084           0 : static PyObject *py_mgmt_inq_stats_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1085             : {
    1086             :         DATA_BLOB blob;
    1087           0 :         Py_ssize_t blob_length = 0;
    1088           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1089           0 :         PyObject *bigendian_obj = NULL;
    1090           0 :         PyObject *ndr64_obj = NULL;
    1091           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1092           0 :         PyObject *allow_remaining_obj = NULL;
    1093           0 :         bool allow_remaining = false;
    1094             : 
    1095           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1096             :                 discard_const_p(char *, kwnames),
    1097             :                 &blob.data, &blob_length,
    1098             :                 &bigendian_obj,
    1099             :                 &ndr64_obj,
    1100             :                 &allow_remaining_obj)) {
    1101           0 :                 return NULL;
    1102             :         }
    1103           0 :         blob.length = blob_length;
    1104             : 
    1105           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1106           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1107             :         }
    1108           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1109           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1110             :         }
    1111             : 
    1112           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1113           0 :                 allow_remaining = true;
    1114             :         }
    1115             : 
    1116           0 :         return py_mgmt_inq_stats_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1117             : }
    1118             : 
    1119           0 : static PyObject *py_mgmt_inq_stats_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1120             : {
    1121             :         DATA_BLOB blob;
    1122           0 :         Py_ssize_t blob_length = 0;
    1123           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1124           0 :         PyObject *bigendian_obj = NULL;
    1125           0 :         PyObject *ndr64_obj = NULL;
    1126           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1127           0 :         PyObject *allow_remaining_obj = NULL;
    1128           0 :         bool allow_remaining = false;
    1129             : 
    1130           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1131             :                 discard_const_p(char *, kwnames),
    1132             :                 &blob.data, &blob_length,
    1133             :                 &bigendian_obj,
    1134             :                 &ndr64_obj,
    1135             :                 &allow_remaining_obj)) {
    1136           0 :                 return NULL;
    1137             :         }
    1138           0 :         blob.length = blob_length;
    1139             : 
    1140           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1141           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1142             :         }
    1143           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1144           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1145             :         }
    1146             : 
    1147           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1148           0 :                 allow_remaining = true;
    1149             :         }
    1150             : 
    1151           0 :         return py_mgmt_inq_stats_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1152             : }
    1153             : 
    1154           0 : static PyObject *py_mgmt_inq_stats_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1155             : {
    1156           0 :         const struct ndr_interface_call *call = NULL;
    1157           0 :         struct mgmt_inq_stats *object = (struct mgmt_inq_stats *)pytalloc_get_ptr(py_obj);
    1158             :         PyObject *ret;
    1159             :         char *retstr;
    1160             : 
    1161           0 :         if (ndr_table_mgmt.num_calls < 2) {
    1162           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_stats_ndr_print");
    1163           0 :                 return NULL;
    1164             :         }
    1165           0 :         call = &ndr_table_mgmt.calls[1];
    1166             : 
    1167           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1168           0 :         ret = PyUnicode_FromString(retstr);
    1169           0 :         TALLOC_FREE(retstr);
    1170             : 
    1171           0 :         return ret;
    1172             : }
    1173             : 
    1174           0 : static PyObject *py_mgmt_inq_stats_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1175             : {
    1176           0 :         return py_mgmt_inq_stats_ndr_print(py_obj, "mgmt_inq_stats_in", NDR_IN);
    1177             : }
    1178             : 
    1179           0 : static PyObject *py_mgmt_inq_stats_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1180             : {
    1181           0 :         return py_mgmt_inq_stats_ndr_print(py_obj, "mgmt_inq_stats_out", NDR_OUT);
    1182             : }
    1183             : 
    1184             : static PyMethodDef py_mgmt_inq_stats_methods[] = {
    1185             :         { "opnum", (PyCFunction)py_mgmt_inq_stats_ndr_opnum, METH_NOARGS|METH_CLASS,
    1186             :                 "mgmt.inq_stats.opnum() -> 1 (0x01) " },
    1187             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_stats_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1188             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1189             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_stats_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1190             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1191             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_stats_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1192             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1193             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_stats_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1194             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1195             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_inq_stats_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1196             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_inq_stats_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1197             :         { NULL, NULL, 0, NULL }
    1198             : };
    1199             : 
    1200             : 
    1201             : static PyTypeObject mgmt_inq_stats_Type = {
    1202             :         PyVarObject_HEAD_INIT(NULL, 0)
    1203             :         .tp_name = "mgmt.inq_stats",
    1204             :         .tp_getset = py_mgmt_inq_stats_getsetters,
    1205             :         .tp_methods = py_mgmt_inq_stats_methods,
    1206             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1207             :         .tp_new = py_mgmt_inq_stats_new,
    1208             : };
    1209             : 
    1210           0 : static bool pack_py_mgmt_inq_stats_args_in(PyObject *args, PyObject *kwargs, struct mgmt_inq_stats *r)
    1211             : {
    1212             :         PyObject *py_max_count;
    1213             :         PyObject *py_unknown;
    1214           0 :         const char *kwnames[] = {
    1215             :                 "max_count", "unknown", NULL
    1216             :         };
    1217             : 
    1218           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:mgmt_inq_stats", discard_const_p(char *, kwnames), &py_max_count, &py_unknown)) {
    1219           0 :                 return false;
    1220             :         }
    1221             : 
    1222           0 :         if (py_max_count == NULL) {
    1223           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.max_count");
    1224           0 :                 return false;
    1225             :         }
    1226             :         {
    1227           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.max_count));
    1228           0 :                 if (PyLong_Check(py_max_count)) {
    1229             :                         unsigned long long test_var;
    1230           0 :                         test_var = PyLong_AsUnsignedLongLong(py_max_count);
    1231           0 :                         if (PyErr_Occurred() != NULL) {
    1232           0 :                                 return false;
    1233             :                         }
    1234           0 :                         if (test_var > uint_max) {
    1235           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1236             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1237           0 :                                 return false;
    1238             :                         }
    1239           0 :                         r->in.max_count = test_var;
    1240             :                 } else {
    1241           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1242             :                           PyLong_Type.tp_name);
    1243           0 :                         return false;
    1244             :                 }
    1245             :         }
    1246           0 :         if (py_unknown == NULL) {
    1247           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.unknown");
    1248           0 :                 return false;
    1249             :         }
    1250             :         {
    1251           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.unknown));
    1252           0 :                 if (PyLong_Check(py_unknown)) {
    1253             :                         unsigned long long test_var;
    1254           0 :                         test_var = PyLong_AsUnsignedLongLong(py_unknown);
    1255           0 :                         if (PyErr_Occurred() != NULL) {
    1256           0 :                                 return false;
    1257             :                         }
    1258           0 :                         if (test_var > uint_max) {
    1259           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1260             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1261           0 :                                 return false;
    1262             :                         }
    1263           0 :                         r->in.unknown = test_var;
    1264             :                 } else {
    1265           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1266             :                           PyLong_Type.tp_name);
    1267           0 :                         return false;
    1268             :                 }
    1269             :         }
    1270           0 :         return true;
    1271             : }
    1272             : 
    1273           0 : static PyObject *unpack_py_mgmt_inq_stats_args_out(struct mgmt_inq_stats *r)
    1274             : {
    1275             :         PyObject *result;
    1276             :         PyObject *py_statistics;
    1277           0 :         py_statistics = pytalloc_reference_ex(&mgmt_statistics_Type, r->out.statistics, r->out.statistics);
    1278           0 :         result = py_statistics;
    1279           0 :         if (!W_ERROR_IS_OK(r->out.result)) {
    1280           0 :                 PyErr_SetWERROR(r->out.result);
    1281           0 :                 return NULL;
    1282             :         }
    1283             : 
    1284           0 :         return result;
    1285             : }
    1286             : 
    1287             : 
    1288           0 : static PyObject *py_mgmt_is_server_listening_out_get_status(PyObject *obj, void *closure)
    1289             : {
    1290           0 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(obj);
    1291             :         PyObject *py_status;
    1292           0 :         if (object->out.status == NULL) {
    1293           0 :                 Py_RETURN_NONE;
    1294             :         }
    1295           0 :         py_status = PyLong_FromUnsignedLongLong((uint32_t)*object->out.status);
    1296           0 :         return py_status;
    1297             : }
    1298             : 
    1299           0 : static int py_mgmt_is_server_listening_out_set_status(PyObject *py_obj, PyObject *value, void *closure)
    1300             : {
    1301           0 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(py_obj);
    1302           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.status));
    1303           0 :         if (value == NULL) {
    1304           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.status");
    1305           0 :                 return -1;
    1306             :         }
    1307           0 :         object->out.status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.status);
    1308           0 :         if (object->out.status == NULL) {
    1309           0 :                 PyErr_NoMemory();
    1310           0 :                 return -1;
    1311             :         }
    1312             :         {
    1313           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.status));
    1314           0 :                 if (PyLong_Check(value)) {
    1315             :                         unsigned long long test_var;
    1316           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1317           0 :                         if (PyErr_Occurred() != NULL) {
    1318           0 :                                 return -1;
    1319             :                         }
    1320           0 :                         if (test_var > uint_max) {
    1321           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1322             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1323           0 :                                 return -1;
    1324             :                         }
    1325           0 :                         *object->out.status = test_var;
    1326             :                 } else {
    1327           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1328             :                           PyLong_Type.tp_name);
    1329           0 :                         return -1;
    1330             :                 }
    1331             :         }
    1332           0 :         return 0;
    1333             : }
    1334             : 
    1335           0 : static PyObject *py_mgmt_is_server_listening_get_result(PyObject *obj, void *closure)
    1336             : {
    1337           0 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(obj);
    1338             :         PyObject *py_result;
    1339           0 :         py_result = PyLong_FromUnsignedLongLong((uint32_t)object->out.result);
    1340           0 :         return py_result;
    1341             : }
    1342             : 
    1343           0 : static int py_mgmt_is_server_listening_set_result(PyObject *py_obj, PyObject *value, void *closure)
    1344             : {
    1345           0 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(py_obj);
    1346           0 :         if (value == NULL) {
    1347           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    1348           0 :                 return -1;
    1349             :         }
    1350             :         {
    1351           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.result));
    1352           0 :                 if (PyLong_Check(value)) {
    1353             :                         unsigned long long test_var;
    1354           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1355           0 :                         if (PyErr_Occurred() != NULL) {
    1356           0 :                                 return -1;
    1357             :                         }
    1358           0 :                         if (test_var > uint_max) {
    1359           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1360             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1361           0 :                                 return -1;
    1362             :                         }
    1363           0 :                         object->out.result = test_var;
    1364             :                 } else {
    1365           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1366             :                           PyLong_Type.tp_name);
    1367           0 :                         return -1;
    1368             :                 }
    1369             :         }
    1370           0 :         return 0;
    1371             : }
    1372             : 
    1373             : static PyGetSetDef py_mgmt_is_server_listening_getsetters[] = {
    1374             :         {
    1375             :                 .name = discard_const_p(char, "out_status"),
    1376             :                 .get = py_mgmt_is_server_listening_out_get_status,
    1377             :                 .set = py_mgmt_is_server_listening_out_set_status,
    1378             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1379             :         },
    1380             :         {
    1381             :                 .name = discard_const_p(char, "result"),
    1382             :                 .get = py_mgmt_is_server_listening_get_result,
    1383             :                 .set = py_mgmt_is_server_listening_set_result,
    1384             :                 .doc = discard_const_p(char, "PIDL-generated element of type uint32")
    1385             :         },
    1386             :         { .name = NULL }
    1387             : };
    1388             : 
    1389           3 : static PyObject *py_mgmt_is_server_listening_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1390             : {
    1391           3 :         PyObject *self = pytalloc_new(struct mgmt_is_server_listening, type);
    1392           3 :         struct mgmt_is_server_listening *_self = (struct mgmt_is_server_listening *)pytalloc_get_ptr(self);
    1393           3 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    1394           3 :         _self->out.status = talloc_zero(mem_ctx, uint32_t);
    1395           3 :         return self;
    1396             : }
    1397             : 
    1398          24 : static PyObject *py_mgmt_is_server_listening_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1399             : {
    1400             : 
    1401             : 
    1402          24 :         return PyLong_FromLong(2);
    1403             : }
    1404             : 
    1405          24 : static PyObject *py_mgmt_is_server_listening_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1406             : {
    1407          24 :         const struct ndr_interface_call *call = NULL;
    1408          24 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(py_obj);
    1409          24 :         PyObject *ret = NULL;
    1410          24 :         struct ndr_push *push = NULL;
    1411             :         DATA_BLOB blob;
    1412             :         enum ndr_err_code err;
    1413             : 
    1414          24 :         if (ndr_table_mgmt.num_calls < 3) {
    1415           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_is_server_listening_ndr_pack");
    1416           0 :                 return NULL;
    1417             :         }
    1418          24 :         call = &ndr_table_mgmt.calls[2];
    1419             : 
    1420          24 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1421          24 :         if (push == NULL) {
    1422           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1423           0 :                 return NULL;
    1424             :         }
    1425             : 
    1426          24 :         push->flags |= ndr_push_flags;
    1427             : 
    1428          24 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1429          24 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1430           0 :                 TALLOC_FREE(push);
    1431           0 :                 PyErr_SetNdrError(err);
    1432           0 :                 return NULL;
    1433             :         }
    1434          24 :         blob = ndr_push_blob(push);
    1435          24 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1436          24 :         TALLOC_FREE(push);
    1437          24 :         return ret;
    1438             : }
    1439             : 
    1440          24 : static PyObject *py_mgmt_is_server_listening_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1441             : {
    1442          24 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1443          24 :         PyObject *bigendian_obj = NULL;
    1444          24 :         PyObject *ndr64_obj = NULL;
    1445          24 :         uint32_t ndr_push_flags = 0;
    1446             : 
    1447          24 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    1448             :                 discard_const_p(char *, kwnames),
    1449             :                 &bigendian_obj,
    1450             :                 &ndr64_obj)) {
    1451           0 :                 return NULL;
    1452             :         }
    1453             : 
    1454          24 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1455           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1456             :         }
    1457          24 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1458           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1459             :         }
    1460             : 
    1461          24 :         return py_mgmt_is_server_listening_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1462             : }
    1463             : 
    1464           0 : static PyObject *py_mgmt_is_server_listening_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1465             : {
    1466           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1467           0 :         PyObject *bigendian_obj = NULL;
    1468           0 :         PyObject *ndr64_obj = NULL;
    1469           0 :         uint32_t ndr_push_flags = 0;
    1470             : 
    1471           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1472             :                 discard_const_p(char *, kwnames),
    1473             :                 &bigendian_obj,
    1474             :                 &ndr64_obj)) {
    1475           0 :                 return NULL;
    1476             :         }
    1477             : 
    1478           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1479           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1480             :         }
    1481           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1482           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1483             :         }
    1484             : 
    1485           0 :         return py_mgmt_is_server_listening_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1486             : }
    1487             : 
    1488          24 : static PyObject *py_mgmt_is_server_listening_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1489             : {
    1490          24 :         const struct ndr_interface_call *call = NULL;
    1491          24 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(py_obj);
    1492          24 :         struct ndr_pull *pull = NULL;
    1493             :         enum ndr_err_code err;
    1494             : 
    1495          24 :         if (ndr_table_mgmt.num_calls < 3) {
    1496           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_is_server_listening_ndr_unpack");
    1497           0 :                 return NULL;
    1498             :         }
    1499          24 :         call = &ndr_table_mgmt.calls[2];
    1500             : 
    1501          24 :         pull = ndr_pull_init_blob(blob, object);
    1502          24 :         if (pull == NULL) {
    1503           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1504           0 :                 return NULL;
    1505             :         }
    1506             : 
    1507          24 :         pull->flags |= ndr_pull_flags;
    1508             : 
    1509          24 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1510          24 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1511           0 :                 TALLOC_FREE(pull);
    1512           0 :                 PyErr_SetNdrError(err);
    1513           0 :                 return NULL;
    1514             :         }
    1515          24 :         if (!allow_remaining) {
    1516             :                 uint32_t highest_ofs;
    1517             : 
    1518          24 :                 if (pull->offset > pull->relative_highest_offset) {
    1519          24 :                         highest_ofs = pull->offset;
    1520             :                 } else {
    1521           0 :                         highest_ofs = pull->relative_highest_offset;
    1522             :                 }
    1523          24 :                 if (highest_ofs < pull->data_size) {
    1524           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1525             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1526             :                                 highest_ofs, pull->data_size);
    1527           0 :                         TALLOC_FREE(pull);
    1528           0 :                         PyErr_SetNdrError(err);
    1529           0 :                         return NULL;
    1530             :                 }
    1531             :         }
    1532             : 
    1533          24 :         TALLOC_FREE(pull);
    1534          24 :         Py_RETURN_NONE;
    1535             : }
    1536             : 
    1537           0 : static PyObject *py_mgmt_is_server_listening_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1538             : {
    1539             :         DATA_BLOB blob;
    1540           0 :         Py_ssize_t blob_length = 0;
    1541           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1542           0 :         PyObject *bigendian_obj = NULL;
    1543           0 :         PyObject *ndr64_obj = NULL;
    1544           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1545           0 :         PyObject *allow_remaining_obj = NULL;
    1546           0 :         bool allow_remaining = false;
    1547             : 
    1548           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1549             :                 discard_const_p(char *, kwnames),
    1550             :                 &blob.data, &blob_length,
    1551             :                 &bigendian_obj,
    1552             :                 &ndr64_obj,
    1553             :                 &allow_remaining_obj)) {
    1554           0 :                 return NULL;
    1555             :         }
    1556           0 :         blob.length = blob_length;
    1557             : 
    1558           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1559           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1560             :         }
    1561           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1562           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1563             :         }
    1564             : 
    1565           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1566           0 :                 allow_remaining = true;
    1567             :         }
    1568             : 
    1569           0 :         return py_mgmt_is_server_listening_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1570             : }
    1571             : 
    1572          24 : static PyObject *py_mgmt_is_server_listening_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1573             : {
    1574             :         DATA_BLOB blob;
    1575          24 :         Py_ssize_t blob_length = 0;
    1576          24 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1577          24 :         PyObject *bigendian_obj = NULL;
    1578          24 :         PyObject *ndr64_obj = NULL;
    1579          24 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1580          24 :         PyObject *allow_remaining_obj = NULL;
    1581          24 :         bool allow_remaining = false;
    1582             : 
    1583          24 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1584             :                 discard_const_p(char *, kwnames),
    1585             :                 &blob.data, &blob_length,
    1586             :                 &bigendian_obj,
    1587             :                 &ndr64_obj,
    1588             :                 &allow_remaining_obj)) {
    1589           0 :                 return NULL;
    1590             :         }
    1591          24 :         blob.length = blob_length;
    1592             : 
    1593          24 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1594           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1595             :         }
    1596          24 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1597           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1598             :         }
    1599             : 
    1600          24 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1601           0 :                 allow_remaining = true;
    1602             :         }
    1603             : 
    1604          24 :         return py_mgmt_is_server_listening_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1605             : }
    1606             : 
    1607           0 : static PyObject *py_mgmt_is_server_listening_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1608             : {
    1609           0 :         const struct ndr_interface_call *call = NULL;
    1610           0 :         struct mgmt_is_server_listening *object = (struct mgmt_is_server_listening *)pytalloc_get_ptr(py_obj);
    1611             :         PyObject *ret;
    1612             :         char *retstr;
    1613             : 
    1614           0 :         if (ndr_table_mgmt.num_calls < 3) {
    1615           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_is_server_listening_ndr_print");
    1616           0 :                 return NULL;
    1617             :         }
    1618           0 :         call = &ndr_table_mgmt.calls[2];
    1619             : 
    1620           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1621           0 :         ret = PyUnicode_FromString(retstr);
    1622           0 :         TALLOC_FREE(retstr);
    1623             : 
    1624           0 :         return ret;
    1625             : }
    1626             : 
    1627           0 : static PyObject *py_mgmt_is_server_listening_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1628             : {
    1629           0 :         return py_mgmt_is_server_listening_ndr_print(py_obj, "mgmt_is_server_listening_in", NDR_IN);
    1630             : }
    1631             : 
    1632           0 : static PyObject *py_mgmt_is_server_listening_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1633             : {
    1634           0 :         return py_mgmt_is_server_listening_ndr_print(py_obj, "mgmt_is_server_listening_out", NDR_OUT);
    1635             : }
    1636             : 
    1637             : static PyMethodDef py_mgmt_is_server_listening_methods[] = {
    1638             :         { "opnum", (PyCFunction)py_mgmt_is_server_listening_ndr_opnum, METH_NOARGS|METH_CLASS,
    1639             :                 "mgmt.is_server_listening.opnum() -> 2 (0x02) " },
    1640             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_is_server_listening_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1641             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1642             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_is_server_listening_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1643             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1644             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_is_server_listening_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1645             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1646             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_is_server_listening_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1647             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1648             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_is_server_listening_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1649             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_is_server_listening_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1650             :         { NULL, NULL, 0, NULL }
    1651             : };
    1652             : 
    1653             : 
    1654             : static PyTypeObject mgmt_is_server_listening_Type = {
    1655             :         PyVarObject_HEAD_INIT(NULL, 0)
    1656             :         .tp_name = "mgmt.is_server_listening",
    1657             :         .tp_getset = py_mgmt_is_server_listening_getsetters,
    1658             :         .tp_methods = py_mgmt_is_server_listening_methods,
    1659             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1660             :         .tp_new = py_mgmt_is_server_listening_new,
    1661             : };
    1662             : 
    1663           0 : static bool pack_py_mgmt_is_server_listening_args_in(PyObject *args, PyObject *kwargs, struct mgmt_is_server_listening *r)
    1664             : {
    1665           0 :         const char *kwnames[] = {
    1666             :                 NULL
    1667             :         };
    1668             : 
    1669           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":mgmt_is_server_listening", discard_const_p(char *, kwnames))) {
    1670           0 :                 return false;
    1671             :         }
    1672             : 
    1673           0 :         return true;
    1674             : }
    1675             : 
    1676           0 : static PyObject *unpack_py_mgmt_is_server_listening_args_out(struct mgmt_is_server_listening *r)
    1677             : {
    1678             :         PyObject *result;
    1679             :         PyObject *py_status;
    1680           0 :         result = PyTuple_New(2);
    1681           0 :         py_status = PyLong_FromUnsignedLongLong((uint32_t)*r->out.status);
    1682           0 :         PyTuple_SetItem(result, 0, py_status);
    1683           0 :         PyTuple_SetItem(result, 1, PyLong_FromUnsignedLongLong((uint32_t)r->out.result));
    1684           0 :         return result;
    1685             : }
    1686             : 
    1687             : 
    1688           0 : static PyObject *py_mgmt_stop_server_listening_get_result(PyObject *obj, void *closure)
    1689             : {
    1690           0 :         struct mgmt_stop_server_listening *object = (struct mgmt_stop_server_listening *)pytalloc_get_ptr(obj);
    1691             :         PyObject *py_result;
    1692           0 :         py_result = PyErr_FromWERROR(object->out.result);
    1693           0 :         return py_result;
    1694             : }
    1695             : 
    1696           0 : static int py_mgmt_stop_server_listening_set_result(PyObject *py_obj, PyObject *value, void *closure)
    1697             : {
    1698           0 :         struct mgmt_stop_server_listening *object = (struct mgmt_stop_server_listening *)pytalloc_get_ptr(py_obj);
    1699           0 :         if (value == NULL) {
    1700           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    1701           0 :                 return -1;
    1702             :         }
    1703           0 :         object->out.result = W_ERROR(PyLong_AsLong(value));
    1704           0 :         return 0;
    1705             : }
    1706             : 
    1707             : static PyGetSetDef py_mgmt_stop_server_listening_getsetters[] = {
    1708             :         {
    1709             :                 .name = discard_const_p(char, "result"),
    1710             :                 .get = py_mgmt_stop_server_listening_get_result,
    1711             :                 .set = py_mgmt_stop_server_listening_set_result,
    1712             :                 .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
    1713             :         },
    1714             :         { .name = NULL }
    1715             : };
    1716             : 
    1717           0 : static PyObject *py_mgmt_stop_server_listening_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1718             : {
    1719           0 :         PyObject *self = pytalloc_new(struct mgmt_stop_server_listening, type);
    1720           0 :         return self;
    1721             : }
    1722             : 
    1723           0 : static PyObject *py_mgmt_stop_server_listening_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1724             : {
    1725             : 
    1726             : 
    1727           0 :         return PyLong_FromLong(3);
    1728             : }
    1729             : 
    1730           0 : static PyObject *py_mgmt_stop_server_listening_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1731             : {
    1732           0 :         const struct ndr_interface_call *call = NULL;
    1733           0 :         struct mgmt_stop_server_listening *object = (struct mgmt_stop_server_listening *)pytalloc_get_ptr(py_obj);
    1734           0 :         PyObject *ret = NULL;
    1735           0 :         struct ndr_push *push = NULL;
    1736             :         DATA_BLOB blob;
    1737             :         enum ndr_err_code err;
    1738             : 
    1739           0 :         if (ndr_table_mgmt.num_calls < 4) {
    1740           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_stop_server_listening_ndr_pack");
    1741           0 :                 return NULL;
    1742             :         }
    1743           0 :         call = &ndr_table_mgmt.calls[3];
    1744             : 
    1745           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1746           0 :         if (push == NULL) {
    1747           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1748           0 :                 return NULL;
    1749             :         }
    1750             : 
    1751           0 :         push->flags |= ndr_push_flags;
    1752             : 
    1753           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1754           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1755           0 :                 TALLOC_FREE(push);
    1756           0 :                 PyErr_SetNdrError(err);
    1757           0 :                 return NULL;
    1758             :         }
    1759           0 :         blob = ndr_push_blob(push);
    1760           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1761           0 :         TALLOC_FREE(push);
    1762           0 :         return ret;
    1763             : }
    1764             : 
    1765           0 : static PyObject *py_mgmt_stop_server_listening_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1766             : {
    1767           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1768           0 :         PyObject *bigendian_obj = NULL;
    1769           0 :         PyObject *ndr64_obj = NULL;
    1770           0 :         uint32_t ndr_push_flags = 0;
    1771             : 
    1772           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    1773             :                 discard_const_p(char *, kwnames),
    1774             :                 &bigendian_obj,
    1775             :                 &ndr64_obj)) {
    1776           0 :                 return NULL;
    1777             :         }
    1778             : 
    1779           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1780           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1781             :         }
    1782           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1783           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1784             :         }
    1785             : 
    1786           0 :         return py_mgmt_stop_server_listening_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1787             : }
    1788             : 
    1789           0 : static PyObject *py_mgmt_stop_server_listening_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1790             : {
    1791           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1792           0 :         PyObject *bigendian_obj = NULL;
    1793           0 :         PyObject *ndr64_obj = NULL;
    1794           0 :         uint32_t ndr_push_flags = 0;
    1795             : 
    1796           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1797             :                 discard_const_p(char *, kwnames),
    1798             :                 &bigendian_obj,
    1799             :                 &ndr64_obj)) {
    1800           0 :                 return NULL;
    1801             :         }
    1802             : 
    1803           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1804           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1805             :         }
    1806           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1807           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1808             :         }
    1809             : 
    1810           0 :         return py_mgmt_stop_server_listening_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1811             : }
    1812             : 
    1813           0 : static PyObject *py_mgmt_stop_server_listening_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1814             : {
    1815           0 :         const struct ndr_interface_call *call = NULL;
    1816           0 :         struct mgmt_stop_server_listening *object = (struct mgmt_stop_server_listening *)pytalloc_get_ptr(py_obj);
    1817           0 :         struct ndr_pull *pull = NULL;
    1818             :         enum ndr_err_code err;
    1819             : 
    1820           0 :         if (ndr_table_mgmt.num_calls < 4) {
    1821           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_stop_server_listening_ndr_unpack");
    1822           0 :                 return NULL;
    1823             :         }
    1824           0 :         call = &ndr_table_mgmt.calls[3];
    1825             : 
    1826           0 :         pull = ndr_pull_init_blob(blob, object);
    1827           0 :         if (pull == NULL) {
    1828           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1829           0 :                 return NULL;
    1830             :         }
    1831             : 
    1832           0 :         pull->flags |= ndr_pull_flags;
    1833             : 
    1834           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1835           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1836           0 :                 TALLOC_FREE(pull);
    1837           0 :                 PyErr_SetNdrError(err);
    1838           0 :                 return NULL;
    1839             :         }
    1840           0 :         if (!allow_remaining) {
    1841             :                 uint32_t highest_ofs;
    1842             : 
    1843           0 :                 if (pull->offset > pull->relative_highest_offset) {
    1844           0 :                         highest_ofs = pull->offset;
    1845             :                 } else {
    1846           0 :                         highest_ofs = pull->relative_highest_offset;
    1847             :                 }
    1848           0 :                 if (highest_ofs < pull->data_size) {
    1849           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1850             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1851             :                                 highest_ofs, pull->data_size);
    1852           0 :                         TALLOC_FREE(pull);
    1853           0 :                         PyErr_SetNdrError(err);
    1854           0 :                         return NULL;
    1855             :                 }
    1856             :         }
    1857             : 
    1858           0 :         TALLOC_FREE(pull);
    1859           0 :         Py_RETURN_NONE;
    1860             : }
    1861             : 
    1862           0 : static PyObject *py_mgmt_stop_server_listening_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1863             : {
    1864             :         DATA_BLOB blob;
    1865           0 :         Py_ssize_t blob_length = 0;
    1866           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1867           0 :         PyObject *bigendian_obj = NULL;
    1868           0 :         PyObject *ndr64_obj = NULL;
    1869           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1870           0 :         PyObject *allow_remaining_obj = NULL;
    1871           0 :         bool allow_remaining = false;
    1872             : 
    1873           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1874             :                 discard_const_p(char *, kwnames),
    1875             :                 &blob.data, &blob_length,
    1876             :                 &bigendian_obj,
    1877             :                 &ndr64_obj,
    1878             :                 &allow_remaining_obj)) {
    1879           0 :                 return NULL;
    1880             :         }
    1881           0 :         blob.length = blob_length;
    1882             : 
    1883           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1884           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1885             :         }
    1886           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1887           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1888             :         }
    1889             : 
    1890           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1891           0 :                 allow_remaining = true;
    1892             :         }
    1893             : 
    1894           0 :         return py_mgmt_stop_server_listening_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1895             : }
    1896             : 
    1897           0 : static PyObject *py_mgmt_stop_server_listening_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1898             : {
    1899             :         DATA_BLOB blob;
    1900           0 :         Py_ssize_t blob_length = 0;
    1901           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1902           0 :         PyObject *bigendian_obj = NULL;
    1903           0 :         PyObject *ndr64_obj = NULL;
    1904           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1905           0 :         PyObject *allow_remaining_obj = NULL;
    1906           0 :         bool allow_remaining = false;
    1907             : 
    1908           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1909             :                 discard_const_p(char *, kwnames),
    1910             :                 &blob.data, &blob_length,
    1911             :                 &bigendian_obj,
    1912             :                 &ndr64_obj,
    1913             :                 &allow_remaining_obj)) {
    1914           0 :                 return NULL;
    1915             :         }
    1916           0 :         blob.length = blob_length;
    1917             : 
    1918           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1919           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1920             :         }
    1921           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1922           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1923             :         }
    1924             : 
    1925           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1926           0 :                 allow_remaining = true;
    1927             :         }
    1928             : 
    1929           0 :         return py_mgmt_stop_server_listening_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1930             : }
    1931             : 
    1932           0 : static PyObject *py_mgmt_stop_server_listening_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1933             : {
    1934           0 :         const struct ndr_interface_call *call = NULL;
    1935           0 :         struct mgmt_stop_server_listening *object = (struct mgmt_stop_server_listening *)pytalloc_get_ptr(py_obj);
    1936             :         PyObject *ret;
    1937             :         char *retstr;
    1938             : 
    1939           0 :         if (ndr_table_mgmt.num_calls < 4) {
    1940           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_stop_server_listening_ndr_print");
    1941           0 :                 return NULL;
    1942             :         }
    1943           0 :         call = &ndr_table_mgmt.calls[3];
    1944             : 
    1945           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1946           0 :         ret = PyUnicode_FromString(retstr);
    1947           0 :         TALLOC_FREE(retstr);
    1948             : 
    1949           0 :         return ret;
    1950             : }
    1951             : 
    1952           0 : static PyObject *py_mgmt_stop_server_listening_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1953             : {
    1954           0 :         return py_mgmt_stop_server_listening_ndr_print(py_obj, "mgmt_stop_server_listening_in", NDR_IN);
    1955             : }
    1956             : 
    1957           0 : static PyObject *py_mgmt_stop_server_listening_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1958             : {
    1959           0 :         return py_mgmt_stop_server_listening_ndr_print(py_obj, "mgmt_stop_server_listening_out", NDR_OUT);
    1960             : }
    1961             : 
    1962             : static PyMethodDef py_mgmt_stop_server_listening_methods[] = {
    1963             :         { "opnum", (PyCFunction)py_mgmt_stop_server_listening_ndr_opnum, METH_NOARGS|METH_CLASS,
    1964             :                 "mgmt.stop_server_listening.opnum() -> 3 (0x03) " },
    1965             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_stop_server_listening_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1966             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1967             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_stop_server_listening_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1968             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1969             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_stop_server_listening_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1970             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1971             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_stop_server_listening_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1972             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1973             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_stop_server_listening_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1974             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_stop_server_listening_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1975             :         { NULL, NULL, 0, NULL }
    1976             : };
    1977             : 
    1978             : 
    1979             : static PyTypeObject mgmt_stop_server_listening_Type = {
    1980             :         PyVarObject_HEAD_INIT(NULL, 0)
    1981             :         .tp_name = "mgmt.stop_server_listening",
    1982             :         .tp_getset = py_mgmt_stop_server_listening_getsetters,
    1983             :         .tp_methods = py_mgmt_stop_server_listening_methods,
    1984             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1985             :         .tp_new = py_mgmt_stop_server_listening_new,
    1986             : };
    1987             : 
    1988           0 : static bool pack_py_mgmt_stop_server_listening_args_in(PyObject *args, PyObject *kwargs, struct mgmt_stop_server_listening *r)
    1989             : {
    1990           0 :         const char *kwnames[] = {
    1991             :                 NULL
    1992             :         };
    1993             : 
    1994           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":mgmt_stop_server_listening", discard_const_p(char *, kwnames))) {
    1995           0 :                 return false;
    1996             :         }
    1997             : 
    1998           0 :         return true;
    1999             : }
    2000             : 
    2001           0 : static PyObject *unpack_py_mgmt_stop_server_listening_args_out(struct mgmt_stop_server_listening *r)
    2002             : {
    2003             :         PyObject *result;
    2004           0 :         result = Py_None;
    2005           0 :         Py_INCREF(result);
    2006           0 :         if (!W_ERROR_IS_OK(r->out.result)) {
    2007           0 :                 PyErr_SetWERROR(r->out.result);
    2008           0 :                 return NULL;
    2009             :         }
    2010             : 
    2011           0 :         return result;
    2012             : }
    2013             : 
    2014             : 
    2015           0 : static PyObject *py_mgmt_inq_princ_name_in_get_authn_proto(PyObject *obj, void *closure)
    2016             : {
    2017           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(obj);
    2018             :         PyObject *py_authn_proto;
    2019           0 :         py_authn_proto = PyLong_FromUnsignedLongLong((uint32_t)object->in.authn_proto);
    2020           0 :         return py_authn_proto;
    2021             : }
    2022             : 
    2023           0 : static int py_mgmt_inq_princ_name_in_set_authn_proto(PyObject *py_obj, PyObject *value, void *closure)
    2024             : {
    2025           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2026           0 :         if (value == NULL) {
    2027           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.authn_proto");
    2028           0 :                 return -1;
    2029             :         }
    2030             :         {
    2031           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.authn_proto));
    2032           0 :                 if (PyLong_Check(value)) {
    2033             :                         unsigned long long test_var;
    2034           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2035           0 :                         if (PyErr_Occurred() != NULL) {
    2036           0 :                                 return -1;
    2037             :                         }
    2038           0 :                         if (test_var > uint_max) {
    2039           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2040             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2041           0 :                                 return -1;
    2042             :                         }
    2043           0 :                         object->in.authn_proto = test_var;
    2044             :                 } else {
    2045           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2046             :                           PyLong_Type.tp_name);
    2047           0 :                         return -1;
    2048             :                 }
    2049             :         }
    2050           0 :         return 0;
    2051             : }
    2052             : 
    2053           0 : static PyObject *py_mgmt_inq_princ_name_in_get_princ_name_size(PyObject *obj, void *closure)
    2054             : {
    2055           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(obj);
    2056             :         PyObject *py_princ_name_size;
    2057           0 :         py_princ_name_size = PyLong_FromUnsignedLongLong((uint32_t)object->in.princ_name_size);
    2058           0 :         return py_princ_name_size;
    2059             : }
    2060             : 
    2061           0 : static int py_mgmt_inq_princ_name_in_set_princ_name_size(PyObject *py_obj, PyObject *value, void *closure)
    2062             : {
    2063           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2064           0 :         if (value == NULL) {
    2065           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.princ_name_size");
    2066           0 :                 return -1;
    2067             :         }
    2068             :         {
    2069           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.princ_name_size));
    2070           0 :                 if (PyLong_Check(value)) {
    2071             :                         unsigned long long test_var;
    2072           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2073           0 :                         if (PyErr_Occurred() != NULL) {
    2074           0 :                                 return -1;
    2075             :                         }
    2076           0 :                         if (test_var > uint_max) {
    2077           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2078             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2079           0 :                                 return -1;
    2080             :                         }
    2081           0 :                         object->in.princ_name_size = test_var;
    2082             :                 } else {
    2083           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2084             :                           PyLong_Type.tp_name);
    2085           0 :                         return -1;
    2086             :                 }
    2087             :         }
    2088           0 :         return 0;
    2089             : }
    2090             : 
    2091           0 : static PyObject *py_mgmt_inq_princ_name_out_get_princ_name(PyObject *obj, void *closure)
    2092             : {
    2093           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(obj);
    2094             :         PyObject *py_princ_name;
    2095           0 :         if (object->out.princ_name == NULL) {
    2096           0 :                 py_princ_name = Py_None;
    2097           0 :                 Py_INCREF(py_princ_name);
    2098             :         } else {
    2099           0 :                 py_princ_name = PyUnicode_Decode(object->out.princ_name, strlen(object->out.princ_name), "utf-8", "ignore");
    2100             :         }
    2101           0 :         return py_princ_name;
    2102             : }
    2103             : 
    2104           0 : static int py_mgmt_inq_princ_name_out_set_princ_name(PyObject *py_obj, PyObject *value, void *closure)
    2105             : {
    2106           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2107           0 :         if (value == NULL) {
    2108           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.princ_name");
    2109           0 :                 return -1;
    2110             :         }
    2111             :         {
    2112             :                 const char *test_str;
    2113             :                 const char *talloc_str;
    2114           0 :                 PyObject *unicode = NULL;
    2115           0 :                 if (PyUnicode_Check(value)) {
    2116           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2117           0 :                         if (unicode == NULL) {
    2118           0 :                                 PyErr_NoMemory();
    2119           0 :                                 return -1;
    2120             :                         }
    2121           0 :                         test_str = PyBytes_AS_STRING(unicode);
    2122           0 :                 } else if (PyBytes_Check(value)) {
    2123           0 :                         test_str = PyBytes_AS_STRING(value);
    2124             :                 } else {
    2125           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2126           0 :                         return -1;
    2127             :                 }
    2128           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2129           0 :                 if (unicode != NULL) {
    2130           0 :                         Py_DECREF(unicode);
    2131             :                 }
    2132           0 :                 if (talloc_str == NULL) {
    2133           0 :                         PyErr_NoMemory();
    2134           0 :                         return -1;
    2135             :                 }
    2136           0 :                 object->out.princ_name = talloc_str;
    2137             :         }
    2138           0 :         return 0;
    2139             : }
    2140             : 
    2141           0 : static PyObject *py_mgmt_inq_princ_name_get_result(PyObject *obj, void *closure)
    2142             : {
    2143           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(obj);
    2144             :         PyObject *py_result;
    2145           0 :         py_result = PyErr_FromWERROR(object->out.result);
    2146           0 :         return py_result;
    2147             : }
    2148             : 
    2149           0 : static int py_mgmt_inq_princ_name_set_result(PyObject *py_obj, PyObject *value, void *closure)
    2150             : {
    2151           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2152           0 :         if (value == NULL) {
    2153           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    2154           0 :                 return -1;
    2155             :         }
    2156           0 :         object->out.result = W_ERROR(PyLong_AsLong(value));
    2157           0 :         return 0;
    2158             : }
    2159             : 
    2160             : static PyGetSetDef py_mgmt_inq_princ_name_getsetters[] = {
    2161             :         {
    2162             :                 .name = discard_const_p(char, "in_authn_proto"),
    2163             :                 .get = py_mgmt_inq_princ_name_in_get_authn_proto,
    2164             :                 .set = py_mgmt_inq_princ_name_in_set_authn_proto,
    2165             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2166             :         },
    2167             :         {
    2168             :                 .name = discard_const_p(char, "in_princ_name_size"),
    2169             :                 .get = py_mgmt_inq_princ_name_in_get_princ_name_size,
    2170             :                 .set = py_mgmt_inq_princ_name_in_set_princ_name_size,
    2171             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2172             :         },
    2173             :         {
    2174             :                 .name = discard_const_p(char, "out_princ_name"),
    2175             :                 .get = py_mgmt_inq_princ_name_out_get_princ_name,
    2176             :                 .set = py_mgmt_inq_princ_name_out_set_princ_name,
    2177             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2178             :         },
    2179             :         {
    2180             :                 .name = discard_const_p(char, "result"),
    2181             :                 .get = py_mgmt_inq_princ_name_get_result,
    2182             :                 .set = py_mgmt_inq_princ_name_set_result,
    2183             :                 .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
    2184             :         },
    2185             :         { .name = NULL }
    2186             : };
    2187             : 
    2188           0 : static PyObject *py_mgmt_inq_princ_name_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2189             : {
    2190           0 :         PyObject *self = pytalloc_new(struct mgmt_inq_princ_name, type);
    2191           0 :         return self;
    2192             : }
    2193             : 
    2194           0 : static PyObject *py_mgmt_inq_princ_name_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    2195             : {
    2196             : 
    2197             : 
    2198           0 :         return PyLong_FromLong(4);
    2199             : }
    2200             : 
    2201           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    2202             : {
    2203           0 :         const struct ndr_interface_call *call = NULL;
    2204           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2205           0 :         PyObject *ret = NULL;
    2206           0 :         struct ndr_push *push = NULL;
    2207             :         DATA_BLOB blob;
    2208             :         enum ndr_err_code err;
    2209             : 
    2210           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2211           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_pack");
    2212           0 :                 return NULL;
    2213             :         }
    2214           0 :         call = &ndr_table_mgmt.calls[4];
    2215             : 
    2216           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    2217           0 :         if (push == NULL) {
    2218           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2219           0 :                 return NULL;
    2220             :         }
    2221             : 
    2222           0 :         push->flags |= ndr_push_flags;
    2223             : 
    2224           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    2225           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2226           0 :                 TALLOC_FREE(push);
    2227           0 :                 PyErr_SetNdrError(err);
    2228           0 :                 return NULL;
    2229             :         }
    2230           0 :         blob = ndr_push_blob(push);
    2231           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2232           0 :         TALLOC_FREE(push);
    2233           0 :         return ret;
    2234             : }
    2235             : 
    2236           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2237             : {
    2238           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2239           0 :         PyObject *bigendian_obj = NULL;
    2240           0 :         PyObject *ndr64_obj = NULL;
    2241           0 :         uint32_t ndr_push_flags = 0;
    2242             : 
    2243           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2244             :                 discard_const_p(char *, kwnames),
    2245             :                 &bigendian_obj,
    2246             :                 &ndr64_obj)) {
    2247           0 :                 return NULL;
    2248             :         }
    2249             : 
    2250           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2251           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2252             :         }
    2253           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2254           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2255             :         }
    2256             : 
    2257           0 :         return py_mgmt_inq_princ_name_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2258             : }
    2259             : 
    2260           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2261             : {
    2262           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2263           0 :         PyObject *bigendian_obj = NULL;
    2264           0 :         PyObject *ndr64_obj = NULL;
    2265           0 :         uint32_t ndr_push_flags = 0;
    2266             : 
    2267           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2268             :                 discard_const_p(char *, kwnames),
    2269             :                 &bigendian_obj,
    2270             :                 &ndr64_obj)) {
    2271           0 :                 return NULL;
    2272             :         }
    2273             : 
    2274           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2275           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2276             :         }
    2277           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2278           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2279             :         }
    2280             : 
    2281           0 :         return py_mgmt_inq_princ_name_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2282             : }
    2283             : 
    2284           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    2285             : {
    2286           0 :         const struct ndr_interface_call *call = NULL;
    2287           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2288           0 :         struct ndr_pull *pull = NULL;
    2289             :         enum ndr_err_code err;
    2290             : 
    2291           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2292           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_unpack");
    2293           0 :                 return NULL;
    2294             :         }
    2295           0 :         call = &ndr_table_mgmt.calls[4];
    2296             : 
    2297           0 :         pull = ndr_pull_init_blob(blob, object);
    2298           0 :         if (pull == NULL) {
    2299           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2300           0 :                 return NULL;
    2301             :         }
    2302             : 
    2303           0 :         pull->flags |= ndr_pull_flags;
    2304             : 
    2305           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2306           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2307           0 :                 TALLOC_FREE(pull);
    2308           0 :                 PyErr_SetNdrError(err);
    2309           0 :                 return NULL;
    2310             :         }
    2311           0 :         if (!allow_remaining) {
    2312             :                 uint32_t highest_ofs;
    2313             : 
    2314           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2315           0 :                         highest_ofs = pull->offset;
    2316             :                 } else {
    2317           0 :                         highest_ofs = pull->relative_highest_offset;
    2318             :                 }
    2319           0 :                 if (highest_ofs < pull->data_size) {
    2320           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2321             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2322             :                                 highest_ofs, pull->data_size);
    2323           0 :                         TALLOC_FREE(pull);
    2324           0 :                         PyErr_SetNdrError(err);
    2325           0 :                         return NULL;
    2326             :                 }
    2327             :         }
    2328             : 
    2329           0 :         TALLOC_FREE(pull);
    2330           0 :         Py_RETURN_NONE;
    2331             : }
    2332             : 
    2333           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2334             : {
    2335             :         DATA_BLOB blob;
    2336           0 :         Py_ssize_t blob_length = 0;
    2337           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2338           0 :         PyObject *bigendian_obj = NULL;
    2339           0 :         PyObject *ndr64_obj = NULL;
    2340           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2341           0 :         PyObject *allow_remaining_obj = NULL;
    2342           0 :         bool allow_remaining = false;
    2343             : 
    2344           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    2345             :                 discard_const_p(char *, kwnames),
    2346             :                 &blob.data, &blob_length,
    2347             :                 &bigendian_obj,
    2348             :                 &ndr64_obj,
    2349             :                 &allow_remaining_obj)) {
    2350           0 :                 return NULL;
    2351             :         }
    2352           0 :         blob.length = blob_length;
    2353             : 
    2354           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2355           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2356             :         }
    2357           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2358           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2359             :         }
    2360             : 
    2361           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2362           0 :                 allow_remaining = true;
    2363             :         }
    2364             : 
    2365           0 :         return py_mgmt_inq_princ_name_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    2366             : }
    2367             : 
    2368           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2369             : {
    2370             :         DATA_BLOB blob;
    2371           0 :         Py_ssize_t blob_length = 0;
    2372           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2373           0 :         PyObject *bigendian_obj = NULL;
    2374           0 :         PyObject *ndr64_obj = NULL;
    2375           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2376           0 :         PyObject *allow_remaining_obj = NULL;
    2377           0 :         bool allow_remaining = false;
    2378             : 
    2379           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    2380             :                 discard_const_p(char *, kwnames),
    2381             :                 &blob.data, &blob_length,
    2382             :                 &bigendian_obj,
    2383             :                 &ndr64_obj,
    2384             :                 &allow_remaining_obj)) {
    2385           0 :                 return NULL;
    2386             :         }
    2387           0 :         blob.length = blob_length;
    2388             : 
    2389           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2390           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2391             :         }
    2392           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2393           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2394             :         }
    2395             : 
    2396           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2397           0 :                 allow_remaining = true;
    2398             :         }
    2399             : 
    2400           0 :         return py_mgmt_inq_princ_name_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    2401             : }
    2402             : 
    2403           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    2404             : {
    2405           0 :         const struct ndr_interface_call *call = NULL;
    2406           0 :         struct mgmt_inq_princ_name *object = (struct mgmt_inq_princ_name *)pytalloc_get_ptr(py_obj);
    2407             :         PyObject *ret;
    2408             :         char *retstr;
    2409             : 
    2410           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2411           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_print");
    2412           0 :                 return NULL;
    2413             :         }
    2414           0 :         call = &ndr_table_mgmt.calls[4];
    2415             : 
    2416           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    2417           0 :         ret = PyUnicode_FromString(retstr);
    2418           0 :         TALLOC_FREE(retstr);
    2419             : 
    2420           0 :         return ret;
    2421             : }
    2422             : 
    2423           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2424             : {
    2425           0 :         return py_mgmt_inq_princ_name_ndr_print(py_obj, "mgmt_inq_princ_name_in", NDR_IN);
    2426             : }
    2427             : 
    2428           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2429             : {
    2430           0 :         return py_mgmt_inq_princ_name_ndr_print(py_obj, "mgmt_inq_princ_name_out", NDR_OUT);
    2431             : }
    2432             : 
    2433             : static PyMethodDef py_mgmt_inq_princ_name_methods[] = {
    2434             :         { "opnum", (PyCFunction)py_mgmt_inq_princ_name_ndr_opnum, METH_NOARGS|METH_CLASS,
    2435             :                 "mgmt.inq_princ_name.opnum() -> 4 (0x04) " },
    2436             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    2437             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    2438             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    2439             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    2440             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    2441             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    2442             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    2443             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    2444             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_inq_princ_name_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    2445             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_inq_princ_name_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    2446             :         { NULL, NULL, 0, NULL }
    2447             : };
    2448             : 
    2449             : 
    2450             : static PyTypeObject mgmt_inq_princ_name_Type = {
    2451             :         PyVarObject_HEAD_INIT(NULL, 0)
    2452             :         .tp_name = "mgmt.inq_princ_name",
    2453             :         .tp_getset = py_mgmt_inq_princ_name_getsetters,
    2454             :         .tp_methods = py_mgmt_inq_princ_name_methods,
    2455             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2456             :         .tp_new = py_mgmt_inq_princ_name_new,
    2457             : };
    2458             : 
    2459           0 : static bool pack_py_mgmt_inq_princ_name_args_in(PyObject *args, PyObject *kwargs, struct mgmt_inq_princ_name *r)
    2460             : {
    2461             :         PyObject *py_authn_proto;
    2462             :         PyObject *py_princ_name_size;
    2463           0 :         const char *kwnames[] = {
    2464             :                 "authn_proto", "princ_name_size", NULL
    2465             :         };
    2466             : 
    2467           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:mgmt_inq_princ_name", discard_const_p(char *, kwnames), &py_authn_proto, &py_princ_name_size)) {
    2468           0 :                 return false;
    2469             :         }
    2470             : 
    2471           0 :         if (py_authn_proto == NULL) {
    2472           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.authn_proto");
    2473           0 :                 return false;
    2474             :         }
    2475             :         {
    2476           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.authn_proto));
    2477           0 :                 if (PyLong_Check(py_authn_proto)) {
    2478             :                         unsigned long long test_var;
    2479           0 :                         test_var = PyLong_AsUnsignedLongLong(py_authn_proto);
    2480           0 :                         if (PyErr_Occurred() != NULL) {
    2481           0 :                                 return false;
    2482             :                         }
    2483           0 :                         if (test_var > uint_max) {
    2484           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2485             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2486           0 :                                 return false;
    2487             :                         }
    2488           0 :                         r->in.authn_proto = test_var;
    2489             :                 } else {
    2490           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2491             :                           PyLong_Type.tp_name);
    2492           0 :                         return false;
    2493             :                 }
    2494             :         }
    2495           0 :         if (py_princ_name_size == NULL) {
    2496           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.princ_name_size");
    2497           0 :                 return false;
    2498             :         }
    2499             :         {
    2500           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.princ_name_size));
    2501           0 :                 if (PyLong_Check(py_princ_name_size)) {
    2502             :                         unsigned long long test_var;
    2503           0 :                         test_var = PyLong_AsUnsignedLongLong(py_princ_name_size);
    2504           0 :                         if (PyErr_Occurred() != NULL) {
    2505           0 :                                 return false;
    2506             :                         }
    2507           0 :                         if (test_var > uint_max) {
    2508           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2509             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2510           0 :                                 return false;
    2511             :                         }
    2512           0 :                         r->in.princ_name_size = test_var;
    2513             :                 } else {
    2514           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2515             :                           PyLong_Type.tp_name);
    2516           0 :                         return false;
    2517             :                 }
    2518             :         }
    2519           0 :         return true;
    2520             : }
    2521             : 
    2522           0 : static PyObject *unpack_py_mgmt_inq_princ_name_args_out(struct mgmt_inq_princ_name *r)
    2523             : {
    2524             :         PyObject *result;
    2525             :         PyObject *py_princ_name;
    2526           0 :         if (r->out.princ_name == NULL) {
    2527           0 :                 py_princ_name = Py_None;
    2528           0 :                 Py_INCREF(py_princ_name);
    2529             :         } else {
    2530           0 :                 py_princ_name = PyUnicode_Decode(r->out.princ_name, strlen(r->out.princ_name), "utf-8", "ignore");
    2531             :         }
    2532           0 :         result = py_princ_name;
    2533           0 :         if (!W_ERROR_IS_OK(r->out.result)) {
    2534           0 :                 PyErr_SetWERROR(r->out.result);
    2535           0 :                 return NULL;
    2536             :         }
    2537             : 
    2538           0 :         return result;
    2539             : }
    2540             : 
    2541             : const struct PyNdrRpcMethodDef py_ndr_mgmt_methods[] = {
    2542             :         { "inq_if_ids", "S.inq_if_ids() -> if_id_vector", (py_dcerpc_call_fn)dcerpc_mgmt_inq_if_ids_r, (py_data_pack_fn)pack_py_mgmt_inq_if_ids_args_in, (py_data_unpack_fn)unpack_py_mgmt_inq_if_ids_args_out, 0, &ndr_table_mgmt },
    2543             :         { "inq_stats", "S.inq_stats(max_count, unknown) -> statistics", (py_dcerpc_call_fn)dcerpc_mgmt_inq_stats_r, (py_data_pack_fn)pack_py_mgmt_inq_stats_args_in, (py_data_unpack_fn)unpack_py_mgmt_inq_stats_args_out, 1, &ndr_table_mgmt },
    2544             :         { "is_server_listening", "S.is_server_listening() -> (status, result)", (py_dcerpc_call_fn)dcerpc_mgmt_is_server_listening_r, (py_data_pack_fn)pack_py_mgmt_is_server_listening_args_in, (py_data_unpack_fn)unpack_py_mgmt_is_server_listening_args_out, 2, &ndr_table_mgmt },
    2545             :         { "stop_server_listening", "S.stop_server_listening() -> None", (py_dcerpc_call_fn)dcerpc_mgmt_stop_server_listening_r, (py_data_pack_fn)pack_py_mgmt_stop_server_listening_args_in, (py_data_unpack_fn)unpack_py_mgmt_stop_server_listening_args_out, 3, &ndr_table_mgmt },
    2546             :         { "inq_princ_name", "S.inq_princ_name(authn_proto, princ_name_size) -> princ_name", (py_dcerpc_call_fn)dcerpc_mgmt_inq_princ_name_r, (py_data_pack_fn)pack_py_mgmt_inq_princ_name_args_in, (py_data_unpack_fn)unpack_py_mgmt_inq_princ_name_args_out, 4, &ndr_table_mgmt },
    2547             :         {0}
    2548             : };
    2549             : 
    2550           0 : static PyObject *interface_mgmt_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2551             : {
    2552           0 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_mgmt);
    2553             : }
    2554             : 
    2555             : #define PY_DOC_MGMT "DCE/RPC Remote Management"
    2556             : static PyTypeObject mgmt_InterfaceType = {
    2557             :         PyVarObject_HEAD_INIT(NULL, 0)
    2558             :         .tp_name = "mgmt.mgmt",
    2559             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    2560             :         .tp_doc = "mgmt(binding, lp_ctx=None, credentials=None) -> connection\n"
    2561             : "\n"
    2562             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    2563             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    2564             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_MGMT,
    2565             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2566             :         .tp_new = interface_mgmt_new,
    2567             : };
    2568             : 
    2569         393 : static PyObject *syntax_mgmt_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2570             : {
    2571         393 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_mgmt.syntax_id);
    2572             : }
    2573             : 
    2574             : #define PY_DOC_MGMT_SYNTAX "DCE/RPC Remote Management"
    2575             : static PyTypeObject mgmt_SyntaxType = {
    2576             :         PyVarObject_HEAD_INIT(NULL, 0)
    2577             :         .tp_name = "mgmt.mgmt_abstract_syntax",
    2578             :         .tp_doc = "mgmt_abstract_syntax()\n"PY_DOC_MGMT_SYNTAX,
    2579             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2580             :         .tp_new = syntax_mgmt_new,
    2581             : };
    2582             : 
    2583             : static PyMethodDef mgmt_methods[] = {
    2584             :         { NULL, NULL, 0, NULL }
    2585             : };
    2586             : 
    2587             : static struct PyModuleDef moduledef = {
    2588             :         PyModuleDef_HEAD_INIT,
    2589             :         .m_name = "mgmt",
    2590             :         .m_doc = "mgmt DCE/RPC",
    2591             :         .m_size = -1,
    2592             :         .m_methods = mgmt_methods,
    2593             : };
    2594           5 : MODULE_INIT_FUNC(mgmt)
    2595             : {
    2596           5 :         PyObject *m = NULL;
    2597           5 :         PyObject *dep_samba_dcerpc_misc = NULL;
    2598           5 :         PyObject *dep_talloc = NULL;
    2599           5 :         PyObject *dep_samba_dcerpc_base = NULL;
    2600             : 
    2601           5 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    2602           5 :         if (dep_samba_dcerpc_misc == NULL)
    2603           0 :                 goto out;
    2604             : 
    2605           5 :         dep_talloc = PyImport_ImportModule("talloc");
    2606           5 :         if (dep_talloc == NULL)
    2607           0 :                 goto out;
    2608             : 
    2609           5 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    2610           5 :         if (dep_samba_dcerpc_base == NULL)
    2611           0 :                 goto out;
    2612             : 
    2613           5 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    2614           5 :         if (ndr_syntax_id_Type == NULL)
    2615           0 :                 goto out;
    2616             : 
    2617           5 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    2618           5 :         if (BaseObject_Type == NULL)
    2619           0 :                 goto out;
    2620             : 
    2621           5 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    2622           5 :         if (ClientConnection_Type == NULL)
    2623           0 :                 goto out;
    2624             : 
    2625           5 :         ndr_syntax_id_p_Type.tp_base = BaseObject_Type;
    2626           5 :         ndr_syntax_id_p_Type.tp_basicsize = pytalloc_BaseObject_size();
    2627             : 
    2628           5 :         rpc_if_id_vector_t_Type.tp_base = BaseObject_Type;
    2629           5 :         rpc_if_id_vector_t_Type.tp_basicsize = pytalloc_BaseObject_size();
    2630             : 
    2631           5 :         mgmt_statistics_Type.tp_base = BaseObject_Type;
    2632           5 :         mgmt_statistics_Type.tp_basicsize = pytalloc_BaseObject_size();
    2633             : 
    2634           5 :         mgmt_inq_if_ids_Type.tp_base = BaseObject_Type;
    2635           5 :         mgmt_inq_if_ids_Type.tp_basicsize = pytalloc_BaseObject_size();
    2636             : 
    2637           5 :         mgmt_inq_stats_Type.tp_base = BaseObject_Type;
    2638           5 :         mgmt_inq_stats_Type.tp_basicsize = pytalloc_BaseObject_size();
    2639             : 
    2640           5 :         mgmt_is_server_listening_Type.tp_base = BaseObject_Type;
    2641           5 :         mgmt_is_server_listening_Type.tp_basicsize = pytalloc_BaseObject_size();
    2642             : 
    2643           5 :         mgmt_stop_server_listening_Type.tp_base = BaseObject_Type;
    2644           5 :         mgmt_stop_server_listening_Type.tp_basicsize = pytalloc_BaseObject_size();
    2645             : 
    2646           5 :         mgmt_inq_princ_name_Type.tp_base = BaseObject_Type;
    2647           5 :         mgmt_inq_princ_name_Type.tp_basicsize = pytalloc_BaseObject_size();
    2648             : 
    2649           5 :         mgmt_InterfaceType.tp_base = ClientConnection_Type;
    2650             : 
    2651           5 :         mgmt_SyntaxType.tp_base = ndr_syntax_id_Type;
    2652           5 :         mgmt_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    2653             : 
    2654           5 :         if (PyType_Ready(&ndr_syntax_id_p_Type) < 0)
    2655           0 :                 goto out;
    2656           5 :         if (PyType_Ready(&rpc_if_id_vector_t_Type) < 0)
    2657           0 :                 goto out;
    2658           5 :         if (PyType_Ready(&mgmt_statistics_Type) < 0)
    2659           0 :                 goto out;
    2660           5 :         if (PyType_Ready(&mgmt_inq_if_ids_Type) < 0)
    2661           0 :                 goto out;
    2662           5 :         if (PyType_Ready(&mgmt_inq_stats_Type) < 0)
    2663           0 :                 goto out;
    2664           5 :         if (PyType_Ready(&mgmt_is_server_listening_Type) < 0)
    2665           0 :                 goto out;
    2666           5 :         if (PyType_Ready(&mgmt_stop_server_listening_Type) < 0)
    2667           0 :                 goto out;
    2668           5 :         if (PyType_Ready(&mgmt_inq_princ_name_Type) < 0)
    2669           0 :                 goto out;
    2670           5 :         if (PyType_Ready(&mgmt_InterfaceType) < 0)
    2671           0 :                 goto out;
    2672           5 :         if (PyType_Ready(&mgmt_SyntaxType) < 0)
    2673           0 :                 goto out;
    2674           5 :         if (!PyInterface_AddNdrRpcMethods(&mgmt_InterfaceType, py_ndr_mgmt_methods))
    2675           0 :                 return NULL;
    2676             : 
    2677             : #ifdef PY_NDR_SYNTAX_ID_P_PATCH
    2678             :         PY_NDR_SYNTAX_ID_P_PATCH(&ndr_syntax_id_p_Type);
    2679             : #endif
    2680             : #ifdef PY_RPC_IF_ID_VECTOR_T_PATCH
    2681             :         PY_RPC_IF_ID_VECTOR_T_PATCH(&rpc_if_id_vector_t_Type);
    2682             : #endif
    2683             : #ifdef PY_STATISTICS_PATCH
    2684             :         PY_STATISTICS_PATCH(&mgmt_statistics_Type);
    2685             : #endif
    2686             : #ifdef PY_INQ_IF_IDS_PATCH
    2687             :         PY_INQ_IF_IDS_PATCH(&mgmt_inq_if_ids_Type);
    2688             : #endif
    2689             : #ifdef PY_INQ_STATS_PATCH
    2690             :         PY_INQ_STATS_PATCH(&mgmt_inq_stats_Type);
    2691             : #endif
    2692             : #ifdef PY_IS_SERVER_LISTENING_PATCH
    2693             :         PY_IS_SERVER_LISTENING_PATCH(&mgmt_is_server_listening_Type);
    2694             : #endif
    2695             : #ifdef PY_STOP_SERVER_LISTENING_PATCH
    2696             :         PY_STOP_SERVER_LISTENING_PATCH(&mgmt_stop_server_listening_Type);
    2697             : #endif
    2698             : #ifdef PY_INQ_PRINC_NAME_PATCH
    2699             :         PY_INQ_PRINC_NAME_PATCH(&mgmt_inq_princ_name_Type);
    2700             : #endif
    2701             : #ifdef PY_MGMT_PATCH
    2702             :         PY_MGMT_PATCH(&mgmt_InterfaceType);
    2703             : #endif
    2704             : #ifdef PY_MGMT_ABSTRACT_SYNTAX_PATCH
    2705             :         PY_MGMT_ABSTRACT_SYNTAX_PATCH(&mgmt_SyntaxType);
    2706             : #endif
    2707             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    2708             :         PY_ABSTRACT_SYNTAX_PATCH(&mgmt_SyntaxType);
    2709             : #endif
    2710             : 
    2711           5 :         m = PyModule_Create(&moduledef);
    2712           5 :         if (m == NULL)
    2713           0 :                 goto out;
    2714             : 
    2715           5 :         PyModule_AddObject(m, "MGMT_STATS_CALLS_IN", PyLong_FromUnsignedLongLong(0));
    2716           5 :         PyModule_AddObject(m, "MGMT_STATS_CALLS_OUT", PyLong_FromUnsignedLongLong(1));
    2717           5 :         PyModule_AddObject(m, "MGMT_STATS_PKTS_IN", PyLong_FromUnsignedLongLong(2));
    2718           5 :         PyModule_AddObject(m, "MGMT_STATS_PKTS_OUT", PyLong_FromUnsignedLongLong(3));
    2719           5 :         PyModule_AddObject(m, "MGMT_STATS_ARRAY_MAX_SIZE", PyLong_FromUnsignedLongLong(4));
    2720           5 :         Py_INCREF((PyObject *)(void *)&ndr_syntax_id_p_Type);
    2721           5 :         PyModule_AddObject(m, "ndr_syntax_id_p", (PyObject *)(void *)&ndr_syntax_id_p_Type);
    2722           5 :         Py_INCREF((PyObject *)(void *)&rpc_if_id_vector_t_Type);
    2723           5 :         PyModule_AddObject(m, "rpc_if_id_vector_t", (PyObject *)(void *)&rpc_if_id_vector_t_Type);
    2724           5 :         Py_INCREF((PyObject *)(void *)&mgmt_statistics_Type);
    2725           5 :         PyModule_AddObject(m, "statistics", (PyObject *)(void *)&mgmt_statistics_Type);
    2726           5 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_if_ids_Type);
    2727           5 :         PyModule_AddObject(m, "inq_if_ids", (PyObject *)(void *)&mgmt_inq_if_ids_Type);
    2728           5 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_stats_Type);
    2729           5 :         PyModule_AddObject(m, "inq_stats", (PyObject *)(void *)&mgmt_inq_stats_Type);
    2730           5 :         Py_INCREF((PyObject *)(void *)&mgmt_is_server_listening_Type);
    2731           5 :         PyModule_AddObject(m, "is_server_listening", (PyObject *)(void *)&mgmt_is_server_listening_Type);
    2732           5 :         Py_INCREF((PyObject *)(void *)&mgmt_stop_server_listening_Type);
    2733           5 :         PyModule_AddObject(m, "stop_server_listening", (PyObject *)(void *)&mgmt_stop_server_listening_Type);
    2734           5 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_princ_name_Type);
    2735           5 :         PyModule_AddObject(m, "inq_princ_name", (PyObject *)(void *)&mgmt_inq_princ_name_Type);
    2736           5 :         Py_INCREF((PyObject *)(void *)&mgmt_InterfaceType);
    2737           5 :         PyModule_AddObject(m, "mgmt", (PyObject *)(void *)&mgmt_InterfaceType);
    2738           5 :         Py_INCREF((PyObject *)(void *)&mgmt_SyntaxType);
    2739           5 :         PyModule_AddObject(m, "mgmt_abstract_syntax", (PyObject *)(void *)&mgmt_SyntaxType);
    2740           5 :         Py_INCREF((PyObject *)(void *)&mgmt_SyntaxType);
    2741           5 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&mgmt_SyntaxType);
    2742             : #ifdef PY_MOD_MGMT_PATCH
    2743             :         PY_MOD_MGMT_PATCH(m);
    2744             : #endif
    2745           5 :         out:
    2746           5 :         Py_XDECREF(dep_samba_dcerpc_misc);
    2747           5 :         Py_XDECREF(dep_talloc);
    2748           5 :         Py_XDECREF(dep_samba_dcerpc_base);
    2749           5 :         return m;
    2750             : 
    2751             : }

Generated by: LCOV version 1.13