source: trunk/server/source4/librpc/rpc/pyrpc_util.h

Last change on this file was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 2.2 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3
4 Python interface to DCE/RPC library - utility functions.
5
6 Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
7 Copyright (C) 2010 Andrew Tridgell <tridge@samba.org>
8
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.
13
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.
18
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/>.
21*/
22
23#ifndef __PYRPC_UTIL_H__
24#define __PYRPC_UTIL_H__
25
26#include "librpc/rpc/pyrpc.h"
27
28#define PyErr_FromNdrError(err) Py_BuildValue("(is)", err, ndr_map_error2string(err))
29
30#define PyErr_SetNdrError(err) \
31 PyErr_SetObject(PyExc_RuntimeError, PyErr_FromNdrError(err))
32
33void PyErr_SetDCERPCStatus(struct dcerpc_pipe *p, NTSTATUS status);
34
35typedef NTSTATUS (*py_dcerpc_call_fn) (struct dcerpc_binding_handle *, TALLOC_CTX *, void *);
36typedef bool (*py_data_pack_fn) (PyObject *args, PyObject *kwargs, void *r);
37typedef PyObject *(*py_data_unpack_fn) (void *r);
38
39struct 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;
47};
48
49bool py_check_dcerpc_type(PyObject *obj, const char *module, const char *type_name);
50bool PyInterface_AddNdrRpcMethods(PyTypeObject *object, const struct PyNdrRpcMethodDef *mds);
51PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs, const struct ndr_interface_table *table);
52
53PyObject *py_return_ndr_struct(const char *module_name, const char *type_name,
54 TALLOC_CTX *r_ctx, void *r);
55
56PyObject *PyString_FromStringOrNULL(const char *str);
57
58#endif /* __PYRPC_UTIL_H__ */
Note: See TracBrowser for help on using the repository browser.