GUPnPIgd.SimpleIgd¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
This |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This is to allow the application to control which #GUPnPContext this client should use. |
|
This means that mapping a port on a specific IGD has failed (it may still succeed on other IGDs on the network). |
|
This signal means that an IGD has been found that that adding a port mapping has succeeded. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class GUPnPIgd.SimpleIgd(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All members are private, access them using methods and properties
- classmethod new()¶
- Returns:
a new
GUPnPIgd.SimpleIgd
- Return type:
main context) This creates a new #GUPnpSimpleIgd object using the special
GLib.MainContext
- add_port(protocol, external_port, local_ip, local_port, lease_duration, description)¶
- Parameters:
protocol (
str
) – the protocol “UDP” or “TCP”external_port (
int
) – The port to try to open on the external device, 0 means to try a random port if the same port as the local port is already takenlocal_ip (
str
) – The IP address to forward packets to (most likely the local ip address)local_port (
int
) – The local port to forward packets tolease_duration (
int
) – The duration of the lease (it will be auto-renewed before it expires). This is in seconds.description (
str
) – The description that will appear in the router’s table
This adds a port to the router’s forwarding table. The mapping will be automatically refreshed by this object until it is either removed with
GUPnPIgd.SimpleIgd.remove_port
(),GUPnPIgd.SimpleIgd.remove_port_local
() or the object disapears.If there is a problem, the
GUPnPIgd.SimpleIgd
::error-mapping-port
signal will be emitted. If a router is found and a port is mapped correctly,GUPnPIgd.SimpleIgd
::mapped-external-port
will be emitted. These signals may be emitted multiple times if there are multiple routers present.
- delete_all_mappings()¶
-
Removes all mappings and prevents other from being formed Should only be called by the dispose function of subclasses
- remove_port(protocol, external_port)¶
- Parameters:
protocol (
str
) – the protocol “UDP” or “TCP” as given toGUPnPIgd.SimpleIgd.add_port
()external_port (
int
) – The port to try to open on the external device as given toGUPnPIgd.SimpleIgd.add_port
()
This tries to remove a port entry from the routers that was previously added with
GUPnPIgd.SimpleIgd.add_port
(). There is no indicated of success or failure it is a best effort mechanism. If it fails, the bindings will disapears after the lease duration set when the port where added.
- remove_port_local(protocol, local_ip, local_port)¶
- Parameters:
protocol (
str
) – the protocol “UDP” or “TCP” as given toGUPnPIgd.SimpleIgd.add_port
()local_ip (
str
) – The local ip on the internal device as was toGUPnPIgd.SimpleIgd.add_port
()local_port (
int
) – The port to try to open on the internal device as given toGUPnPIgd.SimpleIgd.add_port
()
This tries to remove a port entry from the routers that was previously added with
GUPnPIgd.SimpleIgd.add_port
(). There is no indicated of success or failure it is a best effort mechanism. If it fails, the bindings will disapears after the lease duration set when the port where added.
Signal Details¶
- GUPnPIgd.SimpleIgd.signals.context_available(simple_igd, context)¶
- Signal Name:
context-available
- Flags:
- Parameters:
simple_igd (
GUPnPIgd.SimpleIgd
) – The object which received the signalcontext (
GObject.Object
) – a #GUPnPContext
- Returns:
False
if the context should be used orTrue
if it should be ignored- Return type:
This is to allow the application to control which #GUPnPContext this client should use. If the application connects to this signal, it controls if a context will be used by changing the return value of the signal handler.
- GUPnPIgd.SimpleIgd.signals.error_mapping_port(simple_igd, error, proto, external_port, local_ip, local_port, description)¶
- Signal Name:
error-mapping-port
- Flags:
- Parameters:
simple_igd (
GUPnPIgd.SimpleIgd
) – The object which received the signalerror (
GLib.Error
) – aGLib.Error
proto (
str
) – The requested protocolexternal_port (
int
) – the external port requested inGUPnPIgd.SimpleIgd.add_port
()local_ip (
str
) – internal ip this is forwarded tolocal_port (
int
) – the local portdescription (
str
) – the passed description
This means that mapping a port on a specific IGD has failed (it may still succeed on other IGDs on the network).
- GUPnPIgd.SimpleIgd.signals.mapped_external_port(simple_igd, proto, external_ip, replaces_external_ip, external_port, local_ip, local_port, description)¶
- Signal Name:
mapped-external-port
- Flags:
- Parameters:
simple_igd (
GUPnPIgd.SimpleIgd
) – The object which received the signalproto (
str
) – the requested protocol (“UDP” or “TCP”)external_ip (
str
) – the external IPreplaces_external_ip (
str
) – if this mapping replaces another mapping, this is the old external IPexternal_port (
int
) – the external port that was allocatedlocal_ip (
str
) – IP address that the router should forward the packets to. It could be the address of another machine on the local networklocal_port (
int
) – the local portdescription (
str
) – the user’s selected description
This signal means that an IGD has been found that that adding a port mapping has succeeded.
Property Details¶
- GUPnPIgd.SimpleIgd.props.main_context¶
-
This
GLib.MainContext
will be used for all async activities