GSSDP.Client

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object GSSDP.Client GSSDP.Client GObject.Object->GSSDP.Client Gio.Initable->GSSDP.Client

Subclasses:None

Methods

Inherited:GObject.Object (37), Gio.Initable (2)
Structs:GObject.ObjectClass (5)
class new (iface)
class new_with_port (iface, msearch_port)
  add_cache_entry (ip_address, user_agent)
  append_header (name, value)
  clear_headers ()
  get_active ()
  get_address ()
  get_address_mask ()
  get_family ()
  get_host_ip ()
  get_index ()
  get_interface ()
  get_network ()
  get_server_id ()
  get_uda_version ()
  guess_user_agent (ip_address)
  remove_header (name)
  set_boot_id (boot_id)
  set_config_id (config_id)
  set_network (network)
  set_server_id (server_id)

Virtual Methods

Inherited:GObject.Object (7), Gio.Initable (1)

Properties

Name Type Flags Short Description
active bool r/w True if the client is active.
address-family Gio.SocketFamily r/w/co IP address family to prefer when creating the client
boot-id int r/w/c Value of the BOOTID.UPNP.ORG header
config-id int r/w/c Value of the CONFIGID.UPNP.ORG header
host-ip str r/w/c The IP address of the associatednetwork interface
host-mask Gio.InetAddressMask r/w/c The IP netmask of the associatednetwork interface
interface str r/w/co The name of the associated network interface.
msearch-port int r/w/co UDP port to use for M-SEARCH requests
network str r/w/c The network this client is currently connected to.
server-id str r/w The SSDP server’s identifier.
socket-ttl int r/w/co Time To Live for client’s sockets
uda-version GSSDP.UDAVersion r/w/co UPnP Device Architecture version on this client

Signals

Inherited:GObject.Object (1)
Name Short Description
message-received Internal signal.

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class GSSDP.Client(**kwargs)
Bases:GObject.Object, Gio.Initable
Abstract:No
Structure:GSSDP.ClientClass
classmethod new(iface)
Parameters:iface (str or None) – The name of the network interface, or None for auto-detection.
Raises:GLib.Error
Returns:A new GSSDP.Client object.
Return type:GSSDP.Client
classmethod new_with_port(iface, msearch_port)
Parameters:
  • iface (str or None) – The name of the network interface, or None for auto-detection.
  • msearch_port (int) – The network port to use for M-SEARCH requests or 0 for random.
Raises:

GLib.Error

Returns:

A new GSSDP.Client object.

Return type:

GSSDP.Client

add_cache_entry(ip_address, user_agent)
Parameters:
  • ip_address (str) – The host to add to the cache
  • user_agent (str) – User agent ot the host to add
append_header(name, value)
Parameters:
  • name (str) – Header name
  • value (str) – Header value

Adds a header field to the message sent by this self. It is intended to be used by clients requiring vendor specific header fields. (If there is an existing header with name name , then this creates a second one).

clear_headers()

Removes all the headers for this self.

get_active()
Returns:True if self is active, False otherwise.
Return type:bool
get_address()
Returns:The Gio.InetAddress this client works on
Return type:Gio.InetAddress
get_address_mask()
Returns:Address mask of this client
Return type:Gio.InetAddressMask

New in version 1.2.3.

get_family()
Returns:IP protocol version (Gio.SocketFamily.IPV4 or Gio.SocketFamily.IPV6) this client uses
Return type:Gio.SocketFamily
get_host_ip()
Returns:The IP address. This string should not be freed.
Return type:str

Get the IP address we advertise ourselves as using.

get_index()
Returns:The interface index of this client
Return type:int
get_interface()
Returns:The network interface name. This string should not be freed.
Return type:str

Get the name of the network interface associated to self.

get_network()
Returns:The network identification. This string should not be freed.
Return type:str

Get the network this client is associated with.

get_server_id()
Returns:The server ID.
Return type:str
get_uda_version()
Returns:the UDA protocol version this client adheres to
Return type:GSSDP.UDAVersion
guess_user_agent(ip_address)
Parameters:ip_address (str) – IP address to guess the user-agent for
Returns:The user-agent cached for this IP, None if none is cached.
Return type:str
remove_header(name)
Parameters:name (str) – Header name

Removes name from the list of headers . If there are multiple values for name, they are all removed.

set_boot_id(boot_id)
Parameters:boot_id (int) – The new boot-id for the client

Will set the new boot-id for this SSDP client. Does nothing if the UDA version used by the client is UDA 1.0

The boot-id is used to signalize changes in the network configuration for multi-homed hosts

set_config_id(config_id)
Parameters:config_id (int) – The new config-id for the client

The config-id is used to allow caching of the device or service description. It should be changed if that changes.

set_network(network)
Parameters:network (str) – The string identifying the network

Sets the network identification of self to network.

set_server_id(server_id)
Parameters:server_id (str) – The server ID

Sets the server ID of self to server_id.

Signal Details

GSSDP.Client.signals.message_received()
Signal Name:message-received
Flags:RUN_LAST

Internal signal.

Property Details

GSSDP.Client.props.active
Name:active
Type:bool
Default Value:True
Flags:READABLE, WRITABLE

Whether this client is active or not (passive). When active (default), the client sends messages on the network, otherwise not. In most cases, you don’t want to touch this property.

GSSDP.Client.props.address_family
Name:address-family
Type:Gio.SocketFamily
Default Value:Gio.SocketFamily.INVALID
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The IP protocol address family this client works on. When specified during construction without giving a concrete address, it will be used to determine the proper address.

If not specified, will contain the currrent address family after the call to Gio.Initable.init() . Use Gio.SocketFamily.INVALID to specifiy using the default socket family (legacy IP)

New in version 1.1.1.

GSSDP.Client.props.boot_id
Name:boot-id
Type:int
Default Value:-1
Flags:READABLE, WRITABLE, CONSTRUCT

The value of the BOOTID.UPNP.ORG header

New in version 1.1.2.

GSSDP.Client.props.config_id
Name:config-id
Type:int
Default Value:-1
Flags:READABLE, WRITABLE, CONSTRUCT

The value of the BOOTID.UPNP.ORG header

New in version 1.1.2.

GSSDP.Client.props.host_ip
Name:host-ip
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The IP address of the assoicated network interface.

GSSDP.Client.props.host_mask
Name:host-mask
Type:Gio.InetAddressMask
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The network mask of the assoicated network interface.

GSSDP.Client.props.interface
Name:interface
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The name of the network interface this client is associated with. Set to None to autodetect.

GSSDP.Client.props.msearch_port
Name:msearch-port
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

UDP port to use for sending multicast M-SEARCH requests on the network. If not set (or set to 0) a random port will be used. This property can be only set during object construction.

GSSDP.Client.props.network
Name:network
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The network this client is currently connected to. You could set this to anything you want to identify the network this client is associated with. If you are using #GUPnPContextManager and associated interface is a WiFi interface, this property is set to the ESSID of the network. Otherwise, expect this to be the network IP address by default.

GSSDP.Client.props.server_id
Name:server-id
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The SSDP server’s identifier.

GSSDP.Client.props.socket_ttl
Name:socket-ttl
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Time-to-live value to use for all sockets created by this client. If not set (or set to 0) the value recommended by UPnP will be used. This property can only be set during object construction.

GSSDP.Client.props.uda_version
Name:uda-version
Type:GSSDP.UDAVersion
Default Value:GSSDP.UDAVersion.VERSION_1_0
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The UPnP version the client adheres to.

New in version 1.1.1.