:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/upnp/doc_classes/UPNPDevice.xml. .. _class_UPNPDevice: UPNPDevice ========== **Inherits:** :ref:`Reference` **<** :ref:`Object` Universal Plug and Play (UPnP) device. .. rst-class:: classref-introduction-group Description ----------- Universal Plug and Play (UPnP) device. See :ref:`UPNP` for UPnP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`String` | :ref:`description_url` | ``""`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`String` | :ref:`igd_control_url` | ``""`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`String` | :ref:`igd_our_addr` | ``""`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`String` | :ref:`igd_service_type` | ``""`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`IGDStatus` | :ref:`igd_status` | ``9`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ | :ref:`String` | :ref:`service_type` | ``""`` | +---------------------------------------------+---------------------------------------------------------------------+--------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`add_port_mapping` **(** :ref:`int` port, :ref:`int` port_internal=0, :ref:`String` desc="", :ref:`String` proto="UDP", :ref:`int` duration=0 **)** |const| | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`delete_port_mapping` **(** :ref:`int` port, :ref:`String` proto="UDP" **)** |const| | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_valid_gateway` **(** **)** |const| | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`query_external_address` **(** **)** |const| | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_UPNPDevice_IGDStatus: .. rst-class:: classref-enumeration enum **IGDStatus**: .. _class_UPNPDevice_constant_IGD_STATUS_OK: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_OK** = ``0`` OK. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_ERROR: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_HTTP_ERROR** = ``1`` HTTP error. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_EMPTY: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_HTTP_EMPTY** = ``2`` Empty HTTP response. .. _class_UPNPDevice_constant_IGD_STATUS_NO_URLS: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_NO_URLS** = ``3`` Returned response contained no URLs. .. _class_UPNPDevice_constant_IGD_STATUS_NO_IGD: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_NO_IGD** = ``4`` Not a valid IGD. .. _class_UPNPDevice_constant_IGD_STATUS_DISCONNECTED: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_DISCONNECTED** = ``5`` Disconnected. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_DEVICE: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_UNKNOWN_DEVICE** = ``6`` Unknown device. .. _class_UPNPDevice_constant_IGD_STATUS_INVALID_CONTROL: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_INVALID_CONTROL** = ``7`` Invalid control. .. _class_UPNPDevice_constant_IGD_STATUS_MALLOC_ERROR: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_MALLOC_ERROR** = ``8`` Memory allocation error. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_ERROR: .. rst-class:: classref-enumeration-constant :ref:`IGDStatus` **IGD_STATUS_UNKNOWN_ERROR** = ``9`` Unknown error. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_UPNPDevice_property_description_url: .. rst-class:: classref-property :ref:`String` **description_url** = ``""`` .. rst-class:: classref-property-setget - void **set_description_url** **(** :ref:`String` value **)** - :ref:`String` **get_description_url** **(** **)** URL to the device description. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_property_igd_control_url: .. rst-class:: classref-property :ref:`String` **igd_control_url** = ``""`` .. rst-class:: classref-property-setget - void **set_igd_control_url** **(** :ref:`String` value **)** - :ref:`String` **get_igd_control_url** **(** **)** IDG control URL. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_property_igd_our_addr: .. rst-class:: classref-property :ref:`String` **igd_our_addr** = ``""`` .. rst-class:: classref-property-setget - void **set_igd_our_addr** **(** :ref:`String` value **)** - :ref:`String` **get_igd_our_addr** **(** **)** Address of the local machine in the network connecting it to this **UPNPDevice**. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_property_igd_service_type: .. rst-class:: classref-property :ref:`String` **igd_service_type** = ``""`` .. rst-class:: classref-property-setget - void **set_igd_service_type** **(** :ref:`String` value **)** - :ref:`String` **get_igd_service_type** **(** **)** IGD service type. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_property_igd_status: .. rst-class:: classref-property :ref:`IGDStatus` **igd_status** = ``9`` .. rst-class:: classref-property-setget - void **set_igd_status** **(** :ref:`IGDStatus` value **)** - :ref:`IGDStatus` **get_igd_status** **(** **)** IGD status. See :ref:`IGDStatus`. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_property_service_type: .. rst-class:: classref-property :ref:`String` **service_type** = ``""`` .. rst-class:: classref-property-setget - void **set_service_type** **(** :ref:`String` value **)** - :ref:`String` **get_service_type** **(** **)** Service type. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_UPNPDevice_method_add_port_mapping: .. rst-class:: classref-method :ref:`int` **add_port_mapping** **(** :ref:`int` port, :ref:`int` port_internal=0, :ref:`String` desc="", :ref:`String` proto="UDP", :ref:`int` duration=0 **)** |const| Adds a port mapping to forward the given external port on this **UPNPDevice** for the given protocol to the local machine. See :ref:`UPNP.add_port_mapping`. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_method_delete_port_mapping: .. rst-class:: classref-method :ref:`int` **delete_port_mapping** **(** :ref:`int` port, :ref:`String` proto="UDP" **)** |const| Deletes the port mapping identified by the given port and protocol combination on this device. See :ref:`UPNP.delete_port_mapping`. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_method_is_valid_gateway: .. rst-class:: classref-method :ref:`bool` **is_valid_gateway** **(** **)** |const| Returns ``true`` if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding. .. rst-class:: classref-item-separator ---- .. _class_UPNPDevice_method_query_external_address: .. rst-class:: classref-method :ref:`String` **query_external_address** **(** **)** |const| Returns the external IP address of this **UPNPDevice** or an empty string. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`