docs: mention AD prerequirements for using idmap_ad
[Samba.git] / source4 / librpc / rpc / pyrpc_util.h
blob837a33be16968d066e3cc6ec769da9486ea206bf
1 /*
2 Unix SMB/CIFS implementation.
4 Python interface to DCE/RPC library - utility functions.
6 Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
7 Copyright (C) 2010 Andrew Tridgell <tridge@samba.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef __PYRPC_UTIL_H__
24 #define __PYRPC_UTIL_H__
26 #include "librpc/rpc/pyrpc.h"
28 #define PyErr_FromNdrError(err) Py_BuildValue("(is)", err, ndr_map_error2string(err))
30 #define PyErr_SetNdrError(err) \
31 PyErr_SetObject(PyExc_RuntimeError, PyErr_FromNdrError(err))
33 void PyErr_SetDCERPCStatus(struct dcerpc_pipe *p, NTSTATUS status);
35 typedef NTSTATUS (*py_dcerpc_call_fn) (struct dcerpc_binding_handle *, TALLOC_CTX *, void *);
36 typedef bool (*py_data_pack_fn) (PyObject *args, PyObject *kwargs, void *r);
37 typedef PyObject *(*py_data_unpack_fn) (void *r);
39 struct PyNdrRpcMethodDef {
40 const char *name;
41 const char *doc;
42 py_dcerpc_call_fn call;
43 py_data_pack_fn pack_in_data;
44 py_data_unpack_fn unpack_out_data;
45 uint32_t opnum;
46 const struct ndr_interface_table *table;
49 bool py_check_dcerpc_type(PyObject *obj, const char *module, const char *type_name);
50 bool PyInterface_AddNdrRpcMethods(PyTypeObject *object, const struct PyNdrRpcMethodDef *mds);
51 PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs, const struct ndr_interface_table *table);
53 PyObject *py_return_ndr_struct(const char *module_name, const char *type_name,
54 TALLOC_CTX *r_ctx, void *r);
56 PyObject *PyString_FromStringOrNULL(const char *str);
58 #endif /* __PYRPC_UTIL_H__ */