SpiceClientGLib.Session

g GObject.Object GObject.Object SpiceClientGLib.Session SpiceClientGLib.Session GObject.Object->SpiceClientGLib.Session

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

connect ()

disconnect ()

get_channels ()

get_proxy_uri ()

get_read_only ()

has_channel_type (type)

is_for_migration ()

open_fd (fd)

Virtual Methods

Inherited:

GObject.Object (7)

do_channel_destroy (channel)

do_channel_new (channel)

Properties

Name

Type

Flags

Short Description

ca

GLib.ByteArray

r/w

The CA certificates data

ca-file

str

r/w

File holding the CA certificates

cache-size

int

r/w

Images cache size (bytes)

cert-subject

str

r/w

Certificate subject to check

ciphers

str

r/w

SSL cipher list

client-sockets

bool

r/w

Sockets are provided by the client

color-depth

int

d/r/w

Display channel color depth deprecated

disable-effects

[str]

r/w

Comma-separated effects to disable

enable-audio

bool

r/w/c

Enable audio channels

enable-smartcard

bool

r/w

Forward smartcard events to the SPICE server

enable-usbredir

bool

r/w/c

Forward USB devices to the SPICE server

gl-scanout

bool

r/w/c

Enable GL scanout support

glz-window-size

int

r/w

Glz window size (bytes)

host

str

r/w/c

Remote host

inhibit-keyboard-grab

bool

r/w

Request that SpiceDisplays don’t grab the keyboard

migration-state

SpiceClientGLib.SessionMigration

r

Migration state

name

str

r

Spice server name

password

str

r/w

port

str

r/w

Remote port (plaintext)

protocol

int

r/w/c

Spice protocol major version

proxy

str

r/w

The proxy server

pubkey

GLib.ByteArray

r/w

Public key to check

read-only

bool

r/w/c

Whether this connection is read-only mode

secure-channels

[str]

r/w

Array of channel type to secure

share-dir-ro

bool

r/w/c

Share directory read-only

shared-dir

str

r/w/c

Shared directory

smartcard-certificates

[str]

r/w

Smartcard certificates for software-based smartcards

smartcard-db

str

r/w

Path to the database for smartcard certificates

tls-port

str

r/w

Remote port (encrypted)

unix-path

str

r/w/c

Unix path

uri

str

r/w

Spice connection URI

username

str

r/w

Username used for SASL connections

uuid

int

r

Spice server uuid

verify

SpiceClientGLib.SessionVerify

r/w/c

Certificate verification parameters

Signals

Inherited:

GObject.Object (1)

Name

Short Description

channel-destroy

The SpiceClientGLib.Session ::channel-destroy signal is emitted each time a SpiceClientGLib.Channel is destroyed.

channel-new

The SpiceClientGLib.Session ::channel-new signal is emitted each time a SpiceClientGLib.Channel is created.

disconnected

The SpiceClientGLib.Session ::disconnected signal is emitted when all channels have been destroyed.

mm-time-reset

