Top |
A Spice port channel carry arbitrary data between the Spice client and the Spice server. It may be used to provide additional services on top of a Spice connection. For example, a channel can be associated with the qemu monitor for the client to interact with it, just like any qemu chardev. Or it may be used with various protocols, such as the Spice Controller.
A port kind is identified simply by a fqdn, such as org.qemu.monitor, org.spice.spicy.test or org.ovirt.controller...
Once connected and initialized, the client may read the name of the port via SpicePortChannel:port-name.
When the other end of the port is ready,
SpicePortChannel:port-opened is set to TRUE
and you can start
receiving data via the signal SpicePortChannel::port-data, or
sending data via spice_port_write_async()
.
void spice_port_event (SpicePortChannel *port
,guint8 event
);
Send an event to the port.
Note: The values SPICE_PORT_EVENT_CLOSED and SPICE_PORT_EVENT_OPENED are managed by the channel connection state.
Since: 0.15
void spice_port_write_async (SpicePortChannel *port
,const void *buffer
,gsize count
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Request an asynchronous write of count bytes from buffer
into the
port
. When the operation is finished callback
will be called. You
can then call spice_port_write_finish()
to get the result of
the operation.
port |
||
buffer |
the buffer containing the data to write. |
[array length=count][element-type guint8] |
count |
the number of bytes to write |
|
cancellable |
optional GCancellable object, NULL to ignore. |
[allow-none] |
callback |
callback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
Since: 0.15
gssize spice_port_write_finish (SpicePortChannel *port
,GAsyncResult *result
,GError **error
);
Finishes a port write operation.
Since: 0.15
struct SpicePortChannel;
The SpicePortChannel struct is opaque and should not be accessed directly.
struct SpicePortChannelClass { SpiceChannelClass parent_class; };
Class structure for SpicePortChannel.
“port-data”
signalvoid user_function (SpicePortChannel *channel, gpointer data, gint size, gpointer user_data)
The “port-data” signal is emitted when new port data is received.
channel |
the channel that emitted the signal |
|
data |
the data received |
|
size |
number of bytes read |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 0.15
“port-event”
signalvoid user_function (SpicePortChannel *channel, gint event, gpointer user_data)
The “port-event” signal is emitted when new port event is received.
channel |
the channel that emitted the signal |
|
event |
the event received |
|
size |
number of bytes read |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 0.15