/* Python wrapper functions auto-generated by pidl */ #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */ #include #include "python/py3compat.h" #include "includes.h" #include "python/modules.h" #include #include "librpc/rpc/pyrpc.h" #include "librpc/rpc/pyrpc_util.h" #include "bin/default/librpc/gen_ndr/ndr_frsapi.h" #include "bin/default/librpc/gen_ndr/ndr_frsapi_c.h" /* * Suppress compiler warnings if the generated code does not call these * functions */ #ifndef _MAYBE_UNUSED_ #ifdef __has_attribute #if __has_attribute(unused) #define _MAYBE_UNUSED_ __attribute__ ((unused)) #else #define _MAYBE_UNUSED_ #endif #endif #endif /* * These functions are here to ensure they can be optimized out by * the compiler based on the constant input values */ static inline unsigned long long ndr_sizeof2uintmax(size_t var_size) { switch (var_size) { case 8: return UINT64_MAX; case 4: return UINT32_MAX; case 2: return UINT16_MAX; case 1: return UINT8_MAX; } return 0; } static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size) { switch (var_size) { case 8: return INT64_MAX; case 4: return INT32_MAX; case 2: return INT16_MAX; case 1: return INT8_MAX; } return 0; } #include "librpc/gen_ndr/misc.h" static PyTypeObject frsapi_Info_Type; static PyTypeObject frsapi_InterfaceType; static PyTypeObject frsapi_SetDsPollingIntervalW_Type; static PyTypeObject frsapi_GetDsPollingIntervalW_Type; static PyTypeObject frsapi_InfoW_Type; static PyTypeObject frsapi_IsPathReplicated_Type; static PyTypeObject frsapi_WriterCommand_Type; static PyTypeObject frsapi_ForceReplication_Type; static PyTypeObject *GUID_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *ClientConnection_Type; static PyTypeObject *ndr_syntax_id_Type; static PyObject *py_frsapi_Info_get_length(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_length; py_length = PyLong_FromUnsignedLongLong((uint32_t)object->length); return py_length; } static int py_frsapi_Info_set_length(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_guid(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_guid; py_guid = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->guid); return py_guid; } static int py_frsapi_Info_set_guid(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->guid"); return -1; } PY_CHECK_TYPE(GUID_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->guid = *(struct GUID *)pytalloc_get_ptr(value); return 0; } static PyObject *py_frsapi_Info_get_length2(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_length2; py_length2 = PyLong_FromUnsignedLongLong((uint32_t)object->length2); return py_length2; } static int py_frsapi_Info_set_length2(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length2"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length2)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->length2 = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_unknown1(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_unknown1; py_unknown1 = PyLong_FromUnsignedLongLong((uint32_t)object->unknown1); return py_unknown1; } static int py_frsapi_Info_set_unknown1(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unknown1"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->unknown1)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->unknown1 = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_level(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_level; py_level = PyLong_FromUnsignedLongLong((uint32_t)object->level); return py_level; } static int py_frsapi_Info_set_level(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->level)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_query_counter(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_query_counter; py_query_counter = PyLong_FromUnsignedLongLong((uint32_t)object->query_counter); return py_query_counter; } static int py_frsapi_Info_set_query_counter(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->query_counter"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->query_counter)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->query_counter = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_unknown2(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_unknown2; py_unknown2 = PyLong_FromUnsignedLongLong((uint32_t)object->unknown2); return py_unknown2; } static int py_frsapi_Info_set_unknown2(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unknown2"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->unknown2)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->unknown2 = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_offset(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_offset; py_offset = PyLong_FromUnsignedLongLong((uint32_t)object->offset); return py_offset; } static int py_frsapi_Info_set_offset(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->offset"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->offset)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->offset = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_blob_len(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_blob_len; py_blob_len = PyLong_FromUnsignedLongLong((uint32_t)object->blob_len); return py_blob_len; } static int py_frsapi_Info_set_blob_len(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->blob_len"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->blob_len)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->blob_len = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_Info_get_blob(PyObject *obj, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(obj); PyObject *py_blob; py_blob = PyBytes_FromStringAndSize((char *)(object->blob).data, (object->blob).length); return py_blob; } static int py_frsapi_Info_set_blob(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_Info *object = (struct frsapi_Info *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->blob"); return -1; } object->blob = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value)); return 0; } static PyGetSetDef py_frsapi_Info_getsetters[] = { { .name = discard_const_p(char, "length"), .get = py_frsapi_Info_get_length, .set = py_frsapi_Info_set_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "guid"), .get = py_frsapi_Info_get_guid, .set = py_frsapi_Info_set_guid, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = discard_const_p(char, "length2"), .get = py_frsapi_Info_get_length2, .set = py_frsapi_Info_set_length2, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "unknown1"), .get = py_frsapi_Info_get_unknown1, .set = py_frsapi_Info_set_unknown1, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "level"), .get = py_frsapi_Info_get_level, .set = py_frsapi_Info_set_level, .doc = discard_const_p(char, "PIDL-generated element of base type frsapi_InfoEnum") }, { .name = discard_const_p(char, "query_counter"), .get = py_frsapi_Info_get_query_counter, .set = py_frsapi_Info_set_query_counter, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "unknown2"), .get = py_frsapi_Info_get_unknown2, .set = py_frsapi_Info_set_unknown2, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "offset"), .get = py_frsapi_Info_get_offset, .set = py_frsapi_Info_set_offset, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "blob_len"), .get = py_frsapi_Info_get_blob_len, .set = py_frsapi_Info_set_blob_len, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "blob"), .get = py_frsapi_Info_get_blob, .set = py_frsapi_Info_set_blob, .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB") }, { .name = NULL } }; static PyObject *py_frsapi_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct frsapi_Info, type); } static PyTypeObject frsapi_Info_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.Info", .tp_getset = py_frsapi_Info_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_Info_new, }; static PyObject *py_frsapi_SetDsPollingIntervalW_in_get_CurrentInterval(PyObject *obj, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_CurrentInterval; py_CurrentInterval = PyLong_FromUnsignedLongLong((uint32_t)object->in.CurrentInterval); return py_CurrentInterval; } static int py_frsapi_SetDsPollingIntervalW_in_set_CurrentInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.CurrentInterval"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.CurrentInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.CurrentInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_SetDsPollingIntervalW_in_get_DsPollingLongInterval(PyObject *obj, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_DsPollingLongInterval; py_DsPollingLongInterval = PyLong_FromUnsignedLongLong((uint32_t)object->in.DsPollingLongInterval); return py_DsPollingLongInterval; } static int py_frsapi_SetDsPollingIntervalW_in_set_DsPollingLongInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DsPollingLongInterval"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.DsPollingLongInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.DsPollingLongInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_SetDsPollingIntervalW_in_get_DsPollingShortInterval(PyObject *obj, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_DsPollingShortInterval; py_DsPollingShortInterval = PyLong_FromUnsignedLongLong((uint32_t)object->in.DsPollingShortInterval); return py_DsPollingShortInterval; } static int py_frsapi_SetDsPollingIntervalW_in_set_DsPollingShortInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DsPollingShortInterval"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.DsPollingShortInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.DsPollingShortInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_SetDsPollingIntervalW_get_result(PyObject *obj, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_SetDsPollingIntervalW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_SetDsPollingIntervalW_getsetters[] = { { .name = discard_const_p(char, "in_CurrentInterval"), .get = py_frsapi_SetDsPollingIntervalW_in_get_CurrentInterval, .set = py_frsapi_SetDsPollingIntervalW_in_set_CurrentInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_DsPollingLongInterval"), .get = py_frsapi_SetDsPollingIntervalW_in_get_DsPollingLongInterval, .set = py_frsapi_SetDsPollingIntervalW_in_set_DsPollingLongInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_DsPollingShortInterval"), .get = py_frsapi_SetDsPollingIntervalW_in_get_DsPollingShortInterval, .set = py_frsapi_SetDsPollingIntervalW_in_set_DsPollingShortInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_SetDsPollingIntervalW_get_result, .set = py_frsapi_SetDsPollingIntervalW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_SetDsPollingIntervalW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_SetDsPollingIntervalW, type); return self; } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(4); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_SetDsPollingIntervalW_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[4]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_SetDsPollingIntervalW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_SetDsPollingIntervalW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_SetDsPollingIntervalW_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[4]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_SetDsPollingIntervalW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_SetDsPollingIntervalW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_SetDsPollingIntervalW *object = (struct frsapi_SetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_SetDsPollingIntervalW_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[4]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_SetDsPollingIntervalW_ndr_print(py_obj, "frsapi_SetDsPollingIntervalW_in", NDR_IN); } static PyObject *py_frsapi_SetDsPollingIntervalW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_SetDsPollingIntervalW_ndr_print(py_obj, "frsapi_SetDsPollingIntervalW_out", NDR_OUT); } static PyMethodDef py_frsapi_SetDsPollingIntervalW_methods[] = { { "opnum", (PyCFunction)py_frsapi_SetDsPollingIntervalW_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.SetDsPollingIntervalW.opnum() -> 4 (0x04) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_SetDsPollingIntervalW_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_SetDsPollingIntervalW_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_SetDsPollingIntervalW_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_SetDsPollingIntervalW_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_SetDsPollingIntervalW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_SetDsPollingIntervalW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_SetDsPollingIntervalW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.SetDsPollingIntervalW", .tp_getset = py_frsapi_SetDsPollingIntervalW_getsetters, .tp_methods = py_frsapi_SetDsPollingIntervalW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_SetDsPollingIntervalW_new, }; static bool pack_py_frsapi_SetDsPollingIntervalW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_SetDsPollingIntervalW *r) { PyObject *py_CurrentInterval; PyObject *py_DsPollingLongInterval; PyObject *py_DsPollingShortInterval; const char *kwnames[] = { "CurrentInterval", "DsPollingLongInterval", "DsPollingShortInterval", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:frsapi_SetDsPollingIntervalW", discard_const_p(char *, kwnames), &py_CurrentInterval, &py_DsPollingLongInterval, &py_DsPollingShortInterval)) { return false; } if (py_CurrentInterval == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.CurrentInterval"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.CurrentInterval)); if (PyLong_Check(py_CurrentInterval)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_CurrentInterval); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.CurrentInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_DsPollingLongInterval == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DsPollingLongInterval"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.DsPollingLongInterval)); if (PyLong_Check(py_DsPollingLongInterval)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_DsPollingLongInterval); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.DsPollingLongInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_DsPollingShortInterval == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DsPollingShortInterval"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.DsPollingShortInterval)); if (PyLong_Check(py_DsPollingShortInterval)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_DsPollingShortInterval); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.DsPollingShortInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_frsapi_SetDsPollingIntervalW_args_out(struct frsapi_SetDsPollingIntervalW *r) { PyObject *result; result = Py_None; Py_INCREF(result); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_frsapi_GetDsPollingIntervalW_out_get_CurrentInterval(PyObject *obj, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_CurrentInterval; if (object->out.CurrentInterval == NULL) { Py_RETURN_NONE; } py_CurrentInterval = PyLong_FromUnsignedLongLong((uint32_t)*object->out.CurrentInterval); return py_CurrentInterval; } static int py_frsapi_GetDsPollingIntervalW_out_set_CurrentInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.CurrentInterval)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.CurrentInterval"); return -1; } object->out.CurrentInterval = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.CurrentInterval); if (object->out.CurrentInterval == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.CurrentInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.CurrentInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_GetDsPollingIntervalW_out_get_DsPollingLongInterval(PyObject *obj, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_DsPollingLongInterval; if (object->out.DsPollingLongInterval == NULL) { Py_RETURN_NONE; } py_DsPollingLongInterval = PyLong_FromUnsignedLongLong((uint32_t)*object->out.DsPollingLongInterval); return py_DsPollingLongInterval; } static int py_frsapi_GetDsPollingIntervalW_out_set_DsPollingLongInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.DsPollingLongInterval)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.DsPollingLongInterval"); return -1; } object->out.DsPollingLongInterval = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.DsPollingLongInterval); if (object->out.DsPollingLongInterval == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.DsPollingLongInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.DsPollingLongInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_GetDsPollingIntervalW_out_get_DsPollingShortInterval(PyObject *obj, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_DsPollingShortInterval; if (object->out.DsPollingShortInterval == NULL) { Py_RETURN_NONE; } py_DsPollingShortInterval = PyLong_FromUnsignedLongLong((uint32_t)*object->out.DsPollingShortInterval); return py_DsPollingShortInterval; } static int py_frsapi_GetDsPollingIntervalW_out_set_DsPollingShortInterval(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.DsPollingShortInterval)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.DsPollingShortInterval"); return -1; } object->out.DsPollingShortInterval = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.DsPollingShortInterval); if (object->out.DsPollingShortInterval == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.DsPollingShortInterval)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.DsPollingShortInterval = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_GetDsPollingIntervalW_get_result(PyObject *obj, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_GetDsPollingIntervalW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_GetDsPollingIntervalW_getsetters[] = { { .name = discard_const_p(char, "out_CurrentInterval"), .get = py_frsapi_GetDsPollingIntervalW_out_get_CurrentInterval, .set = py_frsapi_GetDsPollingIntervalW_out_set_CurrentInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_DsPollingLongInterval"), .get = py_frsapi_GetDsPollingIntervalW_out_get_DsPollingLongInterval, .set = py_frsapi_GetDsPollingIntervalW_out_set_DsPollingLongInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_DsPollingShortInterval"), .get = py_frsapi_GetDsPollingIntervalW_out_get_DsPollingShortInterval, .set = py_frsapi_GetDsPollingIntervalW_out_set_DsPollingShortInterval, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_GetDsPollingIntervalW_get_result, .set = py_frsapi_GetDsPollingIntervalW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_GetDsPollingIntervalW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_GetDsPollingIntervalW, type); struct frsapi_GetDsPollingIntervalW *_self = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.CurrentInterval = talloc_zero(mem_ctx, uint32_t); _self->out.DsPollingLongInterval = talloc_zero(mem_ctx, uint32_t); _self->out.DsPollingShortInterval = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(5); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_GetDsPollingIntervalW_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[5]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_GetDsPollingIntervalW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_GetDsPollingIntervalW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_GetDsPollingIntervalW_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[5]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_GetDsPollingIntervalW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_GetDsPollingIntervalW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_GetDsPollingIntervalW *object = (struct frsapi_GetDsPollingIntervalW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_GetDsPollingIntervalW_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[5]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_GetDsPollingIntervalW_ndr_print(py_obj, "frsapi_GetDsPollingIntervalW_in", NDR_IN); } static PyObject *py_frsapi_GetDsPollingIntervalW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_GetDsPollingIntervalW_ndr_print(py_obj, "frsapi_GetDsPollingIntervalW_out", NDR_OUT); } static PyMethodDef py_frsapi_GetDsPollingIntervalW_methods[] = { { "opnum", (PyCFunction)py_frsapi_GetDsPollingIntervalW_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.GetDsPollingIntervalW.opnum() -> 5 (0x05) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_GetDsPollingIntervalW_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_GetDsPollingIntervalW_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_GetDsPollingIntervalW_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_GetDsPollingIntervalW_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_GetDsPollingIntervalW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_GetDsPollingIntervalW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_GetDsPollingIntervalW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.GetDsPollingIntervalW", .tp_getset = py_frsapi_GetDsPollingIntervalW_getsetters, .tp_methods = py_frsapi_GetDsPollingIntervalW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_GetDsPollingIntervalW_new, }; static bool pack_py_frsapi_GetDsPollingIntervalW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_GetDsPollingIntervalW *r) { const char *kwnames[] = { NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":frsapi_GetDsPollingIntervalW", discard_const_p(char *, kwnames))) { return false; } return true; } static PyObject *unpack_py_frsapi_GetDsPollingIntervalW_args_out(struct frsapi_GetDsPollingIntervalW *r) { PyObject *result; PyObject *py_CurrentInterval; PyObject *py_DsPollingLongInterval; PyObject *py_DsPollingShortInterval; result = PyTuple_New(3); py_CurrentInterval = PyLong_FromUnsignedLongLong((uint32_t)*r->out.CurrentInterval); PyTuple_SetItem(result, 0, py_CurrentInterval); py_DsPollingLongInterval = PyLong_FromUnsignedLongLong((uint32_t)*r->out.DsPollingLongInterval); PyTuple_SetItem(result, 1, py_DsPollingLongInterval); py_DsPollingShortInterval = PyLong_FromUnsignedLongLong((uint32_t)*r->out.DsPollingShortInterval); PyTuple_SetItem(result, 2, py_DsPollingShortInterval); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_frsapi_InfoW_in_get_length(PyObject *obj, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(obj); PyObject *py_length; py_length = PyLong_FromUnsignedLongLong((uint32_t)object->in.length); return py_length; } static int py_frsapi_InfoW_in_set_length(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.length"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_InfoW_in_get_info(PyObject *obj, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->in.info == NULL) { Py_RETURN_NONE; } if (object->in.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = pytalloc_reference_ex(&frsapi_Info_Type, object->in.info, object->in.info); } return py_info; } static int py_frsapi_InfoW_in_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info"); return -1; } if (value == Py_None) { object->in.info = NULL; } else { object->in.info = NULL; PY_CHECK_TYPE(&frsapi_Info_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->in.info = (struct frsapi_Info *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_frsapi_InfoW_out_get_info(PyObject *obj, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->out.info == NULL) { Py_RETURN_NONE; } if (object->out.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = pytalloc_reference_ex(&frsapi_Info_Type, object->out.info, object->out.info); } return py_info; } static int py_frsapi_InfoW_out_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.info"); return -1; } if (value == Py_None) { object->out.info = NULL; } else { object->out.info = NULL; PY_CHECK_TYPE(&frsapi_Info_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->out.info = (struct frsapi_Info *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_frsapi_InfoW_get_result(PyObject *obj, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_InfoW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_InfoW_getsetters[] = { { .name = discard_const_p(char, "in_length"), .get = py_frsapi_InfoW_in_get_length, .set = py_frsapi_InfoW_in_set_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_info"), .get = py_frsapi_InfoW_in_get_info, .set = py_frsapi_InfoW_in_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type frsapi_Info") }, { .name = discard_const_p(char, "out_info"), .get = py_frsapi_InfoW_out_get_info, .set = py_frsapi_InfoW_out_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type frsapi_Info") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_InfoW_get_result, .set = py_frsapi_InfoW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_InfoW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_InfoW, type); return self; } static PyObject *py_frsapi_InfoW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(7); } static PyObject *py_frsapi_InfoW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_InfoW_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[7]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_InfoW_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_InfoW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_InfoW_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_InfoW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_InfoW_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_InfoW_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[7]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_InfoW_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_InfoW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_InfoW_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_InfoW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_InfoW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_InfoW *object = (struct frsapi_InfoW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_InfoW_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[7]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_InfoW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_InfoW_ndr_print(py_obj, "frsapi_InfoW_in", NDR_IN); } static PyObject *py_frsapi_InfoW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_InfoW_ndr_print(py_obj, "frsapi_InfoW_out", NDR_OUT); } static PyMethodDef py_frsapi_InfoW_methods[] = { { "opnum", (PyCFunction)py_frsapi_InfoW_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.InfoW.opnum() -> 7 (0x07) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_InfoW_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_InfoW_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_InfoW_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_InfoW_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_InfoW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_InfoW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_InfoW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.InfoW", .tp_getset = py_frsapi_InfoW_getsetters, .tp_methods = py_frsapi_InfoW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_InfoW_new, }; static bool pack_py_frsapi_InfoW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_InfoW *r) { PyObject *py_length; PyObject *py_info; const char *kwnames[] = { "length", "info", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:frsapi_InfoW", discard_const_p(char *, kwnames), &py_length, &py_info)) { return false; } if (py_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.length"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.length)); if (PyLong_Check(py_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_info == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info"); return false; } if (py_info == Py_None) { r->in.info = NULL; } else { r->in.info = NULL; PY_CHECK_TYPE(&frsapi_Info_Type, py_info, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_info)) == NULL) { PyErr_NoMemory(); return false; } r->in.info = (struct frsapi_Info *)pytalloc_get_ptr(py_info); } return true; } static PyObject *unpack_py_frsapi_InfoW_args_out(struct frsapi_InfoW *r) { PyObject *result; PyObject *py_info; if (r->out.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = pytalloc_reference_ex(&frsapi_Info_Type, r->out.info, r->out.info); } result = py_info; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_frsapi_IsPathReplicated_in_get_path(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_path; if (object->in.path == NULL) { Py_RETURN_NONE; } if (object->in.path == NULL) { py_path = Py_None; Py_INCREF(py_path); } else { if (object->in.path == NULL) { py_path = Py_None; Py_INCREF(py_path); } else { py_path = PyUnicode_Decode(object->in.path, strlen(object->in.path), "utf-8", "ignore"); } } return py_path; } static int py_frsapi_IsPathReplicated_in_set_path(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.path"); return -1; } if (value == Py_None) { object->in.path = NULL; } else { object->in.path = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.path = talloc_str; } } return 0; } static PyObject *py_frsapi_IsPathReplicated_in_get_replica_set_type(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_replica_set_type; py_replica_set_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.replica_set_type); return py_replica_set_type; } static int py_frsapi_IsPathReplicated_in_set_replica_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.replica_set_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.replica_set_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.replica_set_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_IsPathReplicated_out_get_replicated(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_replicated; if (object->out.replicated == NULL) { Py_RETURN_NONE; } py_replicated = PyLong_FromUnsignedLongLong((uint32_t)*object->out.replicated); return py_replicated; } static int py_frsapi_IsPathReplicated_out_set_replicated(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.replicated)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.replicated"); return -1; } object->out.replicated = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.replicated); if (object->out.replicated == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.replicated)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.replicated = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_IsPathReplicated_out_get_primary(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_primary; if (object->out.primary == NULL) { Py_RETURN_NONE; } py_primary = PyLong_FromUnsignedLongLong((uint32_t)*object->out.primary); return py_primary; } static int py_frsapi_IsPathReplicated_out_set_primary(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.primary)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.primary"); return -1; } object->out.primary = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.primary); if (object->out.primary == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.primary)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.primary = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_IsPathReplicated_out_get_root(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_root; if (object->out.root == NULL) { Py_RETURN_NONE; } py_root = PyLong_FromUnsignedLongLong((uint32_t)*object->out.root); return py_root; } static int py_frsapi_IsPathReplicated_out_set_root(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.root)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.root"); return -1; } object->out.root = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.root); if (object->out.root == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.root)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.root = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_IsPathReplicated_out_get_replica_set_guid(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_replica_set_guid; if (object->out.replica_set_guid == NULL) { Py_RETURN_NONE; } py_replica_set_guid = pytalloc_reference_ex(GUID_Type, object->out.replica_set_guid, object->out.replica_set_guid); return py_replica_set_guid; } static int py_frsapi_IsPathReplicated_out_set_replica_set_guid(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.replica_set_guid)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.replica_set_guid"); return -1; } object->out.replica_set_guid = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.replica_set_guid); if (object->out.replica_set_guid == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(GUID_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->out.replica_set_guid = (struct GUID *)pytalloc_get_ptr(value); return 0; } static PyObject *py_frsapi_IsPathReplicated_get_result(PyObject *obj, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_IsPathReplicated_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_IsPathReplicated_getsetters[] = { { .name = discard_const_p(char, "in_path"), .get = py_frsapi_IsPathReplicated_in_get_path, .set = py_frsapi_IsPathReplicated_in_set_path, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_replica_set_type"), .get = py_frsapi_IsPathReplicated_in_get_replica_set_type, .set = py_frsapi_IsPathReplicated_in_set_replica_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type frsapi_ReplicaSetType") }, { .name = discard_const_p(char, "out_replicated"), .get = py_frsapi_IsPathReplicated_out_get_replicated, .set = py_frsapi_IsPathReplicated_out_set_replicated, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_primary"), .get = py_frsapi_IsPathReplicated_out_get_primary, .set = py_frsapi_IsPathReplicated_out_set_primary, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_root"), .get = py_frsapi_IsPathReplicated_out_get_root, .set = py_frsapi_IsPathReplicated_out_set_root, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_replica_set_guid"), .get = py_frsapi_IsPathReplicated_out_get_replica_set_guid, .set = py_frsapi_IsPathReplicated_out_set_replica_set_guid, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_IsPathReplicated_get_result, .set = py_frsapi_IsPathReplicated_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_IsPathReplicated_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_IsPathReplicated, type); struct frsapi_IsPathReplicated *_self = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.replicated = talloc_zero(mem_ctx, uint32_t); _self->out.primary = talloc_zero(mem_ctx, uint32_t); _self->out.root = talloc_zero(mem_ctx, uint32_t); _self->out.replica_set_guid = talloc_zero(mem_ctx, struct GUID); return self; } static PyObject *py_frsapi_IsPathReplicated_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(8); } static PyObject *py_frsapi_IsPathReplicated_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_IsPathReplicated_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[8]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_IsPathReplicated_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_IsPathReplicated_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_IsPathReplicated_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_IsPathReplicated_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_IsPathReplicated_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_IsPathReplicated_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[8]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_IsPathReplicated_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_IsPathReplicated_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_IsPathReplicated_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_IsPathReplicated_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_IsPathReplicated_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_IsPathReplicated *object = (struct frsapi_IsPathReplicated *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_IsPathReplicated_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[8]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_IsPathReplicated_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_IsPathReplicated_ndr_print(py_obj, "frsapi_IsPathReplicated_in", NDR_IN); } static PyObject *py_frsapi_IsPathReplicated_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_IsPathReplicated_ndr_print(py_obj, "frsapi_IsPathReplicated_out", NDR_OUT); } static PyMethodDef py_frsapi_IsPathReplicated_methods[] = { { "opnum", (PyCFunction)py_frsapi_IsPathReplicated_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.IsPathReplicated.opnum() -> 8 (0x08) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_IsPathReplicated_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_IsPathReplicated_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_IsPathReplicated_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_IsPathReplicated_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_IsPathReplicated_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_IsPathReplicated_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_IsPathReplicated_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.IsPathReplicated", .tp_getset = py_frsapi_IsPathReplicated_getsetters, .tp_methods = py_frsapi_IsPathReplicated_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_IsPathReplicated_new, }; static bool pack_py_frsapi_IsPathReplicated_args_in(PyObject *args, PyObject *kwargs, struct frsapi_IsPathReplicated *r) { PyObject *py_path; PyObject *py_replica_set_type; const char *kwnames[] = { "path", "replica_set_type", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:frsapi_IsPathReplicated", discard_const_p(char *, kwnames), &py_path, &py_replica_set_type)) { return false; } if (py_path == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.path"); return false; } if (py_path == Py_None) { r->in.path = NULL; } else { r->in.path = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_path)) { unicode = PyUnicode_AsEncodedString(py_path, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_path)) { test_str = PyBytes_AS_STRING(py_path); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_path)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.path = talloc_str; } } if (py_replica_set_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.replica_set_type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.replica_set_type)); if (PyLong_Check(py_replica_set_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_replica_set_type); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.replica_set_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_frsapi_IsPathReplicated_args_out(struct frsapi_IsPathReplicated *r) { PyObject *result; PyObject *py_replicated; PyObject *py_primary; PyObject *py_root; PyObject *py_replica_set_guid; result = PyTuple_New(4); py_replicated = PyLong_FromUnsignedLongLong((uint32_t)*r->out.replicated); PyTuple_SetItem(result, 0, py_replicated); py_primary = PyLong_FromUnsignedLongLong((uint32_t)*r->out.primary); PyTuple_SetItem(result, 1, py_primary); py_root = PyLong_FromUnsignedLongLong((uint32_t)*r->out.root); PyTuple_SetItem(result, 2, py_root); py_replica_set_guid = pytalloc_reference_ex(GUID_Type, r->out.replica_set_guid, r->out.replica_set_guid); PyTuple_SetItem(result, 3, py_replica_set_guid); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_frsapi_WriterCommand_in_get_command(PyObject *obj, void *closure) { struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(obj); PyObject *py_command; py_command = PyLong_FromUnsignedLongLong((uint32_t)object->in.command); return py_command; } static int py_frsapi_WriterCommand_in_set_command(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.command"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.command)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_frsapi_WriterCommand_get_result(PyObject *obj, void *closure) { struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_WriterCommand_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_WriterCommand_getsetters[] = { { .name = discard_const_p(char, "in_command"), .get = py_frsapi_WriterCommand_in_get_command, .set = py_frsapi_WriterCommand_in_set_command, .doc = discard_const_p(char, "PIDL-generated element of base type frsapi_WriterCommandsValues") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_WriterCommand_get_result, .set = py_frsapi_WriterCommand_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_WriterCommand_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_WriterCommand, type); return self; } static PyObject *py_frsapi_WriterCommand_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(9); } static PyObject *py_frsapi_WriterCommand_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_WriterCommand_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[9]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_WriterCommand_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_WriterCommand_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_WriterCommand_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_WriterCommand_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_WriterCommand_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_WriterCommand_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[9]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_WriterCommand_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_WriterCommand_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_WriterCommand_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_WriterCommand_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_WriterCommand_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_WriterCommand *object = (struct frsapi_WriterCommand *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_WriterCommand_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[9]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_WriterCommand_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_WriterCommand_ndr_print(py_obj, "frsapi_WriterCommand_in", NDR_IN); } static PyObject *py_frsapi_WriterCommand_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_WriterCommand_ndr_print(py_obj, "frsapi_WriterCommand_out", NDR_OUT); } static PyMethodDef py_frsapi_WriterCommand_methods[] = { { "opnum", (PyCFunction)py_frsapi_WriterCommand_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.WriterCommand.opnum() -> 9 (0x09) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_WriterCommand_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_WriterCommand_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_WriterCommand_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_WriterCommand_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_WriterCommand_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_WriterCommand_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_WriterCommand_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.WriterCommand", .tp_getset = py_frsapi_WriterCommand_getsetters, .tp_methods = py_frsapi_WriterCommand_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_WriterCommand_new, }; static bool pack_py_frsapi_WriterCommand_args_in(PyObject *args, PyObject *kwargs, struct frsapi_WriterCommand *r) { PyObject *py_command; const char *kwnames[] = { "command", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:frsapi_WriterCommand", discard_const_p(char *, kwnames), &py_command)) { return false; } if (py_command == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.command"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.command)); if (PyLong_Check(py_command)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_command); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_frsapi_WriterCommand_args_out(struct frsapi_WriterCommand *r) { PyObject *result; result = Py_None; Py_INCREF(result); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_frsapi_ForceReplication_in_get_replica_set_guid(PyObject *obj, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(obj); PyObject *py_replica_set_guid; if (object->in.replica_set_guid == NULL) { Py_RETURN_NONE; } if (object->in.replica_set_guid == NULL) { py_replica_set_guid = Py_None; Py_INCREF(py_replica_set_guid); } else { py_replica_set_guid = pytalloc_reference_ex(GUID_Type, object->in.replica_set_guid, object->in.replica_set_guid); } return py_replica_set_guid; } static int py_frsapi_ForceReplication_in_set_replica_set_guid(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.replica_set_guid)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.replica_set_guid"); return -1; } if (value == Py_None) { object->in.replica_set_guid = NULL; } else { object->in.replica_set_guid = NULL; PY_CHECK_TYPE(GUID_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->in.replica_set_guid = (struct GUID *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_frsapi_ForceReplication_in_get_connection_guid(PyObject *obj, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(obj); PyObject *py_connection_guid; if (object->in.connection_guid == NULL) { Py_RETURN_NONE; } if (object->in.connection_guid == NULL) { py_connection_guid = Py_None; Py_INCREF(py_connection_guid); } else { py_connection_guid = pytalloc_reference_ex(GUID_Type, object->in.connection_guid, object->in.connection_guid); } return py_connection_guid; } static int py_frsapi_ForceReplication_in_set_connection_guid(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.connection_guid)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.connection_guid"); return -1; } if (value == Py_None) { object->in.connection_guid = NULL; } else { object->in.connection_guid = NULL; PY_CHECK_TYPE(GUID_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->in.connection_guid = (struct GUID *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_frsapi_ForceReplication_in_get_replica_set_name(PyObject *obj, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(obj); PyObject *py_replica_set_name; if (object->in.replica_set_name == NULL) { Py_RETURN_NONE; } if (object->in.replica_set_name == NULL) { py_replica_set_name = Py_None; Py_INCREF(py_replica_set_name); } else { if (object->in.replica_set_name == NULL) { py_replica_set_name = Py_None; Py_INCREF(py_replica_set_name); } else { py_replica_set_name = PyUnicode_Decode(object->in.replica_set_name, strlen(object->in.replica_set_name), "utf-8", "ignore"); } } return py_replica_set_name; } static int py_frsapi_ForceReplication_in_set_replica_set_name(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.replica_set_name"); return -1; } if (value == Py_None) { object->in.replica_set_name = NULL; } else { object->in.replica_set_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.replica_set_name = talloc_str; } } return 0; } static PyObject *py_frsapi_ForceReplication_in_get_partner_dns_name(PyObject *obj, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(obj); PyObject *py_partner_dns_name; if (object->in.partner_dns_name == NULL) { Py_RETURN_NONE; } if (object->in.partner_dns_name == NULL) { py_partner_dns_name = Py_None; Py_INCREF(py_partner_dns_name); } else { if (object->in.partner_dns_name == NULL) { py_partner_dns_name = Py_None; Py_INCREF(py_partner_dns_name); } else { py_partner_dns_name = PyUnicode_Decode(object->in.partner_dns_name, strlen(object->in.partner_dns_name), "utf-8", "ignore"); } } return py_partner_dns_name; } static int py_frsapi_ForceReplication_in_set_partner_dns_name(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.partner_dns_name"); return -1; } if (value == Py_None) { object->in.partner_dns_name = NULL; } else { object->in.partner_dns_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.partner_dns_name = talloc_str; } } return 0; } static PyObject *py_frsapi_ForceReplication_get_result(PyObject *obj, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_frsapi_ForceReplication_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_frsapi_ForceReplication_getsetters[] = { { .name = discard_const_p(char, "in_replica_set_guid"), .get = py_frsapi_ForceReplication_in_get_replica_set_guid, .set = py_frsapi_ForceReplication_in_set_replica_set_guid, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = discard_const_p(char, "in_connection_guid"), .get = py_frsapi_ForceReplication_in_get_connection_guid, .set = py_frsapi_ForceReplication_in_set_connection_guid, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = discard_const_p(char, "in_replica_set_name"), .get = py_frsapi_ForceReplication_in_get_replica_set_name, .set = py_frsapi_ForceReplication_in_set_replica_set_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_partner_dns_name"), .get = py_frsapi_ForceReplication_in_get_partner_dns_name, .set = py_frsapi_ForceReplication_in_set_partner_dns_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_frsapi_ForceReplication_get_result, .set = py_frsapi_ForceReplication_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_frsapi_ForceReplication_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct frsapi_ForceReplication, type); return self; } static PyObject *py_frsapi_ForceReplication_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(10); } static PyObject *py_frsapi_ForceReplication_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_ForceReplication_ndr_pack"); return NULL; } call = &ndr_table_frsapi.calls[10]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_frsapi_ForceReplication_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_ForceReplication_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_frsapi_ForceReplication_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_frsapi_ForceReplication_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_frsapi_ForceReplication_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_frsapi.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_ForceReplication_ndr_unpack"); return NULL; } call = &ndr_table_frsapi.calls[10]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_frsapi_ForceReplication_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_ForceReplication_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_ForceReplication_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_frsapi_ForceReplication_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_frsapi_ForceReplication_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct frsapi_ForceReplication *object = (struct frsapi_ForceReplication *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_frsapi.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_frsapi_ForceReplication_ndr_print"); return NULL; } call = &ndr_table_frsapi.calls[10]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_frsapi_ForceReplication_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_ForceReplication_ndr_print(py_obj, "frsapi_ForceReplication_in", NDR_IN); } static PyObject *py_frsapi_ForceReplication_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_frsapi_ForceReplication_ndr_print(py_obj, "frsapi_ForceReplication_out", NDR_OUT); } static PyMethodDef py_frsapi_ForceReplication_methods[] = { { "opnum", (PyCFunction)py_frsapi_ForceReplication_ndr_opnum, METH_NOARGS|METH_CLASS, "frsapi.ForceReplication.opnum() -> 10 (0x0a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_ForceReplication_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_ForceReplication_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_ForceReplication_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_frsapi_ForceReplication_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_frsapi_ForceReplication_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_frsapi_ForceReplication_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject frsapi_ForceReplication_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.ForceReplication", .tp_getset = py_frsapi_ForceReplication_getsetters, .tp_methods = py_frsapi_ForceReplication_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_frsapi_ForceReplication_new, }; static bool pack_py_frsapi_ForceReplication_args_in(PyObject *args, PyObject *kwargs, struct frsapi_ForceReplication *r) { PyObject *py_replica_set_guid; PyObject *py_connection_guid; PyObject *py_replica_set_name; PyObject *py_partner_dns_name; const char *kwnames[] = { "replica_set_guid", "connection_guid", "replica_set_name", "partner_dns_name", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:frsapi_ForceReplication", discard_const_p(char *, kwnames), &py_replica_set_guid, &py_connection_guid, &py_replica_set_name, &py_partner_dns_name)) { return false; } if (py_replica_set_guid == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.replica_set_guid"); return false; } if (py_replica_set_guid == Py_None) { r->in.replica_set_guid = NULL; } else { r->in.replica_set_guid = NULL; PY_CHECK_TYPE(GUID_Type, py_replica_set_guid, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_replica_set_guid)) == NULL) { PyErr_NoMemory(); return false; } r->in.replica_set_guid = (struct GUID *)pytalloc_get_ptr(py_replica_set_guid); } if (py_connection_guid == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.connection_guid"); return false; } if (py_connection_guid == Py_None) { r->in.connection_guid = NULL; } else { r->in.connection_guid = NULL; PY_CHECK_TYPE(GUID_Type, py_connection_guid, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_connection_guid)) == NULL) { PyErr_NoMemory(); return false; } r->in.connection_guid = (struct GUID *)pytalloc_get_ptr(py_connection_guid); } if (py_replica_set_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.replica_set_name"); return false; } if (py_replica_set_name == Py_None) { r->in.replica_set_name = NULL; } else { r->in.replica_set_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_replica_set_name)) { unicode = PyUnicode_AsEncodedString(py_replica_set_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_replica_set_name)) { test_str = PyBytes_AS_STRING(py_replica_set_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_replica_set_name)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.replica_set_name = talloc_str; } } if (py_partner_dns_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.partner_dns_name"); return false; } if (py_partner_dns_name == Py_None) { r->in.partner_dns_name = NULL; } else { r->in.partner_dns_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_partner_dns_name)) { unicode = PyUnicode_AsEncodedString(py_partner_dns_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_partner_dns_name)) { test_str = PyBytes_AS_STRING(py_partner_dns_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_partner_dns_name)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.partner_dns_name = talloc_str; } } return true; } static PyObject *unpack_py_frsapi_ForceReplication_args_out(struct frsapi_ForceReplication *r) { PyObject *result; result = Py_None; Py_INCREF(result); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } const struct PyNdrRpcMethodDef py_ndr_frsapi_methods[] = { { "SetDsPollingIntervalW", "S.SetDsPollingIntervalW(CurrentInterval, DsPollingLongInterval, DsPollingShortInterval) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_SetDsPollingIntervalW_r, (py_data_pack_fn)pack_py_frsapi_SetDsPollingIntervalW_args_in, (py_data_unpack_fn)unpack_py_frsapi_SetDsPollingIntervalW_args_out, 4, &ndr_table_frsapi }, { "GetDsPollingIntervalW", "S.GetDsPollingIntervalW() -> (CurrentInterval, DsPollingLongInterval, DsPollingShortInterval)", (py_dcerpc_call_fn)dcerpc_frsapi_GetDsPollingIntervalW_r, (py_data_pack_fn)pack_py_frsapi_GetDsPollingIntervalW_args_in, (py_data_unpack_fn)unpack_py_frsapi_GetDsPollingIntervalW_args_out, 5, &ndr_table_frsapi }, { "InfoW", "S.InfoW(length, info) -> info", (py_dcerpc_call_fn)dcerpc_frsapi_InfoW_r, (py_data_pack_fn)pack_py_frsapi_InfoW_args_in, (py_data_unpack_fn)unpack_py_frsapi_InfoW_args_out, 7, &ndr_table_frsapi }, { "IsPathReplicated", "S.IsPathReplicated(path, replica_set_type) -> (replicated, primary, root, replica_set_guid)", (py_dcerpc_call_fn)dcerpc_frsapi_IsPathReplicated_r, (py_data_pack_fn)pack_py_frsapi_IsPathReplicated_args_in, (py_data_unpack_fn)unpack_py_frsapi_IsPathReplicated_args_out, 8, &ndr_table_frsapi }, { "WriterCommand", "S.WriterCommand(command) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_WriterCommand_r, (py_data_pack_fn)pack_py_frsapi_WriterCommand_args_in, (py_data_unpack_fn)unpack_py_frsapi_WriterCommand_args_out, 9, &ndr_table_frsapi }, { "ForceReplication", "S.ForceReplication(replica_set_guid, connection_guid, replica_set_name, partner_dns_name) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_ForceReplication_r, (py_data_pack_fn)pack_py_frsapi_ForceReplication_args_in, (py_data_unpack_fn)unpack_py_frsapi_ForceReplication_args_out, 10, &ndr_table_frsapi }, {0} }; static PyObject *interface_frsapi_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_frsapi); } #define PY_DOC_FRSAPI "File Replication API" static PyTypeObject frsapi_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.frsapi", .tp_basicsize = sizeof(dcerpc_InterfaceObject), .tp_doc = "frsapi(binding, lp_ctx=None, credentials=None) -> connection\n" "\n" "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n" "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n" "credentials should be a credentials.Credentials object.\n\n"PY_DOC_FRSAPI, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = interface_frsapi_new, }; static PyObject *syntax_frsapi_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_frsapi.syntax_id); } #define PY_DOC_FRSAPI_SYNTAX "File Replication API" static PyTypeObject frsapi_SyntaxType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "frsapi.frsapi_abstract_syntax", .tp_doc = "frsapi_abstract_syntax()\n"PY_DOC_FRSAPI_SYNTAX, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = syntax_frsapi_new, }; static PyMethodDef frsapi_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "frsapi", .m_doc = "frsapi DCE/RPC", .m_size = -1, .m_methods = frsapi_methods, }; MODULE_INIT_FUNC(frsapi) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_misc = NULL; PyObject *dep_talloc = NULL; PyObject *dep_samba_dcerpc_base = NULL; dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc"); if (dep_samba_dcerpc_misc == NULL) goto out; dep_talloc = PyImport_ImportModule("talloc"); if (dep_talloc == NULL) goto out; dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base"); if (dep_samba_dcerpc_base == NULL) goto out; GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID"); if (GUID_Type == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection"); if (ClientConnection_Type == NULL) goto out; ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id"); if (ndr_syntax_id_Type == NULL) goto out; frsapi_Info_Type.tp_base = BaseObject_Type; frsapi_Info_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_SetDsPollingIntervalW_Type.tp_base = BaseObject_Type; frsapi_SetDsPollingIntervalW_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_GetDsPollingIntervalW_Type.tp_base = BaseObject_Type; frsapi_GetDsPollingIntervalW_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_InfoW_Type.tp_base = BaseObject_Type; frsapi_InfoW_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_IsPathReplicated_Type.tp_base = BaseObject_Type; frsapi_IsPathReplicated_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_WriterCommand_Type.tp_base = BaseObject_Type; frsapi_WriterCommand_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_ForceReplication_Type.tp_base = BaseObject_Type; frsapi_ForceReplication_Type.tp_basicsize = pytalloc_BaseObject_size(); frsapi_InterfaceType.tp_base = ClientConnection_Type; frsapi_SyntaxType.tp_base = ndr_syntax_id_Type; frsapi_SyntaxType.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&frsapi_Info_Type) < 0) goto out; if (PyType_Ready(&frsapi_SetDsPollingIntervalW_Type) < 0) goto out; if (PyType_Ready(&frsapi_GetDsPollingIntervalW_Type) < 0) goto out; if (PyType_Ready(&frsapi_InfoW_Type) < 0) goto out; if (PyType_Ready(&frsapi_IsPathReplicated_Type) < 0) goto out; if (PyType_Ready(&frsapi_WriterCommand_Type) < 0) goto out; if (PyType_Ready(&frsapi_ForceReplication_Type) < 0) goto out; if (PyType_Ready(&frsapi_InterfaceType) < 0) goto out; if (PyType_Ready(&frsapi_SyntaxType) < 0) goto out; if (!PyInterface_AddNdrRpcMethods(&frsapi_InterfaceType, py_ndr_frsapi_methods)) return NULL; #ifdef PY_INFO_PATCH PY_INFO_PATCH(&frsapi_Info_Type); #endif #ifdef PY_SETDSPOLLINGINTERVALW_PATCH PY_SETDSPOLLINGINTERVALW_PATCH(&frsapi_SetDsPollingIntervalW_Type); #endif #ifdef PY_GETDSPOLLINGINTERVALW_PATCH PY_GETDSPOLLINGINTERVALW_PATCH(&frsapi_GetDsPollingIntervalW_Type); #endif #ifdef PY_INFOW_PATCH PY_INFOW_PATCH(&frsapi_InfoW_Type); #endif #ifdef PY_ISPATHREPLICATED_PATCH PY_ISPATHREPLICATED_PATCH(&frsapi_IsPathReplicated_Type); #endif #ifdef PY_WRITERCOMMAND_PATCH PY_WRITERCOMMAND_PATCH(&frsapi_WriterCommand_Type); #endif #ifdef PY_FORCEREPLICATION_PATCH PY_FORCEREPLICATION_PATCH(&frsapi_ForceReplication_Type); #endif #ifdef PY_FRSAPI_PATCH PY_FRSAPI_PATCH(&frsapi_InterfaceType); #endif #ifdef PY_FRSAPI_ABSTRACT_SYNTAX_PATCH PY_FRSAPI_ABSTRACT_SYNTAX_PATCH(&frsapi_SyntaxType); #endif #ifdef PY_ABSTRACT_SYNTAX_PATCH PY_ABSTRACT_SYNTAX_PATCH(&frsapi_SyntaxType); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "FRSAPI_INFO_VERSION", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_VERSION)); PyModule_AddObject(m, "FRSAPI_INFO_SETS", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_SETS)); PyModule_AddObject(m, "FRSAPI_INFO_DS", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_DS)); PyModule_AddObject(m, "FRSAPI_INFO_MEMORY", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_MEMORY)); PyModule_AddObject(m, "FRSAPI_INFO_IDTABLE", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_IDTABLE)); PyModule_AddObject(m, "FRSAPI_INFO_OUTLOG", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_OUTLOG)); PyModule_AddObject(m, "FRSAPI_INFO_INLOG", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_INLOG)); PyModule_AddObject(m, "FRSAPI_INFO_THREADS", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_THREADS)); PyModule_AddObject(m, "FRSAPI_INFO_STAGE", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_STAGE)); PyModule_AddObject(m, "FRSAPI_INFO_CONFIGTABLE", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_INFO_CONFIGTABLE)); PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_0", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_REPLICA_SET_TYPE_0)); PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_DOMAIN", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_REPLICA_SET_TYPE_DOMAIN)); PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_DFS", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_REPLICA_SET_TYPE_DFS)); PyModule_AddObject(m, "FRSAPI_WRITER_COMMAND_FREEZE", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_WRITER_COMMAND_FREEZE)); PyModule_AddObject(m, "FRSAPI_WRITER_COMMAND_THAW", PyLong_FromUnsignedLongLong((uint32_t)FRSAPI_WRITER_COMMAND_THAW)); Py_INCREF((PyObject *)(void *)&frsapi_Info_Type); PyModule_AddObject(m, "Info", (PyObject *)(void *)&frsapi_Info_Type); Py_INCREF((PyObject *)(void *)&frsapi_SetDsPollingIntervalW_Type); PyModule_AddObject(m, "SetDsPollingIntervalW", (PyObject *)(void *)&frsapi_SetDsPollingIntervalW_Type); Py_INCREF((PyObject *)(void *)&frsapi_GetDsPollingIntervalW_Type); PyModule_AddObject(m, "GetDsPollingIntervalW", (PyObject *)(void *)&frsapi_GetDsPollingIntervalW_Type); Py_INCREF((PyObject *)(void *)&frsapi_InfoW_Type); PyModule_AddObject(m, "InfoW", (PyObject *)(void *)&frsapi_InfoW_Type); Py_INCREF((PyObject *)(void *)&frsapi_IsPathReplicated_Type); PyModule_AddObject(m, "IsPathReplicated", (PyObject *)(void *)&frsapi_IsPathReplicated_Type); Py_INCREF((PyObject *)(void *)&frsapi_WriterCommand_Type); PyModule_AddObject(m, "WriterCommand", (PyObject *)(void *)&frsapi_WriterCommand_Type); Py_INCREF((PyObject *)(void *)&frsapi_ForceReplication_Type); PyModule_AddObject(m, "ForceReplication", (PyObject *)(void *)&frsapi_ForceReplication_Type); Py_INCREF((PyObject *)(void *)&frsapi_InterfaceType); PyModule_AddObject(m, "frsapi", (PyObject *)(void *)&frsapi_InterfaceType); Py_INCREF((PyObject *)(void *)&frsapi_SyntaxType); PyModule_AddObject(m, "frsapi_abstract_syntax", (PyObject *)(void *)&frsapi_SyntaxType); Py_INCREF((PyObject *)(void *)&frsapi_SyntaxType); PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&frsapi_SyntaxType); #ifdef PY_MOD_FRSAPI_PATCH PY_MOD_FRSAPI_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_misc); Py_XDECREF(dep_talloc); Py_XDECREF(dep_samba_dcerpc_base); return m; }