1 /* Tastes like -*- C -*- */
4 Unix SMB/CIFS implementation.
6 Swig interface to librpc functions.
8 Copyright (C) Tim Potter 2004
9 Copyright (C) Jelmer Vernooij 2007
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 /* This symbol is used in both includes.h and Python.h which causes an
30 annoying compiler warning. */
37 #include "dynconfig.h"
38 #include "librpc/rpc/dcerpc.h"
39 #include "param/param.h"
45 %import "../../lib/talloc/talloc.i"
46 %import "../../auth/credentials/credentials.i"
48 %typemap(in,noblock=1, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
49 $1 = &temp_dcerpc_pipe;
52 %typemap(argout,noblock=1) struct dcerpc_pipe ** {
53 /* Set REF_ALLOC flag so we don't have to do too much extra
54 mucking around with ref variables in ndr unmarshalling. */
56 (*$1)->conn->flags |= DCERPC_NDR_REF_ALLOC;
58 /* Return swig handle on dcerpc_pipe */
60 $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_dcerpc_pipe, 0);
63 %types(struct dcerpc_pipe *);
65 %rename(pipe_connect) dcerpc_pipe_connect;
67 NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
68 struct dcerpc_pipe **pp,
70 const struct ndr_interface_table *table,
71 struct cli_credentials *credentials,
72 struct event_context *ev,
73 struct loadparm_context *lp_ctx);
75 %typemap(in,noblock=1) DATA_BLOB * (DATA_BLOB temp_data_blob) {
76 temp_data_blob.data = PyString_AsString($input);
77 temp_data_blob.length = PyString_Size($input);
81 const char *dcerpc_server_name(struct dcerpc_pipe *p);
83 /* Some typemaps for easier access to resume handles. Really this can
84 also be done using the uint32 carray functions, but it's a bit of a
85 hassle. TODO: Fix memory leak here. */
87 %typemap(in,noblock=1) uint32_t *resume_handle {
88 $1 = malloc(sizeof(*$1));
89 *$1 = PyLong_AsLong($input);
92 %typemap(out,noblock=1) uint32_t *resume_handle {
93 $result = PyLong_FromLong(*$1);
96 %typemap(in,noblock=1) struct policy_handle * {
98 if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,
99 SWIG_POINTER_EXCEPTION)) == -1)
103 PyErr_SetString(PyExc_TypeError, "None is not a valid policy handle");
108 /* When returning a policy handle to Python we need to make a copy of
109 as the talloc context it is created under is destroyed after the
110 wrapper function returns. TODO: Fix memory leak created here. */
112 %typemap(out,noblock=1) struct policy_handle * {
114 struct policy_handle *temp = (struct policy_handle *)malloc(sizeof(struct policy_handle));
115 memcpy(temp, $1, sizeof(struct policy_handle));
116 $result = SWIG_NewPointerObj(temp, SWIGTYPE_p_policy_handle, 0);