2005-12-19 16:34:11 +00:00
|
|
|
/*
|
|
|
|
* types.c: converter functions between the internal representation
|
|
|
|
* and the Python objects
|
|
|
|
*
|
2012-02-02 22:45:54 +00:00
|
|
|
* Copyright (C) 2005, 2007, 2012 Red Hat, Inc.
|
2005-12-19 16:34:11 +00:00
|
|
|
*
|
|
|
|
* Daniel Veillard <veillard@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2008-01-29 18:15:54 +00:00
|
|
|
#include <config.h>
|
2007-12-07 10:08:06 +00:00
|
|
|
|
2008-04-18 18:31:32 +00:00
|
|
|
/* Horrible kludge to work around even more horrible name-space pollution
|
|
|
|
* via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
|
|
|
|
* which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
|
|
#undef HAVE_PTHREAD_H
|
|
|
|
|
2009-09-16 13:03:53 +00:00
|
|
|
#include "typewrappers.h"
|
2005-12-19 16:34:11 +00:00
|
|
|
|
2012-02-02 22:45:54 +00:00
|
|
|
#include "memory.h"
|
|
|
|
|
2010-12-02 17:15:10 +00:00
|
|
|
#ifndef Py_CAPSULE_H
|
|
|
|
typedef void(*PyCapsule_Destructor)(void *, void *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
libvirt_buildPyObject(void *cobj,
|
|
|
|
const char *name,
|
|
|
|
PyCapsule_Destructor destr)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
#ifdef Py_CAPSULE_H
|
|
|
|
ret = PyCapsule_New(cobj, name, destr);
|
|
|
|
#else
|
|
|
|
ret = PyCObject_FromVoidPtrAndDesc(cobj, (void *) name, destr);
|
|
|
|
#endif /* _TEST_CAPSULE */
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-12-19 16:34:11 +00:00
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_intWrap(int val)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
ret = PyInt_FromLong((long) val);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_longWrap(long val)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
ret = PyInt_FromLong(val);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
2006-11-15 19:40:00 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_ulongWrap(unsigned long val)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
ret = PyLong_FromLong(val);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-02-05 19:27:37 +00:00
|
|
|
}
|
2006-11-15 19:40:00 +00:00
|
|
|
|
2006-01-31 10:24:12 +00:00
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_longlongWrap(long long val)
|
2006-01-31 10:24:12 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
ret = PyLong_FromUnsignedLongLong((unsigned long long) val);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2006-01-31 10:24:12 +00:00
|
|
|
}
|
|
|
|
|
2010-02-03 11:31:45 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_ulonglongWrap(unsigned long long val)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
ret = PyLong_FromUnsignedLongLong(val);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2010-02-03 11:31:45 +00:00
|
|
|
}
|
|
|
|
|
2011-06-14 20:07:43 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2011-06-14 20:07:43 +00:00
|
|
|
}
|
|
|
|
ret = PyString_FromStringAndSize(str, size);
|
2012-02-02 22:45:54 +00:00
|
|
|
VIR_FREE(str);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2011-06-14 20:07:43 +00:00
|
|
|
}
|
|
|
|
|
2005-12-19 16:34:11 +00:00
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_charPtrWrap(char *str)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
ret = PyString_FromString(str);
|
2012-02-02 22:45:54 +00:00
|
|
|
VIR_FREE(str);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_constcharPtrWrap(const char *str)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
ret = PyString_FromString(str);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
2012-03-27 06:06:10 +00:00
|
|
|
int
|
|
|
|
libvirt_intUnwrap(PyObject *obj, int *val)
|
|
|
|
{
|
|
|
|
long long_val;
|
|
|
|
|
|
|
|
/* If obj is type of PyInt_Type, PyInt_AsLong converts it
|
|
|
|
* to C long type directly. If it is of PyLong_Type, PyInt_AsLong
|
|
|
|
* will call PyLong_AsLong() to deal with it automatically.
|
|
|
|
*/
|
|
|
|
long_val = PyInt_AsLong(obj);
|
|
|
|
if ((long_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((int)long_val == long_val) {
|
|
|
|
*val = long_val;
|
|
|
|
} else {
|
|
|
|
PyErr_SetString(PyExc_OverflowError,
|
|
|
|
"Python int too large to convert to C int");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_uintUnwrap(PyObject *obj, unsigned int *val)
|
|
|
|
{
|
|
|
|
long long_val;
|
|
|
|
|
|
|
|
long_val = PyInt_AsLong(obj);
|
|
|
|
if ((long_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((unsigned int)long_val == long_val) {
|
|
|
|
*val = long_val;
|
|
|
|
} else {
|
|
|
|
PyErr_SetString(PyExc_OverflowError,
|
|
|
|
"Python int too large to convert to C unsigned int");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_longUnwrap(PyObject *obj, long *val)
|
|
|
|
{
|
|
|
|
long long_val;
|
|
|
|
|
|
|
|
long_val = PyInt_AsLong(obj);
|
|
|
|
if ((long_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*val = long_val;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_ulongUnwrap(PyObject *obj, unsigned long *val)
|
|
|
|
{
|
|
|
|
long long_val;
|
|
|
|
|
|
|
|
long_val = PyInt_AsLong(obj);
|
|
|
|
if ((long_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*val = long_val;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_longlongUnwrap(PyObject *obj, long long *val)
|
|
|
|
{
|
|
|
|
long long llong_val;
|
|
|
|
|
|
|
|
/* If obj is of PyInt_Type, PyLong_AsLongLong
|
|
|
|
* will call PyInt_AsLong() to handle it automatically.
|
|
|
|
*/
|
|
|
|
llong_val = PyLong_AsLongLong(obj);
|
|
|
|
if ((llong_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*val = llong_val;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_ulonglongUnwrap(PyObject *obj, unsigned long long *val)
|
|
|
|
{
|
|
|
|
unsigned long long ullong_val = -1;
|
|
|
|
|
|
|
|
/* The PyLong_AsUnsignedLongLong doesn't check the type of
|
|
|
|
* obj, only accept argument of PyLong_Type, so we check it instead.
|
|
|
|
*/
|
|
|
|
if (PyInt_Check(obj))
|
|
|
|
ullong_val = PyInt_AsLong(obj);
|
|
|
|
else if (PyLong_Check(obj))
|
|
|
|
ullong_val = PyLong_AsUnsignedLongLong(obj);
|
|
|
|
else
|
|
|
|
PyErr_SetString(PyExc_TypeError, "an integer is required");
|
|
|
|
|
|
|
|
if ((ullong_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*val = ullong_val;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_doubleUnwrap(PyObject *obj, double *val)
|
|
|
|
{
|
|
|
|
double double_val;
|
|
|
|
|
|
|
|
double_val = PyFloat_AsDouble(obj);
|
|
|
|
if ((double_val == -1) && PyErr_Occurred())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*val = double_val;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
libvirt_boolUnwrap(PyObject *obj, bool *val)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = PyObject_IsTrue(obj);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
*val = ret > 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-12-19 16:34:11 +00:00
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_virDomainPtrWrap(virDomainPtr node)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virDomainPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
2007-03-09 15:42:50 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virNetworkPtrWrap(virNetworkPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2007-03-09 15:42:50 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virNetworkPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2007-03-09 15:42:50 +00:00
|
|
|
}
|
|
|
|
|
2009-05-21 10:57:05 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virInterfacePtrWrap(virInterfacePtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2009-05-21 10:57:05 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virInterfacePtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2009-05-21 10:57:05 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 15:26:22 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virStoragePoolPtrWrap(virStoragePoolPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-02-20 15:26:22 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virStoragePoolPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-02-20 15:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
libvirt_virStorageVolPtrWrap(virStorageVolPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-02-20 15:26:22 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virStorageVolPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-02-20 15:26:22 +00:00
|
|
|
}
|
|
|
|
|
2005-12-19 16:34:11 +00:00
|
|
|
PyObject *
|
2006-02-09 17:45:11 +00:00
|
|
|
libvirt_virConnectPtrWrap(virConnectPtr node)
|
2005-12-19 16:34:11 +00:00
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virConnectPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2005-12-19 16:34:11 +00:00
|
|
|
}
|
2008-10-31 10:13:45 +00:00
|
|
|
|
2008-11-21 12:41:15 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virNodeDevicePtrWrap(virNodeDevicePtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-11-21 12:41:15 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virNodeDevicePtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-11-21 12:41:15 +00:00
|
|
|
}
|
|
|
|
|
Secret manipulation API docs refresh & wire up python generator
Sample session:
>>> import libvirt
>>> c = libvirt.open('qemu:///session')
>>> c.listSecrets()
['12247729-47d2-a783-88ce-b329d4781cd3', 'reee', 'abc']
>>> s = c.secretDefineXML("<secret ephemeral='no' private='no'>\n<description>Something for use</description>\n<volume>/foo/bar</volume>\n</secret>\n")
>>> s.UUIDString()
'340c2dfb-811b-eda8-da9e-25ccd7bfd650'
>>> s.XMLDesc()
"<secret ephemeral='no' private='no'>\n <uuid>340c2dfb-811b-eda8-da9e-25ccd7bfd650</uuid>\n <description>Something for use</description>\n <volume>/foo/bar</volume>\n</secret>\n"
>>> s.setValue('abc\0xx\xffx')
0
>>> s.value()
'abc\x00xx\xffx'
>>> s.undefine()
0
* python/generator.py: Add rules for virSecret APIs
* python/libvir.c, python/libvirt-python-api.xml: Manual impl of
virSecretSetValue, virSecretGetValue$ and virConnectListSecrets APIs
* python/libvirt_wrap.h, python/types.c: Wrapper for virSecret objects
* docs/libvirt-api.xml, docs/libvirt-refs.xml,
docs/html/libvirt-virterror.html, docs/html/libvirt-libvirt.html,
docs/devhelp/libvirt-virterror.html, docs/devhelp/libvirt-libvirt.html:
Re-generate with 'make api'
2009-08-04 18:38:21 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virSecretPtrWrap(virSecretPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virSecretPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2010-04-29 10:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
libvirt_virNWFilterPtrWrap(virNWFilterPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virNWFilterPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
Secret manipulation API docs refresh & wire up python generator
Sample session:
>>> import libvirt
>>> c = libvirt.open('qemu:///session')
>>> c.listSecrets()
['12247729-47d2-a783-88ce-b329d4781cd3', 'reee', 'abc']
>>> s = c.secretDefineXML("<secret ephemeral='no' private='no'>\n<description>Something for use</description>\n<volume>/foo/bar</volume>\n</secret>\n")
>>> s.UUIDString()
'340c2dfb-811b-eda8-da9e-25ccd7bfd650'
>>> s.XMLDesc()
"<secret ephemeral='no' private='no'>\n <uuid>340c2dfb-811b-eda8-da9e-25ccd7bfd650</uuid>\n <description>Something for use</description>\n <volume>/foo/bar</volume>\n</secret>\n"
>>> s.setValue('abc\0xx\xffx')
0
>>> s.value()
'abc\x00xx\xffx'
>>> s.undefine()
0
* python/generator.py: Add rules for virSecret APIs
* python/libvir.c, python/libvirt-python-api.xml: Manual impl of
virSecretSetValue, virSecretGetValue$ and virConnectListSecrets APIs
* python/libvirt_wrap.h, python/types.c: Wrapper for virSecret objects
* docs/libvirt-api.xml, docs/libvirt-refs.xml,
docs/html/libvirt-virterror.html, docs/html/libvirt-libvirt.html,
docs/devhelp/libvirt-virterror.html, docs/devhelp/libvirt-libvirt.html:
Re-generate with 'make api'
2009-08-04 18:38:21 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 11:18:12 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virStreamPtrWrap(virStreamPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virStreamPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2009-07-10 11:18:12 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 20:33:13 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2010-03-31 20:33:13 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virDomainSnapshotPtr", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2010-03-31 20:33:13 +00:00
|
|
|
}
|
|
|
|
|
2008-10-31 10:13:45 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virEventHandleCallbackWrap(virEventHandleCallback node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2008-12-18 12:25:11 +00:00
|
|
|
printf("%s: WARNING - Wrapping None\n", __func__);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virEventHandleCallback", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
libvirt_virEventTimeoutCallbackWrap(virEventTimeoutCallback node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
2008-12-18 12:25:11 +00:00
|
|
|
printf("%s: WARNING - Wrapping None\n", __func__);
|
2008-10-31 10:13:45 +00:00
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virEventTimeoutCallback", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|
|
|
|
|
2008-11-19 16:24:01 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virFreeCallbackWrap(virFreeCallback node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-11-19 16:24:01 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "virFreeCallback", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-11-19 16:24:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-31 10:13:45 +00:00
|
|
|
PyObject *
|
|
|
|
libvirt_virVoidPtrWrap(void* node)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
if (node == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
2012-03-22 11:33:35 +00:00
|
|
|
return Py_None;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|
2010-12-02 17:15:10 +00:00
|
|
|
|
|
|
|
ret = libvirt_buildPyObject(node, "void*", NULL);
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret;
|
2008-10-31 10:13:45 +00:00
|
|
|
}
|