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 master 2b515b7d Lines: 211 1295 16.3 %
Date: 2024-02-28 12: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 "lib/replace/system/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 = 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 = 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: 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 = 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 = pytalloc_get_ptr(py_obj);
     154           0 :         if (value == NULL) {
     155           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = pytalloc_get_ptr(py_obj);
     203           0 :         if (value == NULL) {
     204           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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: (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 = 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 = pytalloc_get_ptr(py_obj);
     272           0 :         if (value == NULL) {
     273           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = pytalloc_get_ptr(py_obj);
     321           0 :         if (value == NULL) {
     322           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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: (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 = 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 = 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: 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 = 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 = pytalloc_get_ptr(py_obj);
     448           0 :         if (value == NULL) {
     449           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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         144 : static PyObject *py_mgmt_inq_if_ids_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     473             : {
     474         144 :         PyObject *self = pytalloc_new(struct mgmt_inq_if_ids, type);
     475         144 :         struct mgmt_inq_if_ids *_self = (struct mgmt_inq_if_ids *)pytalloc_get_ptr(self);
     476         144 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
     477             :         /* a pointer to a NULL pointer */
     478         144 :         _self->out.if_id_vector = talloc_zero(mem_ctx, struct rpc_if_id_vector_t *);
     479         144 :         return self;
     480             : }
     481             : 
     482         210 : static PyObject *py_mgmt_inq_if_ids_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
     483             : {
     484             : 
     485             : 
     486         210 :         return PyLong_FromLong(0);
     487             : }
     488             : 
     489         210 : static PyObject *py_mgmt_inq_if_ids_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
     490             : {
     491         210 :         const struct ndr_interface_call *call = NULL;
     492         210 :         struct mgmt_inq_if_ids *object = pytalloc_get_ptr(py_obj);
     493         210 :         PyObject *ret = NULL;
     494         210 :         struct ndr_push *push = NULL;
     495             :         DATA_BLOB blob;
     496             :         enum ndr_err_code err;
     497             : 
     498         210 :         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         210 :         call = &ndr_table_mgmt.calls[0];
     503             : 
     504         210 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
     505         210 :         if (push == NULL) {
     506           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     507           0 :                 return NULL;
     508             :         }
     509             : 
     510         210 :         push->flags |= ndr_push_flags;
     511             : 
     512         210 :         err = call->ndr_push(push, ndr_inout_flags, object);
     513         210 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     514           0 :                 TALLOC_FREE(push);
     515           0 :                 PyErr_SetNdrError(err);
     516           0 :                 return NULL;
     517             :         }
     518         210 :         blob = ndr_push_blob(push);
     519         210 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     520         210 :         TALLOC_FREE(push);
     521         210 :         return ret;
     522             : }
     523             : 
     524         210 : static PyObject *py_mgmt_inq_if_ids_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     525             : {
     526         210 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     527         210 :         PyObject *bigendian_obj = NULL;
     528         210 :         PyObject *ndr64_obj = NULL;
     529         210 :         libndr_flags ndr_push_flags = 0;
     530             : 
     531         210 :         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         210 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     539           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     540             :         }
     541         210 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     542           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     543             :         }
     544             : 
     545         210 :         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 :         libndr_flags 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          75 : static PyObject *py_mgmt_inq_if_ids_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
     573             : {
     574          75 :         const struct ndr_interface_call *call = NULL;
     575          75 :         struct mgmt_inq_if_ids *object = pytalloc_get_ptr(py_obj);
     576          75 :         struct ndr_pull *pull = NULL;
     577             :         enum ndr_err_code err;
     578             : 
     579          75 :         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          75 :         call = &ndr_table_mgmt.calls[0];
     584             : 
     585          75 :         pull = ndr_pull_init_blob(blob, object);
     586          75 :         if (pull == NULL) {
     587           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     588           0 :                 return NULL;
     589             :         }
     590             : 
     591          75 :         pull->flags |= ndr_pull_flags;
     592             : 
     593          75 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
     594          75 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     595           0 :                 TALLOC_FREE(pull);
     596           0 :                 PyErr_SetNdrError(err);
     597           0 :                 return NULL;
     598             :         }
     599          75 :         if (!allow_remaining) {
     600             :                 uint32_t highest_ofs;
     601             : 
     602          75 :                 if (pull->offset > pull->relative_highest_offset) {
     603          75 :                         highest_ofs = pull->offset;
     604             :                 } else {
     605           0 :                         highest_ofs = pull->relative_highest_offset;
     606             :                 }
     607          75 :                 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          75 :         TALLOC_FREE(pull);
     618          75 :         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 :         libndr_flags 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          75 : static PyObject *py_mgmt_inq_if_ids_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     657             : {
     658             :         DATA_BLOB blob;
     659          75 :         Py_ssize_t blob_length = 0;
     660          75 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     661          75 :         PyObject *bigendian_obj = NULL;
     662          75 :         PyObject *ndr64_obj = NULL;
     663          75 :         libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     664          75 :         PyObject *allow_remaining_obj = NULL;
     665          75 :         bool allow_remaining = false;
     666             : 
     667          75 :         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          75 :         blob.length = blob_length;
     676             : 
     677          75 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     678           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     679             :         }
     680          75 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     681           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     682             :         }
     683             : 
     684          75 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     685           0 :                 allow_remaining = true;
     686             :         }
     687             : 
     688          75 :         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, ndr_flags_type ndr_inout_flags)
     692             : {
     693           0 :         const struct ndr_interface_call *call = NULL;
     694           0 :         struct mgmt_inq_if_ids *object = 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 = 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 = pytalloc_get_ptr(py_obj);
     791           0 :         if (value == NULL) {
     792           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = pytalloc_get_ptr(py_obj);
     829           0 :         if (value == NULL) {
     830           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = 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: 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 = 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 = pytalloc_get_ptr(py_obj);
     900           0 :         if (value == NULL) {
     901           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
     953             : {
     954           0 :         const struct ndr_interface_call *call = NULL;
     955           0 :         struct mgmt_inq_stats *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
    1036             : {
    1037           0 :         const struct ndr_interface_call *call = NULL;
    1038           0 :         struct mgmt_inq_stats *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags)
    1155             : {
    1156           0 :         const struct ndr_interface_call *call = NULL;
    1157           0 :         struct mgmt_inq_stats *object = 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: 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: 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 = 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 = 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: 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 = 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 = pytalloc_get_ptr(py_obj);
    1346           0 :         if (value == NULL) {
    1347           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
    1406             : {
    1407          24 :         const struct ndr_interface_call *call = NULL;
    1408          24 :         struct mgmt_is_server_listening *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
    1489             : {
    1490          24 :         const struct ndr_interface_call *call = NULL;
    1491          24 :         struct mgmt_is_server_listening *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags)
    1608             : {
    1609           0 :         const struct ndr_interface_call *call = NULL;
    1610           0 :         struct mgmt_is_server_listening *object = 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 = 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 = pytalloc_get_ptr(py_obj);
    1699           0 :         if (value == NULL) {
    1700           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
    1731             : {
    1732           0 :         const struct ndr_interface_call *call = NULL;
    1733           0 :         struct mgmt_stop_server_listening *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
    1814             : {
    1815           0 :         const struct ndr_interface_call *call = NULL;
    1816           0 :         struct mgmt_stop_server_listening *object = 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 :         libndr_flags 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 :         libndr_flags 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, ndr_flags_type ndr_inout_flags)
    1933             : {
    1934           0 :         const struct ndr_interface_call *call = NULL;
    1935           0 :         struct mgmt_stop_server_listening *object = 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 = 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 = pytalloc_get_ptr(py_obj);
    2026           0 :         if (value == NULL) {
    2027           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = pytalloc_get_ptr(py_obj);
    2064           0 :         if (value == NULL) {
    2065           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 = 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 = pytalloc_get_ptr(py_obj);
    2107           0 :         if (value == NULL) {
    2108           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: 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 :                                 return -1;
    2119             :                         }
    2120           0 :                         test_str = PyBytes_AS_STRING(unicode);
    2121           0 :                 } else if (PyBytes_Check(value)) {
    2122           0 :                         test_str = PyBytes_AS_STRING(value);
    2123             :                 } else {
    2124           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2125           0 :                         return -1;
    2126             :                 }
    2127           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2128           0 :                 if (unicode != NULL) {
    2129           0 :                         Py_DECREF(unicode);
    2130             :                 }
    2131           0 :                 if (talloc_str == NULL) {
    2132           0 :                         PyErr_NoMemory();
    2133           0 :                         return -1;
    2134             :                 }
    2135           0 :                 object->out.princ_name = talloc_str;
    2136             :         }
    2137           0 :         return 0;
    2138             : }
    2139             : 
    2140           0 : static PyObject *py_mgmt_inq_princ_name_get_result(PyObject *obj, void *closure)
    2141             : {
    2142           0 :         struct mgmt_inq_princ_name *object = pytalloc_get_ptr(obj);
    2143             :         PyObject *py_result;
    2144           0 :         py_result = PyErr_FromWERROR(object->out.result);
    2145           0 :         return py_result;
    2146             : }
    2147             : 
    2148           0 : static int py_mgmt_inq_princ_name_set_result(PyObject *py_obj, PyObject *value, void *closure)
    2149             : {
    2150           0 :         struct mgmt_inq_princ_name *object = pytalloc_get_ptr(py_obj);
    2151           0 :         if (value == NULL) {
    2152           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
    2153           0 :                 return -1;
    2154             :         }
    2155           0 :         object->out.result = W_ERROR(PyLong_AsLong(value));
    2156           0 :         return 0;
    2157             : }
    2158             : 
    2159             : static PyGetSetDef py_mgmt_inq_princ_name_getsetters[] = {
    2160             :         {
    2161             :                 .name = discard_const_p(char, "in_authn_proto"),
    2162             :                 .get = py_mgmt_inq_princ_name_in_get_authn_proto,
    2163             :                 .set = py_mgmt_inq_princ_name_in_set_authn_proto,
    2164             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2165             :         },
    2166             :         {
    2167             :                 .name = discard_const_p(char, "in_princ_name_size"),
    2168             :                 .get = py_mgmt_inq_princ_name_in_get_princ_name_size,
    2169             :                 .set = py_mgmt_inq_princ_name_in_set_princ_name_size,
    2170             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2171             :         },
    2172             :         {
    2173             :                 .name = discard_const_p(char, "out_princ_name"),
    2174             :                 .get = py_mgmt_inq_princ_name_out_get_princ_name,
    2175             :                 .set = py_mgmt_inq_princ_name_out_set_princ_name,
    2176             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2177             :         },
    2178             :         {
    2179             :                 .name = discard_const_p(char, "result"),
    2180             :                 .get = py_mgmt_inq_princ_name_get_result,
    2181             :                 .set = py_mgmt_inq_princ_name_set_result,
    2182             :                 .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
    2183             :         },
    2184             :         { .name = NULL }
    2185             : };
    2186             : 
    2187           0 : static PyObject *py_mgmt_inq_princ_name_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2188             : {
    2189           0 :         PyObject *self = pytalloc_new(struct mgmt_inq_princ_name, type);
    2190           0 :         return self;
    2191             : }
    2192             : 
    2193           0 : static PyObject *py_mgmt_inq_princ_name_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    2194             : {
    2195             : 
    2196             : 
    2197           0 :         return PyLong_FromLong(4);
    2198             : }
    2199             : 
    2200           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
    2201             : {
    2202           0 :         const struct ndr_interface_call *call = NULL;
    2203           0 :         struct mgmt_inq_princ_name *object = pytalloc_get_ptr(py_obj);
    2204           0 :         PyObject *ret = NULL;
    2205           0 :         struct ndr_push *push = NULL;
    2206             :         DATA_BLOB blob;
    2207             :         enum ndr_err_code err;
    2208             : 
    2209           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2210           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_pack");
    2211           0 :                 return NULL;
    2212             :         }
    2213           0 :         call = &ndr_table_mgmt.calls[4];
    2214             : 
    2215           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    2216           0 :         if (push == NULL) {
    2217           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2218           0 :                 return NULL;
    2219             :         }
    2220             : 
    2221           0 :         push->flags |= ndr_push_flags;
    2222             : 
    2223           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    2224           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2225           0 :                 TALLOC_FREE(push);
    2226           0 :                 PyErr_SetNdrError(err);
    2227           0 :                 return NULL;
    2228             :         }
    2229           0 :         blob = ndr_push_blob(push);
    2230           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2231           0 :         TALLOC_FREE(push);
    2232           0 :         return ret;
    2233             : }
    2234             : 
    2235           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2236             : {
    2237           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2238           0 :         PyObject *bigendian_obj = NULL;
    2239           0 :         PyObject *ndr64_obj = NULL;
    2240           0 :         libndr_flags ndr_push_flags = 0;
    2241             : 
    2242           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2243             :                 discard_const_p(char *, kwnames),
    2244             :                 &bigendian_obj,
    2245             :                 &ndr64_obj)) {
    2246           0 :                 return NULL;
    2247             :         }
    2248             : 
    2249           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2250           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2251             :         }
    2252           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2253           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2254             :         }
    2255             : 
    2256           0 :         return py_mgmt_inq_princ_name_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2257             : }
    2258             : 
    2259           0 : static PyObject *py_mgmt_inq_princ_name_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2260             : {
    2261           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2262           0 :         PyObject *bigendian_obj = NULL;
    2263           0 :         PyObject *ndr64_obj = NULL;
    2264           0 :         libndr_flags ndr_push_flags = 0;
    2265             : 
    2266           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2267             :                 discard_const_p(char *, kwnames),
    2268             :                 &bigendian_obj,
    2269             :                 &ndr64_obj)) {
    2270           0 :                 return NULL;
    2271             :         }
    2272             : 
    2273           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2274           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2275             :         }
    2276           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2277           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2278             :         }
    2279             : 
    2280           0 :         return py_mgmt_inq_princ_name_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2281             : }
    2282             : 
    2283           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
    2284             : {
    2285           0 :         const struct ndr_interface_call *call = NULL;
    2286           0 :         struct mgmt_inq_princ_name *object = pytalloc_get_ptr(py_obj);
    2287           0 :         struct ndr_pull *pull = NULL;
    2288             :         enum ndr_err_code err;
    2289             : 
    2290           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2291           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_unpack");
    2292           0 :                 return NULL;
    2293             :         }
    2294           0 :         call = &ndr_table_mgmt.calls[4];
    2295             : 
    2296           0 :         pull = ndr_pull_init_blob(blob, object);
    2297           0 :         if (pull == NULL) {
    2298           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2299           0 :                 return NULL;
    2300             :         }
    2301             : 
    2302           0 :         pull->flags |= ndr_pull_flags;
    2303             : 
    2304           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2305           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2306           0 :                 TALLOC_FREE(pull);
    2307           0 :                 PyErr_SetNdrError(err);
    2308           0 :                 return NULL;
    2309             :         }
    2310           0 :         if (!allow_remaining) {
    2311             :                 uint32_t highest_ofs;
    2312             : 
    2313           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2314           0 :                         highest_ofs = pull->offset;
    2315             :                 } else {
    2316           0 :                         highest_ofs = pull->relative_highest_offset;
    2317             :                 }
    2318           0 :                 if (highest_ofs < pull->data_size) {
    2319           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2320             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2321             :                                 highest_ofs, pull->data_size);
    2322           0 :                         TALLOC_FREE(pull);
    2323           0 :                         PyErr_SetNdrError(err);
    2324           0 :                         return NULL;
    2325             :                 }
    2326             :         }
    2327             : 
    2328           0 :         TALLOC_FREE(pull);
    2329           0 :         Py_RETURN_NONE;
    2330             : }
    2331             : 
    2332           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2333             : {
    2334             :         DATA_BLOB blob;
    2335           0 :         Py_ssize_t blob_length = 0;
    2336           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2337           0 :         PyObject *bigendian_obj = NULL;
    2338           0 :         PyObject *ndr64_obj = NULL;
    2339           0 :         libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2340           0 :         PyObject *allow_remaining_obj = NULL;
    2341           0 :         bool allow_remaining = false;
    2342             : 
    2343           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    2344             :                 discard_const_p(char *, kwnames),
    2345             :                 &blob.data, &blob_length,
    2346             :                 &bigendian_obj,
    2347             :                 &ndr64_obj,
    2348             :                 &allow_remaining_obj)) {
    2349           0 :                 return NULL;
    2350             :         }
    2351           0 :         blob.length = blob_length;
    2352             : 
    2353           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2354           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2355             :         }
    2356           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2357           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2358             :         }
    2359             : 
    2360           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2361           0 :                 allow_remaining = true;
    2362             :         }
    2363             : 
    2364           0 :         return py_mgmt_inq_princ_name_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    2365             : }
    2366             : 
    2367           0 : static PyObject *py_mgmt_inq_princ_name_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2368             : {
    2369             :         DATA_BLOB blob;
    2370           0 :         Py_ssize_t blob_length = 0;
    2371           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2372           0 :         PyObject *bigendian_obj = NULL;
    2373           0 :         PyObject *ndr64_obj = NULL;
    2374           0 :         libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2375           0 :         PyObject *allow_remaining_obj = NULL;
    2376           0 :         bool allow_remaining = false;
    2377             : 
    2378           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    2379             :                 discard_const_p(char *, kwnames),
    2380             :                 &blob.data, &blob_length,
    2381             :                 &bigendian_obj,
    2382             :                 &ndr64_obj,
    2383             :                 &allow_remaining_obj)) {
    2384           0 :                 return NULL;
    2385             :         }
    2386           0 :         blob.length = blob_length;
    2387             : 
    2388           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2389           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2390             :         }
    2391           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2392           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2393             :         }
    2394             : 
    2395           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2396           0 :                 allow_remaining = true;
    2397             :         }
    2398             : 
    2399           0 :         return py_mgmt_inq_princ_name_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    2400             : }
    2401             : 
    2402           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
    2403             : {
    2404           0 :         const struct ndr_interface_call *call = NULL;
    2405           0 :         struct mgmt_inq_princ_name *object = pytalloc_get_ptr(py_obj);
    2406             :         PyObject *ret;
    2407             :         char *retstr;
    2408             : 
    2409           0 :         if (ndr_table_mgmt.num_calls < 5) {
    2410           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_mgmt_inq_princ_name_ndr_print");
    2411           0 :                 return NULL;
    2412             :         }
    2413           0 :         call = &ndr_table_mgmt.calls[4];
    2414             : 
    2415           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    2416           0 :         ret = PyUnicode_FromString(retstr);
    2417           0 :         TALLOC_FREE(retstr);
    2418             : 
    2419           0 :         return ret;
    2420             : }
    2421             : 
    2422           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2423             : {
    2424           0 :         return py_mgmt_inq_princ_name_ndr_print(py_obj, "mgmt_inq_princ_name_in", NDR_IN);
    2425             : }
    2426             : 
    2427           0 : static PyObject *py_mgmt_inq_princ_name_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2428             : {
    2429           0 :         return py_mgmt_inq_princ_name_ndr_print(py_obj, "mgmt_inq_princ_name_out", NDR_OUT);
    2430             : }
    2431             : 
    2432             : static PyMethodDef py_mgmt_inq_princ_name_methods[] = {
    2433             :         { "opnum", (PyCFunction)py_mgmt_inq_princ_name_ndr_opnum, METH_NOARGS|METH_CLASS,
    2434             :                 "mgmt.inq_princ_name.opnum() -> 4 (0x04) " },
    2435             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    2436             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    2437             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    2438             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    2439             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    2440             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    2441             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_mgmt_inq_princ_name_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    2442             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    2443             :         { "__ndr_print_in__", (PyCFunction)py_mgmt_inq_princ_name_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    2444             :         { "__ndr_print_out__", (PyCFunction)py_mgmt_inq_princ_name_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    2445             :         { NULL, NULL, 0, NULL }
    2446             : };
    2447             : 
    2448             : 
    2449             : static PyTypeObject mgmt_inq_princ_name_Type = {
    2450             :         PyVarObject_HEAD_INIT(NULL, 0)
    2451             :         .tp_name = "mgmt.inq_princ_name",
    2452             :         .tp_getset = py_mgmt_inq_princ_name_getsetters,
    2453             :         .tp_methods = py_mgmt_inq_princ_name_methods,
    2454             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2455             :         .tp_new = py_mgmt_inq_princ_name_new,
    2456             : };
    2457             : 
    2458           0 : static bool pack_py_mgmt_inq_princ_name_args_in(PyObject *args, PyObject *kwargs, struct mgmt_inq_princ_name *r)
    2459             : {
    2460             :         PyObject *py_authn_proto;
    2461             :         PyObject *py_princ_name_size;
    2462           0 :         const char *kwnames[] = {
    2463             :                 "authn_proto", "princ_name_size", NULL
    2464             :         };
    2465             : 
    2466           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:mgmt_inq_princ_name", discard_const_p(char *, kwnames), &py_authn_proto, &py_princ_name_size)) {
    2467           0 :                 return false;
    2468             :         }
    2469             : 
    2470           0 :         if (py_authn_proto == NULL) {
    2471           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.authn_proto");
    2472           0 :                 return false;
    2473             :         }
    2474             :         {
    2475           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.authn_proto));
    2476           0 :                 if (PyLong_Check(py_authn_proto)) {
    2477             :                         unsigned long long test_var;
    2478           0 :                         test_var = PyLong_AsUnsignedLongLong(py_authn_proto);
    2479           0 :                         if (PyErr_Occurred() != NULL) {
    2480           0 :                                 return false;
    2481             :                         }
    2482           0 :                         if (test_var > uint_max) {
    2483           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2484             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2485           0 :                                 return false;
    2486             :                         }
    2487           0 :                         r->in.authn_proto = test_var;
    2488             :                 } else {
    2489           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2490             :                           PyLong_Type.tp_name);
    2491           0 :                         return false;
    2492             :                 }
    2493             :         }
    2494           0 :         if (py_princ_name_size == NULL) {
    2495           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.princ_name_size");
    2496           0 :                 return false;
    2497             :         }
    2498             :         {
    2499           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.princ_name_size));
    2500           0 :                 if (PyLong_Check(py_princ_name_size)) {
    2501             :                         unsigned long long test_var;
    2502           0 :                         test_var = PyLong_AsUnsignedLongLong(py_princ_name_size);
    2503           0 :                         if (PyErr_Occurred() != NULL) {
    2504           0 :                                 return false;
    2505             :                         }
    2506           0 :                         if (test_var > uint_max) {
    2507           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2508             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2509           0 :                                 return false;
    2510             :                         }
    2511           0 :                         r->in.princ_name_size = test_var;
    2512             :                 } else {
    2513           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2514             :                           PyLong_Type.tp_name);
    2515           0 :                         return false;
    2516             :                 }
    2517             :         }
    2518           0 :         return true;
    2519             : }
    2520             : 
    2521           0 : static PyObject *unpack_py_mgmt_inq_princ_name_args_out(struct mgmt_inq_princ_name *r)
    2522             : {
    2523             :         PyObject *result;
    2524             :         PyObject *py_princ_name;
    2525           0 :         if (r->out.princ_name == NULL) {
    2526           0 :                 py_princ_name = Py_None;
    2527           0 :                 Py_INCREF(py_princ_name);
    2528             :         } else {
    2529           0 :                 py_princ_name = PyUnicode_Decode(r->out.princ_name, strlen(r->out.princ_name), "utf-8", "ignore");
    2530             :         }
    2531           0 :         result = py_princ_name;
    2532           0 :         if (!W_ERROR_IS_OK(r->out.result)) {
    2533           0 :                 PyErr_SetWERROR(r->out.result);
    2534           0 :                 return NULL;
    2535             :         }
    2536             : 
    2537           0 :         return result;
    2538             : }
    2539             : 
    2540             : const struct PyNdrRpcMethodDef py_ndr_mgmt_methods[] = {
    2541             :         { "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 },
    2542             :         { "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 },
    2543             :         { "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 },
    2544             :         { "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 },
    2545             :         { "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 },
    2546             :         {0}
    2547             : };
    2548             : 
    2549           0 : static PyObject *interface_mgmt_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2550             : {
    2551           0 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_mgmt);
    2552             : }
    2553             : 
    2554             : #define PY_DOC_MGMT "DCE/RPC Remote Management"
    2555             : static PyTypeObject mgmt_InterfaceType = {
    2556             :         PyVarObject_HEAD_INIT(NULL, 0)
    2557             :         .tp_name = "mgmt.mgmt",
    2558             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    2559             :         .tp_doc = "mgmt(binding, lp_ctx=None, credentials=None) -> connection\n"
    2560             : "\n"
    2561             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    2562             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    2563             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_MGMT,
    2564             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2565             :         .tp_new = interface_mgmt_new,
    2566             : };
    2567             : 
    2568         510 : static PyObject *syntax_mgmt_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2569             : {
    2570         510 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_mgmt.syntax_id);
    2571             : }
    2572             : 
    2573             : #define PY_DOC_MGMT_SYNTAX "DCE/RPC Remote Management"
    2574             : static PyTypeObject mgmt_SyntaxType = {
    2575             :         PyVarObject_HEAD_INIT(NULL, 0)
    2576             :         .tp_name = "mgmt.mgmt_abstract_syntax",
    2577             :         .tp_doc = "mgmt_abstract_syntax()\n"PY_DOC_MGMT_SYNTAX,
    2578             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2579             :         .tp_new = syntax_mgmt_new,
    2580             : };
    2581             : 
    2582             : static PyMethodDef mgmt_methods[] = {
    2583             :         { NULL, NULL, 0, NULL }
    2584             : };
    2585             : 
    2586             : static struct PyModuleDef moduledef = {
    2587             :         PyModuleDef_HEAD_INIT,
    2588             :         .m_name = "mgmt",
    2589             :         .m_doc = "mgmt DCE/RPC",
    2590             :         .m_size = -1,
    2591             :         .m_methods = mgmt_methods,
    2592             : };
    2593           3 : MODULE_INIT_FUNC(mgmt)
    2594             : {
    2595           3 :         PyObject *m = NULL;
    2596           3 :         PyObject *dep_samba_dcerpc_misc = NULL;
    2597           3 :         PyObject *dep_talloc = NULL;
    2598           3 :         PyObject *dep_samba_dcerpc_base = NULL;
    2599             : 
    2600           3 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    2601           3 :         if (dep_samba_dcerpc_misc == NULL)
    2602           0 :                 goto out;
    2603             : 
    2604           3 :         dep_talloc = PyImport_ImportModule("talloc");
    2605           3 :         if (dep_talloc == NULL)
    2606           0 :                 goto out;
    2607             : 
    2608           3 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    2609           3 :         if (dep_samba_dcerpc_base == NULL)
    2610           0 :                 goto out;
    2611             : 
    2612           3 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    2613           3 :         if (ndr_syntax_id_Type == NULL)
    2614           0 :                 goto out;
    2615             : 
    2616           3 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    2617           3 :         if (BaseObject_Type == NULL)
    2618           0 :                 goto out;
    2619             : 
    2620           3 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    2621           3 :         if (ClientConnection_Type == NULL)
    2622           0 :                 goto out;
    2623             : 
    2624           3 :         ndr_syntax_id_p_Type.tp_base = BaseObject_Type;
    2625           3 :         ndr_syntax_id_p_Type.tp_basicsize = pytalloc_BaseObject_size();
    2626             : 
    2627           3 :         rpc_if_id_vector_t_Type.tp_base = BaseObject_Type;
    2628           3 :         rpc_if_id_vector_t_Type.tp_basicsize = pytalloc_BaseObject_size();
    2629             : 
    2630           3 :         mgmt_statistics_Type.tp_base = BaseObject_Type;
    2631           3 :         mgmt_statistics_Type.tp_basicsize = pytalloc_BaseObject_size();
    2632             : 
    2633           3 :         mgmt_inq_if_ids_Type.tp_base = BaseObject_Type;
    2634           3 :         mgmt_inq_if_ids_Type.tp_basicsize = pytalloc_BaseObject_size();
    2635             : 
    2636           3 :         mgmt_inq_stats_Type.tp_base = BaseObject_Type;
    2637           3 :         mgmt_inq_stats_Type.tp_basicsize = pytalloc_BaseObject_size();
    2638             : 
    2639           3 :         mgmt_is_server_listening_Type.tp_base = BaseObject_Type;
    2640           3 :         mgmt_is_server_listening_Type.tp_basicsize = pytalloc_BaseObject_size();
    2641             : 
    2642           3 :         mgmt_stop_server_listening_Type.tp_base = BaseObject_Type;
    2643           3 :         mgmt_stop_server_listening_Type.tp_basicsize = pytalloc_BaseObject_size();
    2644             : 
    2645           3 :         mgmt_inq_princ_name_Type.tp_base = BaseObject_Type;
    2646           3 :         mgmt_inq_princ_name_Type.tp_basicsize = pytalloc_BaseObject_size();
    2647             : 
    2648           3 :         mgmt_InterfaceType.tp_base = ClientConnection_Type;
    2649             : 
    2650           3 :         mgmt_SyntaxType.tp_base = ndr_syntax_id_Type;
    2651           3 :         mgmt_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    2652             : 
    2653           3 :         if (PyType_Ready(&ndr_syntax_id_p_Type) < 0)
    2654           0 :                 goto out;
    2655           3 :         if (PyType_Ready(&rpc_if_id_vector_t_Type) < 0)
    2656           0 :                 goto out;
    2657           3 :         if (PyType_Ready(&mgmt_statistics_Type) < 0)
    2658           0 :                 goto out;
    2659           3 :         if (PyType_Ready(&mgmt_inq_if_ids_Type) < 0)
    2660           0 :                 goto out;
    2661           3 :         if (PyType_Ready(&mgmt_inq_stats_Type) < 0)
    2662           0 :                 goto out;
    2663           3 :         if (PyType_Ready(&mgmt_is_server_listening_Type) < 0)
    2664           0 :                 goto out;
    2665           3 :         if (PyType_Ready(&mgmt_stop_server_listening_Type) < 0)
    2666           0 :                 goto out;
    2667           3 :         if (PyType_Ready(&mgmt_inq_princ_name_Type) < 0)
    2668           0 :                 goto out;
    2669           3 :         if (PyType_Ready(&mgmt_InterfaceType) < 0)
    2670           0 :                 goto out;
    2671           3 :         if (PyType_Ready(&mgmt_SyntaxType) < 0)
    2672           0 :                 goto out;
    2673           3 :         if (!PyInterface_AddNdrRpcMethods(&mgmt_InterfaceType, py_ndr_mgmt_methods))
    2674           0 :                 return NULL;
    2675             : 
    2676             : #ifdef PY_NDR_SYNTAX_ID_P_PATCH
    2677             :         PY_NDR_SYNTAX_ID_P_PATCH(&ndr_syntax_id_p_Type);
    2678             : #endif
    2679             : #ifdef PY_RPC_IF_ID_VECTOR_T_PATCH
    2680             :         PY_RPC_IF_ID_VECTOR_T_PATCH(&rpc_if_id_vector_t_Type);
    2681             : #endif
    2682             : #ifdef PY_STATISTICS_PATCH
    2683             :         PY_STATISTICS_PATCH(&mgmt_statistics_Type);
    2684             : #endif
    2685             : #ifdef PY_INQ_IF_IDS_PATCH
    2686             :         PY_INQ_IF_IDS_PATCH(&mgmt_inq_if_ids_Type);
    2687             : #endif
    2688             : #ifdef PY_INQ_STATS_PATCH
    2689             :         PY_INQ_STATS_PATCH(&mgmt_inq_stats_Type);
    2690             : #endif
    2691             : #ifdef PY_IS_SERVER_LISTENING_PATCH
    2692             :         PY_IS_SERVER_LISTENING_PATCH(&mgmt_is_server_listening_Type);
    2693             : #endif
    2694             : #ifdef PY_STOP_SERVER_LISTENING_PATCH
    2695             :         PY_STOP_SERVER_LISTENING_PATCH(&mgmt_stop_server_listening_Type);
    2696             : #endif
    2697             : #ifdef PY_INQ_PRINC_NAME_PATCH
    2698             :         PY_INQ_PRINC_NAME_PATCH(&mgmt_inq_princ_name_Type);
    2699             : #endif
    2700             : #ifdef PY_MGMT_PATCH
    2701             :         PY_MGMT_PATCH(&mgmt_InterfaceType);
    2702             : #endif
    2703             : #ifdef PY_MGMT_ABSTRACT_SYNTAX_PATCH
    2704             :         PY_MGMT_ABSTRACT_SYNTAX_PATCH(&mgmt_SyntaxType);
    2705             : #endif
    2706             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    2707             :         PY_ABSTRACT_SYNTAX_PATCH(&mgmt_SyntaxType);
    2708             : #endif
    2709             : 
    2710           3 :         m = PyModule_Create(&moduledef);
    2711           3 :         if (m == NULL)
    2712           0 :                 goto out;
    2713             : 
    2714           3 :         PyModule_AddObject(m, "MGMT_STATS_CALLS_IN", PyLong_FromUnsignedLongLong(0));
    2715           3 :         PyModule_AddObject(m, "MGMT_STATS_CALLS_OUT", PyLong_FromUnsignedLongLong(1));
    2716           3 :         PyModule_AddObject(m, "MGMT_STATS_PKTS_IN", PyLong_FromUnsignedLongLong(2));
    2717           3 :         PyModule_AddObject(m, "MGMT_STATS_PKTS_OUT", PyLong_FromUnsignedLongLong(3));
    2718           3 :         PyModule_AddObject(m, "MGMT_STATS_ARRAY_MAX_SIZE", PyLong_FromUnsignedLongLong(4));
    2719           2 :         Py_INCREF((PyObject *)(void *)&ndr_syntax_id_p_Type);
    2720           3 :         PyModule_AddObject(m, "ndr_syntax_id_p", (PyObject *)(void *)&ndr_syntax_id_p_Type);
    2721           2 :         Py_INCREF((PyObject *)(void *)&rpc_if_id_vector_t_Type);
    2722           3 :         PyModule_AddObject(m, "rpc_if_id_vector_t", (PyObject *)(void *)&rpc_if_id_vector_t_Type);
    2723           2 :         Py_INCREF((PyObject *)(void *)&mgmt_statistics_Type);
    2724           3 :         PyModule_AddObject(m, "statistics", (PyObject *)(void *)&mgmt_statistics_Type);
    2725           2 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_if_ids_Type);
    2726           3 :         PyModule_AddObject(m, "inq_if_ids", (PyObject *)(void *)&mgmt_inq_if_ids_Type);
    2727           2 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_stats_Type);
    2728           3 :         PyModule_AddObject(m, "inq_stats", (PyObject *)(void *)&mgmt_inq_stats_Type);
    2729           2 :         Py_INCREF((PyObject *)(void *)&mgmt_is_server_listening_Type);
    2730           3 :         PyModule_AddObject(m, "is_server_listening", (PyObject *)(void *)&mgmt_is_server_listening_Type);
    2731           2 :         Py_INCREF((PyObject *)(void *)&mgmt_stop_server_listening_Type);
    2732           3 :         PyModule_AddObject(m, "stop_server_listening", (PyObject *)(void *)&mgmt_stop_server_listening_Type);
    2733           2 :         Py_INCREF((PyObject *)(void *)&mgmt_inq_princ_name_Type);
    2734           3 :         PyModule_AddObject(m, "inq_princ_name", (PyObject *)(void *)&mgmt_inq_princ_name_Type);
    2735           2 :         Py_INCREF((PyObject *)(void *)&mgmt_InterfaceType);
    2736           3 :         PyModule_AddObject(m, "mgmt", (PyObject *)(void *)&mgmt_InterfaceType);
    2737           2 :         Py_INCREF((PyObject *)(void *)&mgmt_SyntaxType);
    2738           3 :         PyModule_AddObject(m, "mgmt_abstract_syntax", (PyObject *)(void *)&mgmt_SyntaxType);
    2739           2 :         Py_INCREF((PyObject *)(void *)&mgmt_SyntaxType);
    2740           3 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&mgmt_SyntaxType);
    2741             : #ifdef PY_MOD_MGMT_PATCH
    2742             :         PY_MOD_MGMT_PATCH(m);
    2743             : #endif
    2744           3 :         out:
    2745           3 :         Py_XDECREF(dep_samba_dcerpc_misc);
    2746           3 :         Py_XDECREF(dep_talloc);
    2747           3 :         Py_XDECREF(dep_samba_dcerpc_base);
    2748           3 :         return m;
    2749             : 
    2750             : }

Generated by: LCOV version 1.14