summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rwxr-xr-xgenerator.py32
-rw-r--r--libvirt-override-virStream.py20
-rw-r--r--typewrappers.c13
-rw-r--r--typewrappers.h10
5 files changed, 74 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 95ae84d..cda6559 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,9 @@ DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIRT_VERSION)
DOCS = ${srcdir}/TODO
-CLASSES_EXTRA = libvirt-override-virConnect.py
+CLASSES_EXTRA = \
+ libvirt-override-virConnect.py \
+ libvirt-override-virStream.py
EXTRA_DIST = \
generator.py \
diff --git a/generator.py b/generator.py
index 178a415..48ad14b 100755
--- a/generator.py
+++ b/generator.py
@@ -282,6 +282,11 @@ py_types = {
'const virSecretPtr': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
'virSecret *': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
'const virSecret *': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
+
+ 'virStreamPtr': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
+ 'const virStreamPtr': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
+ 'virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
+ 'const virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
}
py_return_types = {
@@ -338,6 +343,8 @@ skip_impl = (
'virSecretGetUUID',
'virSecretGetUUIDString',
'virSecretLookupByUUID',
+ 'virStreamRecv',
+ 'virStreamSend',
'virStoragePoolGetUUID',
'virStoragePoolGetUUIDString',
'virStoragePoolLookupByUUID',
@@ -373,6 +380,11 @@ skip_function = (
'virConnectDomainEventDeregister', # overridden in virConnect.py
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
+ 'virStreamEventAddCallback',
+ 'virStreamRecvAll',
+ 'virStreamSendAll',
+ 'virStreamRef',
+ 'virStreamFree',
)
@@ -643,6 +655,8 @@ classes_type = {
"virNodeDevice *": ("._o", "virNodeDevice(self, _obj=%s)", "virNodeDevice"),
"virSecretPtr": ("._o", "virSecret(self, _obj=%s)", "virSecret"),
"virSecret *": ("._o", "virSecret(self, _obj=%s)", "virSecret"),
+ "virStreamPtr": ("._o", "virStream(self, _obj=%s)", "virStream"),
+ "virStream *": ("._o", "virStream(self, _obj=%s)", "virStream"),
"virConnectPtr": ("._o", "virConnect(_obj=%s)", "virConnect"),
"virConnect *": ("._o", "virConnect(_obj=%s)", "virConnect"),
}
@@ -652,7 +666,8 @@ converter_type = {
primary_classes = ["virDomain", "virNetwork", "virInterface",
"virStoragePool", "virStorageVol",
- "virConnect", "virNodeDevice", "virSecret" ]
+ "virConnect", "virNodeDevice", "virSecret",
+ "virStream"]
classes_ancestor = {
}
@@ -663,7 +678,9 @@ classes_destructors = {
"virStoragePool": "virStoragePoolFree",
"virStorageVol": "virStorageVolFree",
"virNodeDevice" : "virNodeDeviceFree",
- "virSecret": "virSecretFree"
+ "virSecret": "virSecretFree",
+ # We hand-craft __del__ for this one
+ #"virStream": "virStreamFree",
}
functions_noexcept = {
@@ -782,6 +799,11 @@ def nameFixup(name, classe, type, file):
elif name[0:9] == 'virSecret':
func = name[9:]
func = string.lower(func[0:1]) + func[1:]
+ elif name[0:12] == 'virStreamNew':
+ func = "newStream"
+ elif name[0:9] == 'virStream':
+ func = name[9:]
+ func = string.lower(func[0:1]) + func[1:]
elif name[0:17] == "virStoragePoolGet":
func = name[17:]
func = string.lower(func[0:1]) + func[1:]
@@ -1059,7 +1081,8 @@ def buildWrappers():
classes_ancestor[classname]))
else:
classes.write("class %s:\n" % (classname))
- if classname in [ "virDomain", "virNetwork", "virInterface", "virStoragePool", "virStorageVol", "virNodeDevice", "virSecret" ]:
+ if classname in [ "virDomain", "virNetwork", "virInterface", "virStoragePool",
+ "virStorageVol", "virNodeDevice", "virSecret","virStream" ]:
classes.write(" def __init__(self, conn, _obj=None):\n")
else:
classes.write(" def __init__(self, _obj=None):\n")
@@ -1067,7 +1090,8 @@ def buildWrappers():
list = reference_keepers[classname]
for ref in list:
classes.write(" self.%s = None\n" % ref[1])
- if classname in [ "virDomain", "virNetwork", "virInterface", "virNodeDevice", "virSecret" ]:
+ if classname in [ "virDomain", "virNetwork", "virInterface",
+ "virNodeDevice", "virSecret", "virStream" ]:
classes.write(" self._conn = conn\n")
elif classname in [ "virStorageVol", "virStoragePool" ]:
classes.write(" self._conn = conn\n" + \
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
new file mode 100644
index 0000000..f50a7ef
--- /dev/null
+++ b/libvirt-override-virStream.py
@@ -0,0 +1,20 @@
+ def __del__(self):
+ try:
+ if self.cb:
+ libvirtmod.virStreamEventRemoveCallback(self._o)
+ except AttributeError:
+ pass
+
+ if self._o != None:
+ libvirtmod.virStreamFree(self._o)
+ self._o = None
+
+ def eventAddCallback(self, cb, opaque):
+ """ """
+ try:
+ self.cb = cb
+ self.opaque = opaque
+ ret = libvirtmod.virStreamEventAddCallback(self._o, self)
+ if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed', conn=self._conn)
+ except AttributeError:
+ pass
diff --git a/typewrappers.c b/typewrappers.c
index 0d8ac97..9ba99de 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -207,6 +207,19 @@ libvirt_virSecretPtrWrap(virSecretPtr node)
}
PyObject *
+libvirt_virStreamPtrWrap(virStreamPtr node)
+{
+ PyObject *ret;
+
+ if (node == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ ret = PyCObject_FromVoidPtrAndDesc(node, (char *) "virStreamPtr", NULL);
+ return (ret);
+}
+
+PyObject *
libvirt_virEventHandleCallbackWrap(virEventHandleCallback node)
{
PyObject *ret;
diff --git a/typewrappers.h b/typewrappers.h
index 99d5805..61f7249 100644
--- a/typewrappers.h
+++ b/typewrappers.h
@@ -92,6 +92,15 @@ typedef struct {
} PyvirSecret_Object;
+#define PyvirStream_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyvirStream_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ virStreamPtr obj;
+} PyvirStream_Object;
+
+
#define PyvirEventHandleCallback_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirEventHandleCallback_Object *)(v))->obj))
@@ -144,6 +153,7 @@ PyObject * libvirt_virFreeCallbackWrap(virFreeCallback node);
PyObject * libvirt_virVoidPtrWrap(void* node);
PyObject * libvirt_virNodeDevicePtrWrap(virNodeDevicePtr node);
PyObject * libvirt_virSecretPtrWrap(virSecretPtr node);
+PyObject * libvirt_virStreamPtrWrap(virStreamPtr node);
/* Provide simple macro statement wrappers (adapted from GLib, in turn from Perl):