1 |
|
---|
2 | /* Python wrapper functions auto-generated by pidl */
|
---|
3 | #include <Python.h>
|
---|
4 | #include "includes.h"
|
---|
5 | #include <pytalloc.h>
|
---|
6 | #include "librpc/rpc/pyrpc.h"
|
---|
7 | #include "librpc/rpc/pyrpc_util.h"
|
---|
8 | #include "librpc/gen_ndr/ndr_frsapi.h"
|
---|
9 | #include "librpc/gen_ndr/ndr_frsapi_c.h"
|
---|
10 |
|
---|
11 | #include "librpc/gen_ndr/misc.h"
|
---|
12 | staticforward PyTypeObject frsapi_Info_Type;
|
---|
13 | staticforward PyTypeObject frsapi_InterfaceType;
|
---|
14 |
|
---|
15 | void initfrsapi(void);static PyTypeObject *Object_Type;
|
---|
16 | static PyTypeObject *GUID_Type;
|
---|
17 | static PyTypeObject *ClientConnection_Type;
|
---|
18 |
|
---|
19 | static PyObject *py_frsapi_Info_get_length(PyObject *obj, void *closure)
|
---|
20 | {
|
---|
21 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
22 | PyObject *py_length;
|
---|
23 | py_length = PyInt_FromLong(object->length);
|
---|
24 | return py_length;
|
---|
25 | }
|
---|
26 |
|
---|
27 | static int py_frsapi_Info_set_length(PyObject *py_obj, PyObject *value, void *closure)
|
---|
28 | {
|
---|
29 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
30 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
31 | object->length = PyInt_AsLong(value);
|
---|
32 | return 0;
|
---|
33 | }
|
---|
34 |
|
---|
35 | static PyObject *py_frsapi_Info_get_guid(PyObject *obj, void *closure)
|
---|
36 | {
|
---|
37 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
38 | PyObject *py_guid;
|
---|
39 | py_guid = py_talloc_reference_ex(GUID_Type, py_talloc_get_mem_ctx(obj), &object->guid);
|
---|
40 | return py_guid;
|
---|
41 | }
|
---|
42 |
|
---|
43 | static int py_frsapi_Info_set_guid(PyObject *py_obj, PyObject *value, void *closure)
|
---|
44 | {
|
---|
45 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
46 | PY_CHECK_TYPE(GUID_Type, value, return -1;);
|
---|
47 | if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
|
---|
48 | PyErr_NoMemory();
|
---|
49 | return -1;
|
---|
50 | }
|
---|
51 | object->guid = *(struct GUID *)py_talloc_get_ptr(value);
|
---|
52 | return 0;
|
---|
53 | }
|
---|
54 |
|
---|
55 | static PyObject *py_frsapi_Info_get_length2(PyObject *obj, void *closure)
|
---|
56 | {
|
---|
57 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
58 | PyObject *py_length2;
|
---|
59 | py_length2 = PyInt_FromLong(object->length2);
|
---|
60 | return py_length2;
|
---|
61 | }
|
---|
62 |
|
---|
63 | static int py_frsapi_Info_set_length2(PyObject *py_obj, PyObject *value, void *closure)
|
---|
64 | {
|
---|
65 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
66 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
67 | object->length2 = PyInt_AsLong(value);
|
---|
68 | return 0;
|
---|
69 | }
|
---|
70 |
|
---|
71 | static PyObject *py_frsapi_Info_get_unknown1(PyObject *obj, void *closure)
|
---|
72 | {
|
---|
73 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
74 | PyObject *py_unknown1;
|
---|
75 | py_unknown1 = PyInt_FromLong(object->unknown1);
|
---|
76 | return py_unknown1;
|
---|
77 | }
|
---|
78 |
|
---|
79 | static int py_frsapi_Info_set_unknown1(PyObject *py_obj, PyObject *value, void *closure)
|
---|
80 | {
|
---|
81 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
82 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
83 | object->unknown1 = PyInt_AsLong(value);
|
---|
84 | return 0;
|
---|
85 | }
|
---|
86 |
|
---|
87 | static PyObject *py_frsapi_Info_get_level(PyObject *obj, void *closure)
|
---|
88 | {
|
---|
89 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
90 | PyObject *py_level;
|
---|
91 | py_level = PyInt_FromLong(object->level);
|
---|
92 | return py_level;
|
---|
93 | }
|
---|
94 |
|
---|
95 | static int py_frsapi_Info_set_level(PyObject *py_obj, PyObject *value, void *closure)
|
---|
96 | {
|
---|
97 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
98 | if (PyLong_Check(value)) {
|
---|
99 | object->level = PyLong_AsLongLong(value);
|
---|
100 | } else if (PyInt_Check(value)) {
|
---|
101 | object->level = PyInt_AsLong(value);
|
---|
102 | } else {
|
---|
103 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
---|
104 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
---|
105 | return -1;
|
---|
106 | }
|
---|
107 | return 0;
|
---|
108 | }
|
---|
109 |
|
---|
110 | static PyObject *py_frsapi_Info_get_query_counter(PyObject *obj, void *closure)
|
---|
111 | {
|
---|
112 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
113 | PyObject *py_query_counter;
|
---|
114 | py_query_counter = PyInt_FromLong(object->query_counter);
|
---|
115 | return py_query_counter;
|
---|
116 | }
|
---|
117 |
|
---|
118 | static int py_frsapi_Info_set_query_counter(PyObject *py_obj, PyObject *value, void *closure)
|
---|
119 | {
|
---|
120 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
121 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
122 | object->query_counter = PyInt_AsLong(value);
|
---|
123 | return 0;
|
---|
124 | }
|
---|
125 |
|
---|
126 | static PyObject *py_frsapi_Info_get_unknown2(PyObject *obj, void *closure)
|
---|
127 | {
|
---|
128 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
129 | PyObject *py_unknown2;
|
---|
130 | py_unknown2 = PyInt_FromLong(object->unknown2);
|
---|
131 | return py_unknown2;
|
---|
132 | }
|
---|
133 |
|
---|
134 | static int py_frsapi_Info_set_unknown2(PyObject *py_obj, PyObject *value, void *closure)
|
---|
135 | {
|
---|
136 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
137 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
138 | object->unknown2 = PyInt_AsLong(value);
|
---|
139 | return 0;
|
---|
140 | }
|
---|
141 |
|
---|
142 | static PyObject *py_frsapi_Info_get_offset(PyObject *obj, void *closure)
|
---|
143 | {
|
---|
144 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
145 | PyObject *py_offset;
|
---|
146 | py_offset = PyInt_FromLong(object->offset);
|
---|
147 | return py_offset;
|
---|
148 | }
|
---|
149 |
|
---|
150 | static int py_frsapi_Info_set_offset(PyObject *py_obj, PyObject *value, void *closure)
|
---|
151 | {
|
---|
152 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
153 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
154 | object->offset = PyInt_AsLong(value);
|
---|
155 | return 0;
|
---|
156 | }
|
---|
157 |
|
---|
158 | static PyObject *py_frsapi_Info_get_blob_len(PyObject *obj, void *closure)
|
---|
159 | {
|
---|
160 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
161 | PyObject *py_blob_len;
|
---|
162 | py_blob_len = PyInt_FromLong(object->blob_len);
|
---|
163 | return py_blob_len;
|
---|
164 | }
|
---|
165 |
|
---|
166 | static int py_frsapi_Info_set_blob_len(PyObject *py_obj, PyObject *value, void *closure)
|
---|
167 | {
|
---|
168 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
169 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
---|
170 | object->blob_len = PyInt_AsLong(value);
|
---|
171 | return 0;
|
---|
172 | }
|
---|
173 |
|
---|
174 | static PyObject *py_frsapi_Info_get_blob(PyObject *obj, void *closure)
|
---|
175 | {
|
---|
176 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(obj);
|
---|
177 | PyObject *py_blob;
|
---|
178 | py_blob = PyString_FromStringAndSize((char *)(object->blob).data, (object->blob).length);
|
---|
179 | return py_blob;
|
---|
180 | }
|
---|
181 |
|
---|
182 | static int py_frsapi_Info_set_blob(PyObject *py_obj, PyObject *value, void *closure)
|
---|
183 | {
|
---|
184 | struct frsapi_Info *object = (struct frsapi_Info *)py_talloc_get_ptr(py_obj);
|
---|
185 | object->blob = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
---|
186 | return 0;
|
---|
187 | }
|
---|
188 |
|
---|
189 | static PyGetSetDef py_frsapi_Info_getsetters[] = {
|
---|
190 | { discard_const_p(char, "length"), py_frsapi_Info_get_length, py_frsapi_Info_set_length },
|
---|
191 | { discard_const_p(char, "guid"), py_frsapi_Info_get_guid, py_frsapi_Info_set_guid },
|
---|
192 | { discard_const_p(char, "length2"), py_frsapi_Info_get_length2, py_frsapi_Info_set_length2 },
|
---|
193 | { discard_const_p(char, "unknown1"), py_frsapi_Info_get_unknown1, py_frsapi_Info_set_unknown1 },
|
---|
194 | { discard_const_p(char, "level"), py_frsapi_Info_get_level, py_frsapi_Info_set_level },
|
---|
195 | { discard_const_p(char, "query_counter"), py_frsapi_Info_get_query_counter, py_frsapi_Info_set_query_counter },
|
---|
196 | { discard_const_p(char, "unknown2"), py_frsapi_Info_get_unknown2, py_frsapi_Info_set_unknown2 },
|
---|
197 | { discard_const_p(char, "offset"), py_frsapi_Info_get_offset, py_frsapi_Info_set_offset },
|
---|
198 | { discard_const_p(char, "blob_len"), py_frsapi_Info_get_blob_len, py_frsapi_Info_set_blob_len },
|
---|
199 | { discard_const_p(char, "blob"), py_frsapi_Info_get_blob, py_frsapi_Info_set_blob },
|
---|
200 | { NULL }
|
---|
201 | };
|
---|
202 |
|
---|
203 | static PyObject *py_frsapi_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
---|
204 | {
|
---|
205 | return py_talloc_new(struct frsapi_Info, type);
|
---|
206 | }
|
---|
207 |
|
---|
208 |
|
---|
209 | static PyTypeObject frsapi_Info_Type = {
|
---|
210 | PyObject_HEAD_INIT(NULL) 0,
|
---|
211 | .tp_name = "frsapi.Info",
|
---|
212 | .tp_getset = py_frsapi_Info_getsetters,
|
---|
213 | .tp_methods = NULL,
|
---|
214 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
---|
215 | .tp_basicsize = sizeof(py_talloc_Object),
|
---|
216 | .tp_new = py_frsapi_Info_new,
|
---|
217 | };
|
---|
218 |
|
---|
219 |
|
---|
220 | static bool pack_py_frsapi_SetDsPollingIntervalW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_SetDsPollingIntervalW *r)
|
---|
221 | {
|
---|
222 | PyObject *py_CurrentInterval;
|
---|
223 | PyObject *py_DsPollingLongInterval;
|
---|
224 | PyObject *py_DsPollingShortInterval;
|
---|
225 | const char *kwnames[] = {
|
---|
226 | "CurrentInterval", "DsPollingLongInterval", "DsPollingShortInterval", NULL
|
---|
227 | };
|
---|
228 |
|
---|
229 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:frsapi_SetDsPollingIntervalW", discard_const_p(char *, kwnames), &py_CurrentInterval, &py_DsPollingLongInterval, &py_DsPollingShortInterval)) {
|
---|
230 | return false;
|
---|
231 | }
|
---|
232 |
|
---|
233 | PY_CHECK_TYPE(&PyInt_Type, py_CurrentInterval, return false;);
|
---|
234 | r->in.CurrentInterval = PyInt_AsLong(py_CurrentInterval);
|
---|
235 | PY_CHECK_TYPE(&PyInt_Type, py_DsPollingLongInterval, return false;);
|
---|
236 | r->in.DsPollingLongInterval = PyInt_AsLong(py_DsPollingLongInterval);
|
---|
237 | PY_CHECK_TYPE(&PyInt_Type, py_DsPollingShortInterval, return false;);
|
---|
238 | r->in.DsPollingShortInterval = PyInt_AsLong(py_DsPollingShortInterval);
|
---|
239 | return true;
|
---|
240 | }
|
---|
241 |
|
---|
242 | static PyObject *unpack_py_frsapi_SetDsPollingIntervalW_args_out(struct frsapi_SetDsPollingIntervalW *r)
|
---|
243 | {
|
---|
244 | PyObject *result;
|
---|
245 | result = Py_None;
|
---|
246 | Py_INCREF(result);
|
---|
247 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
248 | PyErr_SetWERROR(r->out.result);
|
---|
249 | return NULL;
|
---|
250 | }
|
---|
251 |
|
---|
252 | return result;
|
---|
253 | }
|
---|
254 |
|
---|
255 | static bool pack_py_frsapi_GetDsPollingIntervalW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_GetDsPollingIntervalW *r)
|
---|
256 | {
|
---|
257 | const char *kwnames[] = {
|
---|
258 | NULL
|
---|
259 | };
|
---|
260 |
|
---|
261 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":frsapi_GetDsPollingIntervalW", discard_const_p(char *, kwnames))) {
|
---|
262 | return false;
|
---|
263 | }
|
---|
264 |
|
---|
265 | return true;
|
---|
266 | }
|
---|
267 |
|
---|
268 | static PyObject *unpack_py_frsapi_GetDsPollingIntervalW_args_out(struct frsapi_GetDsPollingIntervalW *r)
|
---|
269 | {
|
---|
270 | PyObject *result;
|
---|
271 | PyObject *py_CurrentInterval;
|
---|
272 | PyObject *py_DsPollingLongInterval;
|
---|
273 | PyObject *py_DsPollingShortInterval;
|
---|
274 | result = PyTuple_New(3);
|
---|
275 | py_CurrentInterval = PyInt_FromLong(*r->out.CurrentInterval);
|
---|
276 | PyTuple_SetItem(result, 0, py_CurrentInterval);
|
---|
277 | py_DsPollingLongInterval = PyInt_FromLong(*r->out.DsPollingLongInterval);
|
---|
278 | PyTuple_SetItem(result, 1, py_DsPollingLongInterval);
|
---|
279 | py_DsPollingShortInterval = PyInt_FromLong(*r->out.DsPollingShortInterval);
|
---|
280 | PyTuple_SetItem(result, 2, py_DsPollingShortInterval);
|
---|
281 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
282 | PyErr_SetWERROR(r->out.result);
|
---|
283 | return NULL;
|
---|
284 | }
|
---|
285 |
|
---|
286 | return result;
|
---|
287 | }
|
---|
288 |
|
---|
289 | static bool pack_py_frsapi_InfoW_args_in(PyObject *args, PyObject *kwargs, struct frsapi_InfoW *r)
|
---|
290 | {
|
---|
291 | PyObject *py_length;
|
---|
292 | PyObject *py_info;
|
---|
293 | const char *kwnames[] = {
|
---|
294 | "length", "info", NULL
|
---|
295 | };
|
---|
296 |
|
---|
297 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:frsapi_InfoW", discard_const_p(char *, kwnames), &py_length, &py_info)) {
|
---|
298 | return false;
|
---|
299 | }
|
---|
300 |
|
---|
301 | PY_CHECK_TYPE(&PyInt_Type, py_length, return false;);
|
---|
302 | r->in.length = PyInt_AsLong(py_length);
|
---|
303 | if (py_info == Py_None) {
|
---|
304 | r->in.info = NULL;
|
---|
305 | } else {
|
---|
306 | r->in.info = NULL;
|
---|
307 | PY_CHECK_TYPE(&frsapi_Info_Type, py_info, return false;);
|
---|
308 | if (talloc_reference(r, py_talloc_get_mem_ctx(py_info)) == NULL) {
|
---|
309 | PyErr_NoMemory();
|
---|
310 | return false;
|
---|
311 | }
|
---|
312 | r->in.info = (struct frsapi_Info *)py_talloc_get_ptr(py_info);
|
---|
313 | }
|
---|
314 | return true;
|
---|
315 | }
|
---|
316 |
|
---|
317 | static PyObject *unpack_py_frsapi_InfoW_args_out(struct frsapi_InfoW *r)
|
---|
318 | {
|
---|
319 | PyObject *result;
|
---|
320 | PyObject *py_info;
|
---|
321 | if (r->out.info == NULL) {
|
---|
322 | py_info = Py_None;
|
---|
323 | Py_INCREF(py_info);
|
---|
324 | } else {
|
---|
325 | py_info = py_talloc_reference_ex(&frsapi_Info_Type, r->out.info, r->out.info);
|
---|
326 | }
|
---|
327 | result = py_info;
|
---|
328 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
329 | PyErr_SetWERROR(r->out.result);
|
---|
330 | return NULL;
|
---|
331 | }
|
---|
332 |
|
---|
333 | return result;
|
---|
334 | }
|
---|
335 |
|
---|
336 | static bool pack_py_frsapi_IsPathReplicated_args_in(PyObject *args, PyObject *kwargs, struct frsapi_IsPathReplicated *r)
|
---|
337 | {
|
---|
338 | PyObject *py_path;
|
---|
339 | PyObject *py_replica_set_type;
|
---|
340 | const char *kwnames[] = {
|
---|
341 | "path", "replica_set_type", NULL
|
---|
342 | };
|
---|
343 |
|
---|
344 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:frsapi_IsPathReplicated", discard_const_p(char *, kwnames), &py_path, &py_replica_set_type)) {
|
---|
345 | return false;
|
---|
346 | }
|
---|
347 |
|
---|
348 | if (py_path == Py_None) {
|
---|
349 | r->in.path = NULL;
|
---|
350 | } else {
|
---|
351 | r->in.path = NULL;
|
---|
352 | if (PyUnicode_Check(py_path)) {
|
---|
353 | r->in.path = PyString_AS_STRING(PyUnicode_AsEncodedString(py_path, "utf-8", "ignore"));
|
---|
354 | } else if (PyString_Check(py_path)) {
|
---|
355 | r->in.path = PyString_AS_STRING(py_path);
|
---|
356 | } else {
|
---|
357 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_path)->tp_name);
|
---|
358 | return false;
|
---|
359 | }
|
---|
360 | }
|
---|
361 | if (PyLong_Check(py_replica_set_type)) {
|
---|
362 | r->in.replica_set_type = PyLong_AsLongLong(py_replica_set_type);
|
---|
363 | } else if (PyInt_Check(py_replica_set_type)) {
|
---|
364 | r->in.replica_set_type = PyInt_AsLong(py_replica_set_type);
|
---|
365 | } else {
|
---|
366 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
---|
367 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
---|
368 | return false;
|
---|
369 | }
|
---|
370 | return true;
|
---|
371 | }
|
---|
372 |
|
---|
373 | static PyObject *unpack_py_frsapi_IsPathReplicated_args_out(struct frsapi_IsPathReplicated *r)
|
---|
374 | {
|
---|
375 | PyObject *result;
|
---|
376 | PyObject *py_replicated;
|
---|
377 | PyObject *py_primary;
|
---|
378 | PyObject *py_root;
|
---|
379 | PyObject *py_replica_set_guid;
|
---|
380 | result = PyTuple_New(4);
|
---|
381 | py_replicated = PyInt_FromLong(*r->out.replicated);
|
---|
382 | PyTuple_SetItem(result, 0, py_replicated);
|
---|
383 | py_primary = PyInt_FromLong(*r->out.primary);
|
---|
384 | PyTuple_SetItem(result, 1, py_primary);
|
---|
385 | py_root = PyInt_FromLong(*r->out.root);
|
---|
386 | PyTuple_SetItem(result, 2, py_root);
|
---|
387 | py_replica_set_guid = py_talloc_reference_ex(GUID_Type, r->out.replica_set_guid, r->out.replica_set_guid);
|
---|
388 | PyTuple_SetItem(result, 3, py_replica_set_guid);
|
---|
389 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
390 | PyErr_SetWERROR(r->out.result);
|
---|
391 | return NULL;
|
---|
392 | }
|
---|
393 |
|
---|
394 | return result;
|
---|
395 | }
|
---|
396 |
|
---|
397 | static bool pack_py_frsapi_WriterCommand_args_in(PyObject *args, PyObject *kwargs, struct frsapi_WriterCommand *r)
|
---|
398 | {
|
---|
399 | PyObject *py_command;
|
---|
400 | const char *kwnames[] = {
|
---|
401 | "command", NULL
|
---|
402 | };
|
---|
403 |
|
---|
404 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:frsapi_WriterCommand", discard_const_p(char *, kwnames), &py_command)) {
|
---|
405 | return false;
|
---|
406 | }
|
---|
407 |
|
---|
408 | if (PyLong_Check(py_command)) {
|
---|
409 | r->in.command = PyLong_AsLongLong(py_command);
|
---|
410 | } else if (PyInt_Check(py_command)) {
|
---|
411 | r->in.command = PyInt_AsLong(py_command);
|
---|
412 | } else {
|
---|
413 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
---|
414 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
---|
415 | return false;
|
---|
416 | }
|
---|
417 | return true;
|
---|
418 | }
|
---|
419 |
|
---|
420 | static PyObject *unpack_py_frsapi_WriterCommand_args_out(struct frsapi_WriterCommand *r)
|
---|
421 | {
|
---|
422 | PyObject *result;
|
---|
423 | result = Py_None;
|
---|
424 | Py_INCREF(result);
|
---|
425 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
426 | PyErr_SetWERROR(r->out.result);
|
---|
427 | return NULL;
|
---|
428 | }
|
---|
429 |
|
---|
430 | return result;
|
---|
431 | }
|
---|
432 |
|
---|
433 | static bool pack_py_frsapi_ForceReplication_args_in(PyObject *args, PyObject *kwargs, struct frsapi_ForceReplication *r)
|
---|
434 | {
|
---|
435 | PyObject *py_replica_set_guid;
|
---|
436 | PyObject *py_connection_guid;
|
---|
437 | PyObject *py_replica_set_name;
|
---|
438 | PyObject *py_partner_dns_name;
|
---|
439 | const char *kwnames[] = {
|
---|
440 | "replica_set_guid", "connection_guid", "replica_set_name", "partner_dns_name", NULL
|
---|
441 | };
|
---|
442 |
|
---|
443 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:frsapi_ForceReplication", discard_const_p(char *, kwnames), &py_replica_set_guid, &py_connection_guid, &py_replica_set_name, &py_partner_dns_name)) {
|
---|
444 | return false;
|
---|
445 | }
|
---|
446 |
|
---|
447 | if (py_replica_set_guid == Py_None) {
|
---|
448 | r->in.replica_set_guid = NULL;
|
---|
449 | } else {
|
---|
450 | r->in.replica_set_guid = NULL;
|
---|
451 | PY_CHECK_TYPE(GUID_Type, py_replica_set_guid, return false;);
|
---|
452 | if (talloc_reference(r, py_talloc_get_mem_ctx(py_replica_set_guid)) == NULL) {
|
---|
453 | PyErr_NoMemory();
|
---|
454 | return false;
|
---|
455 | }
|
---|
456 | r->in.replica_set_guid = (struct GUID *)py_talloc_get_ptr(py_replica_set_guid);
|
---|
457 | }
|
---|
458 | if (py_connection_guid == Py_None) {
|
---|
459 | r->in.connection_guid = NULL;
|
---|
460 | } else {
|
---|
461 | r->in.connection_guid = NULL;
|
---|
462 | PY_CHECK_TYPE(GUID_Type, py_connection_guid, return false;);
|
---|
463 | if (talloc_reference(r, py_talloc_get_mem_ctx(py_connection_guid)) == NULL) {
|
---|
464 | PyErr_NoMemory();
|
---|
465 | return false;
|
---|
466 | }
|
---|
467 | r->in.connection_guid = (struct GUID *)py_talloc_get_ptr(py_connection_guid);
|
---|
468 | }
|
---|
469 | if (py_replica_set_name == Py_None) {
|
---|
470 | r->in.replica_set_name = NULL;
|
---|
471 | } else {
|
---|
472 | r->in.replica_set_name = NULL;
|
---|
473 | if (PyUnicode_Check(py_replica_set_name)) {
|
---|
474 | r->in.replica_set_name = PyString_AS_STRING(PyUnicode_AsEncodedString(py_replica_set_name, "utf-8", "ignore"));
|
---|
475 | } else if (PyString_Check(py_replica_set_name)) {
|
---|
476 | r->in.replica_set_name = PyString_AS_STRING(py_replica_set_name);
|
---|
477 | } else {
|
---|
478 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_replica_set_name)->tp_name);
|
---|
479 | return false;
|
---|
480 | }
|
---|
481 | }
|
---|
482 | if (py_partner_dns_name == Py_None) {
|
---|
483 | r->in.partner_dns_name = NULL;
|
---|
484 | } else {
|
---|
485 | r->in.partner_dns_name = NULL;
|
---|
486 | if (PyUnicode_Check(py_partner_dns_name)) {
|
---|
487 | r->in.partner_dns_name = PyString_AS_STRING(PyUnicode_AsEncodedString(py_partner_dns_name, "utf-8", "ignore"));
|
---|
488 | } else if (PyString_Check(py_partner_dns_name)) {
|
---|
489 | r->in.partner_dns_name = PyString_AS_STRING(py_partner_dns_name);
|
---|
490 | } else {
|
---|
491 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_partner_dns_name)->tp_name);
|
---|
492 | return false;
|
---|
493 | }
|
---|
494 | }
|
---|
495 | return true;
|
---|
496 | }
|
---|
497 |
|
---|
498 | static PyObject *unpack_py_frsapi_ForceReplication_args_out(struct frsapi_ForceReplication *r)
|
---|
499 | {
|
---|
500 | PyObject *result;
|
---|
501 | result = Py_None;
|
---|
502 | Py_INCREF(result);
|
---|
503 | if (!W_ERROR_IS_OK(r->out.result)) {
|
---|
504 | PyErr_SetWERROR(r->out.result);
|
---|
505 | return NULL;
|
---|
506 | }
|
---|
507 |
|
---|
508 | return result;
|
---|
509 | }
|
---|
510 |
|
---|
511 | const struct PyNdrRpcMethodDef py_ndr_frsapi_methods[] = {
|
---|
512 | { "SetDsPollingIntervalW", "S.SetDsPollingIntervalW(CurrentInterval, DsPollingLongInterval, DsPollingShortInterval) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_SetDsPollingIntervalW_r, (py_data_pack_fn)pack_py_frsapi_SetDsPollingIntervalW_args_in, (py_data_unpack_fn)unpack_py_frsapi_SetDsPollingIntervalW_args_out, 4, &ndr_table_frsapi },
|
---|
513 | { "GetDsPollingIntervalW", "S.GetDsPollingIntervalW() -> (CurrentInterval, DsPollingLongInterval, DsPollingShortInterval)", (py_dcerpc_call_fn)dcerpc_frsapi_GetDsPollingIntervalW_r, (py_data_pack_fn)pack_py_frsapi_GetDsPollingIntervalW_args_in, (py_data_unpack_fn)unpack_py_frsapi_GetDsPollingIntervalW_args_out, 5, &ndr_table_frsapi },
|
---|
514 | { "InfoW", "S.InfoW(length, info) -> info", (py_dcerpc_call_fn)dcerpc_frsapi_InfoW_r, (py_data_pack_fn)pack_py_frsapi_InfoW_args_in, (py_data_unpack_fn)unpack_py_frsapi_InfoW_args_out, 7, &ndr_table_frsapi },
|
---|
515 | { "IsPathReplicated", "S.IsPathReplicated(path, replica_set_type) -> (replicated, primary, root, replica_set_guid)", (py_dcerpc_call_fn)dcerpc_frsapi_IsPathReplicated_r, (py_data_pack_fn)pack_py_frsapi_IsPathReplicated_args_in, (py_data_unpack_fn)unpack_py_frsapi_IsPathReplicated_args_out, 8, &ndr_table_frsapi },
|
---|
516 | { "WriterCommand", "S.WriterCommand(command) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_WriterCommand_r, (py_data_pack_fn)pack_py_frsapi_WriterCommand_args_in, (py_data_unpack_fn)unpack_py_frsapi_WriterCommand_args_out, 9, &ndr_table_frsapi },
|
---|
517 | { "ForceReplication", "S.ForceReplication(replica_set_guid, connection_guid, replica_set_name, partner_dns_name) -> None", (py_dcerpc_call_fn)dcerpc_frsapi_ForceReplication_r, (py_data_pack_fn)pack_py_frsapi_ForceReplication_args_in, (py_data_unpack_fn)unpack_py_frsapi_ForceReplication_args_out, 10, &ndr_table_frsapi },
|
---|
518 | { NULL }
|
---|
519 | };
|
---|
520 |
|
---|
521 | static PyObject *interface_frsapi_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
---|
522 | {
|
---|
523 | return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_frsapi);
|
---|
524 | }
|
---|
525 |
|
---|
526 | #define PY_DOC_FRSAPI "File Replication API"
|
---|
527 | static PyTypeObject frsapi_InterfaceType = {
|
---|
528 | PyObject_HEAD_INIT(NULL) 0,
|
---|
529 | .tp_name = "frsapi.frsapi",
|
---|
530 | .tp_basicsize = sizeof(dcerpc_InterfaceObject),
|
---|
531 | .tp_doc = "frsapi(binding, lp_ctx=None, credentials=None) -> connection\n"
|
---|
532 | "\n"
|
---|
533 | "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
|
---|
534 | "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
|
---|
535 | "credentials should be a credentials.Credentials object.\n\n"PY_DOC_FRSAPI,
|
---|
536 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
---|
537 | .tp_new = interface_frsapi_new,
|
---|
538 | };
|
---|
539 |
|
---|
540 | static PyMethodDef frsapi_methods[] = {
|
---|
541 | { NULL, NULL, 0, NULL }
|
---|
542 | };
|
---|
543 |
|
---|
544 | void initfrsapi(void)
|
---|
545 | {
|
---|
546 | PyObject *m;
|
---|
547 | PyObject *dep_talloc;
|
---|
548 | PyObject *dep_samba_dcerpc_misc;
|
---|
549 | PyObject *dep_samba_dcerpc_base;
|
---|
550 |
|
---|
551 | dep_talloc = PyImport_ImportModule("talloc");
|
---|
552 | if (dep_talloc == NULL)
|
---|
553 | return;
|
---|
554 |
|
---|
555 | dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
|
---|
556 | if (dep_samba_dcerpc_misc == NULL)
|
---|
557 | return;
|
---|
558 |
|
---|
559 | dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
|
---|
560 | if (dep_samba_dcerpc_base == NULL)
|
---|
561 | return;
|
---|
562 |
|
---|
563 | Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
|
---|
564 | if (Object_Type == NULL)
|
---|
565 | return;
|
---|
566 |
|
---|
567 | GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
|
---|
568 | if (GUID_Type == NULL)
|
---|
569 | return;
|
---|
570 |
|
---|
571 | ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
|
---|
572 | if (ClientConnection_Type == NULL)
|
---|
573 | return;
|
---|
574 |
|
---|
575 | frsapi_Info_Type.tp_base = Object_Type;
|
---|
576 |
|
---|
577 | frsapi_InterfaceType.tp_base = ClientConnection_Type;
|
---|
578 |
|
---|
579 | if (PyType_Ready(&frsapi_Info_Type) < 0)
|
---|
580 | return;
|
---|
581 | if (PyType_Ready(&frsapi_InterfaceType) < 0)
|
---|
582 | return;
|
---|
583 | if (!PyInterface_AddNdrRpcMethods(&frsapi_InterfaceType, py_ndr_frsapi_methods))
|
---|
584 | return;
|
---|
585 |
|
---|
586 | #ifdef PY_INFO_PATCH
|
---|
587 | PY_INFO_PATCH(&frsapi_Info_Type);
|
---|
588 | #endif
|
---|
589 | #ifdef PY_FRSAPI_PATCH
|
---|
590 | PY_FRSAPI_PATCH(&frsapi_InterfaceType);
|
---|
591 | #endif
|
---|
592 |
|
---|
593 | m = Py_InitModule3("frsapi", frsapi_methods, "frsapi DCE/RPC");
|
---|
594 | if (m == NULL)
|
---|
595 | return;
|
---|
596 |
|
---|
597 | PyModule_AddObject(m, "FRSAPI_INFO_CONFIGTABLE", PyInt_FromLong(FRSAPI_INFO_CONFIGTABLE));
|
---|
598 | PyModule_AddObject(m, "FRSAPI_INFO_SETS", PyInt_FromLong(FRSAPI_INFO_SETS));
|
---|
599 | PyModule_AddObject(m, "FRSAPI_INFO_VERSION", PyInt_FromLong(FRSAPI_INFO_VERSION));
|
---|
600 | PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_DFS", PyInt_FromLong(FRSAPI_REPLICA_SET_TYPE_DFS));
|
---|
601 | PyModule_AddObject(m, "FRSAPI_INFO_INLOG", PyInt_FromLong(FRSAPI_INFO_INLOG));
|
---|
602 | PyModule_AddObject(m, "FRSAPI_WRITER_COMMAND_THAW", PyInt_FromLong(FRSAPI_WRITER_COMMAND_THAW));
|
---|
603 | PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_DOMAIN", PyInt_FromLong(FRSAPI_REPLICA_SET_TYPE_DOMAIN));
|
---|
604 | PyModule_AddObject(m, "FRSAPI_INFO_OUTLOG", PyInt_FromLong(FRSAPI_INFO_OUTLOG));
|
---|
605 | PyModule_AddObject(m, "FRSAPI_WRITER_COMMAND_FREEZE", PyInt_FromLong(FRSAPI_WRITER_COMMAND_FREEZE));
|
---|
606 | PyModule_AddObject(m, "FRSAPI_INFO_STAGE", PyInt_FromLong(FRSAPI_INFO_STAGE));
|
---|
607 | PyModule_AddObject(m, "FRSAPI_INFO_IDTABLE", PyInt_FromLong(FRSAPI_INFO_IDTABLE));
|
---|
608 | PyModule_AddObject(m, "FRSAPI_INFO_THREADS", PyInt_FromLong(FRSAPI_INFO_THREADS));
|
---|
609 | PyModule_AddObject(m, "FRSAPI_INFO_MEMORY", PyInt_FromLong(FRSAPI_INFO_MEMORY));
|
---|
610 | PyModule_AddObject(m, "FRSAPI_REPLICA_SET_TYPE_0", PyInt_FromLong(FRSAPI_REPLICA_SET_TYPE_0));
|
---|
611 | PyModule_AddObject(m, "FRSAPI_INFO_DS", PyInt_FromLong(FRSAPI_INFO_DS));
|
---|
612 | Py_INCREF((PyObject *)(void *)&frsapi_Info_Type);
|
---|
613 | PyModule_AddObject(m, "Info", (PyObject *)(void *)&frsapi_Info_Type);
|
---|
614 | Py_INCREF((PyObject *)(void *)&frsapi_InterfaceType);
|
---|
615 | PyModule_AddObject(m, "frsapi", (PyObject *)(void *)&frsapi_InterfaceType);
|
---|
616 | #ifdef PY_MOD_FRSAPI_PATCH
|
---|
617 | PY_MOD_FRSAPI_PATCH(m);
|
---|
618 | #endif
|
---|
619 |
|
---|
620 | }
|
---|