git add -f bin/default/librpc/gen_ndr/*.{c,h,ndr,pidl} bin/default/source*/librpc...
[metze/samba/wip.git] / bin / default / source4 / librpc / gen_ndr / py_winsrepl.c
index e142b313e1b0d6f563366f2ef65a20d4f6057211..806c1d4305cd74db379b0c0aa3e937e1d056f136 100644 (file)
@@ -8,19 +8,80 @@
 #include "bin/default/source4/librpc/gen_ndr/ndr_winsrepl.h"
 #include "bin/default/source4/librpc/gen_ndr/ndr_winsrepl_c.h"
 
+/*
+ * These functions are here to ensure they can be optomised 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 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;
+}
+
+static inline PyObject *ndr_PyLong_FromLongLong(long long v)
+{
+       if (v > LONG_MAX || v < LONG_MIN) {
+               return PyLong_FromLongLong(v);
+       } else {
+               return PyInt_FromLong(v);
+       }
+}
+
+static inline PyObject *ndr_PyLong_FromUnsignedLongLong(unsigned long long v)
+{
+       if (v > LONG_MAX) {
+               return PyLong_FromUnsignedLongLong(v);
+       } else {
+               return PyInt_FromLong(v);
+       }
+}
+
 #include "librpc/gen_ndr/nbt.h"
-staticforward PyTypeObject wrepl_ip_Type;
-staticforward PyTypeObject wrepl_address_list_Type;
-staticforward PyTypeObject wrepl_wins_name_Type;
-staticforward PyTypeObject wrepl_send_reply_Type;
-staticforward PyTypeObject wrepl_wins_owner_Type;
-staticforward PyTypeObject wrepl_table_Type;
-staticforward PyTypeObject wrepl_replication_Type;
-staticforward PyTypeObject wrepl_start_Type;
-staticforward PyTypeObject wrepl_stop_Type;
-staticforward PyTypeObject wrepl_packet_Type;
-staticforward PyTypeObject wrepl_wrap_Type;
-staticforward PyTypeObject wrepl_InterfaceType;
+static PyTypeObject wrepl_ip_Type;
+static PyTypeObject wrepl_address_list_Type;
+PyObject *py_import_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, union wrepl_addresses *in);
+union wrepl_addresses *py_export_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, PyObject *in);
+static PyTypeObject wrepl_wins_name_Type;
+static PyTypeObject wrepl_send_reply_Type;
+static PyTypeObject wrepl_wins_owner_Type;
+static PyTypeObject wrepl_table_Type;
+PyObject *py_import_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, union wrepl_replication_info *in);
+union wrepl_replication_info *py_export_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, PyObject *in);
+static PyTypeObject wrepl_replication_Type;
+static PyTypeObject wrepl_start_Type;
+static PyTypeObject wrepl_stop_Type;
+PyObject *py_import_wrepl_message(TALLOC_CTX *mem_ctx, int level, union wrepl_message *in);
+union wrepl_message *py_export_wrepl_message(TALLOC_CTX *mem_ctx, int level, PyObject *in);
+static PyTypeObject wrepl_packet_Type;
+static PyTypeObject wrepl_wrap_Type;
+static PyTypeObject wrepl_InterfaceType;
 
 void initwinsrepl(void);static PyTypeObject *Object_Type;
 static PyTypeObject *ClientConnection_Type;
@@ -83,15 +144,42 @@ static PyObject *py_wrepl_address_list_get_num_ips(PyObject *obj, void *closure)
 {
        struct wrepl_address_list *object = (struct wrepl_address_list *)pytalloc_get_ptr(obj);
        PyObject *py_num_ips;
-       py_num_ips = PyInt_FromLong(object->num_ips);
+       py_num_ips = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->num_ips);
        return py_num_ips;
 }
 
 static int py_wrepl_address_list_set_num_ips(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_address_list *object = (struct wrepl_address_list *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->num_ips = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_ips));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->num_ips = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->num_ips = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -105,7 +193,7 @@ static PyObject *py_wrepl_address_list_get_ips(PyObject *obj, void *closure)
        }
        {
                int ips_cntr_0;
-               for (ips_cntr_0 = 0; ips_cntr_0 < object->num_ips; ips_cntr_0++) {
+               for (ips_cntr_0 = 0; ips_cntr_0 < (object->num_ips); ips_cntr_0++) {
                        PyObject *py_ips_0;
                        py_ips_0 = pytalloc_reference_ex(&wrepl_ip_Type, object->ips, &object->ips[ips_cntr_0]);
                        PyList_SetItem(py_ips, ips_cntr_0, py_ips_0);
@@ -157,7 +245,7 @@ static PyTypeObject wrepl_address_list_Type = {
        .tp_new = py_wrepl_address_list_new,
 };
 
-static PyObject *py_import_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, union wrepl_addresses *in)
+PyObject *py_import_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, union wrepl_addresses *in)
 {
        PyObject *ret;
 
@@ -175,7 +263,7 @@ static PyObject *py_import_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, union
        return NULL;
 }
 
-static union wrepl_addresses *py_export_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, PyObject *in)
+union wrepl_addresses *py_export_wrepl_addresses(TALLOC_CTX *mem_ctx, int level, PyObject *in)
 {
        union wrepl_addresses *ret = talloc_zero(mem_ctx, union wrepl_addresses);
        switch (level) {
@@ -221,21 +309,41 @@ static PyObject *py_wrepl_wins_name_get_flags(PyObject *obj, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(obj);
        PyObject *py_flags;
-       py_flags = PyInt_FromLong(object->flags);
+       py_flags = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->flags);
        return py_flags;
 }
 
 static int py_wrepl_wins_name_set_flags(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->flags = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->flags = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->flags = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->flags = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -244,21 +352,41 @@ static PyObject *py_wrepl_wins_name_get_is_group(PyObject *obj, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(obj);
        PyObject *py_is_group;
-       py_is_group = PyInt_FromLong(object->is_group);
+       py_is_group = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->is_group);
        return py_is_group;
 }
 
 static int py_wrepl_wins_name_set_is_group(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->is_group = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->is_group = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->is_group));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->is_group = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->is_group = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -267,21 +395,41 @@ static PyObject *py_wrepl_wins_name_get_id(PyObject *obj, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(obj);
        PyObject *py_id;
-       py_id = PyLong_FromLongLong(object->id);
+       py_id = ndr_PyLong_FromUnsignedLongLong(object->id);
        return py_id;
 }
 
 static int py_wrepl_wins_name_set_id(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_name *object = (struct wrepl_wins_name *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->id = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->id = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->id));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->id = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->id = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -357,15 +505,42 @@ static PyObject *py_wrepl_send_reply_get_num_names(PyObject *obj, void *closure)
 {
        struct wrepl_send_reply *object = (struct wrepl_send_reply *)pytalloc_get_ptr(obj);
        PyObject *py_num_names;
-       py_num_names = PyInt_FromLong(object->num_names);
+       py_num_names = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->num_names);
        return py_num_names;
 }
 
 static int py_wrepl_send_reply_set_num_names(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_send_reply *object = (struct wrepl_send_reply *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->num_names = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_names));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->num_names = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->num_names = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -379,7 +554,7 @@ static PyObject *py_wrepl_send_reply_get_names(PyObject *obj, void *closure)
        }
        {
                int names_cntr_0;
-               for (names_cntr_0 = 0; names_cntr_0 < object->num_names; names_cntr_0++) {
+               for (names_cntr_0 = 0; names_cntr_0 < (object->num_names); names_cntr_0++) {
                        PyObject *py_names_0;
                        py_names_0 = pytalloc_reference_ex(&wrepl_wins_name_Type, object->names, &object->names[names_cntr_0]);
                        PyList_SetItem(py_names, names_cntr_0, py_names_0);
@@ -451,21 +626,41 @@ static PyObject *py_wrepl_wins_owner_get_max_version(PyObject *obj, void *closur
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(obj);
        PyObject *py_max_version;
-       py_max_version = PyLong_FromLongLong(object->max_version);
+       py_max_version = ndr_PyLong_FromUnsignedLongLong(object->max_version);
        return py_max_version;
 }
 
 static int py_wrepl_wins_owner_set_max_version(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->max_version = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->max_version = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->max_version));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->max_version = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->max_version = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -474,21 +669,41 @@ static PyObject *py_wrepl_wins_owner_get_min_version(PyObject *obj, void *closur
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(obj);
        PyObject *py_min_version;
-       py_min_version = PyLong_FromLongLong(object->min_version);
+       py_min_version = ndr_PyLong_FromUnsignedLongLong(object->min_version);
        return py_min_version;
 }
 
 static int py_wrepl_wins_owner_set_min_version(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->min_version = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->min_version = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->min_version));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->min_version = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->min_version = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -497,15 +712,42 @@ static PyObject *py_wrepl_wins_owner_get_type(PyObject *obj, void *closure)
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(obj);
        PyObject *py_type;
-       py_type = PyInt_FromLong(object->type);
+       py_type = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->type);
        return py_type;
 }
 
 static int py_wrepl_wins_owner_set_type(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wins_owner *object = (struct wrepl_wins_owner *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->type = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->type = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->type = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -538,15 +780,42 @@ static PyObject *py_wrepl_table_get_partner_count(PyObject *obj, void *closure)
 {
        struct wrepl_table *object = (struct wrepl_table *)pytalloc_get_ptr(obj);
        PyObject *py_partner_count;
-       py_partner_count = PyInt_FromLong(object->partner_count);
+       py_partner_count = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->partner_count);
        return py_partner_count;
 }
 
 static int py_wrepl_table_set_partner_count(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_table *object = (struct wrepl_table *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->partner_count = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->partner_count));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->partner_count = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->partner_count = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -560,7 +829,7 @@ static PyObject *py_wrepl_table_get_partners(PyObject *obj, void *closure)
        }
        {
                int partners_cntr_0;
-               for (partners_cntr_0 = 0; partners_cntr_0 < object->partner_count; partners_cntr_0++) {
+               for (partners_cntr_0 = 0; partners_cntr_0 < (object->partner_count); partners_cntr_0++) {
                        PyObject *py_partners_0;
                        py_partners_0 = pytalloc_reference_ex(&wrepl_wins_owner_Type, object->partners, &object->partners[partners_cntr_0]);
                        PyList_SetItem(py_partners, partners_cntr_0, py_partners_0);
@@ -628,7 +897,7 @@ static PyTypeObject wrepl_table_Type = {
        .tp_new = py_wrepl_table_new,
 };
 
-static PyObject *py_import_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, union wrepl_replication_info *in)
+PyObject *py_import_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, union wrepl_replication_info *in)
 {
        PyObject *ret;
 
@@ -671,7 +940,7 @@ static PyObject *py_import_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level
        return NULL;
 }
 
-static union wrepl_replication_info *py_export_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, PyObject *in)
+union wrepl_replication_info *py_export_wrepl_replication_info(TALLOC_CTX *mem_ctx, int level, PyObject *in)
 {
        union wrepl_replication_info *ret = talloc_zero(mem_ctx, union wrepl_replication_info);
        switch (level) {
@@ -755,21 +1024,41 @@ static PyObject *py_wrepl_replication_get_command(PyObject *obj, void *closure)
 {
        struct wrepl_replication *object = (struct wrepl_replication *)pytalloc_get_ptr(obj);
        PyObject *py_command;
-       py_command = PyInt_FromLong(object->command);
+       py_command = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->command);
        return py_command;
 }
 
 static int py_wrepl_replication_set_command(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_replication *object = (struct wrepl_replication *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->command = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->command = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->command = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->command = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -826,15 +1115,42 @@ static PyObject *py_wrepl_start_get_assoc_ctx(PyObject *obj, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(obj);
        PyObject *py_assoc_ctx;
-       py_assoc_ctx = PyInt_FromLong(object->assoc_ctx);
+       py_assoc_ctx = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->assoc_ctx);
        return py_assoc_ctx;
 }
 
 static int py_wrepl_start_set_assoc_ctx(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->assoc_ctx = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->assoc_ctx));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->assoc_ctx = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->assoc_ctx = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -842,15 +1158,42 @@ static PyObject *py_wrepl_start_get_minor_version(PyObject *obj, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(obj);
        PyObject *py_minor_version;
-       py_minor_version = PyInt_FromLong(object->minor_version);
+       py_minor_version = PyInt_FromLong((uint16_t)object->minor_version);
        return py_minor_version;
 }
 
 static int py_wrepl_start_set_minor_version(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->minor_version = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->minor_version));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->minor_version = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->minor_version = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -858,15 +1201,42 @@ static PyObject *py_wrepl_start_get_major_version(PyObject *obj, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(obj);
        PyObject *py_major_version;
-       py_major_version = PyInt_FromLong(object->major_version);
+       py_major_version = PyInt_FromLong((uint16_t)object->major_version);
        return py_major_version;
 }
 
 static int py_wrepl_start_set_major_version(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_start *object = (struct wrepl_start *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->major_version = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->major_version));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->major_version = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->major_version = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -898,15 +1268,42 @@ static PyObject *py_wrepl_stop_get_reason(PyObject *obj, void *closure)
 {
        struct wrepl_stop *object = (struct wrepl_stop *)pytalloc_get_ptr(obj);
        PyObject *py_reason;
-       py_reason = PyInt_FromLong(object->reason);
+       py_reason = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->reason);
        return py_reason;
 }
 
 static int py_wrepl_stop_set_reason(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_stop *object = (struct wrepl_stop *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->reason = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reason));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->reason = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->reason = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -931,7 +1328,7 @@ static PyTypeObject wrepl_stop_Type = {
        .tp_new = py_wrepl_stop_new,
 };
 
-static PyObject *py_import_wrepl_message(TALLOC_CTX *mem_ctx, int level, union wrepl_message *in)
+PyObject *py_import_wrepl_message(TALLOC_CTX *mem_ctx, int level, union wrepl_message *in)
 {
        PyObject *ret;
 
@@ -957,7 +1354,7 @@ static PyObject *py_import_wrepl_message(TALLOC_CTX *mem_ctx, int level, union w
        return NULL;
 }
 
-static union wrepl_message *py_export_wrepl_message(TALLOC_CTX *mem_ctx, int level, PyObject *in)
+union wrepl_message *py_export_wrepl_message(TALLOC_CTX *mem_ctx, int level, PyObject *in)
 {
        union wrepl_message *ret = talloc_zero(mem_ctx, union wrepl_message);
        switch (level) {
@@ -1011,15 +1408,42 @@ static PyObject *py_wrepl_packet_get_opcode(PyObject *obj, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(obj);
        PyObject *py_opcode;
-       py_opcode = PyInt_FromLong(object->opcode);
+       py_opcode = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->opcode);
        return py_opcode;
 }
 
 static int py_wrepl_packet_set_opcode(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->opcode = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->opcode));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->opcode = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->opcode = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -1027,15 +1451,42 @@ static PyObject *py_wrepl_packet_get_assoc_ctx(PyObject *obj, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(obj);
        PyObject *py_assoc_ctx;
-       py_assoc_ctx = PyInt_FromLong(object->assoc_ctx);
+       py_assoc_ctx = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->assoc_ctx);
        return py_assoc_ctx;
 }
 
 static int py_wrepl_packet_set_assoc_ctx(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->assoc_ctx = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->assoc_ctx));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->assoc_ctx = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->assoc_ctx = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -1043,21 +1494,41 @@ static PyObject *py_wrepl_packet_get_mess_type(PyObject *obj, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(obj);
        PyObject *py_mess_type;
-       py_mess_type = PyInt_FromLong(object->mess_type);
+       py_mess_type = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->mess_type);
        return py_mess_type;
 }
 
 static int py_wrepl_packet_set_mess_type(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_packet *object = (struct wrepl_packet *)pytalloc_get_ptr(py_obj);
-       if (PyLong_Check(value)) {
-               object->mess_type = PyLong_AsLongLong(value);
-       } else if (PyInt_Check(value)) {
-               object->mess_type = PyInt_AsLong(value);
-       } else {
-               PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
-                 PyInt_Type.tp_name, PyLong_Type.tp_name);
-               return -1;
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mess_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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->mess_type = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->mess_type = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
        }
        return 0;
 }
@@ -1201,15 +1672,42 @@ static PyObject *py_wrepl_wrap_get_size(PyObject *obj, void *closure)
 {
        struct wrepl_wrap *object = (struct wrepl_wrap *)pytalloc_get_ptr(obj);
        PyObject *py_size;
-       py_size = PyInt_FromLong(object->size);
+       py_size = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->size);
        return py_size;
 }
 
 static int py_wrepl_wrap_set_size(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct wrepl_wrap *object = (struct wrepl_wrap *)pytalloc_get_ptr(py_obj);
-       PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-       object->size = PyInt_AsLong(value);
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
+               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 or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->size = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->size = test_var;
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
+                         PyInt_Type.tp_name, PyLong_Type.tp_name);
+                       return -1;
+               }
+       }
        return 0;
 }
 
@@ -1531,39 +2029,39 @@ void initwinsrepl(void)
        if (m == NULL)
                return;
 
-       PyModule_AddObject(m, "WINS_REPLICATION_PORT", PyInt_FromLong(42));
-       PyModule_AddObject(m, "WREPL_OPCODE_BITS", PyInt_FromLong(0x7800));
-       PyModule_AddObject(m, "WREPL_TYPE_UNIQUE", PyInt_FromLong(WREPL_TYPE_UNIQUE));
-       PyModule_AddObject(m, "WREPL_TYPE_GROUP", PyInt_FromLong(WREPL_TYPE_GROUP));
-       PyModule_AddObject(m, "WREPL_TYPE_SGROUP", PyInt_FromLong(WREPL_TYPE_SGROUP));
-       PyModule_AddObject(m, "WREPL_TYPE_MHOMED", PyInt_FromLong(WREPL_TYPE_MHOMED));
-       PyModule_AddObject(m, "WREPL_STATE_ACTIVE", PyInt_FromLong(WREPL_STATE_ACTIVE));
-       PyModule_AddObject(m, "WREPL_STATE_RELEASED", PyInt_FromLong(WREPL_STATE_RELEASED));
-       PyModule_AddObject(m, "WREPL_STATE_TOMBSTONE", PyInt_FromLong(WREPL_STATE_TOMBSTONE));
-       PyModule_AddObject(m, "WREPL_STATE_RESERVED", PyInt_FromLong(WREPL_STATE_RESERVED));
-       PyModule_AddObject(m, "WREPL_NODE_B", PyInt_FromLong(WREPL_NODE_B));
-       PyModule_AddObject(m, "WREPL_NODE_P", PyInt_FromLong(WREPL_NODE_P));
-       PyModule_AddObject(m, "WREPL_NODE_M", PyInt_FromLong(WREPL_NODE_M));
-       PyModule_AddObject(m, "WREPL_NODE_H", PyInt_FromLong(WREPL_NODE_H));
-       PyModule_AddObject(m, "WREPL_FLAGS_RECORD_TYPE", PyInt_FromLong(WREPL_FLAGS_RECORD_TYPE));
-       PyModule_AddObject(m, "WREPL_FLAGS_RECORD_STATE", PyInt_FromLong(WREPL_FLAGS_RECORD_STATE));
-       PyModule_AddObject(m, "WREPL_FLAGS_REGISTERED_LOCAL", PyInt_FromLong(WREPL_FLAGS_REGISTERED_LOCAL));
-       PyModule_AddObject(m, "WREPL_FLAGS_NODE_TYPE", PyInt_FromLong(WREPL_FLAGS_NODE_TYPE));
-       PyModule_AddObject(m, "WREPL_FLAGS_IS_STATIC", PyInt_FromLong(WREPL_FLAGS_IS_STATIC));
-       PyModule_AddObject(m, "WREPL_GROUP_FLAG_NO_GROUP", PyInt_FromLong(WREPL_GROUP_FLAG_NO_GROUP));
-       PyModule_AddObject(m, "WREPL_GROUP_FLAG_IS_GROUP", PyInt_FromLong(WREPL_GROUP_FLAG_IS_GROUP));
-       PyModule_AddObject(m, "WREPL_REPL_TABLE_QUERY", PyInt_FromLong(WREPL_REPL_TABLE_QUERY));
-       PyModule_AddObject(m, "WREPL_REPL_TABLE_REPLY", PyInt_FromLong(WREPL_REPL_TABLE_REPLY));
-       PyModule_AddObject(m, "WREPL_REPL_SEND_REQUEST", PyInt_FromLong(WREPL_REPL_SEND_REQUEST));
-       PyModule_AddObject(m, "WREPL_REPL_SEND_REPLY", PyInt_FromLong(WREPL_REPL_SEND_REPLY));
-       PyModule_AddObject(m, "WREPL_REPL_UPDATE", PyInt_FromLong(WREPL_REPL_UPDATE));
-       PyModule_AddObject(m, "WREPL_REPL_UPDATE2", PyInt_FromLong(WREPL_REPL_UPDATE2));
-       PyModule_AddObject(m, "WREPL_REPL_INFORM", PyInt_FromLong(WREPL_REPL_INFORM));
-       PyModule_AddObject(m, "WREPL_REPL_INFORM2", PyInt_FromLong(WREPL_REPL_INFORM2));
-       PyModule_AddObject(m, "WREPL_START_ASSOCIATION", PyInt_FromLong(WREPL_START_ASSOCIATION));
-       PyModule_AddObject(m, "WREPL_START_ASSOCIATION_REPLY", PyInt_FromLong(WREPL_START_ASSOCIATION_REPLY));
-       PyModule_AddObject(m, "WREPL_STOP_ASSOCIATION", PyInt_FromLong(WREPL_STOP_ASSOCIATION));
-       PyModule_AddObject(m, "WREPL_REPLICATION", PyInt_FromLong(WREPL_REPLICATION));
+       PyModule_AddObject(m, "WINS_REPLICATION_PORT", ndr_PyLong_FromUnsignedLongLong(42));
+       PyModule_AddObject(m, "WREPL_OPCODE_BITS", ndr_PyLong_FromUnsignedLongLong(0x7800));
+       PyModule_AddObject(m, "WREPL_TYPE_UNIQUE", PyInt_FromLong((uint16_t)WREPL_TYPE_UNIQUE));
+       PyModule_AddObject(m, "WREPL_TYPE_GROUP", PyInt_FromLong((uint16_t)WREPL_TYPE_GROUP));
+       PyModule_AddObject(m, "WREPL_TYPE_SGROUP", PyInt_FromLong((uint16_t)WREPL_TYPE_SGROUP));
+       PyModule_AddObject(m, "WREPL_TYPE_MHOMED", PyInt_FromLong((uint16_t)WREPL_TYPE_MHOMED));
+       PyModule_AddObject(m, "WREPL_STATE_ACTIVE", PyInt_FromLong((uint16_t)WREPL_STATE_ACTIVE));
+       PyModule_AddObject(m, "WREPL_STATE_RELEASED", PyInt_FromLong((uint16_t)WREPL_STATE_RELEASED));
+       PyModule_AddObject(m, "WREPL_STATE_TOMBSTONE", PyInt_FromLong((uint16_t)WREPL_STATE_TOMBSTONE));
+       PyModule_AddObject(m, "WREPL_STATE_RESERVED", PyInt_FromLong((uint16_t)WREPL_STATE_RESERVED));
+       PyModule_AddObject(m, "WREPL_NODE_B", PyInt_FromLong((uint16_t)WREPL_NODE_B));
+       PyModule_AddObject(m, "WREPL_NODE_P", PyInt_FromLong((uint16_t)WREPL_NODE_P));
+       PyModule_AddObject(m, "WREPL_NODE_M", PyInt_FromLong((uint16_t)WREPL_NODE_M));
+       PyModule_AddObject(m, "WREPL_NODE_H", PyInt_FromLong((uint16_t)WREPL_NODE_H));
+       PyModule_AddObject(m, "WREPL_FLAGS_RECORD_TYPE", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_FLAGS_RECORD_TYPE));
+       PyModule_AddObject(m, "WREPL_FLAGS_RECORD_STATE", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_FLAGS_RECORD_STATE));
+       PyModule_AddObject(m, "WREPL_FLAGS_REGISTERED_LOCAL", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_FLAGS_REGISTERED_LOCAL));
+       PyModule_AddObject(m, "WREPL_FLAGS_NODE_TYPE", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_FLAGS_NODE_TYPE));
+       PyModule_AddObject(m, "WREPL_FLAGS_IS_STATIC", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_FLAGS_IS_STATIC));
+       PyModule_AddObject(m, "WREPL_GROUP_FLAG_NO_GROUP", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_GROUP_FLAG_NO_GROUP));
+       PyModule_AddObject(m, "WREPL_GROUP_FLAG_IS_GROUP", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_GROUP_FLAG_IS_GROUP));
+       PyModule_AddObject(m, "WREPL_REPL_TABLE_QUERY", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_TABLE_QUERY));
+       PyModule_AddObject(m, "WREPL_REPL_TABLE_REPLY", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_TABLE_REPLY));
+       PyModule_AddObject(m, "WREPL_REPL_SEND_REQUEST", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_SEND_REQUEST));
+       PyModule_AddObject(m, "WREPL_REPL_SEND_REPLY", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_SEND_REPLY));
+       PyModule_AddObject(m, "WREPL_REPL_UPDATE", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_UPDATE));
+       PyModule_AddObject(m, "WREPL_REPL_UPDATE2", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_UPDATE2));
+       PyModule_AddObject(m, "WREPL_REPL_INFORM", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_INFORM));
+       PyModule_AddObject(m, "WREPL_REPL_INFORM2", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPL_INFORM2));
+       PyModule_AddObject(m, "WREPL_START_ASSOCIATION", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_START_ASSOCIATION));
+       PyModule_AddObject(m, "WREPL_START_ASSOCIATION_REPLY", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_START_ASSOCIATION_REPLY));
+       PyModule_AddObject(m, "WREPL_STOP_ASSOCIATION", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_STOP_ASSOCIATION));
+       PyModule_AddObject(m, "WREPL_REPLICATION", ndr_PyLong_FromUnsignedLongLong((uint32_t)WREPL_REPLICATION));
        Py_INCREF((PyObject *)(void *)&wrepl_ip_Type);
        PyModule_AddObject(m, "wrepl_ip", (PyObject *)(void *)&wrepl_ip_Type);
        Py_INCREF((PyObject *)(void *)&wrepl_address_list_Type);