The SpiceClientGLib.Session ::mm-time-reset is emitted when we identify discontinuity in mm-time

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class SpiceClientGLib.Session(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

SpiceClientGLib.SessionClass

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

classmethod new()
Returns:

a new SpiceClientGLib.Session

Return type:

SpiceClientGLib.Session

Creates a new Spice session.

connect()
Returns:

False if the session state is invalid for connection request. True if the connection is initiated. To know whether the connection is established, you must watch for channels creation (SpiceClientGLib.Session ::channel-new) and the channels state (SpiceClientGLib.Channel ::channel-event).

Return type:

bool

Open the session using the SpiceClientGLib.Session :host and SpiceClientGLib.Session :port.

disconnect()

Disconnect the self, and destroy all channels.

get_channels()
Returns:

a GLib.List of unowned SpiceClientGLib.Channel channels.

Return type:

[SpiceClientGLib.Channel]

Get the list of current channels associated with this self.

get_proxy_uri()
Returns:

the session proxy SpiceClientGLib.URI or None.

Return type:

SpiceClientGLib.URI

Gets the self proxy uri.

New in version 0.24.

get_read_only()
Returns:

whether the self is in read-only mode.

Return type:

bool

Checks whether the self is read-only.

has_channel_type(type)
Parameters:

type (int) – a SpiceClientGLib.Channel :channel-type

Returns:

True if a type channel is available otherwise False.

Return type:

bool

See if there is a type channel in the channels associated with this self.

is_for_migration()
Returns:

True if the session is a copy created during migration

Return type:

bool

During seamless migration, channels may be created to establish a connection with the target, but they are temporary and should only handle migration steps. In order to avoid other interactions with the client, channels should check this value.

New in version 0.27.

open_fd(fd)
Parameters:

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

Returns:

True on success.

Return type:

bool

Open the session using the provided fd socket file descriptor. This is useful if you create the fd yourself, for example to setup a SSH tunnel.

Note however that additional sockets will be needed by all the channels created for self so users of this API should hook into SpiceClientGLib.Channel ::open-fd signal for each channel they are interested in, and create and pass a new socket to the channel using SpiceClientGLib.Channel.open_fd, in the signal callback.

If fd is -1, a valid fd will be requested later via the SpiceClientGLib.Channel ::open-fd signal. Typically, you would want to just pass -1 as fd this call since you will have to hook to SpiceClientGLib.Channel ::open-fd signal anyway.

do_channel_destroy(channel) virtual
Parameters:

channel (SpiceClientGLib.Channel) –

do_channel_new(channel) virtual
Parameters:

channel (SpiceClientGLib.Channel) –

Signal Details

SpiceClientGLib.Session.signals.channel_destroy(session, channel)
Signal Name:

channel-destroy

Flags:

RUN_FIRST

Parameters:

The SpiceClientGLib.Session ::channel-destroy signal is emitted each time a SpiceClientGLib.Channel is destroyed.

SpiceClientGLib.Session.signals.channel_new(session, channel)
Signal Name:

channel-new

Flags:

RUN_FIRST

Parameters:

The SpiceClientGLib.Session ::channel-new signal is emitted each time a SpiceClientGLib.Channel is created.

SpiceClientGLib.Session.signals.disconnected(session)
Signal Name:

disconnected

Flags:

RUN_FIRST

Parameters:

session (SpiceClientGLib.Session) – The object which received the signal

The SpiceClientGLib.Session ::disconnected signal is emitted when all channels have been destroyed.

New in version 0.35.

SpiceClientGLib.Session.signals.mm_time_reset(session)
Signal Name:

mm-time-reset

Flags:

RUN_FIRST

Parameters:

session (SpiceClientGLib.Session) – The object which received the signal

The SpiceClientGLib.Session ::mm-time-reset is emitted when we identify discontinuity in mm-time

New in version 0.20.

Property Details

SpiceClientGLib.Session.props.ca
Name:

ca

Type:

GLib.ByteArray

Default Value:

None

Flags:

READABLE, WRITABLE

CA certificates in PEM format. The text data can contain several CA certificates identified by:

—–BEGIN CERTIFICATE—– … (CA certificate in base64 encoding) … —–END CERTIFICATE—–

New in version 0.15.

SpiceClientGLib.Session.props.ca_file
Name:

ca-file

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

File holding the CA certificates for the host the client is connecting to

SpiceClientGLib.Session.props.cache_size
Name:

cache-size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Images cache size. If 0, don’t set.

New in version 0.9.

SpiceClientGLib.Session.props.cert_subject
Name:

cert-subject

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Certificate subject to check

SpiceClientGLib.Session.props.ciphers
Name:

ciphers

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

SSL cipher list

SpiceClientGLib.Session.props.client_sockets
Name:

client-sockets

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Sockets are provided by the client

SpiceClientGLib.Session.props.color_depth
Name:

color-depth

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE

Display color depth to set on new display channels. If 0, don’t set.

New in version 0.7.

Deprecated since version 0.37: Deprecated due lack of support in drivers, only Windows 7 and older. This option is currently ignored.

SpiceClientGLib.Session.props.disable_effects
Name:

disable-effects

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

A string array of effects to disable. The settings will be applied on new display channels. The following effets can be disabled “wallpaper”, “font-smooth”, “animation”, and “all”, which will disable all the effects. If None, don’t apply changes.

New in version 0.7.

SpiceClientGLib.Session.props.enable_audio
Name:

enable-audio

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

If set to True, the audio channels will be enabled for playback and recording.

New in version 0.8.

SpiceClientGLib.Session.props.enable_smartcard
Name:

enable-smartcard

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

If set to True, the smartcard channel will be enabled and smartcard events will be forwarded to the guest

New in version 0.7.

SpiceClientGLib.Session.props.enable_usbredir
Name:

enable-usbredir

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

If set to True, the usbredir channel will be enabled and USB devices can be redirected to the guest

New in version 0.8.

SpiceClientGLib.Session.props.gl_scanout
Name:

gl-scanout

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether to enable gl-scanout (Unix only). Set to True by default on EGL-enabled host, unless SPICE_DISABLE_GL_SCANOUT environment variable is set.

New in version 0.36.

SpiceClientGLib.Session.props.glz_window_size
Name:

glz-window-size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Glz window size. If 0, don’t set.

New in version 0.9.

SpiceClientGLib.Session.props.host
Name:

host

Type:

str

Default Value:

'localhost'

Flags:

READABLE, WRITABLE, CONSTRUCT

URL of the SPICE host to connect to

SpiceClientGLib.Session.props.inhibit_keyboard_grab
Name:

inhibit-keyboard-grab

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Request that SpiceDisplays don’t grab the keyboard

SpiceClientGLib.Session.props.migration_state
Name:

migration-state

Type:

SpiceClientGLib.SessionMigration

Default Value:

SpiceClientGLib.SessionMigration.NONE

Flags:

READABLE

SpiceClientGLib.SessionMigration bit field indicating if a migration is in progress

SpiceClientGLib.Session.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE

Spice server name.

New in version 0.11.

SpiceClientGLib.Session.props.password
Name:

password

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

TLS password to use

SpiceClientGLib.Session.props.port
Name:

port

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Port to connect to for unencrypted sessions

SpiceClientGLib.Session.props.protocol
Name:

protocol

Type:

int

Default Value:

2

Flags:

READABLE, WRITABLE, CONSTRUCT

Version of the SPICE protocol to use

SpiceClientGLib.Session.props.proxy
Name:

proxy

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

URI to the proxy server to use when doing network connection. of the form [protocol://]<host>[:port]

New in version 0.17.

SpiceClientGLib.Session.props.pubkey
Name:

pubkey

Type:

GLib.ByteArray

Default Value:

None

Flags:

READABLE, WRITABLE

Public key to check

SpiceClientGLib.Session.props.read_only
Name:

read-only

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether this connection is read-only mode.

New in version 0.8.

SpiceClientGLib.Session.props.secure_channels
Name:

secure-channels

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

A string array of channel types to be secured.

New in version 0.20.

SpiceClientGLib.Session.props.share_dir_ro
Name:

share-dir-ro

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether to share the directory read-only.

New in version 0.28.

SpiceClientGLib.Session.props.shared_dir
Name:

shared-dir

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

Location of the shared directory

New in version 0.24.

SpiceClientGLib.Session.props.smartcard_certificates
Name:

smartcard-certificates

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

This property is used when one wants to simulate a smartcard with no hardware smartcard reader. If it’s set to a None-terminated string array containing the names of 3 valid certificates, these will be used to simulate a smartcard in the guest See also SpiceClientGLib.SmartcardManager.insert_card()

New in version 0.7.

SpiceClientGLib.Session.props.smartcard_db
Name:

smartcard-db

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Path to the NSS certificate database containing the certificates to use to simulate a software smartcard

New in version 0.7.

SpiceClientGLib.Session.props.tls_port
Name:

tls-port

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Port to connect to for TLS sessions

SpiceClientGLib.Session.props.unix_path
Name:

unix-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

Path of the Unix socket to connect to

New in version 0.28.

SpiceClientGLib.Session.props.uri
Name:

uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

URI of the SPICE host to connect to. The URI is of the form spice://hostname?port=XXX or spice://hostname?tls_port=XXX

SpiceClientGLib.Session.props.username
Name:

username

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Username to use

SpiceClientGLib.Session.props.uuid
Name:

uuid

Type:

int

Default Value:

None

Flags:

READABLE

Spice server uuid.

New in version 0.11.

SpiceClientGLib.Session.props.verify
Name:

verify

Type:

SpiceClientGLib.SessionVerify

Default Value:

SpiceClientGLib.SessionVerify.HOSTNAME

Flags:

READABLE, WRITABLE, CONSTRUCT

SpiceClientGLib.SessionVerify bit field indicating which parts of the peer certificate should be checked