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