class_upnpdevice.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/modules/upnp/doc_classes/UPNPDevice.xml.
  6. .. _class_UPNPDevice:
  7. UPNPDevice
  8. ==========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Universal Plug and Play (UPnP) device.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Universal Plug and Play (UPnP) device. See :ref:`UPNP<class_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.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +---------------------------------------------+---------------------------------------------------------------------+--------+
  21. | :ref:`String<class_String>` | :ref:`description_url<class_UPNPDevice_property_description_url>` | ``""`` |
  22. +---------------------------------------------+---------------------------------------------------------------------+--------+
  23. | :ref:`String<class_String>` | :ref:`igd_control_url<class_UPNPDevice_property_igd_control_url>` | ``""`` |
  24. +---------------------------------------------+---------------------------------------------------------------------+--------+
  25. | :ref:`String<class_String>` | :ref:`igd_our_addr<class_UPNPDevice_property_igd_our_addr>` | ``""`` |
  26. +---------------------------------------------+---------------------------------------------------------------------+--------+
  27. | :ref:`String<class_String>` | :ref:`igd_service_type<class_UPNPDevice_property_igd_service_type>` | ``""`` |
  28. +---------------------------------------------+---------------------------------------------------------------------+--------+
  29. | :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` | :ref:`igd_status<class_UPNPDevice_property_igd_status>` | ``9`` |
  30. +---------------------------------------------+---------------------------------------------------------------------+--------+
  31. | :ref:`String<class_String>` | :ref:`service_type<class_UPNPDevice_property_service_type>` | ``""`` |
  32. +---------------------------------------------+---------------------------------------------------------------------+--------+
  33. .. rst-class:: classref-reftable-group
  34. Methods
  35. -------
  36. .. table::
  37. :widths: auto
  38. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`add_port_mapping<class_UPNPDevice_method_add_port_mapping>` **(** :ref:`int<class_int>` port, :ref:`int<class_int>` port_internal=0, :ref:`String<class_String>` desc="", :ref:`String<class_String>` proto="UDP", :ref:`int<class_int>` duration=0 **)** |const| |
  40. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`delete_port_mapping<class_UPNPDevice_method_delete_port_mapping>` **(** :ref:`int<class_int>` port, :ref:`String<class_String>` proto="UDP" **)** |const| |
  42. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`is_valid_gateway<class_UPNPDevice_method_is_valid_gateway>` **(** **)** |const| |
  44. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`String<class_String>` | :ref:`query_external_address<class_UPNPDevice_method_query_external_address>` **(** **)** |const| |
  46. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. .. rst-class:: classref-section-separator
  48. ----
  49. .. rst-class:: classref-descriptions-group
  50. Enumerations
  51. ------------
  52. .. _enum_UPNPDevice_IGDStatus:
  53. .. rst-class:: classref-enumeration
  54. enum **IGDStatus**:
  55. .. _class_UPNPDevice_constant_IGD_STATUS_OK:
  56. .. rst-class:: classref-enumeration-constant
  57. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_OK** = ``0``
  58. OK.
  59. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_ERROR:
  60. .. rst-class:: classref-enumeration-constant
  61. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_HTTP_ERROR** = ``1``
  62. HTTP error.
  63. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_EMPTY:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_HTTP_EMPTY** = ``2``
  66. Empty HTTP response.
  67. .. _class_UPNPDevice_constant_IGD_STATUS_NO_URLS:
  68. .. rst-class:: classref-enumeration-constant
  69. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_NO_URLS** = ``3``
  70. Returned response contained no URLs.
  71. .. _class_UPNPDevice_constant_IGD_STATUS_NO_IGD:
  72. .. rst-class:: classref-enumeration-constant
  73. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_NO_IGD** = ``4``
  74. Not a valid IGD.
  75. .. _class_UPNPDevice_constant_IGD_STATUS_DISCONNECTED:
  76. .. rst-class:: classref-enumeration-constant
  77. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_DISCONNECTED** = ``5``
  78. Disconnected.
  79. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_DEVICE:
  80. .. rst-class:: classref-enumeration-constant
  81. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_UNKNOWN_DEVICE** = ``6``
  82. Unknown device.
  83. .. _class_UPNPDevice_constant_IGD_STATUS_INVALID_CONTROL:
  84. .. rst-class:: classref-enumeration-constant
  85. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_INVALID_CONTROL** = ``7``
  86. Invalid control.
  87. .. _class_UPNPDevice_constant_IGD_STATUS_MALLOC_ERROR:
  88. .. rst-class:: classref-enumeration-constant
  89. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_MALLOC_ERROR** = ``8``
  90. Memory allocation error.
  91. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_ERROR:
  92. .. rst-class:: classref-enumeration-constant
  93. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **IGD_STATUS_UNKNOWN_ERROR** = ``9``
  94. Unknown error.
  95. .. rst-class:: classref-section-separator
  96. ----
  97. .. rst-class:: classref-descriptions-group
  98. Property Descriptions
  99. ---------------------
  100. .. _class_UPNPDevice_property_description_url:
  101. .. rst-class:: classref-property
  102. :ref:`String<class_String>` **description_url** = ``""``
  103. .. rst-class:: classref-property-setget
  104. - void **set_description_url** **(** :ref:`String<class_String>` value **)**
  105. - :ref:`String<class_String>` **get_description_url** **(** **)**
  106. URL to the device description.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_UPNPDevice_property_igd_control_url:
  110. .. rst-class:: classref-property
  111. :ref:`String<class_String>` **igd_control_url** = ``""``
  112. .. rst-class:: classref-property-setget
  113. - void **set_igd_control_url** **(** :ref:`String<class_String>` value **)**
  114. - :ref:`String<class_String>` **get_igd_control_url** **(** **)**
  115. IDG control URL.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_UPNPDevice_property_igd_our_addr:
  119. .. rst-class:: classref-property
  120. :ref:`String<class_String>` **igd_our_addr** = ``""``
  121. .. rst-class:: classref-property-setget
  122. - void **set_igd_our_addr** **(** :ref:`String<class_String>` value **)**
  123. - :ref:`String<class_String>` **get_igd_our_addr** **(** **)**
  124. Address of the local machine in the network connecting it to this **UPNPDevice**.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_UPNPDevice_property_igd_service_type:
  128. .. rst-class:: classref-property
  129. :ref:`String<class_String>` **igd_service_type** = ``""``
  130. .. rst-class:: classref-property-setget
  131. - void **set_igd_service_type** **(** :ref:`String<class_String>` value **)**
  132. - :ref:`String<class_String>` **get_igd_service_type** **(** **)**
  133. IGD service type.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_UPNPDevice_property_igd_status:
  137. .. rst-class:: classref-property
  138. :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **igd_status** = ``9``
  139. .. rst-class:: classref-property-setget
  140. - void **set_igd_status** **(** :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` value **)**
  141. - :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **get_igd_status** **(** **)**
  142. IGD status. See :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>`.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_UPNPDevice_property_service_type:
  146. .. rst-class:: classref-property
  147. :ref:`String<class_String>` **service_type** = ``""``
  148. .. rst-class:: classref-property-setget
  149. - void **set_service_type** **(** :ref:`String<class_String>` value **)**
  150. - :ref:`String<class_String>` **get_service_type** **(** **)**
  151. Service type.
  152. .. rst-class:: classref-section-separator
  153. ----
  154. .. rst-class:: classref-descriptions-group
  155. Method Descriptions
  156. -------------------
  157. .. _class_UPNPDevice_method_add_port_mapping:
  158. .. rst-class:: classref-method
  159. :ref:`int<class_int>` **add_port_mapping** **(** :ref:`int<class_int>` port, :ref:`int<class_int>` port_internal=0, :ref:`String<class_String>` desc="", :ref:`String<class_String>` proto="UDP", :ref:`int<class_int>` duration=0 **)** |const|
  160. 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<class_UPNP_method_add_port_mapping>`.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_UPNPDevice_method_delete_port_mapping:
  164. .. rst-class:: classref-method
  165. :ref:`int<class_int>` **delete_port_mapping** **(** :ref:`int<class_int>` port, :ref:`String<class_String>` proto="UDP" **)** |const|
  166. Deletes the port mapping identified by the given port and protocol combination on this device. See :ref:`UPNP.delete_port_mapping<class_UPNP_method_delete_port_mapping>`.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _class_UPNPDevice_method_is_valid_gateway:
  170. .. rst-class:: classref-method
  171. :ref:`bool<class_bool>` **is_valid_gateway** **(** **)** |const|
  172. Returns ``true`` if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_UPNPDevice_method_query_external_address:
  176. .. rst-class:: classref-method
  177. :ref:`String<class_String>` **query_external_address** **(** **)** |const|
  178. Returns the external IP address of this **UPNPDevice** or an empty string.
  179. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  180. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  181. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  182. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  183. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  184. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`