Line data Source code
1 :
2 : /* Python wrapper functions auto-generated by pidl */
3 : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 : #include <Python.h>
5 : #include "python/py3compat.h"
6 : #include "includes.h"
7 : #include "python/modules.h"
8 : #include <pytalloc.h>
9 : #include "librpc/rpc/pyrpc.h"
10 : #include "librpc/rpc/pyrpc_util.h"
11 : #include "bin/default/librpc/gen_ndr/ndr_dns.h"
12 :
13 :
14 : /*
15 : * Suppress compiler warnings if the generated code does not call these
16 : * functions
17 : */
18 : #ifndef _MAYBE_UNUSED_
19 : #ifdef __has_attribute
20 : #if __has_attribute(unused)
21 : #define _MAYBE_UNUSED_ __attribute__ ((unused))
22 : #else
23 : #define _MAYBE_UNUSED_
24 : #endif
25 : #endif
26 : #endif
27 : /*
28 : * These functions are here to ensure they can be optimized out by
29 : * the compiler based on the constant input values
30 : */
31 :
32 56118 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 56118 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 6778 : case 4:
38 6778 : return UINT32_MAX;
39 11945 : case 2:
40 11945 : return UINT16_MAX;
41 37395 : case 1:
42 37395 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 : switch (var_size) {
51 : case 8:
52 : return INT64_MAX;
53 : case 4:
54 : return INT32_MAX;
55 : case 2:
56 : return INT16_MAX;
57 : case 1:
58 : return INT8_MAX;
59 : }
60 :
61 : return 0;
62 : }
63 :
64 : #include "librpc/gen_ndr/misc.h"
65 : #include "librpc/gen_ndr/dnsp.h"
66 : static PyTypeObject dns_name_question_Type;
67 : static PyTypeObject dns_rdata_data_Type;
68 : static PyTypeObject dns_soa_record_Type;
69 : static PyTypeObject dns_mx_record_Type;
70 : static PyTypeObject dns_txt_record_Type;
71 : static PyTypeObject dns_rp_record_Type;
72 : static PyTypeObject dns_srv_record_Type;
73 : static PyTypeObject dns_opt_record_Type;
74 : static PyTypeObject dns_tkey_record_Type;
75 : static PyTypeObject dns_tsig_record_Type;
76 : static PyTypeObject dns_fake_tsig_rec_Type;
77 : static PyTypeObject dns_rdata_Type;
78 : static PyTypeObject dns_res_rec_Type;
79 : static PyTypeObject dns_name_packet_Type;
80 : static PyTypeObject dns_InterfaceType;
81 :
82 : static PyTypeObject *BaseObject_Type;
83 : static PyTypeObject *dnsp_string_list_Type;
84 : static PyTypeObject *dnsp_hinfo_Type;
85 : static PyTypeObject *ClientConnection_Type;
86 : static PyTypeObject *ndr_syntax_id_Type;
87 :
88 30260 : static PyObject *py_dns_name_question_get_name(PyObject *obj, void *closure)
89 : {
90 30260 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(obj);
91 : PyObject *py_name;
92 30260 : py_name = PyString_FromStringOrNULL(object->name);
93 30260 : return py_name;
94 : }
95 :
96 1500 : static int py_dns_name_question_set_name(PyObject *py_obj, PyObject *value, void *closure)
97 : {
98 1500 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
99 1500 : if (value == NULL) {
100 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
101 0 : return -1;
102 : }
103 : {
104 : const char *test_str;
105 : const char *talloc_str;
106 1500 : PyObject *unicode = NULL;
107 1500 : if (PyUnicode_Check(value)) {
108 1500 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
109 1500 : if (unicode == NULL) {
110 0 : PyErr_NoMemory();
111 0 : return -1;
112 : }
113 1500 : test_str = PyBytes_AS_STRING(unicode);
114 0 : } else if (PyBytes_Check(value)) {
115 0 : test_str = PyBytes_AS_STRING(value);
116 : } else {
117 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
118 0 : return -1;
119 : }
120 1500 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
121 1500 : if (unicode != NULL) {
122 1500 : Py_DECREF(unicode);
123 : }
124 1500 : if (talloc_str == NULL) {
125 0 : PyErr_NoMemory();
126 0 : return -1;
127 : }
128 1500 : object->name = talloc_str;
129 : }
130 1500 : return 0;
131 : }
132 :
133 0 : static PyObject *py_dns_name_question_get_question_type(PyObject *obj, void *closure)
134 : {
135 0 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(obj);
136 : PyObject *py_question_type;
137 0 : py_question_type = PyLong_FromLong((uint16_t)object->question_type);
138 0 : return py_question_type;
139 : }
140 :
141 1500 : static int py_dns_name_question_set_question_type(PyObject *py_obj, PyObject *value, void *closure)
142 : {
143 1500 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
144 1500 : if (value == NULL) {
145 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->question_type");
146 0 : return -1;
147 : }
148 : {
149 1500 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->question_type));
150 1500 : if (PyLong_Check(value)) {
151 : unsigned long long test_var;
152 1500 : test_var = PyLong_AsUnsignedLongLong(value);
153 1500 : if (PyErr_Occurred() != NULL) {
154 0 : return -1;
155 : }
156 1500 : if (test_var > uint_max) {
157 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
158 : PyLong_Type.tp_name, uint_max, test_var);
159 0 : return -1;
160 : }
161 1500 : object->question_type = test_var;
162 : } else {
163 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
164 : PyLong_Type.tp_name);
165 0 : return -1;
166 : }
167 : }
168 1500 : return 0;
169 : }
170 :
171 0 : static PyObject *py_dns_name_question_get_question_class(PyObject *obj, void *closure)
172 : {
173 0 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(obj);
174 : PyObject *py_question_class;
175 0 : py_question_class = PyLong_FromLong((uint16_t)object->question_class);
176 0 : return py_question_class;
177 : }
178 :
179 1500 : static int py_dns_name_question_set_question_class(PyObject *py_obj, PyObject *value, void *closure)
180 : {
181 1500 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
182 1500 : if (value == NULL) {
183 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->question_class");
184 0 : return -1;
185 : }
186 : {
187 1500 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->question_class));
188 1500 : if (PyLong_Check(value)) {
189 : unsigned long long test_var;
190 1500 : test_var = PyLong_AsUnsignedLongLong(value);
191 1500 : if (PyErr_Occurred() != NULL) {
192 0 : return -1;
193 : }
194 1500 : if (test_var > uint_max) {
195 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
196 : PyLong_Type.tp_name, uint_max, test_var);
197 0 : return -1;
198 : }
199 1500 : object->question_class = test_var;
200 : } else {
201 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
202 : PyLong_Type.tp_name);
203 0 : return -1;
204 : }
205 : }
206 1500 : return 0;
207 : }
208 :
209 : static PyGetSetDef py_dns_name_question_getsetters[] = {
210 : {
211 : .name = discard_const_p(char, "name"),
212 : .get = py_dns_name_question_get_name,
213 : .set = py_dns_name_question_set_name,
214 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
215 : },
216 : {
217 : .name = discard_const_p(char, "question_type"),
218 : .get = py_dns_name_question_get_question_type,
219 : .set = py_dns_name_question_set_question_type,
220 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_qtype")
221 : },
222 : {
223 : .name = discard_const_p(char, "question_class"),
224 : .get = py_dns_name_question_get_question_class,
225 : .set = py_dns_name_question_set_question_class,
226 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_qclass")
227 : },
228 : { .name = NULL }
229 : };
230 :
231 1500 : static PyObject *py_dns_name_question_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
232 : {
233 1500 : return pytalloc_new(struct dns_name_question, type);
234 : }
235 :
236 0 : static PyObject *py_dns_name_question_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
237 : {
238 0 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
239 0 : PyObject *ret = NULL;
240 : DATA_BLOB blob;
241 : enum ndr_err_code err;
242 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
243 0 : if (tmp_ctx == NULL) {
244 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
245 0 : return NULL;
246 : }
247 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_name_question);
248 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
249 0 : TALLOC_FREE(tmp_ctx);
250 0 : PyErr_SetNdrError(err);
251 0 : return NULL;
252 : }
253 :
254 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
255 0 : TALLOC_FREE(tmp_ctx);
256 0 : return ret;
257 : }
258 :
259 0 : static PyObject *py_dns_name_question_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
260 : {
261 0 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
262 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
263 0 : Py_ssize_t blob_length = 0;
264 : enum ndr_err_code err;
265 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
266 0 : PyObject *allow_remaining_obj = NULL;
267 0 : bool allow_remaining = false;
268 :
269 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
270 : discard_const_p(char *, kwnames),
271 : &blob.data, &blob_length,
272 : &allow_remaining_obj)) {
273 0 : return NULL;
274 : }
275 0 : blob.length = blob_length;
276 :
277 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
278 0 : allow_remaining = true;
279 : }
280 :
281 0 : if (allow_remaining) {
282 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_name_question);
283 : } else {
284 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_name_question);
285 : }
286 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
287 0 : PyErr_SetNdrError(err);
288 0 : return NULL;
289 : }
290 :
291 0 : Py_RETURN_NONE;
292 : }
293 :
294 0 : static PyObject *py_dns_name_question_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
295 : {
296 0 : struct dns_name_question *object = (struct dns_name_question *)pytalloc_get_ptr(py_obj);
297 : PyObject *ret;
298 : char *retstr;
299 :
300 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_name_question, "dns_name_question", object);
301 0 : ret = PyUnicode_FromString(retstr);
302 0 : talloc_free(retstr);
303 :
304 0 : return ret;
305 : }
306 :
307 : static PyMethodDef py_dns_name_question_methods[] = {
308 : { "__ndr_pack__", (PyCFunction)py_dns_name_question_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
309 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_name_question_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
310 : { "__ndr_print__", (PyCFunction)py_dns_name_question_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
311 : { NULL, NULL, 0, NULL }
312 : };
313 :
314 :
315 : static PyTypeObject dns_name_question_Type = {
316 : PyVarObject_HEAD_INIT(NULL, 0)
317 : .tp_name = "dns.name_question",
318 : .tp_getset = py_dns_name_question_getsetters,
319 : .tp_methods = py_dns_name_question_methods,
320 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
321 : .tp_new = py_dns_name_question_new,
322 : };
323 :
324 :
325 0 : static PyObject *py_dns_rdata_data_get_length(PyObject *obj, void *closure)
326 : {
327 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(obj);
328 : PyObject *py_length;
329 0 : py_length = PyLong_FromLong((uint16_t)object->length);
330 0 : return py_length;
331 : }
332 :
333 0 : static int py_dns_rdata_data_set_length(PyObject *py_obj, PyObject *value, void *closure)
334 : {
335 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(py_obj);
336 0 : if (value == NULL) {
337 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length");
338 0 : return -1;
339 : }
340 : {
341 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
342 0 : if (PyLong_Check(value)) {
343 : unsigned long long test_var;
344 0 : test_var = PyLong_AsUnsignedLongLong(value);
345 0 : if (PyErr_Occurred() != NULL) {
346 0 : return -1;
347 : }
348 0 : if (test_var > uint_max) {
349 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
350 : PyLong_Type.tp_name, uint_max, test_var);
351 0 : return -1;
352 : }
353 0 : object->length = test_var;
354 : } else {
355 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
356 : PyLong_Type.tp_name);
357 0 : return -1;
358 : }
359 : }
360 0 : return 0;
361 : }
362 :
363 0 : static PyObject *py_dns_rdata_data_get_data(PyObject *obj, void *closure)
364 : {
365 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(obj);
366 : PyObject *py_data;
367 0 : py_data = PyList_New(object->length);
368 0 : if (py_data == NULL) {
369 0 : return NULL;
370 : }
371 : {
372 : int data_cntr_0;
373 0 : for (data_cntr_0 = 0; data_cntr_0 < (object->length); data_cntr_0++) {
374 : PyObject *py_data_0;
375 0 : py_data_0 = PyLong_FromLong((uint16_t)object->data[data_cntr_0]);
376 0 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
377 : }
378 : }
379 0 : return py_data;
380 : }
381 :
382 0 : static int py_dns_rdata_data_set_data(PyObject *py_obj, PyObject *value, void *closure)
383 : {
384 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(py_obj);
385 0 : if (value == NULL) {
386 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
387 0 : return -1;
388 : }
389 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
390 : {
391 : int data_cntr_0;
392 0 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
393 0 : if (!object->data) { return -1;; }
394 0 : talloc_set_name_const(object->data, "ARRAY: object->data");
395 0 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
396 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
397 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_0]");
398 0 : return -1;
399 : }
400 : {
401 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data[data_cntr_0]));
402 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
403 : unsigned long long test_var;
404 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_0));
405 0 : if (PyErr_Occurred() != NULL) {
406 0 : return -1;
407 : }
408 0 : if (test_var > uint_max) {
409 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
410 : PyLong_Type.tp_name, uint_max, test_var);
411 0 : return -1;
412 : }
413 0 : object->data[data_cntr_0] = test_var;
414 : } else {
415 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
416 : PyLong_Type.tp_name);
417 0 : return -1;
418 : }
419 : }
420 : }
421 : }
422 0 : return 0;
423 : }
424 :
425 : static PyGetSetDef py_dns_rdata_data_getsetters[] = {
426 : {
427 : .name = discard_const_p(char, "length"),
428 : .get = py_dns_rdata_data_get_length,
429 : .set = py_dns_rdata_data_set_length,
430 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
431 : },
432 : {
433 : .name = discard_const_p(char, "data"),
434 : .get = py_dns_rdata_data_get_data,
435 : .set = py_dns_rdata_data_set_data,
436 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
437 : },
438 : { .name = NULL }
439 : };
440 :
441 0 : static PyObject *py_dns_rdata_data_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
442 : {
443 0 : return pytalloc_new(struct dns_rdata_data, type);
444 : }
445 :
446 0 : static PyObject *py_dns_rdata_data_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
447 : {
448 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(py_obj);
449 0 : PyObject *ret = NULL;
450 : DATA_BLOB blob;
451 : enum ndr_err_code err;
452 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
453 0 : if (tmp_ctx == NULL) {
454 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
455 0 : return NULL;
456 : }
457 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_rdata_data);
458 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
459 0 : TALLOC_FREE(tmp_ctx);
460 0 : PyErr_SetNdrError(err);
461 0 : return NULL;
462 : }
463 :
464 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
465 0 : TALLOC_FREE(tmp_ctx);
466 0 : return ret;
467 : }
468 :
469 0 : static PyObject *py_dns_rdata_data_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
470 : {
471 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(py_obj);
472 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
473 0 : Py_ssize_t blob_length = 0;
474 : enum ndr_err_code err;
475 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
476 0 : PyObject *allow_remaining_obj = NULL;
477 0 : bool allow_remaining = false;
478 :
479 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
480 : discard_const_p(char *, kwnames),
481 : &blob.data, &blob_length,
482 : &allow_remaining_obj)) {
483 0 : return NULL;
484 : }
485 0 : blob.length = blob_length;
486 :
487 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
488 0 : allow_remaining = true;
489 : }
490 :
491 0 : if (allow_remaining) {
492 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_rdata_data);
493 : } else {
494 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_rdata_data);
495 : }
496 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
497 0 : PyErr_SetNdrError(err);
498 0 : return NULL;
499 : }
500 :
501 0 : Py_RETURN_NONE;
502 : }
503 :
504 0 : static PyObject *py_dns_rdata_data_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
505 : {
506 0 : struct dns_rdata_data *object = (struct dns_rdata_data *)pytalloc_get_ptr(py_obj);
507 : PyObject *ret;
508 : char *retstr;
509 :
510 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_rdata_data, "dns_rdata_data", object);
511 0 : ret = PyUnicode_FromString(retstr);
512 0 : talloc_free(retstr);
513 :
514 0 : return ret;
515 : }
516 :
517 : static PyMethodDef py_dns_rdata_data_methods[] = {
518 : { "__ndr_pack__", (PyCFunction)py_dns_rdata_data_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
519 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_rdata_data_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
520 : { "__ndr_print__", (PyCFunction)py_dns_rdata_data_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
521 : { NULL, NULL, 0, NULL }
522 : };
523 :
524 :
525 : static PyTypeObject dns_rdata_data_Type = {
526 : PyVarObject_HEAD_INIT(NULL, 0)
527 : .tp_name = "dns.rdata_data",
528 : .tp_getset = py_dns_rdata_data_getsetters,
529 : .tp_methods = py_dns_rdata_data_methods,
530 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
531 : .tp_new = py_dns_rdata_data_new,
532 : };
533 :
534 :
535 4 : static PyObject *py_dns_soa_record_get_mname(PyObject *obj, void *closure)
536 : {
537 4 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
538 : PyObject *py_mname;
539 4 : py_mname = PyString_FromStringOrNULL(object->mname);
540 4 : return py_mname;
541 : }
542 :
543 0 : static int py_dns_soa_record_set_mname(PyObject *py_obj, PyObject *value, void *closure)
544 : {
545 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
546 0 : if (value == NULL) {
547 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mname");
548 0 : return -1;
549 : }
550 : {
551 : const char *test_str;
552 : const char *talloc_str;
553 0 : PyObject *unicode = NULL;
554 0 : if (PyUnicode_Check(value)) {
555 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
556 0 : if (unicode == NULL) {
557 0 : PyErr_NoMemory();
558 0 : return -1;
559 : }
560 0 : test_str = PyBytes_AS_STRING(unicode);
561 0 : } else if (PyBytes_Check(value)) {
562 0 : test_str = PyBytes_AS_STRING(value);
563 : } else {
564 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
565 0 : return -1;
566 : }
567 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
568 0 : if (unicode != NULL) {
569 0 : Py_DECREF(unicode);
570 : }
571 0 : if (talloc_str == NULL) {
572 0 : PyErr_NoMemory();
573 0 : return -1;
574 : }
575 0 : object->mname = talloc_str;
576 : }
577 0 : return 0;
578 : }
579 :
580 0 : static PyObject *py_dns_soa_record_get_rname(PyObject *obj, void *closure)
581 : {
582 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
583 : PyObject *py_rname;
584 0 : py_rname = PyString_FromStringOrNULL(object->rname);
585 0 : return py_rname;
586 : }
587 :
588 0 : static int py_dns_soa_record_set_rname(PyObject *py_obj, PyObject *value, void *closure)
589 : {
590 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
591 0 : if (value == NULL) {
592 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rname");
593 0 : return -1;
594 : }
595 : {
596 : const char *test_str;
597 : const char *talloc_str;
598 0 : PyObject *unicode = NULL;
599 0 : if (PyUnicode_Check(value)) {
600 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
601 0 : if (unicode == NULL) {
602 0 : PyErr_NoMemory();
603 0 : return -1;
604 : }
605 0 : test_str = PyBytes_AS_STRING(unicode);
606 0 : } else if (PyBytes_Check(value)) {
607 0 : test_str = PyBytes_AS_STRING(value);
608 : } else {
609 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
610 0 : return -1;
611 : }
612 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
613 0 : if (unicode != NULL) {
614 0 : Py_DECREF(unicode);
615 : }
616 0 : if (talloc_str == NULL) {
617 0 : PyErr_NoMemory();
618 0 : return -1;
619 : }
620 0 : object->rname = talloc_str;
621 : }
622 0 : return 0;
623 : }
624 :
625 0 : static PyObject *py_dns_soa_record_get_serial(PyObject *obj, void *closure)
626 : {
627 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
628 : PyObject *py_serial;
629 0 : py_serial = PyLong_FromUnsignedLongLong((uint32_t)object->serial);
630 0 : return py_serial;
631 : }
632 :
633 0 : static int py_dns_soa_record_set_serial(PyObject *py_obj, PyObject *value, void *closure)
634 : {
635 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
636 0 : if (value == NULL) {
637 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->serial");
638 0 : return -1;
639 : }
640 : {
641 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->serial));
642 0 : if (PyLong_Check(value)) {
643 : unsigned long long test_var;
644 0 : test_var = PyLong_AsUnsignedLongLong(value);
645 0 : if (PyErr_Occurred() != NULL) {
646 0 : return -1;
647 : }
648 0 : if (test_var > uint_max) {
649 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
650 : PyLong_Type.tp_name, uint_max, test_var);
651 0 : return -1;
652 : }
653 0 : object->serial = test_var;
654 : } else {
655 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
656 : PyLong_Type.tp_name);
657 0 : return -1;
658 : }
659 : }
660 0 : return 0;
661 : }
662 :
663 0 : static PyObject *py_dns_soa_record_get_refresh(PyObject *obj, void *closure)
664 : {
665 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
666 : PyObject *py_refresh;
667 0 : py_refresh = PyLong_FromUnsignedLongLong((uint32_t)object->refresh);
668 0 : return py_refresh;
669 : }
670 :
671 0 : static int py_dns_soa_record_set_refresh(PyObject *py_obj, PyObject *value, void *closure)
672 : {
673 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
674 0 : if (value == NULL) {
675 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->refresh");
676 0 : return -1;
677 : }
678 : {
679 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->refresh));
680 0 : if (PyLong_Check(value)) {
681 : unsigned long long test_var;
682 0 : test_var = PyLong_AsUnsignedLongLong(value);
683 0 : if (PyErr_Occurred() != NULL) {
684 0 : return -1;
685 : }
686 0 : if (test_var > uint_max) {
687 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
688 : PyLong_Type.tp_name, uint_max, test_var);
689 0 : return -1;
690 : }
691 0 : object->refresh = test_var;
692 : } else {
693 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
694 : PyLong_Type.tp_name);
695 0 : return -1;
696 : }
697 : }
698 0 : return 0;
699 : }
700 :
701 0 : static PyObject *py_dns_soa_record_get_retry(PyObject *obj, void *closure)
702 : {
703 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
704 : PyObject *py_retry;
705 0 : py_retry = PyLong_FromUnsignedLongLong((uint32_t)object->retry);
706 0 : return py_retry;
707 : }
708 :
709 0 : static int py_dns_soa_record_set_retry(PyObject *py_obj, PyObject *value, void *closure)
710 : {
711 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
712 0 : if (value == NULL) {
713 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->retry");
714 0 : return -1;
715 : }
716 : {
717 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->retry));
718 0 : if (PyLong_Check(value)) {
719 : unsigned long long test_var;
720 0 : test_var = PyLong_AsUnsignedLongLong(value);
721 0 : if (PyErr_Occurred() != NULL) {
722 0 : return -1;
723 : }
724 0 : if (test_var > uint_max) {
725 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
726 : PyLong_Type.tp_name, uint_max, test_var);
727 0 : return -1;
728 : }
729 0 : object->retry = test_var;
730 : } else {
731 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
732 : PyLong_Type.tp_name);
733 0 : return -1;
734 : }
735 : }
736 0 : return 0;
737 : }
738 :
739 0 : static PyObject *py_dns_soa_record_get_expire(PyObject *obj, void *closure)
740 : {
741 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
742 : PyObject *py_expire;
743 0 : py_expire = PyLong_FromUnsignedLongLong((uint32_t)object->expire);
744 0 : return py_expire;
745 : }
746 :
747 0 : static int py_dns_soa_record_set_expire(PyObject *py_obj, PyObject *value, void *closure)
748 : {
749 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
750 0 : if (value == NULL) {
751 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->expire");
752 0 : return -1;
753 : }
754 : {
755 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->expire));
756 0 : if (PyLong_Check(value)) {
757 : unsigned long long test_var;
758 0 : test_var = PyLong_AsUnsignedLongLong(value);
759 0 : if (PyErr_Occurred() != NULL) {
760 0 : return -1;
761 : }
762 0 : if (test_var > uint_max) {
763 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
764 : PyLong_Type.tp_name, uint_max, test_var);
765 0 : return -1;
766 : }
767 0 : object->expire = test_var;
768 : } else {
769 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
770 : PyLong_Type.tp_name);
771 0 : return -1;
772 : }
773 : }
774 0 : return 0;
775 : }
776 :
777 4 : static PyObject *py_dns_soa_record_get_minimum(PyObject *obj, void *closure)
778 : {
779 4 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(obj);
780 : PyObject *py_minimum;
781 4 : py_minimum = PyLong_FromUnsignedLongLong((uint32_t)object->minimum);
782 4 : return py_minimum;
783 : }
784 :
785 0 : static int py_dns_soa_record_set_minimum(PyObject *py_obj, PyObject *value, void *closure)
786 : {
787 0 : struct dns_soa_record *object = (struct dns_soa_record *)pytalloc_get_ptr(py_obj);
788 0 : if (value == NULL) {
789 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->minimum");
790 0 : return -1;
791 : }
792 : {
793 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->minimum));
794 0 : if (PyLong_Check(value)) {
795 : unsigned long long test_var;
796 0 : test_var = PyLong_AsUnsignedLongLong(value);
797 0 : if (PyErr_Occurred() != NULL) {
798 0 : return -1;
799 : }
800 0 : if (test_var > uint_max) {
801 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
802 : PyLong_Type.tp_name, uint_max, test_var);
803 0 : return -1;
804 : }
805 0 : object->minimum = test_var;
806 : } else {
807 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
808 : PyLong_Type.tp_name);
809 0 : return -1;
810 : }
811 : }
812 0 : return 0;
813 : }
814 :
815 : static PyGetSetDef py_dns_soa_record_getsetters[] = {
816 : {
817 : .name = discard_const_p(char, "mname"),
818 : .get = py_dns_soa_record_get_mname,
819 : .set = py_dns_soa_record_set_mname,
820 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
821 : },
822 : {
823 : .name = discard_const_p(char, "rname"),
824 : .get = py_dns_soa_record_get_rname,
825 : .set = py_dns_soa_record_set_rname,
826 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
827 : },
828 : {
829 : .name = discard_const_p(char, "serial"),
830 : .get = py_dns_soa_record_get_serial,
831 : .set = py_dns_soa_record_set_serial,
832 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
833 : },
834 : {
835 : .name = discard_const_p(char, "refresh"),
836 : .get = py_dns_soa_record_get_refresh,
837 : .set = py_dns_soa_record_set_refresh,
838 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
839 : },
840 : {
841 : .name = discard_const_p(char, "retry"),
842 : .get = py_dns_soa_record_get_retry,
843 : .set = py_dns_soa_record_set_retry,
844 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
845 : },
846 : {
847 : .name = discard_const_p(char, "expire"),
848 : .get = py_dns_soa_record_get_expire,
849 : .set = py_dns_soa_record_set_expire,
850 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
851 : },
852 : {
853 : .name = discard_const_p(char, "minimum"),
854 : .get = py_dns_soa_record_get_minimum,
855 : .set = py_dns_soa_record_set_minimum,
856 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
857 : },
858 : { .name = NULL }
859 : };
860 :
861 0 : static PyObject *py_dns_soa_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
862 : {
863 0 : return pytalloc_new(struct dns_soa_record, type);
864 : }
865 :
866 :
867 : static PyTypeObject dns_soa_record_Type = {
868 : PyVarObject_HEAD_INIT(NULL, 0)
869 : .tp_name = "dns.soa_record",
870 : .tp_getset = py_dns_soa_record_getsetters,
871 : .tp_methods = NULL,
872 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
873 : .tp_new = py_dns_soa_record_new,
874 : };
875 :
876 :
877 2 : static PyObject *py_dns_mx_record_get_preference(PyObject *obj, void *closure)
878 : {
879 2 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(obj);
880 : PyObject *py_preference;
881 2 : py_preference = PyLong_FromLong((uint16_t)object->preference);
882 2 : return py_preference;
883 : }
884 :
885 4 : static int py_dns_mx_record_set_preference(PyObject *py_obj, PyObject *value, void *closure)
886 : {
887 4 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(py_obj);
888 4 : if (value == NULL) {
889 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->preference");
890 0 : return -1;
891 : }
892 : {
893 4 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->preference));
894 4 : if (PyLong_Check(value)) {
895 : unsigned long long test_var;
896 4 : test_var = PyLong_AsUnsignedLongLong(value);
897 4 : if (PyErr_Occurred() != NULL) {
898 0 : return -1;
899 : }
900 4 : if (test_var > uint_max) {
901 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
902 : PyLong_Type.tp_name, uint_max, test_var);
903 0 : return -1;
904 : }
905 4 : object->preference = test_var;
906 : } else {
907 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
908 : PyLong_Type.tp_name);
909 0 : return -1;
910 : }
911 : }
912 4 : return 0;
913 : }
914 :
915 2 : static PyObject *py_dns_mx_record_get_exchange(PyObject *obj, void *closure)
916 : {
917 2 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(obj);
918 : PyObject *py_exchange;
919 2 : py_exchange = PyString_FromStringOrNULL(object->exchange);
920 2 : return py_exchange;
921 : }
922 :
923 4 : static int py_dns_mx_record_set_exchange(PyObject *py_obj, PyObject *value, void *closure)
924 : {
925 4 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(py_obj);
926 4 : if (value == NULL) {
927 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->exchange");
928 0 : return -1;
929 : }
930 : {
931 : const char *test_str;
932 : const char *talloc_str;
933 4 : PyObject *unicode = NULL;
934 4 : if (PyUnicode_Check(value)) {
935 4 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
936 4 : if (unicode == NULL) {
937 0 : PyErr_NoMemory();
938 0 : return -1;
939 : }
940 4 : test_str = PyBytes_AS_STRING(unicode);
941 0 : } else if (PyBytes_Check(value)) {
942 0 : test_str = PyBytes_AS_STRING(value);
943 : } else {
944 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
945 0 : return -1;
946 : }
947 4 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
948 4 : if (unicode != NULL) {
949 4 : Py_DECREF(unicode);
950 : }
951 4 : if (talloc_str == NULL) {
952 0 : PyErr_NoMemory();
953 0 : return -1;
954 : }
955 4 : object->exchange = talloc_str;
956 : }
957 4 : return 0;
958 : }
959 :
960 : static PyGetSetDef py_dns_mx_record_getsetters[] = {
961 : {
962 : .name = discard_const_p(char, "preference"),
963 : .get = py_dns_mx_record_get_preference,
964 : .set = py_dns_mx_record_set_preference,
965 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
966 : },
967 : {
968 : .name = discard_const_p(char, "exchange"),
969 : .get = py_dns_mx_record_get_exchange,
970 : .set = py_dns_mx_record_set_exchange,
971 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
972 : },
973 : { .name = NULL }
974 : };
975 :
976 4 : static PyObject *py_dns_mx_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
977 : {
978 4 : return pytalloc_new(struct dns_mx_record, type);
979 : }
980 :
981 0 : static PyObject *py_dns_mx_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
982 : {
983 0 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(py_obj);
984 0 : PyObject *ret = NULL;
985 : DATA_BLOB blob;
986 : enum ndr_err_code err;
987 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
988 0 : if (tmp_ctx == NULL) {
989 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
990 0 : return NULL;
991 : }
992 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_mx_record);
993 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
994 0 : TALLOC_FREE(tmp_ctx);
995 0 : PyErr_SetNdrError(err);
996 0 : return NULL;
997 : }
998 :
999 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1000 0 : TALLOC_FREE(tmp_ctx);
1001 0 : return ret;
1002 : }
1003 :
1004 0 : static PyObject *py_dns_mx_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1005 : {
1006 0 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(py_obj);
1007 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1008 0 : Py_ssize_t blob_length = 0;
1009 : enum ndr_err_code err;
1010 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1011 0 : PyObject *allow_remaining_obj = NULL;
1012 0 : bool allow_remaining = false;
1013 :
1014 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1015 : discard_const_p(char *, kwnames),
1016 : &blob.data, &blob_length,
1017 : &allow_remaining_obj)) {
1018 0 : return NULL;
1019 : }
1020 0 : blob.length = blob_length;
1021 :
1022 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1023 0 : allow_remaining = true;
1024 : }
1025 :
1026 0 : if (allow_remaining) {
1027 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_mx_record);
1028 : } else {
1029 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_mx_record);
1030 : }
1031 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1032 0 : PyErr_SetNdrError(err);
1033 0 : return NULL;
1034 : }
1035 :
1036 0 : Py_RETURN_NONE;
1037 : }
1038 :
1039 0 : static PyObject *py_dns_mx_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1040 : {
1041 0 : struct dns_mx_record *object = (struct dns_mx_record *)pytalloc_get_ptr(py_obj);
1042 : PyObject *ret;
1043 : char *retstr;
1044 :
1045 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_mx_record, "dns_mx_record", object);
1046 0 : ret = PyUnicode_FromString(retstr);
1047 0 : talloc_free(retstr);
1048 :
1049 0 : return ret;
1050 : }
1051 :
1052 : static PyMethodDef py_dns_mx_record_methods[] = {
1053 : { "__ndr_pack__", (PyCFunction)py_dns_mx_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1054 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_mx_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1055 : { "__ndr_print__", (PyCFunction)py_dns_mx_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1056 : { NULL, NULL, 0, NULL }
1057 : };
1058 :
1059 :
1060 : static PyTypeObject dns_mx_record_Type = {
1061 : PyVarObject_HEAD_INIT(NULL, 0)
1062 : .tp_name = "dns.mx_record",
1063 : .tp_getset = py_dns_mx_record_getsetters,
1064 : .tp_methods = py_dns_mx_record_methods,
1065 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1066 : .tp_new = py_dns_mx_record_new,
1067 : };
1068 :
1069 :
1070 285 : static PyObject *py_dns_txt_record_get_txt(PyObject *obj, void *closure)
1071 : {
1072 285 : struct dns_txt_record *object = (struct dns_txt_record *)pytalloc_get_ptr(obj);
1073 : PyObject *py_txt;
1074 285 : py_txt = pytalloc_reference_ex(dnsp_string_list_Type, pytalloc_get_mem_ctx(obj), &object->txt);
1075 285 : return py_txt;
1076 : }
1077 :
1078 792 : static int py_dns_txt_record_set_txt(PyObject *py_obj, PyObject *value, void *closure)
1079 : {
1080 792 : struct dns_txt_record *object = (struct dns_txt_record *)pytalloc_get_ptr(py_obj);
1081 792 : if (value == NULL) {
1082 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->txt");
1083 0 : return -1;
1084 : }
1085 792 : PY_CHECK_TYPE(dnsp_string_list_Type, value, return -1;);
1086 792 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1087 0 : PyErr_NoMemory();
1088 0 : return -1;
1089 : }
1090 792 : object->txt = *(struct dnsp_string_list *)pytalloc_get_ptr(value);
1091 792 : return 0;
1092 : }
1093 :
1094 : static PyGetSetDef py_dns_txt_record_getsetters[] = {
1095 : {
1096 : .name = discard_const_p(char, "txt"),
1097 : .get = py_dns_txt_record_get_txt,
1098 : .set = py_dns_txt_record_set_txt,
1099 : .doc = discard_const_p(char, "PIDL-generated element of base type dnsp_string_list")
1100 : },
1101 : { .name = NULL }
1102 : };
1103 :
1104 792 : static PyObject *py_dns_txt_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1105 : {
1106 792 : return pytalloc_new(struct dns_txt_record, type);
1107 : }
1108 :
1109 0 : static PyObject *py_dns_txt_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1110 : {
1111 0 : struct dns_txt_record *object = (struct dns_txt_record *)pytalloc_get_ptr(py_obj);
1112 0 : PyObject *ret = NULL;
1113 : DATA_BLOB blob;
1114 : enum ndr_err_code err;
1115 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1116 0 : if (tmp_ctx == NULL) {
1117 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1118 0 : return NULL;
1119 : }
1120 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_txt_record);
1121 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1122 0 : TALLOC_FREE(tmp_ctx);
1123 0 : PyErr_SetNdrError(err);
1124 0 : return NULL;
1125 : }
1126 :
1127 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1128 0 : TALLOC_FREE(tmp_ctx);
1129 0 : return ret;
1130 : }
1131 :
1132 0 : static PyObject *py_dns_txt_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1133 : {
1134 0 : struct dns_txt_record *object = (struct dns_txt_record *)pytalloc_get_ptr(py_obj);
1135 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1136 0 : Py_ssize_t blob_length = 0;
1137 : enum ndr_err_code err;
1138 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1139 0 : PyObject *allow_remaining_obj = NULL;
1140 0 : bool allow_remaining = false;
1141 :
1142 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1143 : discard_const_p(char *, kwnames),
1144 : &blob.data, &blob_length,
1145 : &allow_remaining_obj)) {
1146 0 : return NULL;
1147 : }
1148 0 : blob.length = blob_length;
1149 :
1150 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1151 0 : allow_remaining = true;
1152 : }
1153 :
1154 0 : if (allow_remaining) {
1155 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_txt_record);
1156 : } else {
1157 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_txt_record);
1158 : }
1159 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1160 0 : PyErr_SetNdrError(err);
1161 0 : return NULL;
1162 : }
1163 :
1164 0 : Py_RETURN_NONE;
1165 : }
1166 :
1167 0 : static PyObject *py_dns_txt_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1168 : {
1169 0 : struct dns_txt_record *object = (struct dns_txt_record *)pytalloc_get_ptr(py_obj);
1170 : PyObject *ret;
1171 : char *retstr;
1172 :
1173 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_txt_record, "dns_txt_record", object);
1174 0 : ret = PyUnicode_FromString(retstr);
1175 0 : talloc_free(retstr);
1176 :
1177 0 : return ret;
1178 : }
1179 :
1180 : static PyMethodDef py_dns_txt_record_methods[] = {
1181 : { "__ndr_pack__", (PyCFunction)py_dns_txt_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1182 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_txt_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1183 : { "__ndr_print__", (PyCFunction)py_dns_txt_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1184 : { NULL, NULL, 0, NULL }
1185 : };
1186 :
1187 :
1188 : static PyTypeObject dns_txt_record_Type = {
1189 : PyVarObject_HEAD_INIT(NULL, 0)
1190 : .tp_name = "dns.txt_record",
1191 : .tp_getset = py_dns_txt_record_getsetters,
1192 : .tp_methods = py_dns_txt_record_methods,
1193 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1194 : .tp_new = py_dns_txt_record_new,
1195 : };
1196 :
1197 :
1198 0 : static PyObject *py_dns_rp_record_get_mbox(PyObject *obj, void *closure)
1199 : {
1200 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(obj);
1201 : PyObject *py_mbox;
1202 0 : py_mbox = PyString_FromStringOrNULL(object->mbox);
1203 0 : return py_mbox;
1204 : }
1205 :
1206 0 : static int py_dns_rp_record_set_mbox(PyObject *py_obj, PyObject *value, void *closure)
1207 : {
1208 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(py_obj);
1209 0 : if (value == NULL) {
1210 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mbox");
1211 0 : return -1;
1212 : }
1213 : {
1214 : const char *test_str;
1215 : const char *talloc_str;
1216 0 : PyObject *unicode = NULL;
1217 0 : if (PyUnicode_Check(value)) {
1218 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1219 0 : if (unicode == NULL) {
1220 0 : PyErr_NoMemory();
1221 0 : return -1;
1222 : }
1223 0 : test_str = PyBytes_AS_STRING(unicode);
1224 0 : } else if (PyBytes_Check(value)) {
1225 0 : test_str = PyBytes_AS_STRING(value);
1226 : } else {
1227 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1228 0 : return -1;
1229 : }
1230 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1231 0 : if (unicode != NULL) {
1232 0 : Py_DECREF(unicode);
1233 : }
1234 0 : if (talloc_str == NULL) {
1235 0 : PyErr_NoMemory();
1236 0 : return -1;
1237 : }
1238 0 : object->mbox = talloc_str;
1239 : }
1240 0 : return 0;
1241 : }
1242 :
1243 0 : static PyObject *py_dns_rp_record_get_txt(PyObject *obj, void *closure)
1244 : {
1245 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(obj);
1246 : PyObject *py_txt;
1247 0 : py_txt = PyString_FromStringOrNULL(object->txt);
1248 0 : return py_txt;
1249 : }
1250 :
1251 0 : static int py_dns_rp_record_set_txt(PyObject *py_obj, PyObject *value, void *closure)
1252 : {
1253 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(py_obj);
1254 0 : if (value == NULL) {
1255 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->txt");
1256 0 : return -1;
1257 : }
1258 : {
1259 : const char *test_str;
1260 : const char *talloc_str;
1261 0 : PyObject *unicode = NULL;
1262 0 : if (PyUnicode_Check(value)) {
1263 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1264 0 : if (unicode == NULL) {
1265 0 : PyErr_NoMemory();
1266 0 : return -1;
1267 : }
1268 0 : test_str = PyBytes_AS_STRING(unicode);
1269 0 : } else if (PyBytes_Check(value)) {
1270 0 : test_str = PyBytes_AS_STRING(value);
1271 : } else {
1272 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1273 0 : return -1;
1274 : }
1275 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1276 0 : if (unicode != NULL) {
1277 0 : Py_DECREF(unicode);
1278 : }
1279 0 : if (talloc_str == NULL) {
1280 0 : PyErr_NoMemory();
1281 0 : return -1;
1282 : }
1283 0 : object->txt = talloc_str;
1284 : }
1285 0 : return 0;
1286 : }
1287 :
1288 : static PyGetSetDef py_dns_rp_record_getsetters[] = {
1289 : {
1290 : .name = discard_const_p(char, "mbox"),
1291 : .get = py_dns_rp_record_get_mbox,
1292 : .set = py_dns_rp_record_set_mbox,
1293 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
1294 : },
1295 : {
1296 : .name = discard_const_p(char, "txt"),
1297 : .get = py_dns_rp_record_get_txt,
1298 : .set = py_dns_rp_record_set_txt,
1299 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
1300 : },
1301 : { .name = NULL }
1302 : };
1303 :
1304 0 : static PyObject *py_dns_rp_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1305 : {
1306 0 : return pytalloc_new(struct dns_rp_record, type);
1307 : }
1308 :
1309 0 : static PyObject *py_dns_rp_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1310 : {
1311 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(py_obj);
1312 0 : PyObject *ret = NULL;
1313 : DATA_BLOB blob;
1314 : enum ndr_err_code err;
1315 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1316 0 : if (tmp_ctx == NULL) {
1317 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1318 0 : return NULL;
1319 : }
1320 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_rp_record);
1321 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1322 0 : TALLOC_FREE(tmp_ctx);
1323 0 : PyErr_SetNdrError(err);
1324 0 : return NULL;
1325 : }
1326 :
1327 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1328 0 : TALLOC_FREE(tmp_ctx);
1329 0 : return ret;
1330 : }
1331 :
1332 0 : static PyObject *py_dns_rp_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1333 : {
1334 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(py_obj);
1335 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1336 0 : Py_ssize_t blob_length = 0;
1337 : enum ndr_err_code err;
1338 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1339 0 : PyObject *allow_remaining_obj = NULL;
1340 0 : bool allow_remaining = false;
1341 :
1342 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1343 : discard_const_p(char *, kwnames),
1344 : &blob.data, &blob_length,
1345 : &allow_remaining_obj)) {
1346 0 : return NULL;
1347 : }
1348 0 : blob.length = blob_length;
1349 :
1350 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1351 0 : allow_remaining = true;
1352 : }
1353 :
1354 0 : if (allow_remaining) {
1355 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_rp_record);
1356 : } else {
1357 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_rp_record);
1358 : }
1359 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1360 0 : PyErr_SetNdrError(err);
1361 0 : return NULL;
1362 : }
1363 :
1364 0 : Py_RETURN_NONE;
1365 : }
1366 :
1367 0 : static PyObject *py_dns_rp_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1368 : {
1369 0 : struct dns_rp_record *object = (struct dns_rp_record *)pytalloc_get_ptr(py_obj);
1370 : PyObject *ret;
1371 : char *retstr;
1372 :
1373 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_rp_record, "dns_rp_record", object);
1374 0 : ret = PyUnicode_FromString(retstr);
1375 0 : talloc_free(retstr);
1376 :
1377 0 : return ret;
1378 : }
1379 :
1380 : static PyMethodDef py_dns_rp_record_methods[] = {
1381 : { "__ndr_pack__", (PyCFunction)py_dns_rp_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1382 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_rp_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1383 : { "__ndr_print__", (PyCFunction)py_dns_rp_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1384 : { NULL, NULL, 0, NULL }
1385 : };
1386 :
1387 :
1388 : static PyTypeObject dns_rp_record_Type = {
1389 : PyVarObject_HEAD_INIT(NULL, 0)
1390 : .tp_name = "dns.rp_record",
1391 : .tp_getset = py_dns_rp_record_getsetters,
1392 : .tp_methods = py_dns_rp_record_methods,
1393 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1394 : .tp_new = py_dns_rp_record_new,
1395 : };
1396 :
1397 :
1398 0 : static PyObject *py_dns_srv_record_get_priority(PyObject *obj, void *closure)
1399 : {
1400 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(obj);
1401 : PyObject *py_priority;
1402 0 : py_priority = PyLong_FromLong((uint16_t)object->priority);
1403 0 : return py_priority;
1404 : }
1405 :
1406 52 : static int py_dns_srv_record_set_priority(PyObject *py_obj, PyObject *value, void *closure)
1407 : {
1408 52 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1409 52 : if (value == NULL) {
1410 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->priority");
1411 0 : return -1;
1412 : }
1413 : {
1414 52 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->priority));
1415 52 : if (PyLong_Check(value)) {
1416 : unsigned long long test_var;
1417 52 : test_var = PyLong_AsUnsignedLongLong(value);
1418 52 : if (PyErr_Occurred() != NULL) {
1419 0 : return -1;
1420 : }
1421 52 : if (test_var > uint_max) {
1422 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1423 : PyLong_Type.tp_name, uint_max, test_var);
1424 0 : return -1;
1425 : }
1426 52 : object->priority = test_var;
1427 : } else {
1428 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1429 : PyLong_Type.tp_name);
1430 0 : return -1;
1431 : }
1432 : }
1433 52 : return 0;
1434 : }
1435 :
1436 0 : static PyObject *py_dns_srv_record_get_weight(PyObject *obj, void *closure)
1437 : {
1438 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(obj);
1439 : PyObject *py_weight;
1440 0 : py_weight = PyLong_FromLong((uint16_t)object->weight);
1441 0 : return py_weight;
1442 : }
1443 :
1444 52 : static int py_dns_srv_record_set_weight(PyObject *py_obj, PyObject *value, void *closure)
1445 : {
1446 52 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1447 52 : if (value == NULL) {
1448 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->weight");
1449 0 : return -1;
1450 : }
1451 : {
1452 52 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->weight));
1453 52 : if (PyLong_Check(value)) {
1454 : unsigned long long test_var;
1455 52 : test_var = PyLong_AsUnsignedLongLong(value);
1456 52 : if (PyErr_Occurred() != NULL) {
1457 0 : return -1;
1458 : }
1459 52 : if (test_var > uint_max) {
1460 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1461 : PyLong_Type.tp_name, uint_max, test_var);
1462 0 : return -1;
1463 : }
1464 52 : object->weight = test_var;
1465 : } else {
1466 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1467 : PyLong_Type.tp_name);
1468 0 : return -1;
1469 : }
1470 : }
1471 52 : return 0;
1472 : }
1473 :
1474 0 : static PyObject *py_dns_srv_record_get_port(PyObject *obj, void *closure)
1475 : {
1476 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(obj);
1477 : PyObject *py_port;
1478 0 : py_port = PyLong_FromLong((uint16_t)object->port);
1479 0 : return py_port;
1480 : }
1481 :
1482 52 : static int py_dns_srv_record_set_port(PyObject *py_obj, PyObject *value, void *closure)
1483 : {
1484 52 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1485 52 : if (value == NULL) {
1486 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->port");
1487 0 : return -1;
1488 : }
1489 : {
1490 52 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->port));
1491 52 : if (PyLong_Check(value)) {
1492 : unsigned long long test_var;
1493 52 : test_var = PyLong_AsUnsignedLongLong(value);
1494 52 : if (PyErr_Occurred() != NULL) {
1495 0 : return -1;
1496 : }
1497 52 : if (test_var > uint_max) {
1498 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1499 : PyLong_Type.tp_name, uint_max, test_var);
1500 0 : return -1;
1501 : }
1502 52 : object->port = test_var;
1503 : } else {
1504 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1505 : PyLong_Type.tp_name);
1506 0 : return -1;
1507 : }
1508 : }
1509 52 : return 0;
1510 : }
1511 :
1512 0 : static PyObject *py_dns_srv_record_get_target(PyObject *obj, void *closure)
1513 : {
1514 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(obj);
1515 : PyObject *py_target;
1516 0 : py_target = PyString_FromStringOrNULL(object->target);
1517 0 : return py_target;
1518 : }
1519 :
1520 52 : static int py_dns_srv_record_set_target(PyObject *py_obj, PyObject *value, void *closure)
1521 : {
1522 52 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1523 52 : if (value == NULL) {
1524 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->target");
1525 0 : return -1;
1526 : }
1527 : {
1528 : const char *test_str;
1529 : const char *talloc_str;
1530 52 : PyObject *unicode = NULL;
1531 52 : if (PyUnicode_Check(value)) {
1532 52 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1533 52 : if (unicode == NULL) {
1534 0 : PyErr_NoMemory();
1535 0 : return -1;
1536 : }
1537 52 : test_str = PyBytes_AS_STRING(unicode);
1538 0 : } else if (PyBytes_Check(value)) {
1539 0 : test_str = PyBytes_AS_STRING(value);
1540 : } else {
1541 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1542 0 : return -1;
1543 : }
1544 52 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1545 52 : if (unicode != NULL) {
1546 52 : Py_DECREF(unicode);
1547 : }
1548 52 : if (talloc_str == NULL) {
1549 0 : PyErr_NoMemory();
1550 0 : return -1;
1551 : }
1552 52 : object->target = talloc_str;
1553 : }
1554 52 : return 0;
1555 : }
1556 :
1557 : static PyGetSetDef py_dns_srv_record_getsetters[] = {
1558 : {
1559 : .name = discard_const_p(char, "priority"),
1560 : .get = py_dns_srv_record_get_priority,
1561 : .set = py_dns_srv_record_set_priority,
1562 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1563 : },
1564 : {
1565 : .name = discard_const_p(char, "weight"),
1566 : .get = py_dns_srv_record_get_weight,
1567 : .set = py_dns_srv_record_set_weight,
1568 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1569 : },
1570 : {
1571 : .name = discard_const_p(char, "port"),
1572 : .get = py_dns_srv_record_get_port,
1573 : .set = py_dns_srv_record_set_port,
1574 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1575 : },
1576 : {
1577 : .name = discard_const_p(char, "target"),
1578 : .get = py_dns_srv_record_get_target,
1579 : .set = py_dns_srv_record_set_target,
1580 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
1581 : },
1582 : { .name = NULL }
1583 : };
1584 :
1585 52 : static PyObject *py_dns_srv_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1586 : {
1587 52 : return pytalloc_new(struct dns_srv_record, type);
1588 : }
1589 :
1590 0 : static PyObject *py_dns_srv_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1591 : {
1592 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1593 0 : PyObject *ret = NULL;
1594 : DATA_BLOB blob;
1595 : enum ndr_err_code err;
1596 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1597 0 : if (tmp_ctx == NULL) {
1598 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1599 0 : return NULL;
1600 : }
1601 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_srv_record);
1602 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1603 0 : TALLOC_FREE(tmp_ctx);
1604 0 : PyErr_SetNdrError(err);
1605 0 : return NULL;
1606 : }
1607 :
1608 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1609 0 : TALLOC_FREE(tmp_ctx);
1610 0 : return ret;
1611 : }
1612 :
1613 0 : static PyObject *py_dns_srv_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1614 : {
1615 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1616 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1617 0 : Py_ssize_t blob_length = 0;
1618 : enum ndr_err_code err;
1619 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1620 0 : PyObject *allow_remaining_obj = NULL;
1621 0 : bool allow_remaining = false;
1622 :
1623 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1624 : discard_const_p(char *, kwnames),
1625 : &blob.data, &blob_length,
1626 : &allow_remaining_obj)) {
1627 0 : return NULL;
1628 : }
1629 0 : blob.length = blob_length;
1630 :
1631 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1632 0 : allow_remaining = true;
1633 : }
1634 :
1635 0 : if (allow_remaining) {
1636 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_srv_record);
1637 : } else {
1638 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_srv_record);
1639 : }
1640 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1641 0 : PyErr_SetNdrError(err);
1642 0 : return NULL;
1643 : }
1644 :
1645 0 : Py_RETURN_NONE;
1646 : }
1647 :
1648 0 : static PyObject *py_dns_srv_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1649 : {
1650 0 : struct dns_srv_record *object = (struct dns_srv_record *)pytalloc_get_ptr(py_obj);
1651 : PyObject *ret;
1652 : char *retstr;
1653 :
1654 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_srv_record, "dns_srv_record", object);
1655 0 : ret = PyUnicode_FromString(retstr);
1656 0 : talloc_free(retstr);
1657 :
1658 0 : return ret;
1659 : }
1660 :
1661 : static PyMethodDef py_dns_srv_record_methods[] = {
1662 : { "__ndr_pack__", (PyCFunction)py_dns_srv_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1663 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_srv_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1664 : { "__ndr_print__", (PyCFunction)py_dns_srv_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1665 : { NULL, NULL, 0, NULL }
1666 : };
1667 :
1668 :
1669 : static PyTypeObject dns_srv_record_Type = {
1670 : PyVarObject_HEAD_INIT(NULL, 0)
1671 : .tp_name = "dns.srv_record",
1672 : .tp_getset = py_dns_srv_record_getsetters,
1673 : .tp_methods = py_dns_srv_record_methods,
1674 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1675 : .tp_new = py_dns_srv_record_new,
1676 : };
1677 :
1678 :
1679 0 : static PyObject *py_dns_opt_record_get_option_code(PyObject *obj, void *closure)
1680 : {
1681 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(obj);
1682 : PyObject *py_option_code;
1683 0 : py_option_code = PyLong_FromLong((uint16_t)object->option_code);
1684 0 : return py_option_code;
1685 : }
1686 :
1687 0 : static int py_dns_opt_record_set_option_code(PyObject *py_obj, PyObject *value, void *closure)
1688 : {
1689 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1690 0 : if (value == NULL) {
1691 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->option_code");
1692 0 : return -1;
1693 : }
1694 : {
1695 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->option_code));
1696 0 : if (PyLong_Check(value)) {
1697 : unsigned long long test_var;
1698 0 : test_var = PyLong_AsUnsignedLongLong(value);
1699 0 : if (PyErr_Occurred() != NULL) {
1700 0 : return -1;
1701 : }
1702 0 : if (test_var > uint_max) {
1703 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1704 : PyLong_Type.tp_name, uint_max, test_var);
1705 0 : return -1;
1706 : }
1707 0 : object->option_code = test_var;
1708 : } else {
1709 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1710 : PyLong_Type.tp_name);
1711 0 : return -1;
1712 : }
1713 : }
1714 0 : return 0;
1715 : }
1716 :
1717 0 : static PyObject *py_dns_opt_record_get_option_length(PyObject *obj, void *closure)
1718 : {
1719 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(obj);
1720 : PyObject *py_option_length;
1721 0 : py_option_length = PyLong_FromLong((uint16_t)object->option_length);
1722 0 : return py_option_length;
1723 : }
1724 :
1725 0 : static int py_dns_opt_record_set_option_length(PyObject *py_obj, PyObject *value, void *closure)
1726 : {
1727 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1728 0 : if (value == NULL) {
1729 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->option_length");
1730 0 : return -1;
1731 : }
1732 : {
1733 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->option_length));
1734 0 : if (PyLong_Check(value)) {
1735 : unsigned long long test_var;
1736 0 : test_var = PyLong_AsUnsignedLongLong(value);
1737 0 : if (PyErr_Occurred() != NULL) {
1738 0 : return -1;
1739 : }
1740 0 : if (test_var > uint_max) {
1741 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1742 : PyLong_Type.tp_name, uint_max, test_var);
1743 0 : return -1;
1744 : }
1745 0 : object->option_length = test_var;
1746 : } else {
1747 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1748 : PyLong_Type.tp_name);
1749 0 : return -1;
1750 : }
1751 : }
1752 0 : return 0;
1753 : }
1754 :
1755 0 : static PyObject *py_dns_opt_record_get_option_data(PyObject *obj, void *closure)
1756 : {
1757 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(obj);
1758 : PyObject *py_option_data;
1759 0 : py_option_data = PyList_New(object->option_length);
1760 0 : if (py_option_data == NULL) {
1761 0 : return NULL;
1762 : }
1763 : {
1764 : int option_data_cntr_0;
1765 0 : for (option_data_cntr_0 = 0; option_data_cntr_0 < (object->option_length); option_data_cntr_0++) {
1766 : PyObject *py_option_data_0;
1767 0 : py_option_data_0 = PyLong_FromLong((uint16_t)object->option_data[option_data_cntr_0]);
1768 0 : PyList_SetItem(py_option_data, option_data_cntr_0, py_option_data_0);
1769 : }
1770 : }
1771 0 : return py_option_data;
1772 : }
1773 :
1774 0 : static int py_dns_opt_record_set_option_data(PyObject *py_obj, PyObject *value, void *closure)
1775 : {
1776 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1777 0 : if (value == NULL) {
1778 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->option_data");
1779 0 : return -1;
1780 : }
1781 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1782 : {
1783 : int option_data_cntr_0;
1784 0 : object->option_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->option_data, PyList_GET_SIZE(value));
1785 0 : if (!object->option_data) { return -1;; }
1786 0 : talloc_set_name_const(object->option_data, "ARRAY: object->option_data");
1787 0 : for (option_data_cntr_0 = 0; option_data_cntr_0 < PyList_GET_SIZE(value); option_data_cntr_0++) {
1788 0 : if (PyList_GET_ITEM(value, option_data_cntr_0) == NULL) {
1789 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->option_data[option_data_cntr_0]");
1790 0 : return -1;
1791 : }
1792 : {
1793 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->option_data[option_data_cntr_0]));
1794 0 : if (PyLong_Check(PyList_GET_ITEM(value, option_data_cntr_0))) {
1795 : unsigned long long test_var;
1796 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, option_data_cntr_0));
1797 0 : if (PyErr_Occurred() != NULL) {
1798 0 : return -1;
1799 : }
1800 0 : if (test_var > uint_max) {
1801 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1802 : PyLong_Type.tp_name, uint_max, test_var);
1803 0 : return -1;
1804 : }
1805 0 : object->option_data[option_data_cntr_0] = test_var;
1806 : } else {
1807 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1808 : PyLong_Type.tp_name);
1809 0 : return -1;
1810 : }
1811 : }
1812 : }
1813 : }
1814 0 : return 0;
1815 : }
1816 :
1817 : static PyGetSetDef py_dns_opt_record_getsetters[] = {
1818 : {
1819 : .name = discard_const_p(char, "option_code"),
1820 : .get = py_dns_opt_record_get_option_code,
1821 : .set = py_dns_opt_record_set_option_code,
1822 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1823 : },
1824 : {
1825 : .name = discard_const_p(char, "option_length"),
1826 : .get = py_dns_opt_record_get_option_length,
1827 : .set = py_dns_opt_record_set_option_length,
1828 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1829 : },
1830 : {
1831 : .name = discard_const_p(char, "option_data"),
1832 : .get = py_dns_opt_record_get_option_data,
1833 : .set = py_dns_opt_record_set_option_data,
1834 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1835 : },
1836 : { .name = NULL }
1837 : };
1838 :
1839 0 : static PyObject *py_dns_opt_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1840 : {
1841 0 : return pytalloc_new(struct dns_opt_record, type);
1842 : }
1843 :
1844 0 : static PyObject *py_dns_opt_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1845 : {
1846 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1847 0 : PyObject *ret = NULL;
1848 : DATA_BLOB blob;
1849 : enum ndr_err_code err;
1850 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1851 0 : if (tmp_ctx == NULL) {
1852 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1853 0 : return NULL;
1854 : }
1855 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_opt_record);
1856 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1857 0 : TALLOC_FREE(tmp_ctx);
1858 0 : PyErr_SetNdrError(err);
1859 0 : return NULL;
1860 : }
1861 :
1862 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1863 0 : TALLOC_FREE(tmp_ctx);
1864 0 : return ret;
1865 : }
1866 :
1867 0 : static PyObject *py_dns_opt_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1868 : {
1869 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1870 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1871 0 : Py_ssize_t blob_length = 0;
1872 : enum ndr_err_code err;
1873 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1874 0 : PyObject *allow_remaining_obj = NULL;
1875 0 : bool allow_remaining = false;
1876 :
1877 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1878 : discard_const_p(char *, kwnames),
1879 : &blob.data, &blob_length,
1880 : &allow_remaining_obj)) {
1881 0 : return NULL;
1882 : }
1883 0 : blob.length = blob_length;
1884 :
1885 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1886 0 : allow_remaining = true;
1887 : }
1888 :
1889 0 : if (allow_remaining) {
1890 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_opt_record);
1891 : } else {
1892 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_opt_record);
1893 : }
1894 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1895 0 : PyErr_SetNdrError(err);
1896 0 : return NULL;
1897 : }
1898 :
1899 0 : Py_RETURN_NONE;
1900 : }
1901 :
1902 0 : static PyObject *py_dns_opt_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1903 : {
1904 0 : struct dns_opt_record *object = (struct dns_opt_record *)pytalloc_get_ptr(py_obj);
1905 : PyObject *ret;
1906 : char *retstr;
1907 :
1908 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_opt_record, "dns_opt_record", object);
1909 0 : ret = PyUnicode_FromString(retstr);
1910 0 : talloc_free(retstr);
1911 :
1912 0 : return ret;
1913 : }
1914 :
1915 : static PyMethodDef py_dns_opt_record_methods[] = {
1916 : { "__ndr_pack__", (PyCFunction)py_dns_opt_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1917 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_opt_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1918 : { "__ndr_print__", (PyCFunction)py_dns_opt_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1919 : { NULL, NULL, 0, NULL }
1920 : };
1921 :
1922 :
1923 : static PyTypeObject dns_opt_record_Type = {
1924 : PyVarObject_HEAD_INIT(NULL, 0)
1925 : .tp_name = "dns.opt_record",
1926 : .tp_getset = py_dns_opt_record_getsetters,
1927 : .tp_methods = py_dns_opt_record_methods,
1928 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1929 : .tp_new = py_dns_opt_record_new,
1930 : };
1931 :
1932 :
1933 0 : static PyObject *py_dns_tkey_record_get_algorithm(PyObject *obj, void *closure)
1934 : {
1935 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
1936 : PyObject *py_algorithm;
1937 0 : py_algorithm = PyString_FromStringOrNULL(object->algorithm);
1938 0 : return py_algorithm;
1939 : }
1940 :
1941 11 : static int py_dns_tkey_record_set_algorithm(PyObject *py_obj, PyObject *value, void *closure)
1942 : {
1943 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
1944 11 : if (value == NULL) {
1945 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->algorithm");
1946 0 : return -1;
1947 : }
1948 : {
1949 : const char *test_str;
1950 : const char *talloc_str;
1951 11 : PyObject *unicode = NULL;
1952 11 : if (PyUnicode_Check(value)) {
1953 11 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1954 11 : if (unicode == NULL) {
1955 0 : PyErr_NoMemory();
1956 0 : return -1;
1957 : }
1958 11 : test_str = PyBytes_AS_STRING(unicode);
1959 0 : } else if (PyBytes_Check(value)) {
1960 0 : test_str = PyBytes_AS_STRING(value);
1961 : } else {
1962 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1963 0 : return -1;
1964 : }
1965 11 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1966 11 : if (unicode != NULL) {
1967 11 : Py_DECREF(unicode);
1968 : }
1969 11 : if (talloc_str == NULL) {
1970 0 : PyErr_NoMemory();
1971 0 : return -1;
1972 : }
1973 11 : object->algorithm = talloc_str;
1974 : }
1975 11 : return 0;
1976 : }
1977 :
1978 0 : static PyObject *py_dns_tkey_record_get_inception(PyObject *obj, void *closure)
1979 : {
1980 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
1981 : PyObject *py_inception;
1982 0 : py_inception = PyLong_FromUnsignedLongLong((uint32_t)object->inception);
1983 0 : return py_inception;
1984 : }
1985 :
1986 11 : static int py_dns_tkey_record_set_inception(PyObject *py_obj, PyObject *value, void *closure)
1987 : {
1988 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
1989 11 : if (value == NULL) {
1990 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->inception");
1991 0 : return -1;
1992 : }
1993 : {
1994 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->inception));
1995 11 : if (PyLong_Check(value)) {
1996 : unsigned long long test_var;
1997 11 : test_var = PyLong_AsUnsignedLongLong(value);
1998 11 : if (PyErr_Occurred() != NULL) {
1999 0 : return -1;
2000 : }
2001 11 : if (test_var > uint_max) {
2002 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2003 : PyLong_Type.tp_name, uint_max, test_var);
2004 0 : return -1;
2005 : }
2006 11 : object->inception = test_var;
2007 : } else {
2008 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2009 : PyLong_Type.tp_name);
2010 0 : return -1;
2011 : }
2012 : }
2013 11 : return 0;
2014 : }
2015 :
2016 0 : static PyObject *py_dns_tkey_record_get_expiration(PyObject *obj, void *closure)
2017 : {
2018 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2019 : PyObject *py_expiration;
2020 0 : py_expiration = PyLong_FromUnsignedLongLong((uint32_t)object->expiration);
2021 0 : return py_expiration;
2022 : }
2023 :
2024 11 : static int py_dns_tkey_record_set_expiration(PyObject *py_obj, PyObject *value, void *closure)
2025 : {
2026 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2027 11 : if (value == NULL) {
2028 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->expiration");
2029 0 : return -1;
2030 : }
2031 : {
2032 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->expiration));
2033 11 : if (PyLong_Check(value)) {
2034 : unsigned long long test_var;
2035 11 : test_var = PyLong_AsUnsignedLongLong(value);
2036 11 : if (PyErr_Occurred() != NULL) {
2037 0 : return -1;
2038 : }
2039 11 : if (test_var > uint_max) {
2040 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2041 : PyLong_Type.tp_name, uint_max, test_var);
2042 0 : return -1;
2043 : }
2044 11 : object->expiration = test_var;
2045 : } else {
2046 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2047 : PyLong_Type.tp_name);
2048 0 : return -1;
2049 : }
2050 : }
2051 11 : return 0;
2052 : }
2053 :
2054 0 : static PyObject *py_dns_tkey_record_get_mode(PyObject *obj, void *closure)
2055 : {
2056 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2057 : PyObject *py_mode;
2058 0 : py_mode = PyLong_FromLong((uint16_t)object->mode);
2059 0 : return py_mode;
2060 : }
2061 :
2062 11 : static int py_dns_tkey_record_set_mode(PyObject *py_obj, PyObject *value, void *closure)
2063 : {
2064 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2065 11 : if (value == NULL) {
2066 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mode");
2067 0 : return -1;
2068 : }
2069 : {
2070 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mode));
2071 11 : if (PyLong_Check(value)) {
2072 : unsigned long long test_var;
2073 11 : test_var = PyLong_AsUnsignedLongLong(value);
2074 11 : if (PyErr_Occurred() != NULL) {
2075 0 : return -1;
2076 : }
2077 11 : if (test_var > uint_max) {
2078 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2079 : PyLong_Type.tp_name, uint_max, test_var);
2080 0 : return -1;
2081 : }
2082 11 : object->mode = test_var;
2083 : } else {
2084 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2085 : PyLong_Type.tp_name);
2086 0 : return -1;
2087 : }
2088 : }
2089 11 : return 0;
2090 : }
2091 :
2092 0 : static PyObject *py_dns_tkey_record_get_error(PyObject *obj, void *closure)
2093 : {
2094 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2095 : PyObject *py_error;
2096 0 : py_error = PyLong_FromLong((uint16_t)object->error);
2097 0 : return py_error;
2098 : }
2099 :
2100 11 : static int py_dns_tkey_record_set_error(PyObject *py_obj, PyObject *value, void *closure)
2101 : {
2102 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2103 11 : if (value == NULL) {
2104 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->error");
2105 0 : return -1;
2106 : }
2107 : {
2108 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->error));
2109 11 : if (PyLong_Check(value)) {
2110 : unsigned long long test_var;
2111 11 : test_var = PyLong_AsUnsignedLongLong(value);
2112 11 : if (PyErr_Occurred() != NULL) {
2113 0 : return -1;
2114 : }
2115 11 : if (test_var > uint_max) {
2116 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2117 : PyLong_Type.tp_name, uint_max, test_var);
2118 0 : return -1;
2119 : }
2120 11 : object->error = test_var;
2121 : } else {
2122 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2123 : PyLong_Type.tp_name);
2124 0 : return -1;
2125 : }
2126 : }
2127 11 : return 0;
2128 : }
2129 :
2130 0 : static PyObject *py_dns_tkey_record_get_key_size(PyObject *obj, void *closure)
2131 : {
2132 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2133 : PyObject *py_key_size;
2134 0 : py_key_size = PyLong_FromLong((uint16_t)object->key_size);
2135 0 : return py_key_size;
2136 : }
2137 :
2138 11 : static int py_dns_tkey_record_set_key_size(PyObject *py_obj, PyObject *value, void *closure)
2139 : {
2140 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2141 11 : if (value == NULL) {
2142 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->key_size");
2143 0 : return -1;
2144 : }
2145 : {
2146 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->key_size));
2147 11 : if (PyLong_Check(value)) {
2148 : unsigned long long test_var;
2149 11 : test_var = PyLong_AsUnsignedLongLong(value);
2150 11 : if (PyErr_Occurred() != NULL) {
2151 0 : return -1;
2152 : }
2153 11 : if (test_var > uint_max) {
2154 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2155 : PyLong_Type.tp_name, uint_max, test_var);
2156 0 : return -1;
2157 : }
2158 11 : object->key_size = test_var;
2159 : } else {
2160 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2161 : PyLong_Type.tp_name);
2162 0 : return -1;
2163 : }
2164 : }
2165 11 : return 0;
2166 : }
2167 :
2168 11 : static PyObject *py_dns_tkey_record_get_key_data(PyObject *obj, void *closure)
2169 : {
2170 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2171 : PyObject *py_key_data;
2172 11 : py_key_data = PyList_New(object->key_size);
2173 11 : if (py_key_data == NULL) {
2174 0 : return NULL;
2175 : }
2176 : {
2177 : int key_data_cntr_0;
2178 2053 : for (key_data_cntr_0 = 0; key_data_cntr_0 < (object->key_size); key_data_cntr_0++) {
2179 : PyObject *py_key_data_0;
2180 2042 : py_key_data_0 = PyLong_FromLong((uint16_t)object->key_data[key_data_cntr_0]);
2181 2042 : PyList_SetItem(py_key_data, key_data_cntr_0, py_key_data_0);
2182 : }
2183 : }
2184 11 : return py_key_data;
2185 : }
2186 :
2187 11 : static int py_dns_tkey_record_set_key_data(PyObject *py_obj, PyObject *value, void *closure)
2188 : {
2189 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2190 11 : if (value == NULL) {
2191 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->key_data");
2192 0 : return -1;
2193 : }
2194 11 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2195 : {
2196 : int key_data_cntr_0;
2197 11 : object->key_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->key_data, PyList_GET_SIZE(value));
2198 11 : if (!object->key_data) { return -1;; }
2199 11 : talloc_set_name_const(object->key_data, "ARRAY: object->key_data");
2200 37086 : for (key_data_cntr_0 = 0; key_data_cntr_0 < PyList_GET_SIZE(value); key_data_cntr_0++) {
2201 37075 : if (PyList_GET_ITEM(value, key_data_cntr_0) == NULL) {
2202 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->key_data[key_data_cntr_0]");
2203 0 : return -1;
2204 : }
2205 : {
2206 37075 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->key_data[key_data_cntr_0]));
2207 37075 : if (PyLong_Check(PyList_GET_ITEM(value, key_data_cntr_0))) {
2208 : unsigned long long test_var;
2209 37075 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, key_data_cntr_0));
2210 37075 : if (PyErr_Occurred() != NULL) {
2211 0 : return -1;
2212 : }
2213 37075 : if (test_var > uint_max) {
2214 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2215 : PyLong_Type.tp_name, uint_max, test_var);
2216 0 : return -1;
2217 : }
2218 37075 : object->key_data[key_data_cntr_0] = test_var;
2219 : } else {
2220 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2221 : PyLong_Type.tp_name);
2222 0 : return -1;
2223 : }
2224 : }
2225 : }
2226 : }
2227 11 : return 0;
2228 : }
2229 :
2230 0 : static PyObject *py_dns_tkey_record_get_other_size(PyObject *obj, void *closure)
2231 : {
2232 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2233 : PyObject *py_other_size;
2234 0 : py_other_size = PyLong_FromLong((uint16_t)object->other_size);
2235 0 : return py_other_size;
2236 : }
2237 :
2238 11 : static int py_dns_tkey_record_set_other_size(PyObject *py_obj, PyObject *value, void *closure)
2239 : {
2240 11 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2241 11 : if (value == NULL) {
2242 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_size");
2243 0 : return -1;
2244 : }
2245 : {
2246 11 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_size));
2247 11 : if (PyLong_Check(value)) {
2248 : unsigned long long test_var;
2249 11 : test_var = PyLong_AsUnsignedLongLong(value);
2250 11 : if (PyErr_Occurred() != NULL) {
2251 0 : return -1;
2252 : }
2253 11 : if (test_var > uint_max) {
2254 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2255 : PyLong_Type.tp_name, uint_max, test_var);
2256 0 : return -1;
2257 : }
2258 11 : object->other_size = test_var;
2259 : } else {
2260 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2261 : PyLong_Type.tp_name);
2262 0 : return -1;
2263 : }
2264 : }
2265 11 : return 0;
2266 : }
2267 :
2268 0 : static PyObject *py_dns_tkey_record_get_other_data(PyObject *obj, void *closure)
2269 : {
2270 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(obj);
2271 : PyObject *py_other_data;
2272 0 : py_other_data = PyList_New(object->other_size);
2273 0 : if (py_other_data == NULL) {
2274 0 : return NULL;
2275 : }
2276 : {
2277 : int other_data_cntr_0;
2278 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < (object->other_size); other_data_cntr_0++) {
2279 : PyObject *py_other_data_0;
2280 0 : py_other_data_0 = PyLong_FromLong((uint16_t)object->other_data[other_data_cntr_0]);
2281 0 : PyList_SetItem(py_other_data, other_data_cntr_0, py_other_data_0);
2282 : }
2283 : }
2284 0 : return py_other_data;
2285 : }
2286 :
2287 0 : static int py_dns_tkey_record_set_other_data(PyObject *py_obj, PyObject *value, void *closure)
2288 : {
2289 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2290 0 : if (value == NULL) {
2291 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data");
2292 0 : return -1;
2293 : }
2294 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2295 : {
2296 : int other_data_cntr_0;
2297 0 : object->other_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->other_data, PyList_GET_SIZE(value));
2298 0 : if (!object->other_data) { return -1;; }
2299 0 : talloc_set_name_const(object->other_data, "ARRAY: object->other_data");
2300 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < PyList_GET_SIZE(value); other_data_cntr_0++) {
2301 0 : if (PyList_GET_ITEM(value, other_data_cntr_0) == NULL) {
2302 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data[other_data_cntr_0]");
2303 0 : return -1;
2304 : }
2305 : {
2306 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_data[other_data_cntr_0]));
2307 0 : if (PyLong_Check(PyList_GET_ITEM(value, other_data_cntr_0))) {
2308 : unsigned long long test_var;
2309 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, other_data_cntr_0));
2310 0 : if (PyErr_Occurred() != NULL) {
2311 0 : return -1;
2312 : }
2313 0 : if (test_var > uint_max) {
2314 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2315 : PyLong_Type.tp_name, uint_max, test_var);
2316 0 : return -1;
2317 : }
2318 0 : object->other_data[other_data_cntr_0] = test_var;
2319 : } else {
2320 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2321 : PyLong_Type.tp_name);
2322 0 : return -1;
2323 : }
2324 : }
2325 : }
2326 : }
2327 0 : return 0;
2328 : }
2329 :
2330 : static PyGetSetDef py_dns_tkey_record_getsetters[] = {
2331 : {
2332 : .name = discard_const_p(char, "algorithm"),
2333 : .get = py_dns_tkey_record_get_algorithm,
2334 : .set = py_dns_tkey_record_set_algorithm,
2335 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
2336 : },
2337 : {
2338 : .name = discard_const_p(char, "inception"),
2339 : .get = py_dns_tkey_record_get_inception,
2340 : .set = py_dns_tkey_record_set_inception,
2341 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2342 : },
2343 : {
2344 : .name = discard_const_p(char, "expiration"),
2345 : .get = py_dns_tkey_record_get_expiration,
2346 : .set = py_dns_tkey_record_set_expiration,
2347 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2348 : },
2349 : {
2350 : .name = discard_const_p(char, "mode"),
2351 : .get = py_dns_tkey_record_get_mode,
2352 : .set = py_dns_tkey_record_set_mode,
2353 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_tkey_mode")
2354 : },
2355 : {
2356 : .name = discard_const_p(char, "error"),
2357 : .get = py_dns_tkey_record_get_error,
2358 : .set = py_dns_tkey_record_set_error,
2359 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2360 : },
2361 : {
2362 : .name = discard_const_p(char, "key_size"),
2363 : .get = py_dns_tkey_record_get_key_size,
2364 : .set = py_dns_tkey_record_set_key_size,
2365 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2366 : },
2367 : {
2368 : .name = discard_const_p(char, "key_data"),
2369 : .get = py_dns_tkey_record_get_key_data,
2370 : .set = py_dns_tkey_record_set_key_data,
2371 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2372 : },
2373 : {
2374 : .name = discard_const_p(char, "other_size"),
2375 : .get = py_dns_tkey_record_get_other_size,
2376 : .set = py_dns_tkey_record_set_other_size,
2377 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2378 : },
2379 : {
2380 : .name = discard_const_p(char, "other_data"),
2381 : .get = py_dns_tkey_record_get_other_data,
2382 : .set = py_dns_tkey_record_set_other_data,
2383 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2384 : },
2385 : { .name = NULL }
2386 : };
2387 :
2388 11 : static PyObject *py_dns_tkey_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2389 : {
2390 11 : return pytalloc_new(struct dns_tkey_record, type);
2391 : }
2392 :
2393 0 : static PyObject *py_dns_tkey_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2394 : {
2395 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2396 0 : PyObject *ret = NULL;
2397 : DATA_BLOB blob;
2398 : enum ndr_err_code err;
2399 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2400 0 : if (tmp_ctx == NULL) {
2401 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2402 0 : return NULL;
2403 : }
2404 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_tkey_record);
2405 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2406 0 : TALLOC_FREE(tmp_ctx);
2407 0 : PyErr_SetNdrError(err);
2408 0 : return NULL;
2409 : }
2410 :
2411 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2412 0 : TALLOC_FREE(tmp_ctx);
2413 0 : return ret;
2414 : }
2415 :
2416 0 : static PyObject *py_dns_tkey_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2417 : {
2418 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2419 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2420 0 : Py_ssize_t blob_length = 0;
2421 : enum ndr_err_code err;
2422 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2423 0 : PyObject *allow_remaining_obj = NULL;
2424 0 : bool allow_remaining = false;
2425 :
2426 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2427 : discard_const_p(char *, kwnames),
2428 : &blob.data, &blob_length,
2429 : &allow_remaining_obj)) {
2430 0 : return NULL;
2431 : }
2432 0 : blob.length = blob_length;
2433 :
2434 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2435 0 : allow_remaining = true;
2436 : }
2437 :
2438 0 : if (allow_remaining) {
2439 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_tkey_record);
2440 : } else {
2441 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_tkey_record);
2442 : }
2443 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2444 0 : PyErr_SetNdrError(err);
2445 0 : return NULL;
2446 : }
2447 :
2448 0 : Py_RETURN_NONE;
2449 : }
2450 :
2451 0 : static PyObject *py_dns_tkey_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2452 : {
2453 0 : struct dns_tkey_record *object = (struct dns_tkey_record *)pytalloc_get_ptr(py_obj);
2454 : PyObject *ret;
2455 : char *retstr;
2456 :
2457 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_tkey_record, "dns_tkey_record", object);
2458 0 : ret = PyUnicode_FromString(retstr);
2459 0 : talloc_free(retstr);
2460 :
2461 0 : return ret;
2462 : }
2463 :
2464 : static PyMethodDef py_dns_tkey_record_methods[] = {
2465 : { "__ndr_pack__", (PyCFunction)py_dns_tkey_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2466 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_tkey_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2467 : { "__ndr_print__", (PyCFunction)py_dns_tkey_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2468 : { NULL, NULL, 0, NULL }
2469 : };
2470 :
2471 :
2472 : static PyTypeObject dns_tkey_record_Type = {
2473 : PyVarObject_HEAD_INIT(NULL, 0)
2474 : .tp_name = "dns.tkey_record",
2475 : .tp_getset = py_dns_tkey_record_getsetters,
2476 : .tp_methods = py_dns_tkey_record_methods,
2477 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2478 : .tp_new = py_dns_tkey_record_new,
2479 : };
2480 :
2481 :
2482 20 : static PyObject *py_dns_tsig_record_get_algorithm_name(PyObject *obj, void *closure)
2483 : {
2484 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2485 : PyObject *py_algorithm_name;
2486 20 : py_algorithm_name = PyString_FromStringOrNULL(object->algorithm_name);
2487 20 : return py_algorithm_name;
2488 : }
2489 :
2490 13 : static int py_dns_tsig_record_set_algorithm_name(PyObject *py_obj, PyObject *value, void *closure)
2491 : {
2492 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2493 13 : if (value == NULL) {
2494 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->algorithm_name");
2495 0 : return -1;
2496 : }
2497 : {
2498 : const char *test_str;
2499 : const char *talloc_str;
2500 13 : PyObject *unicode = NULL;
2501 13 : if (PyUnicode_Check(value)) {
2502 13 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2503 13 : if (unicode == NULL) {
2504 0 : PyErr_NoMemory();
2505 0 : return -1;
2506 : }
2507 13 : test_str = PyBytes_AS_STRING(unicode);
2508 0 : } else if (PyBytes_Check(value)) {
2509 0 : test_str = PyBytes_AS_STRING(value);
2510 : } else {
2511 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2512 0 : return -1;
2513 : }
2514 13 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2515 13 : if (unicode != NULL) {
2516 13 : Py_DECREF(unicode);
2517 : }
2518 13 : if (talloc_str == NULL) {
2519 0 : PyErr_NoMemory();
2520 0 : return -1;
2521 : }
2522 13 : object->algorithm_name = talloc_str;
2523 : }
2524 13 : return 0;
2525 : }
2526 :
2527 20 : static PyObject *py_dns_tsig_record_get_time_prefix(PyObject *obj, void *closure)
2528 : {
2529 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2530 : PyObject *py_time_prefix;
2531 20 : py_time_prefix = PyLong_FromLong((uint16_t)object->time_prefix);
2532 20 : return py_time_prefix;
2533 : }
2534 :
2535 13 : static int py_dns_tsig_record_set_time_prefix(PyObject *py_obj, PyObject *value, void *closure)
2536 : {
2537 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2538 13 : if (value == NULL) {
2539 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time_prefix");
2540 0 : return -1;
2541 : }
2542 : {
2543 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time_prefix));
2544 13 : if (PyLong_Check(value)) {
2545 : unsigned long long test_var;
2546 13 : test_var = PyLong_AsUnsignedLongLong(value);
2547 13 : if (PyErr_Occurred() != NULL) {
2548 0 : return -1;
2549 : }
2550 13 : if (test_var > uint_max) {
2551 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2552 : PyLong_Type.tp_name, uint_max, test_var);
2553 0 : return -1;
2554 : }
2555 13 : object->time_prefix = test_var;
2556 : } else {
2557 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2558 : PyLong_Type.tp_name);
2559 0 : return -1;
2560 : }
2561 : }
2562 13 : return 0;
2563 : }
2564 :
2565 20 : static PyObject *py_dns_tsig_record_get_time(PyObject *obj, void *closure)
2566 : {
2567 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2568 : PyObject *py_time;
2569 20 : py_time = PyLong_FromUnsignedLongLong((uint32_t)object->time);
2570 20 : return py_time;
2571 : }
2572 :
2573 13 : static int py_dns_tsig_record_set_time(PyObject *py_obj, PyObject *value, void *closure)
2574 : {
2575 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2576 13 : if (value == NULL) {
2577 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time");
2578 0 : return -1;
2579 : }
2580 : {
2581 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time));
2582 13 : if (PyLong_Check(value)) {
2583 : unsigned long long test_var;
2584 13 : test_var = PyLong_AsUnsignedLongLong(value);
2585 13 : if (PyErr_Occurred() != NULL) {
2586 0 : return -1;
2587 : }
2588 13 : if (test_var > uint_max) {
2589 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2590 : PyLong_Type.tp_name, uint_max, test_var);
2591 0 : return -1;
2592 : }
2593 13 : object->time = test_var;
2594 : } else {
2595 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2596 : PyLong_Type.tp_name);
2597 0 : return -1;
2598 : }
2599 : }
2600 13 : return 0;
2601 : }
2602 :
2603 20 : static PyObject *py_dns_tsig_record_get_fudge(PyObject *obj, void *closure)
2604 : {
2605 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2606 : PyObject *py_fudge;
2607 20 : py_fudge = PyLong_FromLong((uint16_t)object->fudge);
2608 20 : return py_fudge;
2609 : }
2610 :
2611 13 : static int py_dns_tsig_record_set_fudge(PyObject *py_obj, PyObject *value, void *closure)
2612 : {
2613 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2614 13 : if (value == NULL) {
2615 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->fudge");
2616 0 : return -1;
2617 : }
2618 : {
2619 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->fudge));
2620 13 : if (PyLong_Check(value)) {
2621 : unsigned long long test_var;
2622 13 : test_var = PyLong_AsUnsignedLongLong(value);
2623 13 : if (PyErr_Occurred() != NULL) {
2624 0 : return -1;
2625 : }
2626 13 : if (test_var > uint_max) {
2627 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2628 : PyLong_Type.tp_name, uint_max, test_var);
2629 0 : return -1;
2630 : }
2631 13 : object->fudge = test_var;
2632 : } else {
2633 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2634 : PyLong_Type.tp_name);
2635 0 : return -1;
2636 : }
2637 : }
2638 13 : return 0;
2639 : }
2640 :
2641 4 : static PyObject *py_dns_tsig_record_get_mac_size(PyObject *obj, void *closure)
2642 : {
2643 4 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2644 : PyObject *py_mac_size;
2645 4 : py_mac_size = PyLong_FromLong((uint16_t)object->mac_size);
2646 4 : return py_mac_size;
2647 : }
2648 :
2649 13 : static int py_dns_tsig_record_set_mac_size(PyObject *py_obj, PyObject *value, void *closure)
2650 : {
2651 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2652 13 : if (value == NULL) {
2653 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mac_size");
2654 0 : return -1;
2655 : }
2656 : {
2657 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mac_size));
2658 13 : if (PyLong_Check(value)) {
2659 : unsigned long long test_var;
2660 13 : test_var = PyLong_AsUnsignedLongLong(value);
2661 13 : if (PyErr_Occurred() != NULL) {
2662 0 : return -1;
2663 : }
2664 13 : if (test_var > uint_max) {
2665 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2666 : PyLong_Type.tp_name, uint_max, test_var);
2667 0 : return -1;
2668 : }
2669 13 : object->mac_size = test_var;
2670 : } else {
2671 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2672 : PyLong_Type.tp_name);
2673 0 : return -1;
2674 : }
2675 : }
2676 13 : return 0;
2677 : }
2678 :
2679 20 : static PyObject *py_dns_tsig_record_get_mac(PyObject *obj, void *closure)
2680 : {
2681 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2682 : PyObject *py_mac;
2683 20 : py_mac = PyList_New(object->mac_size);
2684 20 : if (py_mac == NULL) {
2685 0 : return NULL;
2686 : }
2687 : {
2688 : int mac_cntr_0;
2689 580 : for (mac_cntr_0 = 0; mac_cntr_0 < (object->mac_size); mac_cntr_0++) {
2690 : PyObject *py_mac_0;
2691 560 : py_mac_0 = PyLong_FromLong((uint16_t)object->mac[mac_cntr_0]);
2692 560 : PyList_SetItem(py_mac, mac_cntr_0, py_mac_0);
2693 : }
2694 : }
2695 20 : return py_mac;
2696 : }
2697 :
2698 13 : static int py_dns_tsig_record_set_mac(PyObject *py_obj, PyObject *value, void *closure)
2699 : {
2700 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2701 13 : if (value == NULL) {
2702 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mac");
2703 0 : return -1;
2704 : }
2705 13 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2706 : {
2707 : int mac_cntr_0;
2708 13 : object->mac = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->mac, PyList_GET_SIZE(value));
2709 13 : if (!object->mac) { return -1;; }
2710 13 : talloc_set_name_const(object->mac, "ARRAY: object->mac");
2711 333 : for (mac_cntr_0 = 0; mac_cntr_0 < PyList_GET_SIZE(value); mac_cntr_0++) {
2712 320 : if (PyList_GET_ITEM(value, mac_cntr_0) == NULL) {
2713 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mac[mac_cntr_0]");
2714 0 : return -1;
2715 : }
2716 : {
2717 320 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mac[mac_cntr_0]));
2718 320 : if (PyLong_Check(PyList_GET_ITEM(value, mac_cntr_0))) {
2719 : unsigned long long test_var;
2720 320 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, mac_cntr_0));
2721 320 : if (PyErr_Occurred() != NULL) {
2722 0 : return -1;
2723 : }
2724 320 : if (test_var > uint_max) {
2725 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2726 : PyLong_Type.tp_name, uint_max, test_var);
2727 0 : return -1;
2728 : }
2729 320 : object->mac[mac_cntr_0] = test_var;
2730 : } else {
2731 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2732 : PyLong_Type.tp_name);
2733 0 : return -1;
2734 : }
2735 : }
2736 : }
2737 : }
2738 13 : return 0;
2739 : }
2740 :
2741 0 : static PyObject *py_dns_tsig_record_get_original_id(PyObject *obj, void *closure)
2742 : {
2743 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2744 : PyObject *py_original_id;
2745 0 : py_original_id = PyLong_FromLong((uint16_t)object->original_id);
2746 0 : return py_original_id;
2747 : }
2748 :
2749 13 : static int py_dns_tsig_record_set_original_id(PyObject *py_obj, PyObject *value, void *closure)
2750 : {
2751 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2752 13 : if (value == NULL) {
2753 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->original_id");
2754 0 : return -1;
2755 : }
2756 : {
2757 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->original_id));
2758 13 : if (PyLong_Check(value)) {
2759 : unsigned long long test_var;
2760 13 : test_var = PyLong_AsUnsignedLongLong(value);
2761 13 : if (PyErr_Occurred() != NULL) {
2762 0 : return -1;
2763 : }
2764 13 : if (test_var > uint_max) {
2765 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2766 : PyLong_Type.tp_name, uint_max, test_var);
2767 0 : return -1;
2768 : }
2769 13 : object->original_id = test_var;
2770 : } else {
2771 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2772 : PyLong_Type.tp_name);
2773 0 : return -1;
2774 : }
2775 : }
2776 13 : return 0;
2777 : }
2778 :
2779 4 : static PyObject *py_dns_tsig_record_get_error(PyObject *obj, void *closure)
2780 : {
2781 4 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2782 : PyObject *py_error;
2783 4 : py_error = PyLong_FromLong((uint16_t)object->error);
2784 4 : return py_error;
2785 : }
2786 :
2787 13 : static int py_dns_tsig_record_set_error(PyObject *py_obj, PyObject *value, void *closure)
2788 : {
2789 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2790 13 : if (value == NULL) {
2791 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->error");
2792 0 : return -1;
2793 : }
2794 : {
2795 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->error));
2796 13 : if (PyLong_Check(value)) {
2797 : unsigned long long test_var;
2798 13 : test_var = PyLong_AsUnsignedLongLong(value);
2799 13 : if (PyErr_Occurred() != NULL) {
2800 0 : return -1;
2801 : }
2802 13 : if (test_var > uint_max) {
2803 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2804 : PyLong_Type.tp_name, uint_max, test_var);
2805 0 : return -1;
2806 : }
2807 13 : object->error = test_var;
2808 : } else {
2809 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2810 : PyLong_Type.tp_name);
2811 0 : return -1;
2812 : }
2813 : }
2814 13 : return 0;
2815 : }
2816 :
2817 0 : static PyObject *py_dns_tsig_record_get_other_size(PyObject *obj, void *closure)
2818 : {
2819 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2820 : PyObject *py_other_size;
2821 0 : py_other_size = PyLong_FromLong((uint16_t)object->other_size);
2822 0 : return py_other_size;
2823 : }
2824 :
2825 13 : static int py_dns_tsig_record_set_other_size(PyObject *py_obj, PyObject *value, void *closure)
2826 : {
2827 13 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2828 13 : if (value == NULL) {
2829 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_size");
2830 0 : return -1;
2831 : }
2832 : {
2833 13 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_size));
2834 13 : if (PyLong_Check(value)) {
2835 : unsigned long long test_var;
2836 13 : test_var = PyLong_AsUnsignedLongLong(value);
2837 13 : if (PyErr_Occurred() != NULL) {
2838 0 : return -1;
2839 : }
2840 13 : if (test_var > uint_max) {
2841 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2842 : PyLong_Type.tp_name, uint_max, test_var);
2843 0 : return -1;
2844 : }
2845 13 : object->other_size = test_var;
2846 : } else {
2847 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2848 : PyLong_Type.tp_name);
2849 0 : return -1;
2850 : }
2851 : }
2852 13 : return 0;
2853 : }
2854 :
2855 0 : static PyObject *py_dns_tsig_record_get_other_data(PyObject *obj, void *closure)
2856 : {
2857 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(obj);
2858 : PyObject *py_other_data;
2859 0 : py_other_data = PyList_New(object->other_size);
2860 0 : if (py_other_data == NULL) {
2861 0 : return NULL;
2862 : }
2863 : {
2864 : int other_data_cntr_0;
2865 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < (object->other_size); other_data_cntr_0++) {
2866 : PyObject *py_other_data_0;
2867 0 : py_other_data_0 = PyLong_FromLong((uint16_t)object->other_data[other_data_cntr_0]);
2868 0 : PyList_SetItem(py_other_data, other_data_cntr_0, py_other_data_0);
2869 : }
2870 : }
2871 0 : return py_other_data;
2872 : }
2873 :
2874 0 : static int py_dns_tsig_record_set_other_data(PyObject *py_obj, PyObject *value, void *closure)
2875 : {
2876 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2877 0 : if (value == NULL) {
2878 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data");
2879 0 : return -1;
2880 : }
2881 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2882 : {
2883 : int other_data_cntr_0;
2884 0 : object->other_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->other_data, PyList_GET_SIZE(value));
2885 0 : if (!object->other_data) { return -1;; }
2886 0 : talloc_set_name_const(object->other_data, "ARRAY: object->other_data");
2887 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < PyList_GET_SIZE(value); other_data_cntr_0++) {
2888 0 : if (PyList_GET_ITEM(value, other_data_cntr_0) == NULL) {
2889 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data[other_data_cntr_0]");
2890 0 : return -1;
2891 : }
2892 : {
2893 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_data[other_data_cntr_0]));
2894 0 : if (PyLong_Check(PyList_GET_ITEM(value, other_data_cntr_0))) {
2895 : unsigned long long test_var;
2896 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, other_data_cntr_0));
2897 0 : if (PyErr_Occurred() != NULL) {
2898 0 : return -1;
2899 : }
2900 0 : if (test_var > uint_max) {
2901 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2902 : PyLong_Type.tp_name, uint_max, test_var);
2903 0 : return -1;
2904 : }
2905 0 : object->other_data[other_data_cntr_0] = test_var;
2906 : } else {
2907 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2908 : PyLong_Type.tp_name);
2909 0 : return -1;
2910 : }
2911 : }
2912 : }
2913 : }
2914 0 : return 0;
2915 : }
2916 :
2917 : static PyGetSetDef py_dns_tsig_record_getsetters[] = {
2918 : {
2919 : .name = discard_const_p(char, "algorithm_name"),
2920 : .get = py_dns_tsig_record_get_algorithm_name,
2921 : .set = py_dns_tsig_record_set_algorithm_name,
2922 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
2923 : },
2924 : {
2925 : .name = discard_const_p(char, "time_prefix"),
2926 : .get = py_dns_tsig_record_get_time_prefix,
2927 : .set = py_dns_tsig_record_set_time_prefix,
2928 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2929 : },
2930 : {
2931 : .name = discard_const_p(char, "time"),
2932 : .get = py_dns_tsig_record_get_time,
2933 : .set = py_dns_tsig_record_set_time,
2934 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2935 : },
2936 : {
2937 : .name = discard_const_p(char, "fudge"),
2938 : .get = py_dns_tsig_record_get_fudge,
2939 : .set = py_dns_tsig_record_set_fudge,
2940 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2941 : },
2942 : {
2943 : .name = discard_const_p(char, "mac_size"),
2944 : .get = py_dns_tsig_record_get_mac_size,
2945 : .set = py_dns_tsig_record_set_mac_size,
2946 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2947 : },
2948 : {
2949 : .name = discard_const_p(char, "mac"),
2950 : .get = py_dns_tsig_record_get_mac,
2951 : .set = py_dns_tsig_record_set_mac,
2952 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2953 : },
2954 : {
2955 : .name = discard_const_p(char, "original_id"),
2956 : .get = py_dns_tsig_record_get_original_id,
2957 : .set = py_dns_tsig_record_set_original_id,
2958 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2959 : },
2960 : {
2961 : .name = discard_const_p(char, "error"),
2962 : .get = py_dns_tsig_record_get_error,
2963 : .set = py_dns_tsig_record_set_error,
2964 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2965 : },
2966 : {
2967 : .name = discard_const_p(char, "other_size"),
2968 : .get = py_dns_tsig_record_get_other_size,
2969 : .set = py_dns_tsig_record_set_other_size,
2970 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2971 : },
2972 : {
2973 : .name = discard_const_p(char, "other_data"),
2974 : .get = py_dns_tsig_record_get_other_data,
2975 : .set = py_dns_tsig_record_set_other_data,
2976 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2977 : },
2978 : { .name = NULL }
2979 : };
2980 :
2981 13 : static PyObject *py_dns_tsig_record_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2982 : {
2983 13 : return pytalloc_new(struct dns_tsig_record, type);
2984 : }
2985 :
2986 20 : static PyObject *py_dns_tsig_record_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2987 : {
2988 20 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
2989 20 : PyObject *ret = NULL;
2990 : DATA_BLOB blob;
2991 : enum ndr_err_code err;
2992 20 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2993 20 : if (tmp_ctx == NULL) {
2994 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2995 0 : return NULL;
2996 : }
2997 20 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_tsig_record);
2998 20 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2999 0 : TALLOC_FREE(tmp_ctx);
3000 0 : PyErr_SetNdrError(err);
3001 0 : return NULL;
3002 : }
3003 :
3004 20 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3005 20 : TALLOC_FREE(tmp_ctx);
3006 20 : return ret;
3007 : }
3008 :
3009 0 : static PyObject *py_dns_tsig_record_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3010 : {
3011 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
3012 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3013 0 : Py_ssize_t blob_length = 0;
3014 : enum ndr_err_code err;
3015 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3016 0 : PyObject *allow_remaining_obj = NULL;
3017 0 : bool allow_remaining = false;
3018 :
3019 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3020 : discard_const_p(char *, kwnames),
3021 : &blob.data, &blob_length,
3022 : &allow_remaining_obj)) {
3023 0 : return NULL;
3024 : }
3025 0 : blob.length = blob_length;
3026 :
3027 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3028 0 : allow_remaining = true;
3029 : }
3030 :
3031 0 : if (allow_remaining) {
3032 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_tsig_record);
3033 : } else {
3034 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_tsig_record);
3035 : }
3036 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3037 0 : PyErr_SetNdrError(err);
3038 0 : return NULL;
3039 : }
3040 :
3041 0 : Py_RETURN_NONE;
3042 : }
3043 :
3044 0 : static PyObject *py_dns_tsig_record_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3045 : {
3046 0 : struct dns_tsig_record *object = (struct dns_tsig_record *)pytalloc_get_ptr(py_obj);
3047 : PyObject *ret;
3048 : char *retstr;
3049 :
3050 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_tsig_record, "dns_tsig_record", object);
3051 0 : ret = PyUnicode_FromString(retstr);
3052 0 : talloc_free(retstr);
3053 :
3054 0 : return ret;
3055 : }
3056 :
3057 : static PyMethodDef py_dns_tsig_record_methods[] = {
3058 : { "__ndr_pack__", (PyCFunction)py_dns_tsig_record_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3059 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_tsig_record_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3060 : { "__ndr_print__", (PyCFunction)py_dns_tsig_record_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3061 : { NULL, NULL, 0, NULL }
3062 : };
3063 :
3064 :
3065 : static PyTypeObject dns_tsig_record_Type = {
3066 : PyVarObject_HEAD_INIT(NULL, 0)
3067 : .tp_name = "dns.tsig_record",
3068 : .tp_getset = py_dns_tsig_record_getsetters,
3069 : .tp_methods = py_dns_tsig_record_methods,
3070 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3071 : .tp_new = py_dns_tsig_record_new,
3072 : };
3073 :
3074 :
3075 0 : static PyObject *py_dns_fake_tsig_rec_get_name(PyObject *obj, void *closure)
3076 : {
3077 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3078 : PyObject *py_name;
3079 0 : py_name = PyString_FromStringOrNULL(object->name);
3080 0 : return py_name;
3081 : }
3082 :
3083 31 : static int py_dns_fake_tsig_rec_set_name(PyObject *py_obj, PyObject *value, void *closure)
3084 : {
3085 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3086 31 : if (value == NULL) {
3087 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
3088 0 : return -1;
3089 : }
3090 : {
3091 : const char *test_str;
3092 : const char *talloc_str;
3093 31 : PyObject *unicode = NULL;
3094 31 : if (PyUnicode_Check(value)) {
3095 31 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
3096 31 : if (unicode == NULL) {
3097 0 : PyErr_NoMemory();
3098 0 : return -1;
3099 : }
3100 31 : test_str = PyBytes_AS_STRING(unicode);
3101 0 : } else if (PyBytes_Check(value)) {
3102 0 : test_str = PyBytes_AS_STRING(value);
3103 : } else {
3104 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
3105 0 : return -1;
3106 : }
3107 31 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
3108 31 : if (unicode != NULL) {
3109 31 : Py_DECREF(unicode);
3110 : }
3111 31 : if (talloc_str == NULL) {
3112 0 : PyErr_NoMemory();
3113 0 : return -1;
3114 : }
3115 31 : object->name = talloc_str;
3116 : }
3117 31 : return 0;
3118 : }
3119 :
3120 0 : static PyObject *py_dns_fake_tsig_rec_get_rr_class(PyObject *obj, void *closure)
3121 : {
3122 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3123 : PyObject *py_rr_class;
3124 0 : py_rr_class = PyLong_FromLong((uint16_t)object->rr_class);
3125 0 : return py_rr_class;
3126 : }
3127 :
3128 31 : static int py_dns_fake_tsig_rec_set_rr_class(PyObject *py_obj, PyObject *value, void *closure)
3129 : {
3130 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3131 31 : if (value == NULL) {
3132 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rr_class");
3133 0 : return -1;
3134 : }
3135 : {
3136 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->rr_class));
3137 31 : if (PyLong_Check(value)) {
3138 : unsigned long long test_var;
3139 31 : test_var = PyLong_AsUnsignedLongLong(value);
3140 31 : if (PyErr_Occurred() != NULL) {
3141 0 : return -1;
3142 : }
3143 31 : if (test_var > uint_max) {
3144 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3145 : PyLong_Type.tp_name, uint_max, test_var);
3146 0 : return -1;
3147 : }
3148 31 : object->rr_class = test_var;
3149 : } else {
3150 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3151 : PyLong_Type.tp_name);
3152 0 : return -1;
3153 : }
3154 : }
3155 31 : return 0;
3156 : }
3157 :
3158 0 : static PyObject *py_dns_fake_tsig_rec_get_ttl(PyObject *obj, void *closure)
3159 : {
3160 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3161 : PyObject *py_ttl;
3162 0 : py_ttl = PyLong_FromUnsignedLongLong((uint32_t)object->ttl);
3163 0 : return py_ttl;
3164 : }
3165 :
3166 31 : static int py_dns_fake_tsig_rec_set_ttl(PyObject *py_obj, PyObject *value, void *closure)
3167 : {
3168 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3169 31 : if (value == NULL) {
3170 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ttl");
3171 0 : return -1;
3172 : }
3173 : {
3174 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ttl));
3175 31 : if (PyLong_Check(value)) {
3176 : unsigned long long test_var;
3177 31 : test_var = PyLong_AsUnsignedLongLong(value);
3178 31 : if (PyErr_Occurred() != NULL) {
3179 0 : return -1;
3180 : }
3181 31 : if (test_var > uint_max) {
3182 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3183 : PyLong_Type.tp_name, uint_max, test_var);
3184 0 : return -1;
3185 : }
3186 31 : object->ttl = test_var;
3187 : } else {
3188 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3189 : PyLong_Type.tp_name);
3190 0 : return -1;
3191 : }
3192 : }
3193 31 : return 0;
3194 : }
3195 :
3196 0 : static PyObject *py_dns_fake_tsig_rec_get_algorithm_name(PyObject *obj, void *closure)
3197 : {
3198 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3199 : PyObject *py_algorithm_name;
3200 0 : py_algorithm_name = PyString_FromStringOrNULL(object->algorithm_name);
3201 0 : return py_algorithm_name;
3202 : }
3203 :
3204 31 : static int py_dns_fake_tsig_rec_set_algorithm_name(PyObject *py_obj, PyObject *value, void *closure)
3205 : {
3206 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3207 31 : if (value == NULL) {
3208 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->algorithm_name");
3209 0 : return -1;
3210 : }
3211 : {
3212 : const char *test_str;
3213 : const char *talloc_str;
3214 31 : PyObject *unicode = NULL;
3215 31 : if (PyUnicode_Check(value)) {
3216 31 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
3217 31 : if (unicode == NULL) {
3218 0 : PyErr_NoMemory();
3219 0 : return -1;
3220 : }
3221 31 : test_str = PyBytes_AS_STRING(unicode);
3222 0 : } else if (PyBytes_Check(value)) {
3223 0 : test_str = PyBytes_AS_STRING(value);
3224 : } else {
3225 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
3226 0 : return -1;
3227 : }
3228 31 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
3229 31 : if (unicode != NULL) {
3230 31 : Py_DECREF(unicode);
3231 : }
3232 31 : if (talloc_str == NULL) {
3233 0 : PyErr_NoMemory();
3234 0 : return -1;
3235 : }
3236 31 : object->algorithm_name = talloc_str;
3237 : }
3238 31 : return 0;
3239 : }
3240 :
3241 0 : static PyObject *py_dns_fake_tsig_rec_get_time_prefix(PyObject *obj, void *closure)
3242 : {
3243 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3244 : PyObject *py_time_prefix;
3245 0 : py_time_prefix = PyLong_FromLong((uint16_t)object->time_prefix);
3246 0 : return py_time_prefix;
3247 : }
3248 :
3249 31 : static int py_dns_fake_tsig_rec_set_time_prefix(PyObject *py_obj, PyObject *value, void *closure)
3250 : {
3251 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3252 31 : if (value == NULL) {
3253 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time_prefix");
3254 0 : return -1;
3255 : }
3256 : {
3257 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time_prefix));
3258 31 : if (PyLong_Check(value)) {
3259 : unsigned long long test_var;
3260 31 : test_var = PyLong_AsUnsignedLongLong(value);
3261 31 : if (PyErr_Occurred() != NULL) {
3262 0 : return -1;
3263 : }
3264 31 : if (test_var > uint_max) {
3265 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3266 : PyLong_Type.tp_name, uint_max, test_var);
3267 0 : return -1;
3268 : }
3269 31 : object->time_prefix = test_var;
3270 : } else {
3271 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3272 : PyLong_Type.tp_name);
3273 0 : return -1;
3274 : }
3275 : }
3276 31 : return 0;
3277 : }
3278 :
3279 11 : static PyObject *py_dns_fake_tsig_rec_get_time(PyObject *obj, void *closure)
3280 : {
3281 11 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3282 : PyObject *py_time;
3283 11 : py_time = PyLong_FromUnsignedLongLong((uint32_t)object->time);
3284 11 : return py_time;
3285 : }
3286 :
3287 31 : static int py_dns_fake_tsig_rec_set_time(PyObject *py_obj, PyObject *value, void *closure)
3288 : {
3289 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3290 31 : if (value == NULL) {
3291 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time");
3292 0 : return -1;
3293 : }
3294 : {
3295 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time));
3296 31 : if (PyLong_Check(value)) {
3297 : unsigned long long test_var;
3298 31 : test_var = PyLong_AsUnsignedLongLong(value);
3299 31 : if (PyErr_Occurred() != NULL) {
3300 0 : return -1;
3301 : }
3302 31 : if (test_var > uint_max) {
3303 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3304 : PyLong_Type.tp_name, uint_max, test_var);
3305 0 : return -1;
3306 : }
3307 31 : object->time = test_var;
3308 : } else {
3309 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3310 : PyLong_Type.tp_name);
3311 0 : return -1;
3312 : }
3313 : }
3314 31 : return 0;
3315 : }
3316 :
3317 0 : static PyObject *py_dns_fake_tsig_rec_get_fudge(PyObject *obj, void *closure)
3318 : {
3319 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3320 : PyObject *py_fudge;
3321 0 : py_fudge = PyLong_FromLong((uint16_t)object->fudge);
3322 0 : return py_fudge;
3323 : }
3324 :
3325 31 : static int py_dns_fake_tsig_rec_set_fudge(PyObject *py_obj, PyObject *value, void *closure)
3326 : {
3327 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3328 31 : if (value == NULL) {
3329 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->fudge");
3330 0 : return -1;
3331 : }
3332 : {
3333 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->fudge));
3334 31 : if (PyLong_Check(value)) {
3335 : unsigned long long test_var;
3336 31 : test_var = PyLong_AsUnsignedLongLong(value);
3337 31 : if (PyErr_Occurred() != NULL) {
3338 0 : return -1;
3339 : }
3340 31 : if (test_var > uint_max) {
3341 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3342 : PyLong_Type.tp_name, uint_max, test_var);
3343 0 : return -1;
3344 : }
3345 31 : object->fudge = test_var;
3346 : } else {
3347 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3348 : PyLong_Type.tp_name);
3349 0 : return -1;
3350 : }
3351 : }
3352 31 : return 0;
3353 : }
3354 :
3355 0 : static PyObject *py_dns_fake_tsig_rec_get_error(PyObject *obj, void *closure)
3356 : {
3357 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3358 : PyObject *py_error;
3359 0 : py_error = PyLong_FromLong((uint16_t)object->error);
3360 0 : return py_error;
3361 : }
3362 :
3363 31 : static int py_dns_fake_tsig_rec_set_error(PyObject *py_obj, PyObject *value, void *closure)
3364 : {
3365 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3366 31 : if (value == NULL) {
3367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->error");
3368 0 : return -1;
3369 : }
3370 : {
3371 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->error));
3372 31 : if (PyLong_Check(value)) {
3373 : unsigned long long test_var;
3374 31 : test_var = PyLong_AsUnsignedLongLong(value);
3375 31 : if (PyErr_Occurred() != NULL) {
3376 0 : return -1;
3377 : }
3378 31 : if (test_var > uint_max) {
3379 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3380 : PyLong_Type.tp_name, uint_max, test_var);
3381 0 : return -1;
3382 : }
3383 31 : object->error = test_var;
3384 : } else {
3385 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3386 : PyLong_Type.tp_name);
3387 0 : return -1;
3388 : }
3389 : }
3390 31 : return 0;
3391 : }
3392 :
3393 0 : static PyObject *py_dns_fake_tsig_rec_get_other_size(PyObject *obj, void *closure)
3394 : {
3395 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3396 : PyObject *py_other_size;
3397 0 : py_other_size = PyLong_FromLong((uint16_t)object->other_size);
3398 0 : return py_other_size;
3399 : }
3400 :
3401 31 : static int py_dns_fake_tsig_rec_set_other_size(PyObject *py_obj, PyObject *value, void *closure)
3402 : {
3403 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3404 31 : if (value == NULL) {
3405 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_size");
3406 0 : return -1;
3407 : }
3408 : {
3409 31 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_size));
3410 31 : if (PyLong_Check(value)) {
3411 : unsigned long long test_var;
3412 31 : test_var = PyLong_AsUnsignedLongLong(value);
3413 31 : if (PyErr_Occurred() != NULL) {
3414 0 : return -1;
3415 : }
3416 31 : if (test_var > uint_max) {
3417 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3418 : PyLong_Type.tp_name, uint_max, test_var);
3419 0 : return -1;
3420 : }
3421 31 : object->other_size = test_var;
3422 : } else {
3423 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3424 : PyLong_Type.tp_name);
3425 0 : return -1;
3426 : }
3427 : }
3428 31 : return 0;
3429 : }
3430 :
3431 0 : static PyObject *py_dns_fake_tsig_rec_get_other_data(PyObject *obj, void *closure)
3432 : {
3433 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(obj);
3434 : PyObject *py_other_data;
3435 0 : py_other_data = PyList_New(object->other_size);
3436 0 : if (py_other_data == NULL) {
3437 0 : return NULL;
3438 : }
3439 : {
3440 : int other_data_cntr_0;
3441 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < (object->other_size); other_data_cntr_0++) {
3442 : PyObject *py_other_data_0;
3443 0 : py_other_data_0 = PyLong_FromLong((uint16_t)object->other_data[other_data_cntr_0]);
3444 0 : PyList_SetItem(py_other_data, other_data_cntr_0, py_other_data_0);
3445 : }
3446 : }
3447 0 : return py_other_data;
3448 : }
3449 :
3450 0 : static int py_dns_fake_tsig_rec_set_other_data(PyObject *py_obj, PyObject *value, void *closure)
3451 : {
3452 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3453 0 : if (value == NULL) {
3454 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data");
3455 0 : return -1;
3456 : }
3457 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3458 : {
3459 : int other_data_cntr_0;
3460 0 : object->other_data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->other_data, PyList_GET_SIZE(value));
3461 0 : if (!object->other_data) { return -1;; }
3462 0 : talloc_set_name_const(object->other_data, "ARRAY: object->other_data");
3463 0 : for (other_data_cntr_0 = 0; other_data_cntr_0 < PyList_GET_SIZE(value); other_data_cntr_0++) {
3464 0 : if (PyList_GET_ITEM(value, other_data_cntr_0) == NULL) {
3465 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->other_data[other_data_cntr_0]");
3466 0 : return -1;
3467 : }
3468 : {
3469 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->other_data[other_data_cntr_0]));
3470 0 : if (PyLong_Check(PyList_GET_ITEM(value, other_data_cntr_0))) {
3471 : unsigned long long test_var;
3472 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, other_data_cntr_0));
3473 0 : if (PyErr_Occurred() != NULL) {
3474 0 : return -1;
3475 : }
3476 0 : if (test_var > uint_max) {
3477 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3478 : PyLong_Type.tp_name, uint_max, test_var);
3479 0 : return -1;
3480 : }
3481 0 : object->other_data[other_data_cntr_0] = test_var;
3482 : } else {
3483 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3484 : PyLong_Type.tp_name);
3485 0 : return -1;
3486 : }
3487 : }
3488 : }
3489 : }
3490 0 : return 0;
3491 : }
3492 :
3493 : static PyGetSetDef py_dns_fake_tsig_rec_getsetters[] = {
3494 : {
3495 : .name = discard_const_p(char, "name"),
3496 : .get = py_dns_fake_tsig_rec_get_name,
3497 : .set = py_dns_fake_tsig_rec_set_name,
3498 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
3499 : },
3500 : {
3501 : .name = discard_const_p(char, "rr_class"),
3502 : .get = py_dns_fake_tsig_rec_get_rr_class,
3503 : .set = py_dns_fake_tsig_rec_set_rr_class,
3504 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_qclass")
3505 : },
3506 : {
3507 : .name = discard_const_p(char, "ttl"),
3508 : .get = py_dns_fake_tsig_rec_get_ttl,
3509 : .set = py_dns_fake_tsig_rec_set_ttl,
3510 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3511 : },
3512 : {
3513 : .name = discard_const_p(char, "algorithm_name"),
3514 : .get = py_dns_fake_tsig_rec_get_algorithm_name,
3515 : .set = py_dns_fake_tsig_rec_set_algorithm_name,
3516 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
3517 : },
3518 : {
3519 : .name = discard_const_p(char, "time_prefix"),
3520 : .get = py_dns_fake_tsig_rec_get_time_prefix,
3521 : .set = py_dns_fake_tsig_rec_set_time_prefix,
3522 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3523 : },
3524 : {
3525 : .name = discard_const_p(char, "time"),
3526 : .get = py_dns_fake_tsig_rec_get_time,
3527 : .set = py_dns_fake_tsig_rec_set_time,
3528 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3529 : },
3530 : {
3531 : .name = discard_const_p(char, "fudge"),
3532 : .get = py_dns_fake_tsig_rec_get_fudge,
3533 : .set = py_dns_fake_tsig_rec_set_fudge,
3534 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3535 : },
3536 : {
3537 : .name = discard_const_p(char, "error"),
3538 : .get = py_dns_fake_tsig_rec_get_error,
3539 : .set = py_dns_fake_tsig_rec_set_error,
3540 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3541 : },
3542 : {
3543 : .name = discard_const_p(char, "other_size"),
3544 : .get = py_dns_fake_tsig_rec_get_other_size,
3545 : .set = py_dns_fake_tsig_rec_set_other_size,
3546 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3547 : },
3548 : {
3549 : .name = discard_const_p(char, "other_data"),
3550 : .get = py_dns_fake_tsig_rec_get_other_data,
3551 : .set = py_dns_fake_tsig_rec_set_other_data,
3552 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3553 : },
3554 : { .name = NULL }
3555 : };
3556 :
3557 31 : static PyObject *py_dns_fake_tsig_rec_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3558 : {
3559 31 : return pytalloc_new(struct dns_fake_tsig_rec, type);
3560 : }
3561 :
3562 31 : static PyObject *py_dns_fake_tsig_rec_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3563 : {
3564 31 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3565 31 : PyObject *ret = NULL;
3566 : DATA_BLOB blob;
3567 : enum ndr_err_code err;
3568 31 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3569 31 : if (tmp_ctx == NULL) {
3570 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3571 0 : return NULL;
3572 : }
3573 31 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_fake_tsig_rec);
3574 31 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3575 0 : TALLOC_FREE(tmp_ctx);
3576 0 : PyErr_SetNdrError(err);
3577 0 : return NULL;
3578 : }
3579 :
3580 31 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3581 31 : TALLOC_FREE(tmp_ctx);
3582 31 : return ret;
3583 : }
3584 :
3585 0 : static PyObject *py_dns_fake_tsig_rec_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3586 : {
3587 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3588 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3589 0 : Py_ssize_t blob_length = 0;
3590 : enum ndr_err_code err;
3591 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3592 0 : PyObject *allow_remaining_obj = NULL;
3593 0 : bool allow_remaining = false;
3594 :
3595 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3596 : discard_const_p(char *, kwnames),
3597 : &blob.data, &blob_length,
3598 : &allow_remaining_obj)) {
3599 0 : return NULL;
3600 : }
3601 0 : blob.length = blob_length;
3602 :
3603 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3604 0 : allow_remaining = true;
3605 : }
3606 :
3607 0 : if (allow_remaining) {
3608 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_fake_tsig_rec);
3609 : } else {
3610 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_fake_tsig_rec);
3611 : }
3612 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3613 0 : PyErr_SetNdrError(err);
3614 0 : return NULL;
3615 : }
3616 :
3617 0 : Py_RETURN_NONE;
3618 : }
3619 :
3620 0 : static PyObject *py_dns_fake_tsig_rec_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3621 : {
3622 0 : struct dns_fake_tsig_rec *object = (struct dns_fake_tsig_rec *)pytalloc_get_ptr(py_obj);
3623 : PyObject *ret;
3624 : char *retstr;
3625 :
3626 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_fake_tsig_rec, "dns_fake_tsig_rec", object);
3627 0 : ret = PyUnicode_FromString(retstr);
3628 0 : talloc_free(retstr);
3629 :
3630 0 : return ret;
3631 : }
3632 :
3633 : static PyMethodDef py_dns_fake_tsig_rec_methods[] = {
3634 : { "__ndr_pack__", (PyCFunction)py_dns_fake_tsig_rec_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3635 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_fake_tsig_rec_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3636 : { "__ndr_print__", (PyCFunction)py_dns_fake_tsig_rec_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3637 : { NULL, NULL, 0, NULL }
3638 : };
3639 :
3640 :
3641 : static PyTypeObject dns_fake_tsig_rec_Type = {
3642 : PyVarObject_HEAD_INIT(NULL, 0)
3643 : .tp_name = "dns.fake_tsig_rec",
3644 : .tp_getset = py_dns_fake_tsig_rec_getsetters,
3645 : .tp_methods = py_dns_fake_tsig_rec_methods,
3646 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3647 : .tp_new = py_dns_fake_tsig_rec_new,
3648 : };
3649 :
3650 395 : static PyObject *py_import_dns_rdata(TALLOC_CTX *mem_ctx, int level, union dns_rdata *in)
3651 : {
3652 : PyObject *ret;
3653 :
3654 395 : switch (level) {
3655 20 : case DNS_QTYPE_A:
3656 20 : ret = PyString_FromStringOrNULL(in->ipv4_record);
3657 20 : return ret;
3658 :
3659 0 : case DNS_QTYPE_NS:
3660 0 : ret = PyString_FromStringOrNULL(in->ns_record);
3661 0 : return ret;
3662 :
3663 27 : case DNS_QTYPE_CNAME:
3664 27 : ret = PyString_FromStringOrNULL(in->cname_record);
3665 27 : return ret;
3666 :
3667 8 : case DNS_QTYPE_SOA:
3668 8 : ret = pytalloc_reference_ex(&dns_soa_record_Type, mem_ctx, &in->soa_record);
3669 8 : return ret;
3670 :
3671 0 : case DNS_QTYPE_PTR:
3672 0 : ret = PyString_FromStringOrNULL(in->ptr_record);
3673 0 : return ret;
3674 :
3675 0 : case DNS_QTYPE_HINFO:
3676 0 : ret = pytalloc_reference_ex(dnsp_hinfo_Type, mem_ctx, &in->hinfo_record);
3677 0 : return ret;
3678 :
3679 4 : case DNS_QTYPE_MX:
3680 4 : ret = pytalloc_reference_ex(&dns_mx_record_Type, mem_ctx, &in->mx_record);
3681 4 : return ret;
3682 :
3683 285 : case DNS_QTYPE_TXT:
3684 285 : ret = pytalloc_reference_ex(&dns_txt_record_Type, mem_ctx, &in->txt_record);
3685 285 : return ret;
3686 :
3687 0 : case DNS_QTYPE_RP:
3688 0 : ret = pytalloc_reference_ex(&dns_rp_record_Type, mem_ctx, &in->rp_record);
3689 0 : return ret;
3690 :
3691 16 : case DNS_QTYPE_AAAA:
3692 16 : ret = PyString_FromStringOrNULL(in->ipv6_record);
3693 16 : return ret;
3694 :
3695 0 : case DNS_QTYPE_SRV:
3696 0 : ret = pytalloc_reference_ex(&dns_srv_record_Type, mem_ctx, &in->srv_record);
3697 0 : return ret;
3698 :
3699 0 : case DNS_QTYPE_OPT:
3700 0 : ret = pytalloc_reference_ex(&dns_opt_record_Type, mem_ctx, &in->opt_record);
3701 0 : return ret;
3702 :
3703 24 : case DNS_QTYPE_TSIG:
3704 24 : ret = pytalloc_reference_ex(&dns_tsig_record_Type, mem_ctx, &in->tsig_record);
3705 24 : return ret;
3706 :
3707 11 : case DNS_QTYPE_TKEY:
3708 11 : ret = pytalloc_reference_ex(&dns_tkey_record_Type, mem_ctx, &in->tkey_record);
3709 11 : return ret;
3710 :
3711 0 : default:
3712 0 : ret = Py_None;
3713 0 : Py_INCREF(ret);
3714 0 : return ret;
3715 :
3716 : }
3717 : PyErr_SetString(PyExc_TypeError, "unknown union level");
3718 : return NULL;
3719 : }
3720 :
3721 1191 : static union dns_rdata *py_export_dns_rdata(TALLOC_CTX *mem_ctx, int level, PyObject *in)
3722 : {
3723 1191 : union dns_rdata *ret = talloc_zero(mem_ctx, union dns_rdata);
3724 1191 : switch (level) {
3725 177 : case DNS_QTYPE_A:
3726 177 : if (in == NULL) {
3727 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->ipv4_record");
3728 0 : talloc_free(ret); return NULL;
3729 : }
3730 : {
3731 : const char *test_str;
3732 : const char *talloc_str;
3733 177 : PyObject *unicode = NULL;
3734 177 : if (PyUnicode_Check(in)) {
3735 177 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
3736 177 : if (unicode == NULL) {
3737 0 : PyErr_NoMemory();
3738 0 : talloc_free(ret); return NULL;
3739 : }
3740 177 : test_str = PyBytes_AS_STRING(unicode);
3741 0 : } else if (PyBytes_Check(in)) {
3742 0 : test_str = PyBytes_AS_STRING(in);
3743 : } else {
3744 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
3745 0 : talloc_free(ret); return NULL;
3746 : }
3747 177 : talloc_str = talloc_strdup(mem_ctx, test_str);
3748 177 : if (unicode != NULL) {
3749 177 : Py_DECREF(unicode);
3750 : }
3751 177 : if (talloc_str == NULL) {
3752 0 : PyErr_NoMemory();
3753 0 : talloc_free(ret); return NULL;
3754 : }
3755 177 : ret->ipv4_record = talloc_str;
3756 : }
3757 177 : break;
3758 :
3759 0 : case DNS_QTYPE_NS:
3760 0 : if (in == NULL) {
3761 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->ns_record");
3762 0 : talloc_free(ret); return NULL;
3763 : }
3764 : {
3765 : const char *test_str;
3766 : const char *talloc_str;
3767 0 : PyObject *unicode = NULL;
3768 0 : if (PyUnicode_Check(in)) {
3769 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
3770 0 : if (unicode == NULL) {
3771 0 : PyErr_NoMemory();
3772 0 : talloc_free(ret); return NULL;
3773 : }
3774 0 : test_str = PyBytes_AS_STRING(unicode);
3775 0 : } else if (PyBytes_Check(in)) {
3776 0 : test_str = PyBytes_AS_STRING(in);
3777 : } else {
3778 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
3779 0 : talloc_free(ret); return NULL;
3780 : }
3781 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
3782 0 : if (unicode != NULL) {
3783 0 : Py_DECREF(unicode);
3784 : }
3785 0 : if (talloc_str == NULL) {
3786 0 : PyErr_NoMemory();
3787 0 : talloc_free(ret); return NULL;
3788 : }
3789 0 : ret->ns_record = talloc_str;
3790 : }
3791 0 : break;
3792 :
3793 58 : case DNS_QTYPE_CNAME:
3794 58 : if (in == NULL) {
3795 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->cname_record");
3796 0 : talloc_free(ret); return NULL;
3797 : }
3798 : {
3799 : const char *test_str;
3800 : const char *talloc_str;
3801 58 : PyObject *unicode = NULL;
3802 58 : if (PyUnicode_Check(in)) {
3803 58 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
3804 58 : if (unicode == NULL) {
3805 0 : PyErr_NoMemory();
3806 0 : talloc_free(ret); return NULL;
3807 : }
3808 58 : test_str = PyBytes_AS_STRING(unicode);
3809 0 : } else if (PyBytes_Check(in)) {
3810 0 : test_str = PyBytes_AS_STRING(in);
3811 : } else {
3812 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
3813 0 : talloc_free(ret); return NULL;
3814 : }
3815 58 : talloc_str = talloc_strdup(mem_ctx, test_str);
3816 58 : if (unicode != NULL) {
3817 58 : Py_DECREF(unicode);
3818 : }
3819 58 : if (talloc_str == NULL) {
3820 0 : PyErr_NoMemory();
3821 0 : talloc_free(ret); return NULL;
3822 : }
3823 58 : ret->cname_record = talloc_str;
3824 : }
3825 58 : break;
3826 :
3827 0 : case DNS_QTYPE_SOA:
3828 0 : if (in == NULL) {
3829 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->soa_record");
3830 0 : talloc_free(ret); return NULL;
3831 : }
3832 0 : PY_CHECK_TYPE(&dns_soa_record_Type, in, talloc_free(ret); return NULL;);
3833 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3834 0 : PyErr_NoMemory();
3835 0 : talloc_free(ret); return NULL;
3836 : }
3837 0 : ret->soa_record = *(struct dns_soa_record *)pytalloc_get_ptr(in);
3838 0 : break;
3839 :
3840 0 : case DNS_QTYPE_PTR:
3841 0 : if (in == NULL) {
3842 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->ptr_record");
3843 0 : talloc_free(ret); return NULL;
3844 : }
3845 : {
3846 : const char *test_str;
3847 : const char *talloc_str;
3848 0 : PyObject *unicode = NULL;
3849 0 : if (PyUnicode_Check(in)) {
3850 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
3851 0 : if (unicode == NULL) {
3852 0 : PyErr_NoMemory();
3853 0 : talloc_free(ret); return NULL;
3854 : }
3855 0 : test_str = PyBytes_AS_STRING(unicode);
3856 0 : } else if (PyBytes_Check(in)) {
3857 0 : test_str = PyBytes_AS_STRING(in);
3858 : } else {
3859 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
3860 0 : talloc_free(ret); return NULL;
3861 : }
3862 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
3863 0 : if (unicode != NULL) {
3864 0 : Py_DECREF(unicode);
3865 : }
3866 0 : if (talloc_str == NULL) {
3867 0 : PyErr_NoMemory();
3868 0 : talloc_free(ret); return NULL;
3869 : }
3870 0 : ret->ptr_record = talloc_str;
3871 : }
3872 0 : break;
3873 :
3874 0 : case DNS_QTYPE_HINFO:
3875 0 : if (in == NULL) {
3876 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->hinfo_record");
3877 0 : talloc_free(ret); return NULL;
3878 : }
3879 0 : PY_CHECK_TYPE(dnsp_hinfo_Type, in, talloc_free(ret); return NULL;);
3880 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3881 0 : PyErr_NoMemory();
3882 0 : talloc_free(ret); return NULL;
3883 : }
3884 0 : ret->hinfo_record = *(struct dnsp_hinfo *)pytalloc_get_ptr(in);
3885 0 : break;
3886 :
3887 4 : case DNS_QTYPE_MX:
3888 4 : if (in == NULL) {
3889 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->mx_record");
3890 0 : talloc_free(ret); return NULL;
3891 : }
3892 4 : PY_CHECK_TYPE(&dns_mx_record_Type, in, talloc_free(ret); return NULL;);
3893 4 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3894 0 : PyErr_NoMemory();
3895 0 : talloc_free(ret); return NULL;
3896 : }
3897 4 : ret->mx_record = *(struct dns_mx_record *)pytalloc_get_ptr(in);
3898 4 : break;
3899 :
3900 792 : case DNS_QTYPE_TXT:
3901 792 : if (in == NULL) {
3902 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->txt_record");
3903 0 : talloc_free(ret); return NULL;
3904 : }
3905 792 : PY_CHECK_TYPE(&dns_txt_record_Type, in, talloc_free(ret); return NULL;);
3906 792 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3907 0 : PyErr_NoMemory();
3908 0 : talloc_free(ret); return NULL;
3909 : }
3910 792 : ret->txt_record = *(struct dns_txt_record *)pytalloc_get_ptr(in);
3911 792 : break;
3912 :
3913 0 : case DNS_QTYPE_RP:
3914 0 : if (in == NULL) {
3915 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->rp_record");
3916 0 : talloc_free(ret); return NULL;
3917 : }
3918 0 : PY_CHECK_TYPE(&dns_rp_record_Type, in, talloc_free(ret); return NULL;);
3919 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3920 0 : PyErr_NoMemory();
3921 0 : talloc_free(ret); return NULL;
3922 : }
3923 0 : ret->rp_record = *(struct dns_rp_record *)pytalloc_get_ptr(in);
3924 0 : break;
3925 :
3926 84 : case DNS_QTYPE_AAAA:
3927 84 : if (in == NULL) {
3928 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->ipv6_record");
3929 0 : talloc_free(ret); return NULL;
3930 : }
3931 : {
3932 : const char *test_str;
3933 : const char *talloc_str;
3934 84 : PyObject *unicode = NULL;
3935 84 : if (PyUnicode_Check(in)) {
3936 84 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
3937 84 : if (unicode == NULL) {
3938 0 : PyErr_NoMemory();
3939 0 : talloc_free(ret); return NULL;
3940 : }
3941 84 : test_str = PyBytes_AS_STRING(unicode);
3942 0 : } else if (PyBytes_Check(in)) {
3943 0 : test_str = PyBytes_AS_STRING(in);
3944 : } else {
3945 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
3946 0 : talloc_free(ret); return NULL;
3947 : }
3948 84 : talloc_str = talloc_strdup(mem_ctx, test_str);
3949 84 : if (unicode != NULL) {
3950 84 : Py_DECREF(unicode);
3951 : }
3952 84 : if (talloc_str == NULL) {
3953 0 : PyErr_NoMemory();
3954 0 : talloc_free(ret); return NULL;
3955 : }
3956 84 : ret->ipv6_record = talloc_str;
3957 : }
3958 84 : break;
3959 :
3960 52 : case DNS_QTYPE_SRV:
3961 52 : if (in == NULL) {
3962 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->srv_record");
3963 0 : talloc_free(ret); return NULL;
3964 : }
3965 52 : PY_CHECK_TYPE(&dns_srv_record_Type, in, talloc_free(ret); return NULL;);
3966 52 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3967 0 : PyErr_NoMemory();
3968 0 : talloc_free(ret); return NULL;
3969 : }
3970 52 : ret->srv_record = *(struct dns_srv_record *)pytalloc_get_ptr(in);
3971 52 : break;
3972 :
3973 0 : case DNS_QTYPE_OPT:
3974 0 : if (in == NULL) {
3975 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->opt_record");
3976 0 : talloc_free(ret); return NULL;
3977 : }
3978 0 : PY_CHECK_TYPE(&dns_opt_record_Type, in, talloc_free(ret); return NULL;);
3979 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3980 0 : PyErr_NoMemory();
3981 0 : talloc_free(ret); return NULL;
3982 : }
3983 0 : ret->opt_record = *(struct dns_opt_record *)pytalloc_get_ptr(in);
3984 0 : break;
3985 :
3986 13 : case DNS_QTYPE_TSIG:
3987 13 : if (in == NULL) {
3988 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->tsig_record");
3989 0 : talloc_free(ret); return NULL;
3990 : }
3991 13 : PY_CHECK_TYPE(&dns_tsig_record_Type, in, talloc_free(ret); return NULL;);
3992 13 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3993 0 : PyErr_NoMemory();
3994 0 : talloc_free(ret); return NULL;
3995 : }
3996 13 : ret->tsig_record = *(struct dns_tsig_record *)pytalloc_get_ptr(in);
3997 13 : break;
3998 :
3999 11 : case DNS_QTYPE_TKEY:
4000 11 : if (in == NULL) {
4001 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->tkey_record");
4002 0 : talloc_free(ret); return NULL;
4003 : }
4004 11 : PY_CHECK_TYPE(&dns_tkey_record_Type, in, talloc_free(ret); return NULL;);
4005 11 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4006 0 : PyErr_NoMemory();
4007 0 : talloc_free(ret); return NULL;
4008 : }
4009 11 : ret->tkey_record = *(struct dns_tkey_record *)pytalloc_get_ptr(in);
4010 11 : break;
4011 :
4012 0 : default:
4013 0 : break;
4014 :
4015 : }
4016 :
4017 1191 : return ret;
4018 : }
4019 :
4020 395 : static PyObject *py_dns_rdata_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4021 : {
4022 395 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4023 395 : PyObject *mem_ctx_obj = NULL;
4024 395 : TALLOC_CTX *mem_ctx = NULL;
4025 395 : int level = 0;
4026 395 : PyObject *in_obj = NULL;
4027 395 : union dns_rdata *in = NULL;
4028 :
4029 395 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
4030 : discard_const_p(char *, kwnames),
4031 : &mem_ctx_obj,
4032 : &level,
4033 : &in_obj)) {
4034 0 : return NULL;
4035 : }
4036 395 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4037 395 : if (mem_ctx == NULL) {
4038 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4039 0 : return NULL;
4040 : }
4041 395 : in = (union dns_rdata *)pytalloc_get_ptr(in_obj);
4042 395 : if (in == NULL) {
4043 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union dns_rdata!");
4044 0 : return NULL;
4045 : }
4046 :
4047 395 : return py_import_dns_rdata(mem_ctx, level, in);
4048 : }
4049 :
4050 1191 : static PyObject *py_dns_rdata_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4051 : {
4052 1191 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4053 1191 : PyObject *mem_ctx_obj = NULL;
4054 1191 : TALLOC_CTX *mem_ctx = NULL;
4055 1191 : int level = 0;
4056 1191 : PyObject *in = NULL;
4057 1191 : union dns_rdata *out = NULL;
4058 :
4059 1191 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
4060 : discard_const_p(char *, kwnames),
4061 : &mem_ctx_obj,
4062 : &level,
4063 : &in)) {
4064 0 : return NULL;
4065 : }
4066 1191 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4067 1191 : if (mem_ctx == NULL) {
4068 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4069 0 : return NULL;
4070 : }
4071 :
4072 1191 : out = py_export_dns_rdata(mem_ctx, level, in);
4073 1191 : if (out == NULL) {
4074 0 : return NULL;
4075 : }
4076 :
4077 1191 : return pytalloc_GenericObject_reference(out);
4078 : }
4079 :
4080 : static PyMethodDef py_dns_rdata_methods[] = {
4081 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_rdata_import),
4082 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4083 : "T.__import__(mem_ctx, level, in) => ret." },
4084 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_rdata_export),
4085 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4086 : "T.__export__(mem_ctx, level, in) => ret." },
4087 : { NULL, NULL, 0, NULL }
4088 : };
4089 :
4090 0 : static PyObject *py_dns_rdata_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4091 : {
4092 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
4093 0 : return NULL;
4094 : }
4095 :
4096 :
4097 : static PyTypeObject dns_rdata_Type = {
4098 : PyVarObject_HEAD_INIT(NULL, 0)
4099 : .tp_name = "dns.rdata",
4100 : .tp_getset = NULL,
4101 : .tp_methods = py_dns_rdata_methods,
4102 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4103 : .tp_new = py_dns_rdata_new,
4104 : };
4105 :
4106 :
4107 6 : static PyObject *py_dns_res_rec_get_name(PyObject *obj, void *closure)
4108 : {
4109 6 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4110 : PyObject *py_name;
4111 6 : py_name = PyString_FromStringOrNULL(object->name);
4112 6 : return py_name;
4113 : }
4114 :
4115 1213 : static int py_dns_res_rec_set_name(PyObject *py_obj, PyObject *value, void *closure)
4116 : {
4117 1213 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4118 1213 : if (value == NULL) {
4119 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
4120 0 : return -1;
4121 : }
4122 : {
4123 : const char *test_str;
4124 : const char *talloc_str;
4125 1213 : PyObject *unicode = NULL;
4126 1213 : if (PyUnicode_Check(value)) {
4127 1213 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
4128 1213 : if (unicode == NULL) {
4129 0 : PyErr_NoMemory();
4130 0 : return -1;
4131 : }
4132 1213 : test_str = PyBytes_AS_STRING(unicode);
4133 0 : } else if (PyBytes_Check(value)) {
4134 0 : test_str = PyBytes_AS_STRING(value);
4135 : } else {
4136 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
4137 0 : return -1;
4138 : }
4139 1213 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
4140 1213 : if (unicode != NULL) {
4141 1213 : Py_DECREF(unicode);
4142 : }
4143 1213 : if (talloc_str == NULL) {
4144 0 : PyErr_NoMemory();
4145 0 : return -1;
4146 : }
4147 1213 : object->name = talloc_str;
4148 : }
4149 1213 : return 0;
4150 : }
4151 :
4152 37 : static PyObject *py_dns_res_rec_get_rr_type(PyObject *obj, void *closure)
4153 : {
4154 37 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4155 : PyObject *py_rr_type;
4156 37 : py_rr_type = PyLong_FromLong((uint16_t)object->rr_type);
4157 37 : return py_rr_type;
4158 : }
4159 :
4160 1213 : static int py_dns_res_rec_set_rr_type(PyObject *py_obj, PyObject *value, void *closure)
4161 : {
4162 1213 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4163 1213 : if (value == NULL) {
4164 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rr_type");
4165 0 : return -1;
4166 : }
4167 : {
4168 1213 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->rr_type));
4169 1213 : if (PyLong_Check(value)) {
4170 : unsigned long long test_var;
4171 1213 : test_var = PyLong_AsUnsignedLongLong(value);
4172 1213 : if (PyErr_Occurred() != NULL) {
4173 0 : return -1;
4174 : }
4175 1213 : if (test_var > uint_max) {
4176 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4177 : PyLong_Type.tp_name, uint_max, test_var);
4178 0 : return -1;
4179 : }
4180 1213 : object->rr_type = test_var;
4181 : } else {
4182 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4183 : PyLong_Type.tp_name);
4184 0 : return -1;
4185 : }
4186 : }
4187 1213 : return 0;
4188 : }
4189 :
4190 0 : static PyObject *py_dns_res_rec_get_rr_class(PyObject *obj, void *closure)
4191 : {
4192 0 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4193 : PyObject *py_rr_class;
4194 0 : py_rr_class = PyLong_FromLong((uint16_t)object->rr_class);
4195 0 : return py_rr_class;
4196 : }
4197 :
4198 1213 : static int py_dns_res_rec_set_rr_class(PyObject *py_obj, PyObject *value, void *closure)
4199 : {
4200 1213 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4201 1213 : if (value == NULL) {
4202 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rr_class");
4203 0 : return -1;
4204 : }
4205 : {
4206 1213 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->rr_class));
4207 1213 : if (PyLong_Check(value)) {
4208 : unsigned long long test_var;
4209 1213 : test_var = PyLong_AsUnsignedLongLong(value);
4210 1213 : if (PyErr_Occurred() != NULL) {
4211 0 : return -1;
4212 : }
4213 1213 : if (test_var > uint_max) {
4214 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4215 : PyLong_Type.tp_name, uint_max, test_var);
4216 0 : return -1;
4217 : }
4218 1213 : object->rr_class = test_var;
4219 : } else {
4220 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4221 : PyLong_Type.tp_name);
4222 0 : return -1;
4223 : }
4224 : }
4225 1213 : return 0;
4226 : }
4227 :
4228 0 : static PyObject *py_dns_res_rec_get_ttl(PyObject *obj, void *closure)
4229 : {
4230 0 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4231 : PyObject *py_ttl;
4232 0 : py_ttl = PyLong_FromUnsignedLongLong((uint32_t)object->ttl);
4233 0 : return py_ttl;
4234 : }
4235 :
4236 1213 : static int py_dns_res_rec_set_ttl(PyObject *py_obj, PyObject *value, void *closure)
4237 : {
4238 1213 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4239 1213 : if (value == NULL) {
4240 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ttl");
4241 0 : return -1;
4242 : }
4243 : {
4244 1213 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ttl));
4245 1213 : if (PyLong_Check(value)) {
4246 : unsigned long long test_var;
4247 1213 : test_var = PyLong_AsUnsignedLongLong(value);
4248 1213 : if (PyErr_Occurred() != NULL) {
4249 0 : return -1;
4250 : }
4251 1213 : if (test_var > uint_max) {
4252 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4253 : PyLong_Type.tp_name, uint_max, test_var);
4254 0 : return -1;
4255 : }
4256 1213 : object->ttl = test_var;
4257 : } else {
4258 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4259 : PyLong_Type.tp_name);
4260 0 : return -1;
4261 : }
4262 : }
4263 1213 : return 0;
4264 : }
4265 :
4266 0 : static PyObject *py_dns_res_rec_get_length(PyObject *obj, void *closure)
4267 : {
4268 0 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4269 : PyObject *py_length;
4270 0 : py_length = PyLong_FromLong((uint16_t)object->length);
4271 0 : return py_length;
4272 : }
4273 :
4274 1213 : static int py_dns_res_rec_set_length(PyObject *py_obj, PyObject *value, void *closure)
4275 : {
4276 1213 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4277 1213 : if (value == NULL) {
4278 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length");
4279 0 : return -1;
4280 : }
4281 : {
4282 1213 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
4283 1213 : if (PyLong_Check(value)) {
4284 : unsigned long long test_var;
4285 1213 : test_var = PyLong_AsUnsignedLongLong(value);
4286 1213 : if (PyErr_Occurred() != NULL) {
4287 0 : return -1;
4288 : }
4289 1213 : if (test_var > uint_max) {
4290 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4291 : PyLong_Type.tp_name, uint_max, test_var);
4292 0 : return -1;
4293 : }
4294 1213 : object->length = test_var;
4295 : } else {
4296 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4297 : PyLong_Type.tp_name);
4298 0 : return -1;
4299 : }
4300 : }
4301 1213 : return 0;
4302 : }
4303 :
4304 395 : static PyObject *py_dns_res_rec_get_rdata(PyObject *obj, void *closure)
4305 : {
4306 395 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4307 : PyObject *py_rdata;
4308 395 : py_rdata = pyrpc_import_union(&dns_rdata_Type, pytalloc_get_mem_ctx(obj), object->rr_type, &object->rdata, "union dns_rdata");
4309 395 : if (py_rdata == NULL) {
4310 0 : return NULL;
4311 : }
4312 395 : return py_rdata;
4313 : }
4314 :
4315 1191 : static int py_dns_res_rec_set_rdata(PyObject *py_obj, PyObject *value, void *closure)
4316 : {
4317 1191 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4318 1191 : if (value == NULL) {
4319 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rdata");
4320 0 : return -1;
4321 : }
4322 : {
4323 : union dns_rdata *rdata_switch_0;
4324 1191 : rdata_switch_0 = (union dns_rdata *)pyrpc_export_union(&dns_rdata_Type, pytalloc_get_mem_ctx(py_obj), object->rr_type, value, "union dns_rdata");
4325 1191 : if (rdata_switch_0 == NULL) {
4326 0 : return -1;
4327 : }
4328 1191 : object->rdata = *rdata_switch_0;
4329 : }
4330 1191 : return 0;
4331 : }
4332 :
4333 0 : static PyObject *py_dns_res_rec_get_unexpected(PyObject *obj, void *closure)
4334 : {
4335 0 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(obj);
4336 : PyObject *py_unexpected;
4337 0 : py_unexpected = PyBytes_FromStringAndSize((char *)(object->unexpected).data, (object->unexpected).length);
4338 0 : return py_unexpected;
4339 : }
4340 :
4341 0 : static int py_dns_res_rec_set_unexpected(PyObject *py_obj, PyObject *value, void *closure)
4342 : {
4343 0 : struct dns_res_rec *object = (struct dns_res_rec *)pytalloc_get_ptr(py_obj);
4344 0 : if (value == NULL) {
4345 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unexpected");
4346 0 : return -1;
4347 : }
4348 0 : object->unexpected = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
4349 0 : return 0;
4350 : }
4351 :
4352 : static PyGetSetDef py_dns_res_rec_getsetters[] = {
4353 : {
4354 : .name = discard_const_p(char, "name"),
4355 : .get = py_dns_res_rec_get_name,
4356 : .set = py_dns_res_rec_set_name,
4357 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_string")
4358 : },
4359 : {
4360 : .name = discard_const_p(char, "rr_type"),
4361 : .get = py_dns_res_rec_get_rr_type,
4362 : .set = py_dns_res_rec_set_rr_type,
4363 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_qtype")
4364 : },
4365 : {
4366 : .name = discard_const_p(char, "rr_class"),
4367 : .get = py_dns_res_rec_get_rr_class,
4368 : .set = py_dns_res_rec_set_rr_class,
4369 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_qclass")
4370 : },
4371 : {
4372 : .name = discard_const_p(char, "ttl"),
4373 : .get = py_dns_res_rec_get_ttl,
4374 : .set = py_dns_res_rec_set_ttl,
4375 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4376 : },
4377 : {
4378 : .name = discard_const_p(char, "length"),
4379 : .get = py_dns_res_rec_get_length,
4380 : .set = py_dns_res_rec_set_length,
4381 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4382 : },
4383 : {
4384 : .name = discard_const_p(char, "rdata"),
4385 : .get = py_dns_res_rec_get_rdata,
4386 : .set = py_dns_res_rec_set_rdata,
4387 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_rdata")
4388 : },
4389 : {
4390 : .name = discard_const_p(char, "unexpected"),
4391 : .get = py_dns_res_rec_get_unexpected,
4392 : .set = py_dns_res_rec_set_unexpected,
4393 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
4394 : },
4395 : { .name = NULL }
4396 : };
4397 :
4398 1213 : static PyObject *py_dns_res_rec_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4399 : {
4400 1213 : return pytalloc_new(struct dns_res_rec, type);
4401 : }
4402 :
4403 :
4404 : static PyTypeObject dns_res_rec_Type = {
4405 : PyVarObject_HEAD_INIT(NULL, 0)
4406 : .tp_name = "dns.res_rec",
4407 : .tp_getset = py_dns_res_rec_getsetters,
4408 : .tp_methods = NULL,
4409 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4410 : .tp_new = py_dns_res_rec_new,
4411 : };
4412 :
4413 :
4414 13 : static PyObject *py_dns_name_packet_get_id(PyObject *obj, void *closure)
4415 : {
4416 13 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4417 : PyObject *py_id;
4418 13 : py_id = PyLong_FromLong((uint16_t)object->id);
4419 13 : return py_id;
4420 : }
4421 :
4422 1491 : static int py_dns_name_packet_set_id(PyObject *py_obj, PyObject *value, void *closure)
4423 : {
4424 1491 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4425 1491 : if (value == NULL) {
4426 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id");
4427 0 : return -1;
4428 : }
4429 : {
4430 1491 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->id));
4431 1491 : if (PyLong_Check(value)) {
4432 : unsigned long long test_var;
4433 1491 : test_var = PyLong_AsUnsignedLongLong(value);
4434 1491 : if (PyErr_Occurred() != NULL) {
4435 0 : return -1;
4436 : }
4437 1491 : if (test_var > uint_max) {
4438 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4439 : PyLong_Type.tp_name, uint_max, test_var);
4440 0 : return -1;
4441 : }
4442 1491 : object->id = test_var;
4443 : } else {
4444 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4445 : PyLong_Type.tp_name);
4446 0 : return -1;
4447 : }
4448 : }
4449 1491 : return 0;
4450 : }
4451 :
4452 36865 : static PyObject *py_dns_name_packet_get_operation(PyObject *obj, void *closure)
4453 : {
4454 36865 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4455 : PyObject *py_operation;
4456 36865 : py_operation = PyLong_FromLong((uint16_t)object->operation);
4457 36865 : return py_operation;
4458 : }
4459 :
4460 6145 : static int py_dns_name_packet_set_operation(PyObject *py_obj, PyObject *value, void *closure)
4461 : {
4462 6145 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4463 6145 : if (value == NULL) {
4464 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->operation");
4465 0 : return -1;
4466 : }
4467 : {
4468 6145 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->operation));
4469 6145 : if (PyLong_Check(value)) {
4470 : unsigned long long test_var;
4471 6145 : test_var = PyLong_AsUnsignedLongLong(value);
4472 6145 : if (PyErr_Occurred() != NULL) {
4473 0 : return -1;
4474 : }
4475 6145 : if (test_var > uint_max) {
4476 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4477 : PyLong_Type.tp_name, uint_max, test_var);
4478 0 : return -1;
4479 : }
4480 6145 : object->operation = test_var;
4481 : } else {
4482 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4483 : PyLong_Type.tp_name);
4484 0 : return -1;
4485 : }
4486 : }
4487 6145 : return 0;
4488 : }
4489 :
4490 0 : static PyObject *py_dns_name_packet_get_qdcount(PyObject *obj, void *closure)
4491 : {
4492 0 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4493 : PyObject *py_qdcount;
4494 0 : py_qdcount = PyLong_FromLong((uint16_t)object->qdcount);
4495 0 : return py_qdcount;
4496 : }
4497 :
4498 1496 : static int py_dns_name_packet_set_qdcount(PyObject *py_obj, PyObject *value, void *closure)
4499 : {
4500 1496 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4501 1496 : if (value == NULL) {
4502 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->qdcount");
4503 0 : return -1;
4504 : }
4505 : {
4506 1496 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->qdcount));
4507 1496 : if (PyLong_Check(value)) {
4508 : unsigned long long test_var;
4509 1496 : test_var = PyLong_AsUnsignedLongLong(value);
4510 1496 : if (PyErr_Occurred() != NULL) {
4511 0 : return -1;
4512 : }
4513 1496 : if (test_var > uint_max) {
4514 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4515 : PyLong_Type.tp_name, uint_max, test_var);
4516 0 : return -1;
4517 : }
4518 1496 : object->qdcount = test_var;
4519 : } else {
4520 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4521 : PyLong_Type.tp_name);
4522 0 : return -1;
4523 : }
4524 : }
4525 1496 : return 0;
4526 : }
4527 :
4528 132 : static PyObject *py_dns_name_packet_get_ancount(PyObject *obj, void *closure)
4529 : {
4530 132 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4531 : PyObject *py_ancount;
4532 132 : py_ancount = PyLong_FromLong((uint16_t)object->ancount);
4533 132 : return py_ancount;
4534 : }
4535 :
4536 14 : static int py_dns_name_packet_set_ancount(PyObject *py_obj, PyObject *value, void *closure)
4537 : {
4538 14 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4539 14 : if (value == NULL) {
4540 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ancount");
4541 0 : return -1;
4542 : }
4543 : {
4544 14 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ancount));
4545 14 : if (PyLong_Check(value)) {
4546 : unsigned long long test_var;
4547 14 : test_var = PyLong_AsUnsignedLongLong(value);
4548 14 : if (PyErr_Occurred() != NULL) {
4549 0 : return -1;
4550 : }
4551 14 : if (test_var > uint_max) {
4552 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4553 : PyLong_Type.tp_name, uint_max, test_var);
4554 0 : return -1;
4555 : }
4556 14 : object->ancount = test_var;
4557 : } else {
4558 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4559 : PyLong_Type.tp_name);
4560 0 : return -1;
4561 : }
4562 : }
4563 14 : return 0;
4564 : }
4565 :
4566 8 : static PyObject *py_dns_name_packet_get_nscount(PyObject *obj, void *closure)
4567 : {
4568 8 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4569 : PyObject *py_nscount;
4570 8 : py_nscount = PyLong_FromLong((uint16_t)object->nscount);
4571 8 : return py_nscount;
4572 : }
4573 :
4574 1167 : static int py_dns_name_packet_set_nscount(PyObject *py_obj, PyObject *value, void *closure)
4575 : {
4576 1167 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4577 1167 : if (value == NULL) {
4578 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->nscount");
4579 0 : return -1;
4580 : }
4581 : {
4582 1167 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->nscount));
4583 1167 : if (PyLong_Check(value)) {
4584 : unsigned long long test_var;
4585 1167 : test_var = PyLong_AsUnsignedLongLong(value);
4586 1167 : if (PyErr_Occurred() != NULL) {
4587 0 : return -1;
4588 : }
4589 1167 : if (test_var > uint_max) {
4590 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4591 : PyLong_Type.tp_name, uint_max, test_var);
4592 0 : return -1;
4593 : }
4594 1167 : object->nscount = test_var;
4595 : } else {
4596 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4597 : PyLong_Type.tp_name);
4598 0 : return -1;
4599 : }
4600 : }
4601 1167 : return 0;
4602 : }
4603 :
4604 0 : static PyObject *py_dns_name_packet_get_arcount(PyObject *obj, void *closure)
4605 : {
4606 0 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4607 : PyObject *py_arcount;
4608 0 : py_arcount = PyLong_FromLong((uint16_t)object->arcount);
4609 0 : return py_arcount;
4610 : }
4611 :
4612 24 : static int py_dns_name_packet_set_arcount(PyObject *py_obj, PyObject *value, void *closure)
4613 : {
4614 24 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4615 24 : if (value == NULL) {
4616 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->arcount");
4617 0 : return -1;
4618 : }
4619 : {
4620 24 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->arcount));
4621 24 : if (PyLong_Check(value)) {
4622 : unsigned long long test_var;
4623 24 : test_var = PyLong_AsUnsignedLongLong(value);
4624 24 : if (PyErr_Occurred() != NULL) {
4625 0 : return -1;
4626 : }
4627 24 : if (test_var > uint_max) {
4628 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4629 : PyLong_Type.tp_name, uint_max, test_var);
4630 0 : return -1;
4631 : }
4632 24 : object->arcount = test_var;
4633 : } else {
4634 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4635 : PyLong_Type.tp_name);
4636 0 : return -1;
4637 : }
4638 : }
4639 24 : return 0;
4640 : }
4641 :
4642 30226 : static PyObject *py_dns_name_packet_get_questions(PyObject *obj, void *closure)
4643 : {
4644 30226 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4645 : PyObject *py_questions;
4646 30226 : py_questions = PyList_New(object->qdcount);
4647 30226 : if (py_questions == NULL) {
4648 0 : return NULL;
4649 : }
4650 : {
4651 : int questions_cntr_0;
4652 60452 : for (questions_cntr_0 = 0; questions_cntr_0 < (object->qdcount); questions_cntr_0++) {
4653 : PyObject *py_questions_0;
4654 30226 : py_questions_0 = pytalloc_reference_ex(&dns_name_question_Type, object->questions, &object->questions[questions_cntr_0]);
4655 30226 : PyList_SetItem(py_questions, questions_cntr_0, py_questions_0);
4656 : }
4657 : }
4658 30226 : return py_questions;
4659 : }
4660 :
4661 2987 : static int py_dns_name_packet_set_questions(PyObject *py_obj, PyObject *value, void *closure)
4662 : {
4663 2987 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4664 2987 : if (value == NULL) {
4665 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->questions");
4666 0 : return -1;
4667 : }
4668 2987 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4669 : {
4670 : int questions_cntr_0;
4671 2987 : object->questions = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->questions, PyList_GET_SIZE(value));
4672 2987 : if (!object->questions) { return -1;; }
4673 2987 : talloc_set_name_const(object->questions, "ARRAY: object->questions");
4674 4491 : for (questions_cntr_0 = 0; questions_cntr_0 < PyList_GET_SIZE(value); questions_cntr_0++) {
4675 1504 : if (PyList_GET_ITEM(value, questions_cntr_0) == NULL) {
4676 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->questions[questions_cntr_0]");
4677 0 : return -1;
4678 : }
4679 1504 : PY_CHECK_TYPE(&dns_name_question_Type, PyList_GET_ITEM(value, questions_cntr_0), return -1;);
4680 1504 : if (talloc_reference(object->questions, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, questions_cntr_0))) == NULL) {
4681 0 : PyErr_NoMemory();
4682 0 : return -1;
4683 : }
4684 1504 : object->questions[questions_cntr_0] = *(struct dns_name_question *)pytalloc_get_ptr(PyList_GET_ITEM(value, questions_cntr_0));
4685 : }
4686 : }
4687 2987 : return 0;
4688 : }
4689 :
4690 260 : static PyObject *py_dns_name_packet_get_answers(PyObject *obj, void *closure)
4691 : {
4692 260 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4693 : PyObject *py_answers;
4694 260 : py_answers = PyList_New(object->ancount);
4695 260 : if (py_answers == NULL) {
4696 0 : return NULL;
4697 : }
4698 : {
4699 : int answers_cntr_0;
4700 978 : for (answers_cntr_0 = 0; answers_cntr_0 < (object->ancount); answers_cntr_0++) {
4701 : PyObject *py_answers_0;
4702 718 : py_answers_0 = pytalloc_reference_ex(&dns_res_rec_Type, object->answers, &object->answers[answers_cntr_0]);
4703 718 : PyList_SetItem(py_answers, answers_cntr_0, py_answers_0);
4704 : }
4705 : }
4706 260 : return py_answers;
4707 : }
4708 :
4709 14 : static int py_dns_name_packet_set_answers(PyObject *py_obj, PyObject *value, void *closure)
4710 : {
4711 14 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4712 14 : if (value == NULL) {
4713 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->answers");
4714 0 : return -1;
4715 : }
4716 14 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4717 : {
4718 : int answers_cntr_0;
4719 14 : object->answers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->answers, PyList_GET_SIZE(value));
4720 14 : if (!object->answers) { return -1;; }
4721 14 : talloc_set_name_const(object->answers, "ARRAY: object->answers");
4722 28 : for (answers_cntr_0 = 0; answers_cntr_0 < PyList_GET_SIZE(value); answers_cntr_0++) {
4723 14 : if (PyList_GET_ITEM(value, answers_cntr_0) == NULL) {
4724 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->answers[answers_cntr_0]");
4725 0 : return -1;
4726 : }
4727 14 : PY_CHECK_TYPE(&dns_res_rec_Type, PyList_GET_ITEM(value, answers_cntr_0), return -1;);
4728 14 : if (talloc_reference(object->answers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, answers_cntr_0))) == NULL) {
4729 0 : PyErr_NoMemory();
4730 0 : return -1;
4731 : }
4732 14 : object->answers[answers_cntr_0] = *(struct dns_res_rec *)pytalloc_get_ptr(PyList_GET_ITEM(value, answers_cntr_0));
4733 : }
4734 : }
4735 14 : return 0;
4736 : }
4737 :
4738 0 : static PyObject *py_dns_name_packet_get_nsrecs(PyObject *obj, void *closure)
4739 : {
4740 0 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4741 : PyObject *py_nsrecs;
4742 0 : py_nsrecs = PyList_New(object->nscount);
4743 0 : if (py_nsrecs == NULL) {
4744 0 : return NULL;
4745 : }
4746 : {
4747 : int nsrecs_cntr_0;
4748 0 : for (nsrecs_cntr_0 = 0; nsrecs_cntr_0 < (object->nscount); nsrecs_cntr_0++) {
4749 : PyObject *py_nsrecs_0;
4750 0 : py_nsrecs_0 = pytalloc_reference_ex(&dns_res_rec_Type, object->nsrecs, &object->nsrecs[nsrecs_cntr_0]);
4751 0 : PyList_SetItem(py_nsrecs, nsrecs_cntr_0, py_nsrecs_0);
4752 : }
4753 : }
4754 0 : return py_nsrecs;
4755 : }
4756 :
4757 1167 : static int py_dns_name_packet_set_nsrecs(PyObject *py_obj, PyObject *value, void *closure)
4758 : {
4759 1167 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4760 1167 : if (value == NULL) {
4761 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->nsrecs");
4762 0 : return -1;
4763 : }
4764 1167 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4765 : {
4766 : int nsrecs_cntr_0;
4767 1167 : object->nsrecs = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->nsrecs, PyList_GET_SIZE(value));
4768 1167 : if (!object->nsrecs) { return -1;; }
4769 1167 : talloc_set_name_const(object->nsrecs, "ARRAY: object->nsrecs");
4770 2342 : for (nsrecs_cntr_0 = 0; nsrecs_cntr_0 < PyList_GET_SIZE(value); nsrecs_cntr_0++) {
4771 1175 : if (PyList_GET_ITEM(value, nsrecs_cntr_0) == NULL) {
4772 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->nsrecs[nsrecs_cntr_0]");
4773 0 : return -1;
4774 : }
4775 1175 : PY_CHECK_TYPE(&dns_res_rec_Type, PyList_GET_ITEM(value, nsrecs_cntr_0), return -1;);
4776 1175 : if (talloc_reference(object->nsrecs, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, nsrecs_cntr_0))) == NULL) {
4777 0 : PyErr_NoMemory();
4778 0 : return -1;
4779 : }
4780 1175 : object->nsrecs[nsrecs_cntr_0] = *(struct dns_res_rec *)pytalloc_get_ptr(PyList_GET_ITEM(value, nsrecs_cntr_0));
4781 : }
4782 : }
4783 1167 : return 0;
4784 : }
4785 :
4786 44 : static PyObject *py_dns_name_packet_get_additional(PyObject *obj, void *closure)
4787 : {
4788 44 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(obj);
4789 : PyObject *py_additional;
4790 44 : py_additional = PyList_New(object->arcount);
4791 44 : if (py_additional == NULL) {
4792 0 : return NULL;
4793 : }
4794 : {
4795 : int additional_cntr_0;
4796 88 : for (additional_cntr_0 = 0; additional_cntr_0 < (object->arcount); additional_cntr_0++) {
4797 : PyObject *py_additional_0;
4798 44 : py_additional_0 = pytalloc_reference_ex(&dns_res_rec_Type, object->additional, &object->additional[additional_cntr_0]);
4799 44 : PyList_SetItem(py_additional, additional_cntr_0, py_additional_0);
4800 : }
4801 : }
4802 44 : return py_additional;
4803 : }
4804 :
4805 1473 : static int py_dns_name_packet_set_additional(PyObject *py_obj, PyObject *value, void *closure)
4806 : {
4807 1473 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4808 1473 : if (value == NULL) {
4809 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->additional");
4810 0 : return -1;
4811 : }
4812 1473 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4813 : {
4814 : int additional_cntr_0;
4815 1473 : object->additional = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->additional, PyList_GET_SIZE(value));
4816 1473 : if (!object->additional) { return -1;; }
4817 1473 : talloc_set_name_const(object->additional, "ARRAY: object->additional");
4818 1497 : for (additional_cntr_0 = 0; additional_cntr_0 < PyList_GET_SIZE(value); additional_cntr_0++) {
4819 24 : if (PyList_GET_ITEM(value, additional_cntr_0) == NULL) {
4820 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->additional[additional_cntr_0]");
4821 0 : return -1;
4822 : }
4823 24 : PY_CHECK_TYPE(&dns_res_rec_Type, PyList_GET_ITEM(value, additional_cntr_0), return -1;);
4824 24 : if (talloc_reference(object->additional, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, additional_cntr_0))) == NULL) {
4825 0 : PyErr_NoMemory();
4826 0 : return -1;
4827 : }
4828 24 : object->additional[additional_cntr_0] = *(struct dns_res_rec *)pytalloc_get_ptr(PyList_GET_ITEM(value, additional_cntr_0));
4829 : }
4830 : }
4831 1473 : return 0;
4832 : }
4833 :
4834 : static PyGetSetDef py_dns_name_packet_getsetters[] = {
4835 : {
4836 : .name = discard_const_p(char, "id"),
4837 : .get = py_dns_name_packet_get_id,
4838 : .set = py_dns_name_packet_set_id,
4839 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4840 : },
4841 : {
4842 : .name = discard_const_p(char, "operation"),
4843 : .get = py_dns_name_packet_get_operation,
4844 : .set = py_dns_name_packet_set_operation,
4845 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_operation")
4846 : },
4847 : {
4848 : .name = discard_const_p(char, "qdcount"),
4849 : .get = py_dns_name_packet_get_qdcount,
4850 : .set = py_dns_name_packet_set_qdcount,
4851 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4852 : },
4853 : {
4854 : .name = discard_const_p(char, "ancount"),
4855 : .get = py_dns_name_packet_get_ancount,
4856 : .set = py_dns_name_packet_set_ancount,
4857 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4858 : },
4859 : {
4860 : .name = discard_const_p(char, "nscount"),
4861 : .get = py_dns_name_packet_get_nscount,
4862 : .set = py_dns_name_packet_set_nscount,
4863 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4864 : },
4865 : {
4866 : .name = discard_const_p(char, "arcount"),
4867 : .get = py_dns_name_packet_get_arcount,
4868 : .set = py_dns_name_packet_set_arcount,
4869 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4870 : },
4871 : {
4872 : .name = discard_const_p(char, "questions"),
4873 : .get = py_dns_name_packet_get_questions,
4874 : .set = py_dns_name_packet_set_questions,
4875 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_name_question")
4876 : },
4877 : {
4878 : .name = discard_const_p(char, "answers"),
4879 : .get = py_dns_name_packet_get_answers,
4880 : .set = py_dns_name_packet_set_answers,
4881 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_res_rec")
4882 : },
4883 : {
4884 : .name = discard_const_p(char, "nsrecs"),
4885 : .get = py_dns_name_packet_get_nsrecs,
4886 : .set = py_dns_name_packet_set_nsrecs,
4887 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_res_rec")
4888 : },
4889 : {
4890 : .name = discard_const_p(char, "additional"),
4891 : .get = py_dns_name_packet_get_additional,
4892 : .set = py_dns_name_packet_set_additional,
4893 : .doc = discard_const_p(char, "PIDL-generated element of base type dns_res_rec")
4894 : },
4895 : { .name = NULL }
4896 : };
4897 :
4898 61891 : static PyObject *py_dns_name_packet_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4899 : {
4900 61891 : return pytalloc_new(struct dns_name_packet, type);
4901 : }
4902 :
4903 60441 : static PyObject *py_dns_name_packet_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4904 : {
4905 60441 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4906 60441 : PyObject *ret = NULL;
4907 : DATA_BLOB blob;
4908 : enum ndr_err_code err;
4909 60441 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4910 60441 : if (tmp_ctx == NULL) {
4911 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4912 0 : return NULL;
4913 : }
4914 60441 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dns_name_packet);
4915 60441 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4916 0 : TALLOC_FREE(tmp_ctx);
4917 0 : PyErr_SetNdrError(err);
4918 0 : return NULL;
4919 : }
4920 :
4921 60441 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4922 60441 : TALLOC_FREE(tmp_ctx);
4923 60441 : return ret;
4924 : }
4925 :
4926 60400 : static PyObject *py_dns_name_packet_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4927 : {
4928 60400 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4929 60400 : DATA_BLOB blob = {.data = NULL, .length = 0};
4930 60400 : Py_ssize_t blob_length = 0;
4931 : enum ndr_err_code err;
4932 60400 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4933 60400 : PyObject *allow_remaining_obj = NULL;
4934 60400 : bool allow_remaining = false;
4935 :
4936 60400 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4937 : discard_const_p(char *, kwnames),
4938 : &blob.data, &blob_length,
4939 : &allow_remaining_obj)) {
4940 0 : return NULL;
4941 : }
4942 60400 : blob.length = blob_length;
4943 :
4944 60400 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4945 0 : allow_remaining = true;
4946 : }
4947 :
4948 60400 : if (allow_remaining) {
4949 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_name_packet);
4950 : } else {
4951 60400 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dns_name_packet);
4952 : }
4953 60400 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4954 0 : PyErr_SetNdrError(err);
4955 0 : return NULL;
4956 : }
4957 :
4958 60400 : Py_RETURN_NONE;
4959 : }
4960 :
4961 0 : static PyObject *py_dns_name_packet_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4962 : {
4963 0 : struct dns_name_packet *object = (struct dns_name_packet *)pytalloc_get_ptr(py_obj);
4964 : PyObject *ret;
4965 : char *retstr;
4966 :
4967 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dns_name_packet, "dns_name_packet", object);
4968 0 : ret = PyUnicode_FromString(retstr);
4969 0 : talloc_free(retstr);
4970 :
4971 0 : return ret;
4972 : }
4973 :
4974 : static PyMethodDef py_dns_name_packet_methods[] = {
4975 : { "__ndr_pack__", (PyCFunction)py_dns_name_packet_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4976 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dns_name_packet_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4977 : { "__ndr_print__", (PyCFunction)py_dns_name_packet_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4978 : { NULL, NULL, 0, NULL }
4979 : };
4980 :
4981 :
4982 : static PyTypeObject dns_name_packet_Type = {
4983 : PyVarObject_HEAD_INIT(NULL, 0)
4984 : .tp_name = "dns.name_packet",
4985 : .tp_getset = py_dns_name_packet_getsetters,
4986 : .tp_methods = py_dns_name_packet_methods,
4987 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4988 : .tp_new = py_dns_name_packet_new,
4989 : };
4990 :
4991 :
4992 : const struct PyNdrRpcMethodDef py_ndr_dns_methods[] = {
4993 : {0}
4994 : };
4995 :
4996 0 : static PyObject *interface_dns_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4997 : {
4998 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_dns);
4999 : }
5000 :
5001 : #define PY_DOC_DNS "DNS records"
5002 : static PyTypeObject dns_InterfaceType = {
5003 : PyVarObject_HEAD_INIT(NULL, 0)
5004 : .tp_name = "dns.dns",
5005 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
5006 : .tp_doc = "dns(binding, lp_ctx=None, credentials=None) -> connection\n"
5007 : "\n"
5008 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
5009 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
5010 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_DNS,
5011 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5012 : .tp_new = interface_dns_new,
5013 : };
5014 :
5015 0 : static PyObject *syntax_dns_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5016 : {
5017 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_dns.syntax_id);
5018 : }
5019 :
5020 : #define PY_DOC_DNS_SYNTAX "DNS records"
5021 : static PyTypeObject dns_SyntaxType = {
5022 : PyVarObject_HEAD_INIT(NULL, 0)
5023 : .tp_name = "dns.dns_abstract_syntax",
5024 : .tp_doc = "dns_abstract_syntax()\n"PY_DOC_DNS_SYNTAX,
5025 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5026 : .tp_new = syntax_dns_new,
5027 : };
5028 :
5029 : static PyMethodDef dns_methods[] = {
5030 : { NULL, NULL, 0, NULL }
5031 : };
5032 :
5033 : static struct PyModuleDef moduledef = {
5034 : PyModuleDef_HEAD_INIT,
5035 : .m_name = "dns",
5036 : .m_doc = "dns DCE/RPC",
5037 : .m_size = -1,
5038 : .m_methods = dns_methods,
5039 : };
5040 29 : MODULE_INIT_FUNC(dns)
5041 : {
5042 29 : PyObject *m = NULL;
5043 29 : PyObject *dep_samba_dcerpc_misc = NULL;
5044 29 : PyObject *dep_samba_dcerpc_dnsp = NULL;
5045 29 : PyObject *dep_talloc = NULL;
5046 29 : PyObject *dep_samba_dcerpc_base = NULL;
5047 :
5048 29 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
5049 29 : if (dep_samba_dcerpc_misc == NULL)
5050 0 : goto out;
5051 :
5052 29 : dep_samba_dcerpc_dnsp = PyImport_ImportModule("samba.dcerpc.dnsp");
5053 29 : if (dep_samba_dcerpc_dnsp == NULL)
5054 0 : goto out;
5055 :
5056 29 : dep_talloc = PyImport_ImportModule("talloc");
5057 29 : if (dep_talloc == NULL)
5058 0 : goto out;
5059 :
5060 29 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
5061 29 : if (dep_samba_dcerpc_base == NULL)
5062 0 : goto out;
5063 :
5064 29 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
5065 29 : if (BaseObject_Type == NULL)
5066 0 : goto out;
5067 :
5068 29 : dnsp_string_list_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_dnsp, "string_list");
5069 29 : if (dnsp_string_list_Type == NULL)
5070 0 : goto out;
5071 :
5072 29 : dnsp_hinfo_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_dnsp, "hinfo");
5073 29 : if (dnsp_hinfo_Type == NULL)
5074 0 : goto out;
5075 :
5076 29 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
5077 29 : if (ClientConnection_Type == NULL)
5078 0 : goto out;
5079 :
5080 29 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
5081 29 : if (ndr_syntax_id_Type == NULL)
5082 0 : goto out;
5083 :
5084 29 : dns_name_question_Type.tp_base = BaseObject_Type;
5085 29 : dns_name_question_Type.tp_basicsize = pytalloc_BaseObject_size();
5086 :
5087 29 : dns_rdata_data_Type.tp_base = BaseObject_Type;
5088 29 : dns_rdata_data_Type.tp_basicsize = pytalloc_BaseObject_size();
5089 :
5090 29 : dns_soa_record_Type.tp_base = BaseObject_Type;
5091 29 : dns_soa_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5092 :
5093 29 : dns_mx_record_Type.tp_base = BaseObject_Type;
5094 29 : dns_mx_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5095 :
5096 29 : dns_txt_record_Type.tp_base = BaseObject_Type;
5097 29 : dns_txt_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5098 :
5099 29 : dns_rp_record_Type.tp_base = BaseObject_Type;
5100 29 : dns_rp_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5101 :
5102 29 : dns_srv_record_Type.tp_base = BaseObject_Type;
5103 29 : dns_srv_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5104 :
5105 29 : dns_opt_record_Type.tp_base = BaseObject_Type;
5106 29 : dns_opt_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5107 :
5108 29 : dns_tkey_record_Type.tp_base = BaseObject_Type;
5109 29 : dns_tkey_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5110 :
5111 29 : dns_tsig_record_Type.tp_base = BaseObject_Type;
5112 29 : dns_tsig_record_Type.tp_basicsize = pytalloc_BaseObject_size();
5113 :
5114 29 : dns_fake_tsig_rec_Type.tp_base = BaseObject_Type;
5115 29 : dns_fake_tsig_rec_Type.tp_basicsize = pytalloc_BaseObject_size();
5116 :
5117 29 : dns_rdata_Type.tp_base = BaseObject_Type;
5118 29 : dns_rdata_Type.tp_basicsize = pytalloc_BaseObject_size();
5119 :
5120 29 : dns_res_rec_Type.tp_base = BaseObject_Type;
5121 29 : dns_res_rec_Type.tp_basicsize = pytalloc_BaseObject_size();
5122 :
5123 29 : dns_name_packet_Type.tp_base = BaseObject_Type;
5124 29 : dns_name_packet_Type.tp_basicsize = pytalloc_BaseObject_size();
5125 :
5126 29 : dns_InterfaceType.tp_base = ClientConnection_Type;
5127 :
5128 29 : dns_SyntaxType.tp_base = ndr_syntax_id_Type;
5129 29 : dns_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
5130 :
5131 29 : if (PyType_Ready(&dns_name_question_Type) < 0)
5132 0 : goto out;
5133 29 : if (PyType_Ready(&dns_rdata_data_Type) < 0)
5134 0 : goto out;
5135 29 : if (PyType_Ready(&dns_soa_record_Type) < 0)
5136 0 : goto out;
5137 29 : if (PyType_Ready(&dns_mx_record_Type) < 0)
5138 0 : goto out;
5139 29 : if (PyType_Ready(&dns_txt_record_Type) < 0)
5140 0 : goto out;
5141 29 : if (PyType_Ready(&dns_rp_record_Type) < 0)
5142 0 : goto out;
5143 29 : if (PyType_Ready(&dns_srv_record_Type) < 0)
5144 0 : goto out;
5145 29 : if (PyType_Ready(&dns_opt_record_Type) < 0)
5146 0 : goto out;
5147 29 : if (PyType_Ready(&dns_tkey_record_Type) < 0)
5148 0 : goto out;
5149 29 : if (PyType_Ready(&dns_tsig_record_Type) < 0)
5150 0 : goto out;
5151 29 : if (PyType_Ready(&dns_fake_tsig_rec_Type) < 0)
5152 0 : goto out;
5153 29 : if (PyType_Ready(&dns_rdata_Type) < 0)
5154 0 : goto out;
5155 29 : if (PyType_Ready(&dns_res_rec_Type) < 0)
5156 0 : goto out;
5157 29 : if (PyType_Ready(&dns_name_packet_Type) < 0)
5158 0 : goto out;
5159 29 : if (PyType_Ready(&dns_InterfaceType) < 0)
5160 0 : goto out;
5161 29 : if (PyType_Ready(&dns_SyntaxType) < 0)
5162 0 : goto out;
5163 29 : if (!PyInterface_AddNdrRpcMethods(&dns_InterfaceType, py_ndr_dns_methods))
5164 0 : return NULL;
5165 :
5166 : #ifdef PY_NAME_QUESTION_PATCH
5167 : PY_NAME_QUESTION_PATCH(&dns_name_question_Type);
5168 : #endif
5169 : #ifdef PY_RDATA_DATA_PATCH
5170 : PY_RDATA_DATA_PATCH(&dns_rdata_data_Type);
5171 : #endif
5172 : #ifdef PY_SOA_RECORD_PATCH
5173 : PY_SOA_RECORD_PATCH(&dns_soa_record_Type);
5174 : #endif
5175 : #ifdef PY_MX_RECORD_PATCH
5176 : PY_MX_RECORD_PATCH(&dns_mx_record_Type);
5177 : #endif
5178 : #ifdef PY_TXT_RECORD_PATCH
5179 : PY_TXT_RECORD_PATCH(&dns_txt_record_Type);
5180 : #endif
5181 : #ifdef PY_RP_RECORD_PATCH
5182 : PY_RP_RECORD_PATCH(&dns_rp_record_Type);
5183 : #endif
5184 : #ifdef PY_SRV_RECORD_PATCH
5185 : PY_SRV_RECORD_PATCH(&dns_srv_record_Type);
5186 : #endif
5187 : #ifdef PY_OPT_RECORD_PATCH
5188 : PY_OPT_RECORD_PATCH(&dns_opt_record_Type);
5189 : #endif
5190 : #ifdef PY_TKEY_RECORD_PATCH
5191 : PY_TKEY_RECORD_PATCH(&dns_tkey_record_Type);
5192 : #endif
5193 : #ifdef PY_TSIG_RECORD_PATCH
5194 : PY_TSIG_RECORD_PATCH(&dns_tsig_record_Type);
5195 : #endif
5196 : #ifdef PY_FAKE_TSIG_REC_PATCH
5197 : PY_FAKE_TSIG_REC_PATCH(&dns_fake_tsig_rec_Type);
5198 : #endif
5199 : #ifdef PY_RDATA_PATCH
5200 : PY_RDATA_PATCH(&dns_rdata_Type);
5201 : #endif
5202 : #ifdef PY_RES_REC_PATCH
5203 : PY_RES_REC_PATCH(&dns_res_rec_Type);
5204 : #endif
5205 : #ifdef PY_NAME_PACKET_PATCH
5206 : PY_NAME_PACKET_PATCH(&dns_name_packet_Type);
5207 : #endif
5208 : #ifdef PY_DNS_PATCH
5209 : PY_DNS_PATCH(&dns_InterfaceType);
5210 : #endif
5211 : #ifdef PY_DNS_ABSTRACT_SYNTAX_PATCH
5212 : PY_DNS_ABSTRACT_SYNTAX_PATCH(&dns_SyntaxType);
5213 : #endif
5214 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
5215 : PY_ABSTRACT_SYNTAX_PATCH(&dns_SyntaxType);
5216 : #endif
5217 :
5218 29 : m = PyModule_Create(&moduledef);
5219 29 : if (m == NULL)
5220 0 : goto out;
5221 :
5222 29 : PyModule_AddObject(m, "DNS_SERVICE_PORT", PyLong_FromUnsignedLongLong(53));
5223 29 : PyModule_AddObject(m, "DNS_MAX_LABELS", PyLong_FromUnsignedLongLong(127));
5224 29 : PyModule_AddObject(m, "DNS_MAX_DOMAIN_LENGTH", PyLong_FromUnsignedLongLong(253));
5225 29 : PyModule_AddObject(m, "DNS_MAX_LABEL_LENGTH", PyLong_FromUnsignedLongLong(63));
5226 29 : PyModule_AddObject(m, "DNS_RCODE", PyLong_FromLong((uint16_t)DNS_RCODE));
5227 29 : PyModule_AddObject(m, "DNS_FLAG_RECURSION_AVAIL", PyLong_FromLong((uint16_t)DNS_FLAG_RECURSION_AVAIL));
5228 29 : PyModule_AddObject(m, "DNS_FLAG_RECURSION_DESIRED", PyLong_FromLong((uint16_t)DNS_FLAG_RECURSION_DESIRED));
5229 29 : PyModule_AddObject(m, "DNS_FLAG_TRUNCATION", PyLong_FromLong((uint16_t)DNS_FLAG_TRUNCATION));
5230 29 : PyModule_AddObject(m, "DNS_FLAG_AUTHORITATIVE", PyLong_FromLong((uint16_t)DNS_FLAG_AUTHORITATIVE));
5231 29 : PyModule_AddObject(m, "DNS_OPCODE", PyLong_FromLong((uint16_t)DNS_OPCODE));
5232 29 : PyModule_AddObject(m, "DNS_FLAG_REPLY", PyLong_FromLong((uint16_t)DNS_FLAG_REPLY));
5233 29 : PyModule_AddObject(m, "DNS_OPCODE_QUERY", PyLong_FromLong((uint16_t)DNS_OPCODE_QUERY));
5234 29 : PyModule_AddObject(m, "DNS_OPCODE_IQUERY", PyLong_FromLong((uint16_t)DNS_OPCODE_IQUERY));
5235 29 : PyModule_AddObject(m, "DNS_OPCODE_STATUS", PyLong_FromLong((uint16_t)DNS_OPCODE_STATUS));
5236 29 : PyModule_AddObject(m, "DNS_OPCODE_UPDATE", PyLong_FromLong((uint16_t)DNS_OPCODE_UPDATE));
5237 29 : PyModule_AddObject(m, "DNS_OPCODE_RELEASE", PyLong_FromLong((uint16_t)DNS_OPCODE_RELEASE));
5238 29 : PyModule_AddObject(m, "DNS_OPCODE_WACK", PyLong_FromLong((uint16_t)DNS_OPCODE_WACK));
5239 29 : PyModule_AddObject(m, "DNS_OPCODE_REFRESH", PyLong_FromLong((uint16_t)DNS_OPCODE_REFRESH));
5240 29 : PyModule_AddObject(m, "DNS_OPCODE_REFRESH2", PyLong_FromLong((uint16_t)DNS_OPCODE_REFRESH2));
5241 29 : PyModule_AddObject(m, "DNS_OPCODE_MULTI_HOME_REG", PyLong_FromLong((uint16_t)DNS_OPCODE_MULTI_HOME_REG));
5242 29 : PyModule_AddObject(m, "DNS_RCODE_OK", PyLong_FromLong((uint16_t)DNS_RCODE_OK));
5243 29 : PyModule_AddObject(m, "DNS_RCODE_FORMERR", PyLong_FromLong((uint16_t)DNS_RCODE_FORMERR));
5244 29 : PyModule_AddObject(m, "DNS_RCODE_SERVFAIL", PyLong_FromLong((uint16_t)DNS_RCODE_SERVFAIL));
5245 29 : PyModule_AddObject(m, "DNS_RCODE_NXDOMAIN", PyLong_FromLong((uint16_t)DNS_RCODE_NXDOMAIN));
5246 29 : PyModule_AddObject(m, "DNS_RCODE_NOTIMP", PyLong_FromLong((uint16_t)DNS_RCODE_NOTIMP));
5247 29 : PyModule_AddObject(m, "DNS_RCODE_REFUSED", PyLong_FromLong((uint16_t)DNS_RCODE_REFUSED));
5248 29 : PyModule_AddObject(m, "DNS_RCODE_YXDOMAIN", PyLong_FromLong((uint16_t)DNS_RCODE_YXDOMAIN));
5249 29 : PyModule_AddObject(m, "DNS_RCODE_YXRRSET", PyLong_FromLong((uint16_t)DNS_RCODE_YXRRSET));
5250 29 : PyModule_AddObject(m, "DNS_RCODE_NXRRSET", PyLong_FromLong((uint16_t)DNS_RCODE_NXRRSET));
5251 29 : PyModule_AddObject(m, "DNS_RCODE_NOTAUTH", PyLong_FromLong((uint16_t)DNS_RCODE_NOTAUTH));
5252 29 : PyModule_AddObject(m, "DNS_RCODE_NOTZONE", PyLong_FromLong((uint16_t)DNS_RCODE_NOTZONE));
5253 29 : PyModule_AddObject(m, "DNS_RCODE_BADSIG", PyLong_FromLong((uint16_t)DNS_RCODE_BADSIG));
5254 29 : PyModule_AddObject(m, "DNS_RCODE_BADKEY", PyLong_FromLong((uint16_t)DNS_RCODE_BADKEY));
5255 29 : PyModule_AddObject(m, "DNS_RCODE_BADTIME", PyLong_FromLong((uint16_t)DNS_RCODE_BADTIME));
5256 29 : PyModule_AddObject(m, "DNS_RCODE_BADMODE", PyLong_FromLong((uint16_t)DNS_RCODE_BADMODE));
5257 29 : PyModule_AddObject(m, "DNS_RCODE_BADNAME", PyLong_FromLong((uint16_t)DNS_RCODE_BADNAME));
5258 29 : PyModule_AddObject(m, "DNS_RCODE_BADALG", PyLong_FromLong((uint16_t)DNS_RCODE_BADALG));
5259 29 : PyModule_AddObject(m, "DNS_QCLASS_IN", PyLong_FromLong((uint16_t)DNS_QCLASS_IN));
5260 29 : PyModule_AddObject(m, "DNS_QCLASS_NONE", PyLong_FromLong((uint16_t)DNS_QCLASS_NONE));
5261 29 : PyModule_AddObject(m, "DNS_QCLASS_ANY", PyLong_FromLong((uint16_t)DNS_QCLASS_ANY));
5262 29 : PyModule_AddObject(m, "DNS_QTYPE_ZERO", PyLong_FromLong((uint16_t)DNS_QTYPE_ZERO));
5263 29 : PyModule_AddObject(m, "DNS_QTYPE_A", PyLong_FromLong((uint16_t)DNS_QTYPE_A));
5264 29 : PyModule_AddObject(m, "DNS_QTYPE_NS", PyLong_FromLong((uint16_t)DNS_QTYPE_NS));
5265 29 : PyModule_AddObject(m, "DNS_QTYPE_MD", PyLong_FromLong((uint16_t)DNS_QTYPE_MD));
5266 29 : PyModule_AddObject(m, "DNS_QTYPE_MF", PyLong_FromLong((uint16_t)DNS_QTYPE_MF));
5267 29 : PyModule_AddObject(m, "DNS_QTYPE_CNAME", PyLong_FromLong((uint16_t)DNS_QTYPE_CNAME));
5268 29 : PyModule_AddObject(m, "DNS_QTYPE_SOA", PyLong_FromLong((uint16_t)DNS_QTYPE_SOA));
5269 29 : PyModule_AddObject(m, "DNS_QTYPE_MB", PyLong_FromLong((uint16_t)DNS_QTYPE_MB));
5270 29 : PyModule_AddObject(m, "DNS_QTYPE_MG", PyLong_FromLong((uint16_t)DNS_QTYPE_MG));
5271 29 : PyModule_AddObject(m, "DNS_QTYPE_MR", PyLong_FromLong((uint16_t)DNS_QTYPE_MR));
5272 29 : PyModule_AddObject(m, "DNS_QTYPE_NULL", PyLong_FromLong((uint16_t)DNS_QTYPE_NULL));
5273 29 : PyModule_AddObject(m, "DNS_QTYPE_WKS", PyLong_FromLong((uint16_t)DNS_QTYPE_WKS));
5274 29 : PyModule_AddObject(m, "DNS_QTYPE_PTR", PyLong_FromLong((uint16_t)DNS_QTYPE_PTR));
5275 29 : PyModule_AddObject(m, "DNS_QTYPE_HINFO", PyLong_FromLong((uint16_t)DNS_QTYPE_HINFO));
5276 29 : PyModule_AddObject(m, "DNS_QTYPE_MINFO", PyLong_FromLong((uint16_t)DNS_QTYPE_MINFO));
5277 29 : PyModule_AddObject(m, "DNS_QTYPE_MX", PyLong_FromLong((uint16_t)DNS_QTYPE_MX));
5278 29 : PyModule_AddObject(m, "DNS_QTYPE_TXT", PyLong_FromLong((uint16_t)DNS_QTYPE_TXT));
5279 29 : PyModule_AddObject(m, "DNS_QTYPE_RP", PyLong_FromLong((uint16_t)DNS_QTYPE_RP));
5280 29 : PyModule_AddObject(m, "DNS_QTYPE_AFSDB", PyLong_FromLong((uint16_t)DNS_QTYPE_AFSDB));
5281 29 : PyModule_AddObject(m, "DNS_QTYPE_X25", PyLong_FromLong((uint16_t)DNS_QTYPE_X25));
5282 29 : PyModule_AddObject(m, "DNS_QTYPE_ISDN", PyLong_FromLong((uint16_t)DNS_QTYPE_ISDN));
5283 29 : PyModule_AddObject(m, "DNS_QTYPE_RT", PyLong_FromLong((uint16_t)DNS_QTYPE_RT));
5284 29 : PyModule_AddObject(m, "DNS_QTYPE_SIG", PyLong_FromLong((uint16_t)DNS_QTYPE_SIG));
5285 29 : PyModule_AddObject(m, "DNS_QTYPE_KEY", PyLong_FromLong((uint16_t)DNS_QTYPE_KEY));
5286 29 : PyModule_AddObject(m, "DNS_QTYPE_AAAA", PyLong_FromLong((uint16_t)DNS_QTYPE_AAAA));
5287 29 : PyModule_AddObject(m, "DNS_QTYPE_LOC", PyLong_FromLong((uint16_t)DNS_QTYPE_LOC));
5288 29 : PyModule_AddObject(m, "DNS_QTYPE_NXT", PyLong_FromLong((uint16_t)DNS_QTYPE_NXT));
5289 29 : PyModule_AddObject(m, "DNS_QTYPE_NETBIOS", PyLong_FromLong((uint16_t)DNS_QTYPE_NETBIOS));
5290 29 : PyModule_AddObject(m, "DNS_QTYPE_SRV", PyLong_FromLong((uint16_t)DNS_QTYPE_SRV));
5291 29 : PyModule_AddObject(m, "DNS_QTYPE_ATMA", PyLong_FromLong((uint16_t)DNS_QTYPE_ATMA));
5292 29 : PyModule_AddObject(m, "DNS_QTYPE_NAPTR", PyLong_FromLong((uint16_t)DNS_QTYPE_NAPTR));
5293 29 : PyModule_AddObject(m, "DNS_QTYPE_CERT", PyLong_FromLong((uint16_t)DNS_QTYPE_CERT));
5294 29 : PyModule_AddObject(m, "DNS_QTYPE_DNAME", PyLong_FromLong((uint16_t)DNS_QTYPE_DNAME));
5295 29 : PyModule_AddObject(m, "DNS_QTYPE_OPT", PyLong_FromLong((uint16_t)DNS_QTYPE_OPT));
5296 29 : PyModule_AddObject(m, "DNS_QTYPE_DS", PyLong_FromLong((uint16_t)DNS_QTYPE_DS));
5297 29 : PyModule_AddObject(m, "DNS_QTYPE_SSHFP", PyLong_FromLong((uint16_t)DNS_QTYPE_SSHFP));
5298 29 : PyModule_AddObject(m, "DNS_QTYPE_IPSECKEY", PyLong_FromLong((uint16_t)DNS_QTYPE_IPSECKEY));
5299 29 : PyModule_AddObject(m, "DNS_QTYPE_RRSIG", PyLong_FromLong((uint16_t)DNS_QTYPE_RRSIG));
5300 29 : PyModule_AddObject(m, "DNS_QTYPE_NSEC", PyLong_FromLong((uint16_t)DNS_QTYPE_NSEC));
5301 29 : PyModule_AddObject(m, "DNS_QTYPE_DNSKEY", PyLong_FromLong((uint16_t)DNS_QTYPE_DNSKEY));
5302 29 : PyModule_AddObject(m, "DNS_QTYPE_DHCID", PyLong_FromLong((uint16_t)DNS_QTYPE_DHCID));
5303 29 : PyModule_AddObject(m, "DNS_QTYPE_NSEC3", PyLong_FromLong((uint16_t)DNS_QTYPE_NSEC3));
5304 29 : PyModule_AddObject(m, "DNS_QTYPE_NSEC3PARAM", PyLong_FromLong((uint16_t)DNS_QTYPE_NSEC3PARAM));
5305 29 : PyModule_AddObject(m, "DNS_QTYPE_TLSA", PyLong_FromLong((uint16_t)DNS_QTYPE_TLSA));
5306 29 : PyModule_AddObject(m, "DNS_QTYPE_CDS", PyLong_FromLong((uint16_t)DNS_QTYPE_CDS));
5307 29 : PyModule_AddObject(m, "DNS_QTYPE_CDNSKEY", PyLong_FromLong((uint16_t)DNS_QTYPE_CDNSKEY));
5308 29 : PyModule_AddObject(m, "DNS_QTYPE_SVCB", PyLong_FromLong((uint16_t)DNS_QTYPE_SVCB));
5309 29 : PyModule_AddObject(m, "DNS_QTYPE_HTTPS", PyLong_FromLong((uint16_t)DNS_QTYPE_HTTPS));
5310 29 : PyModule_AddObject(m, "DNS_QTYPE_TKEY", PyLong_FromLong((uint16_t)DNS_QTYPE_TKEY));
5311 29 : PyModule_AddObject(m, "DNS_QTYPE_TSIG", PyLong_FromLong((uint16_t)DNS_QTYPE_TSIG));
5312 29 : PyModule_AddObject(m, "DNS_QTYPE_IXFR", PyLong_FromLong((uint16_t)DNS_QTYPE_IXFR));
5313 29 : PyModule_AddObject(m, "DNS_QTYPE_AXFR", PyLong_FromLong((uint16_t)DNS_QTYPE_AXFR));
5314 29 : PyModule_AddObject(m, "DNS_QTYPE_MAILB", PyLong_FromLong((uint16_t)DNS_QTYPE_MAILB));
5315 29 : PyModule_AddObject(m, "DNS_QTYPE_MAILA", PyLong_FromLong((uint16_t)DNS_QTYPE_MAILA));
5316 29 : PyModule_AddObject(m, "DNS_QTYPE_ALL", PyLong_FromLong((uint16_t)DNS_QTYPE_ALL));
5317 29 : PyModule_AddObject(m, "DNS_QTYPE_URI", PyLong_FromLong((uint16_t)DNS_QTYPE_URI));
5318 29 : PyModule_AddObject(m, "DNS_QTYPE_CAA", PyLong_FromLong((uint16_t)DNS_QTYPE_CAA));
5319 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_NULL", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_NULL));
5320 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_SERVER", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_SERVER));
5321 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_DH", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_DH));
5322 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_GSSAPI", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_GSSAPI));
5323 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_CLIENT", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_CLIENT));
5324 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_DELETE", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_DELETE));
5325 29 : PyModule_AddObject(m, "DNS_TKEY_MODE_LAST", PyLong_FromLong((uint16_t)DNS_TKEY_MODE_LAST));
5326 29 : Py_INCREF((PyObject *)(void *)&dns_name_question_Type);
5327 29 : PyModule_AddObject(m, "name_question", (PyObject *)(void *)&dns_name_question_Type);
5328 29 : Py_INCREF((PyObject *)(void *)&dns_rdata_data_Type);
5329 29 : PyModule_AddObject(m, "rdata_data", (PyObject *)(void *)&dns_rdata_data_Type);
5330 29 : Py_INCREF((PyObject *)(void *)&dns_soa_record_Type);
5331 29 : PyModule_AddObject(m, "soa_record", (PyObject *)(void *)&dns_soa_record_Type);
5332 29 : Py_INCREF((PyObject *)(void *)&dns_mx_record_Type);
5333 29 : PyModule_AddObject(m, "mx_record", (PyObject *)(void *)&dns_mx_record_Type);
5334 29 : Py_INCREF((PyObject *)(void *)&dns_txt_record_Type);
5335 29 : PyModule_AddObject(m, "txt_record", (PyObject *)(void *)&dns_txt_record_Type);
5336 29 : Py_INCREF((PyObject *)(void *)&dns_rp_record_Type);
5337 29 : PyModule_AddObject(m, "rp_record", (PyObject *)(void *)&dns_rp_record_Type);
5338 29 : Py_INCREF((PyObject *)(void *)&dns_srv_record_Type);
5339 29 : PyModule_AddObject(m, "srv_record", (PyObject *)(void *)&dns_srv_record_Type);
5340 29 : Py_INCREF((PyObject *)(void *)&dns_opt_record_Type);
5341 29 : PyModule_AddObject(m, "opt_record", (PyObject *)(void *)&dns_opt_record_Type);
5342 29 : Py_INCREF((PyObject *)(void *)&dns_tkey_record_Type);
5343 29 : PyModule_AddObject(m, "tkey_record", (PyObject *)(void *)&dns_tkey_record_Type);
5344 29 : Py_INCREF((PyObject *)(void *)&dns_tsig_record_Type);
5345 29 : PyModule_AddObject(m, "tsig_record", (PyObject *)(void *)&dns_tsig_record_Type);
5346 29 : Py_INCREF((PyObject *)(void *)&dns_fake_tsig_rec_Type);
5347 29 : PyModule_AddObject(m, "fake_tsig_rec", (PyObject *)(void *)&dns_fake_tsig_rec_Type);
5348 29 : Py_INCREF((PyObject *)(void *)&dns_rdata_Type);
5349 29 : PyModule_AddObject(m, "rdata", (PyObject *)(void *)&dns_rdata_Type);
5350 29 : Py_INCREF((PyObject *)(void *)&dns_res_rec_Type);
5351 29 : PyModule_AddObject(m, "res_rec", (PyObject *)(void *)&dns_res_rec_Type);
5352 29 : Py_INCREF((PyObject *)(void *)&dns_name_packet_Type);
5353 29 : PyModule_AddObject(m, "name_packet", (PyObject *)(void *)&dns_name_packet_Type);
5354 29 : Py_INCREF((PyObject *)(void *)&dns_InterfaceType);
5355 29 : PyModule_AddObject(m, "dns", (PyObject *)(void *)&dns_InterfaceType);
5356 29 : Py_INCREF((PyObject *)(void *)&dns_SyntaxType);
5357 29 : PyModule_AddObject(m, "dns_abstract_syntax", (PyObject *)(void *)&dns_SyntaxType);
5358 29 : Py_INCREF((PyObject *)(void *)&dns_SyntaxType);
5359 29 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&dns_SyntaxType);
5360 : #ifdef PY_MOD_DNS_PATCH
5361 : PY_MOD_DNS_PATCH(m);
5362 : #endif
5363 29 : out:
5364 29 : Py_XDECREF(dep_samba_dcerpc_misc);
5365 29 : Py_XDECREF(dep_samba_dcerpc_dnsp);
5366 29 : Py_XDECREF(dep_talloc);
5367 29 : Py_XDECREF(dep_samba_dcerpc_base);
5368 29 : return m;
5369 :
5370 : }
|