diff options
author | Tim Potter <tpot@samba.org> | 2004-09-10 12:20:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:38 -0500 |
commit | 56d7b0dc8af0339ba08458ecc64c91928fdf53a7 (patch) | |
tree | 904142b82ea0880f0b1c72c8b900a6060e18c3ff /source4/scripting/swig | |
parent | b79d97414db99ddd83b6de6390080aa56e0d5ae3 (diff) | |
download | samba-56d7b0dc8af0339ba08458ecc64c91928fdf53a7.tar.gz samba-56d7b0dc8af0339ba08458ecc64c91928fdf53a7.tar.bz2 samba-56d7b0dc8af0339ba08458ecc64c91928fdf53a7.zip |
r2278: Add some more helper functions.
(This used to be commit 5a64449599beb7b46484f1c3aef10f7e7b878319)
Diffstat (limited to 'source4/scripting/swig')
-rw-r--r-- | source4/scripting/swig/dcerpc.i | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/source4/scripting/swig/dcerpc.i b/source4/scripting/swig/dcerpc.i index 5ace564359..10dc4721e6 100644 --- a/source4/scripting/swig/dcerpc.i +++ b/source4/scripting/swig/dcerpc.i @@ -47,24 +47,54 @@ void set_ntstatus_exception(int status) PyErr_SetObject(ntstatus_exception, obj); } -char *get_string_property(PyObject *dict, char *key) +uint8 uint8_from_python(PyObject *obj) { - PyObject *item = PyDict_GetItem(dict, PyString_FromString(key)); + return (uint8)PyInt_AsLong(obj); +} + +uint16 uint16_from_python(PyObject *obj) +{ + return (uint16)PyInt_AsLong(obj); +} + +uint32 uint32_from_python(PyObject *obj) +{ + return (uint32)PyInt_AsLong(obj); +} + +int64 int64_from_python(PyObject *obj) +{ + return (int64)PyLong_AsLong(obj); +} - if (!item) - return 0; /* TODO: throw exception */ +uint64 uint64_from_python(PyObject *obj) +{ + return (uint64)PyLong_AsLong(obj); +} + +NTTIME NTTIME_from_python(PyObject *obj) +{ + return (NTTIME)PyLong_AsLong(obj); +} - return PyString_AsString(item); +HYPER_T HYPER_T_from_python(PyObject *obj) +{ + return (HYPER_T)PyLong_AsLong(obj); } -uint32 get_uint32_property(PyObject *dict, char *key) +struct policy_handle *policy_handle_from_python(PyObject *obj) { - PyObject *item = PyDict_GetItem(dict, PyString_FromString(key)); + return (struct policy_handle *)PyString_AsString(obj); +} - if (!item) - return 0; /* TODO: throw exception */ +struct security_descriptor *security_descriptor_from_python(PyObject *obj) +{ + return NULL; +} - return (uint32)PyInt_AsLong(item); +char *string_from_python(PyObject *obj) +{ + return NULL; } %} |