svn commit: samba r2230 - in
branches/SAMBA_4_0/source/scripting/swig: .
tpot at samba.org
tpot at samba.org
Sun Sep 5 04:05:46 GMT 2004
Author: tpot
Date: 2004-09-05 04:05:45 +0000 (Sun, 05 Sep 2004)
New Revision: 2230
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/scripting/swig&rev=2230&nolog=1
Log:
Wrapper for dcerpc_samr_Connect2(). All this glue code should be
automatically generated but at the moment it's hand coded.
Modified:
branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
branches/SAMBA_4_0/source/scripting/swig/samr.i
Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i 2004-09-05 02:39:47 UTC (rev 2229)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i 2004-09-05 04:05:45 UTC (rev 2230)
@@ -50,6 +50,26 @@
PyErr_SetObject(ntstatus_exception, obj);
}
+char *get_string_property(PyObject *dict, char *key)
+{
+ PyObject *item = PyDict_GetItem(dict, PyString_FromString(key));
+
+ if (!item)
+ return 0; /* TODO: throw exception */
+
+ return PyString_AsString(item);
+}
+
+uint32 get_uint32_property(PyObject *dict, char *key)
+{
+ PyObject *item = PyDict_GetItem(dict, PyString_FromString(key));
+
+ if (!item)
+ return 0; /* TODO: throw exception */
+
+ return (uint32)PyInt_AsLong(item);
+}
+
%}
%include "samba.i"
@@ -61,10 +81,14 @@
ntstatus_exception = PyErr_NewException("dcerpc.NTSTATUS", NULL, NULL);
%}
-%typemap(in, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp) {
- $1 = &temp;
+%typemap(in, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
+ $1 = &temp_dcerpc_pipe;
}
+%typemap(in, numinputs=0) TALLOC_CTX * {
+ $1 = talloc_init("foo");
+}
+
%typemap(argout) struct dcerpc_pipe ** {
long status = PyLong_AsLong(resultobj);
if (status != 0) {
Modified: branches/SAMBA_4_0/source/scripting/swig/samr.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/samr.i 2004-09-05 02:39:47 UTC (rev 2229)
+++ branches/SAMBA_4_0/source/scripting/swig/samr.i 2004-09-05 04:05:45 UTC (rev 2230)
@@ -23,3 +23,16 @@
#define DCERPC_SAMR_UUID "12345778-1234-abcd-ef00-0123456789ac"
const int DCERPC_SAMR_VERSION = 1.0;
#define DCERPC_SAMR_NAME "samr"
+
+%typemap(in) struct samr_Connect2 * (struct samr_Connect2 temp) {
+ if (!PyDict_Check($input)) {
+ PyErr_SetString(PyExc_TypeError, "dict arg expected");
+ return NULL;
+ }
+ temp.in.system_name = get_string_property($input, "system_name");
+ temp.in.access_mask = get_uint32_property($input, "access_mask");
+ $1 = &temp;
+}
+
+%rename(samr_Connect2) dcerpc_samr_Connect2;
+NTSTATUS dcerpc_samr_Connect2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_Connect2 *r);
More information about the samba-cvs
mailing list