GSSDP.Client¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
|
||
r/w/co |
The internet address of the client |
||
r/w/co |
IP address family to prefer when creating the client |
||
r/w/c |
Value of the BOOTID.UPNP.ORG header |
||
r/w/c |
Value of the CONFIGID.UPNP.ORG header |
||
r/w/co |
The IP address of the associatednetwork interface |
||
r/w/co |
The IP netmask of the associatednetwork interface |
||
r/w/co |
The name of the associated network interface. |
||
r/w/co |
UDP port to use for M-SEARCH requests |
||
r/w/co |
The network this client is currently connected to. |
||
r/w/co |
UDP port to use for M-SEARCH requests |
||
r/w |
The SSDP server’s identifier. |
||
r/w/co |
Time To Live for client’s sockets |
||
r/w/co |
UPnP Device Architecture version on this client |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Internal signal. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class GSSDP.Client(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A simple SSDP bus handler.
The [classGSSDP.Client] will usually be used by the [classGSSDP.ResourceGroup] for announcing or the [classGSSDP.ResourceBrowser] for finding resources on the network.
A
GSSDP.Client
is required per IP address that you want to use, even if those belong t the same network device.- classmethod new(iface)¶
- Parameters:
iface (
str
orNone
) – The name of the network interface, orNone
for auto-detection.- Raises:
- Returns:
A new
GSSDP.Client
object.- Return type:
GSSDP.Client
orNone
Creates a GSSDP client on iface.
GSSDP.Client
will pick the address it finds suitable for using.Using this utility function, the created client will be using UDA 1.0 and IPv4 only.
Deprecated since version 1.6.: Use [ctorGSSDP.Client.new_for_address] instead.
- classmethod new_for_address(addr, port, uda_version)¶
- Parameters:
addr (
Gio.InetAddress
orNone
) – an IP address orNone
for auto-detection. If you do not care about the address, but want to specify an address family, use [ctor`Glib`.InetAddress.new_any] with the appropriate family instead.port (
int
) – The network port to use for M-SEARCH requests or 0 for random.uda_version (
GSSDP.UDAVersion
) – The UDA version this client will adhere to
- Raises:
- Returns:
A new
GSSDP.Client
object orNone
on error.- Return type:
GSSDP.Client
orNone
Creates a GSSDP client with address addr. If none is specified, GSSDP will chose the address it deems most suitable.
New in version 1.6..
- classmethod new_full(iface, addr, port, uda_version)¶
- Parameters:
addr (
Gio.InetAddress
orNone
) – an IP address orNone
for auto-detection. If you do not care about the address, but want to specify an address family, use [ctor`Glib`.InetAddress.new_any] with the appropriate family instead.port (
int
) – The network port to use for M-SEARCH requests or 0 for random.uda_version (
GSSDP.UDAVersion
) – The UDA version this client will adhere to
- Raises:
- Returns:
A new
GSSDP.Client
object orNone
on error.- Return type:
GSSDP.Client
orNone
Creates a GSSDP client with address addr. If none is specified, GSSDP will chose the address it deems most suitable.
New in version 1.6..
- classmethod new_with_port(iface, msearch_port)¶
- Parameters:
- Raises:
- Returns:
A new
GSSDP.Client
object orNone
on error.- Return type:
GSSDP.Client
orNone
Creates a GSSDP client on iface.
GSSDP.Client
will pick the address it finds suitable for using.Using this utility function, the created client will be using UDA 1.0 and IPv4 only.
Deprecated since version 1.6.: Use [ctorGSSDP.Client.new_for_address] instead.
- add_cache_entry(ip_address, user_agent)¶
- Parameters:
Add user_agent for ip_address.
Each [classGSSDP.Client] maintains a mapping of addresses (MAC on systems that support it, IP addresses otherwise) to User Agents.
This information can be used in higher layers to get an User-Agent for devices that do not set the User-Agent header in their SOAP requests.
- append_header(name, value)¶
-
Adds a header field to the messages 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 it will append another one.
- can_reach(address)¶
- Parameters:
address (
Gio.InetSocketAddress
) – AGio.InetSocketAddress
of the target. The port part of the address may be 0- Returns:
- Return type:
Check if the peer at address is reachable using this self.
New in version 1.2.4.
- clear_headers()¶
Removes all the headers for this self.
- get_active()¶
-
Get the current state of the client. See [propertyGSSDP.Client:active] for details.
- get_address()¶
- Returns:
The
Gio.InetAddress
this client works on- Return type:
The IP address this client works on.
- get_address_mask()¶
- Returns:
Address mask of this client
- Return type:
New in version 1.2.3.
- get_family()¶
- Returns:
IP protocol version (
Gio.SocketFamily.IPV4
orGio.SocketFamily.IPV6
) this client uses- Return type:
- get_host_ip()¶
- Returns:
The IP address. This string should not be freed.
- Return type:
Get the IP address we advertise ourselves as using.
- get_interface()¶
- Returns:
The network interface name. This string should not be freed.
- Return type:
Get the name of the network interface associated to self.
- get_network()¶
- Returns:
The network identification. This string should not be freed.
- Return type:
Get the network identifier of the client. See [propertyGSSDP.Client:network] for details.
- get_uda_version()¶
- Returns:
the UDA protocol version this client adheres to
- Return type:
- 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:
Try to get a User-Agent for ip_address.
- 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. This string is used as the “Server:” identification header for SSDP discovery and response packets and “User-Agent” header for searches.
By default, GSSDP will generate a header conforming to the requirements defined in the UDA documents: OS/Version UPnP/Version GSSDP/Version.
Signal Details¶
Property Details¶
- GSSDP.Client.props.active¶
-
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¶
- Name:
address
- Type:
- Default Value:
- Flags:
The network address this client is bound to.
New in version 1.6.
- GSSDP.Client.props.address_family¶
- Name:
address-family
- Type:
- Default Value:
- Flags:
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 [method`Glib`.Initable.init]. Use
Gio.SocketFamily.INVALID
to specifiy using the default socket family (legacy IP)New in version 1.2.0.
- GSSDP.Client.props.boot_id¶
-
The value of the BOOTID.UPNP.ORG header
New in version 1.2.0.
- GSSDP.Client.props.config_id¶
-
The value of the CONFIGID.UPNP.ORG header
New in version 1.2.0.
- GSSDP.Client.props.host_ip¶
- Name:
host-ip
- Type:
- Default Value:
- Flags:
The IP address of the assoicated network interface.
Deprecated since version 1.6.: Use [propertyGSSDP.Client:address] instead.
- GSSDP.Client.props.host_mask¶
- Name:
host-mask
- Type:
- Default Value:
- Flags:
The network mask of the assoicated network interface.
- GSSDP.Client.props.interface¶
- Name:
interface
- Type:
- Default Value:
- Flags:
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:
- Default Value:
0
- Flags:
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.
Deprecated since version 1.6.0: Use [propertyGSSDP.Client:port] instead
- GSSDP.Client.props.network¶
- Name:
network
- Type:
- Default Value:
- Flags:
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.port¶
- Name:
port
- Type:
- Default Value:
0
- Flags:
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.
New in version 1.6.0.
- GSSDP.Client.props.server_id¶
-
The SSDP server’s identifier.
- GSSDP.Client.props.socket_ttl¶
- Name:
socket-ttl
- Type:
- Default Value:
0
- Flags:
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:
- Default Value:
- Flags:
The UPnP version the client adheres to.
New in version 1.2.0.