1Sys::Virt::Stream(3)  User Contributed Perl Documentation Sys::Virt::Stream(3)
2
3
4

NAME

6       Sys::Virt::Stream - Represent & manage a libvirt stream
7

DESCRIPTION

9       The "Sys::Virt::Stream" module represents a stream managed by the
10       virtual machine monitor.
11

METHODS

13       my $st Sys::Virt::Stream->new($conn, $flags);
14           Creates a new data stream, ready for use with a stream based API.
15           The optional $flags parameter can be used to configure the stream
16           as non-blocking
17
18       $st->abort()
19           Abort I/O on the stream. Either this function or "finish" must be
20           called on any stream which has been activated
21
22       $st->finish()
23           Complete I/O on the stream. Either this function or "abort" must be
24           called on any stream which has been activated
25
26       $rv = $st->recv($data, $nbytes)
27           Receive upto $nbytes worth of data, copying into $data.  Returns
28           the number of bytes read, or -2 if I/O would block, or -1 on error.
29
30       $rv = $st->send($data, $nbytes)
31           Send upto $nbytes worth of data, copying from $data.  Returns the
32           number of bytes sent, or -2 if I/O would block, or -1 on error.
33
34       $st->recv_all($handler)
35           Receive all data available from the stream, invoking $handler to
36           process the data. The $handler parameter must be a function which
37           expects three arguments, the $st stream object, a scalar containing
38           the data received and a data byte count. The function should return
39           the number of bytes processed, or -1 upon error.
40
41       $st->send_all($handler)
42           Send all data produced by $handler to the stream.  The $handler
43           parameter must be a function which expects three arguments, the $st
44           stream object, a scalar which must be filled with data and a
45           maximum data byte count desired. The function should return the
46           number of bytes filled, 0 on end of file, or -1 upon error
47
48       $st->add_callback($events, $coderef)
49           Register a callback to be invoked whenever the stream has one or
50           more events from $events mask set. The $coderef must be a
51           subroutine that expects 2 parameters, the original $st object and
52           the new $events mask
53
54       $st->update_callback($events)
55           Change the event mask for a previously registered callback to
56           $events
57
58       $st->remove_callback();
59           Remove a previously registered callback
60

CONSTANTS

62       Sys::Virt::Stream::NONBLOCK
63           Create a stream which will not block when performing I/O
64
65       Sys::Virt::Stream::EVENT_READABLE
66           The stream has data available for read without blocking
67
68       Sys::Virt::Stream::EVENT_WRITABLE
69           The stream has ability to write data without blocking
70
71       Sys::Virt::Stream::EVENT_ERROR
72           An error occurred on the stream
73
74       Sys::Virt::Stream::EVENT_HANGUP
75           The remote end of the stream closed
76

AUTHORS

78       Daniel P. Berrange <berrange@redhat.com>
79
81       Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2007 Daniel P.
82       Berrange
83

LICENSE

85       This program is free software; you can redistribute it and/or modify it
86       under the terms of either the GNU General Public License as published
87       by the Free Software Foundation (either version 2 of the License, or at
88       your option any later version), or, the Artistic License, as specified
89       in the Perl README file.
90

SEE ALSO

92       Sys::Virt, Sys::Virt::Error, "http://libvirt.org"
93
94
95
96perl v5.10.1                      2012-09-26              Sys::Virt::Stream(3)
Impressum