* src/libvirt.c: Stub for new API --- src/libvirt.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index 85dfc58..9dc638e 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2407,6 +2407,62 @@ error: } /** + * virDomainScreenshot: + * @domain: a domain object + * @stream: stream to use as output + * @flags: extra flags, currently unused + * + * Take a screenshot of current domain console as a stream. The image format + * is hypervisor specific. + * + * This call sets up a stream; subsequent use of stream API is necessary + * to transfer actual data, determine how much data is successfully + * transfered, and detect any errors. + * + * Returns a string representing the mime-type of the image format, or + * NULL upon error. The caller must free() the returned value. + */ +char * +virDomainScreenshot(virDomainPtr domain, + virStreamPtr stream, + unsigned int flags) +{ + VIR_DOMAIN_DEBUG(domain, "stream=%p flags=%u", stream, flags); + + virResetLastError(); + + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { + virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); + virDispatchError(NULL); + return NULL; + } + if (!VIR_IS_STREAM(stream)) { + virLibConnError(VIR_ERR_INVALID_STREAM, __FUNCTION__); + return NULL; + } + if (domain->conn->flags & VIR_CONNECT_RO || + stream->conn->flags & VIR_CONNECT_RO) { + virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); + goto error; + } + + if (domain->conn->driver->domainScreenshot) { + char * ret; + ret = domain->conn->driver->domainScreenshot(domain, stream, flags); + + if (ret == NULL) + goto error; + return ret; + } + + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + +error: + virDispatchError(domain->conn); + return NULL; +} + +/** * virDomainShutdown: * @domain: a domain object * -- 1.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list