SpiceClientGLib.Channel

g GObject.Object GObject.Object SpiceClientGLib.Channel SpiceClientGLib.Channel GObject.Object->SpiceClientGLib.Channel

Subclasses:

SpiceClientGLib.CursorChannel, SpiceClientGLib.DisplayChannel, SpiceClientGLib.InputsChannel, SpiceClientGLib.MainChannel, SpiceClientGLib.PlaybackChannel, SpiceClientGLib.PortChannel, SpiceClientGLib.RecordChannel, SpiceClientGLib.SmartcardChannel, SpiceClientGLib.UsbredirChannel

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (s, type, id)

class

string_to_type (str)

class

type_to_string (type)

connect ()

destroy ()

disconnect (reason)

flush_async (cancellable, callback, *user_data)

flush_finish (result)

get_error ()

open_fd (fd)

set_capability (cap)

test_capability (cap)

test_common_capability (cap)

Virtual Methods

Inherited:

GObject.Object (7)

do_channel_event (event)

do_channel_reset (migrating)

do_channel_send_migration_handshake ()

do_channel_up ()

do_handle_msg (msg)

do_iterate_read ()

do_iterate_write ()

do_open_fd (with_tls)

Properties

Name

Type

Flags

Short Description

channel-id

int

r/w/co

Channel ID

channel-type

int

r/w/co

Channel type

socket

Gio.Socket

r

Underlying Gio.Socket

spice-session

SpiceClientGLib.Session

r/w/co

Spice session

total-read-bytes

int

r

Total read bytes

Signals

Inherited:

GObject.Object (1)

Name

Short Description

channel-event

The SpiceClientGLib.Channel ::channel-event signal is emitted when the state of the connection is changed.

open-fd

The SpiceClientGLib.Channel ::open-fd signal is emitted when a new connection is requested.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class SpiceClientGLib.Channel(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

SpiceClientGLib.ChannelClass

The SpiceClientGLib.Channel struct is opaque and should not be accessed directly.

classmethod new(s, type, id)
Parameters:
  • s (SpiceClientGLib.Session) – the SpiceSession the channel is linked to

  • type (int) – the requested SPICECHANNELPRIVATE type

  • id (int) – the channel-id

Returns:

a weak reference to SpiceClientGLib.Channel, the session owns the reference

Return type:

SpiceClientGLib.Channel

Create a new SpiceClientGLib.Channel of type type, and channel ID id.

classmethod string_to_type(str)
Parameters:

str (str) – a string representation of the channel-type property

Returns:

the channel-type property value for a str channel

Return type:

int

Convert a channel-type property value to a string.

New in version 0.21.

classmethod type_to_string(type)
Parameters:

type (int) – a channel-type property value

Returns:

string representation of type.

Return type:

str

Convert a channel-type property value to a string.

New in version 0.20.

connect()
Returns:

True on success.

Return type:

bool

Connect the channel, using SpiceClientGLib.Session connection informations

destroy()

Disconnect and unref the self.

Deprecated since version 0.27: this function has been deprecated because it is misleading, the object is not actually destroyed. Instead, it is recommended to call explicitely SpiceClientGLib.Channel.disconnect() and GObject.Object.unref().

disconnect(reason)
Parameters:

reason (SpiceClientGLib.ChannelEvent) – a channel event emitted on main context (or SpiceClientGLib.ChannelEvent.NONE)

Close the socket and reset connection specific data. Finally, emit reason SpiceClientGLib.Channel ::channel-event on main context if not SpiceClientGLib.ChannelEvent.NONE.

flush_async(cancellable, callback, *user_data)
Parameters:

Forces an asynchronous write of all user-space buffered data for the given channel.

When the operation is finished callback will be called. You can then call SpiceClientGLib.Channel.flush_finish() to get the result of the operation.

New in version 0.15.

flush_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if flush operation succeeded, False otherwise.

Return type:

bool

Finishes flushing a channel.

New in version 0.15.

get_error()
Returns:

the pointer to the error, or None

Return type:

GLib.Error

Retrieves the GLib.Error currently set on channel, if the SpiceClientGLib.Channel is in error state and can provide additional error details.

New in version 0.24.

open_fd(fd)
Parameters:

fd (int) – a file descriptor (socket) or -1. request mechanism

Returns:

True on success.

Return type:

bool

Connect the channel using fd socket.

If fd is -1, a valid fd will be requested later via the SpiceClientGLib.Channel ::open-fd signal.

set_capability(cap)
Parameters:

cap (int) – a capability

Enable specific channel-kind capability.

Deprecated since version 0.13: this function has been removed

test_capability(cap)
Parameters:

cap (int) – a capability

Returns:

True if cap (channel kind capability) is available.

Return type:

bool

Test availability of remote “channel kind capability”.

test_common_capability(cap)
Parameters:

cap (int) – a capability

Returns:

True if cap (common channel capability) is available.

Return type:

bool

Test availability of remote “common channel capability”.

do_channel_event(event) virtual
Parameters:

event (SpiceClientGLib.ChannelEvent) –

do_channel_reset(migrating) virtual
Parameters:

migrating (bool) –

do_channel_send_migration_handshake() virtual
do_channel_up() virtual
do_handle_msg(msg) virtual
Parameters:

msg (SpiceClientGLib.MsgIn) –

do_iterate_read() virtual
do_iterate_write() virtual
do_open_fd(with_tls) virtual
Parameters:

with_tls (int) –

Signal Details

SpiceClientGLib.Channel.signals.channel_event(channel, event)
Signal Name:

channel-event

Flags:

RUN_FIRST

Parameters:

The SpiceClientGLib.Channel ::channel-event signal is emitted when the state of the connection is changed. In case of errors, SpiceClientGLib.Channel.get_error() may provide additional informations on the source of the error.

SpiceClientGLib.Channel.signals.open_fd(channel, with_tls)
Signal Name:

open-fd

Flags:

RUN_FIRST

Parameters:
  • channel (SpiceClientGLib.Channel) – The object which received the signal

  • with_tls (int) – wether TLS connection is requested

The SpiceClientGLib.Channel ::open-fd signal is emitted when a new connection is requested. This signal is emitted when the connection is made with SpiceClientGLib.Session.open_fd().

Property Details

SpiceClientGLib.Channel.props.channel_id
Name:

channel-id

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Channel ID

SpiceClientGLib.Channel.props.channel_type
Name:

channel-type

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Channel type

SpiceClientGLib.Channel.props.socket
Name:

socket

Type:

Gio.Socket

Default Value:

None

Flags:

READABLE

Get the underlying Gio.Socket. Note that you should not read or write any data to it directly since this will likely corrupt the channel stream. This property is mainly useful to get some connections details.

New in version 0.33.

SpiceClientGLib.Channel.props.spice_session
Name:

spice-session

Type:

SpiceClientGLib.Session

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Spice session

SpiceClientGLib.Channel.props.total_read_bytes
Name:

total-read-bytes

Type:

int

Default Value:

0

Flags:

READABLE

Total read bytes