class_upnpdevice.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the UPNPDevice.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_UPNPDevice:
  6. UPNPDevice
  7. ==========
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. UPNP device.
  10. Description
  11. -----------
  12. 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.
  13. Properties
  14. ----------
  15. +---------------------------------------------+---------------------------------------------------------------------+--------+
  16. | :ref:`String<class_String>` | :ref:`description_url<class_UPNPDevice_property_description_url>` | ``""`` |
  17. +---------------------------------------------+---------------------------------------------------------------------+--------+
  18. | :ref:`String<class_String>` | :ref:`igd_control_url<class_UPNPDevice_property_igd_control_url>` | ``""`` |
  19. +---------------------------------------------+---------------------------------------------------------------------+--------+
  20. | :ref:`String<class_String>` | :ref:`igd_our_addr<class_UPNPDevice_property_igd_our_addr>` | ``""`` |
  21. +---------------------------------------------+---------------------------------------------------------------------+--------+
  22. | :ref:`String<class_String>` | :ref:`igd_service_type<class_UPNPDevice_property_igd_service_type>` | ``""`` |
  23. +---------------------------------------------+---------------------------------------------------------------------+--------+
  24. | :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` | :ref:`igd_status<class_UPNPDevice_property_igd_status>` | ``9`` |
  25. +---------------------------------------------+---------------------------------------------------------------------+--------+
  26. | :ref:`String<class_String>` | :ref:`service_type<class_UPNPDevice_property_service_type>` | ``""`` |
  27. +---------------------------------------------+---------------------------------------------------------------------+--------+
  28. Methods
  29. -------
  30. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :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| |
  32. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :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| |
  34. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`is_valid_gateway<class_UPNPDevice_method_is_valid_gateway>` **(** **)** |const| |
  36. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`query_external_address<class_UPNPDevice_method_query_external_address>` **(** **)** |const| |
  38. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Enumerations
  40. ------------
  41. .. _enum_UPNPDevice_IGDStatus:
  42. .. _class_UPNPDevice_constant_IGD_STATUS_OK:
  43. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_ERROR:
  44. .. _class_UPNPDevice_constant_IGD_STATUS_HTTP_EMPTY:
  45. .. _class_UPNPDevice_constant_IGD_STATUS_NO_URLS:
  46. .. _class_UPNPDevice_constant_IGD_STATUS_NO_IGD:
  47. .. _class_UPNPDevice_constant_IGD_STATUS_DISCONNECTED:
  48. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_DEVICE:
  49. .. _class_UPNPDevice_constant_IGD_STATUS_INVALID_CONTROL:
  50. .. _class_UPNPDevice_constant_IGD_STATUS_MALLOC_ERROR:
  51. .. _class_UPNPDevice_constant_IGD_STATUS_UNKNOWN_ERROR:
  52. enum **IGDStatus**:
  53. - **IGD_STATUS_OK** = **0** --- OK.
  54. - **IGD_STATUS_HTTP_ERROR** = **1** --- HTTP error.
  55. - **IGD_STATUS_HTTP_EMPTY** = **2** --- Empty HTTP response.
  56. - **IGD_STATUS_NO_URLS** = **3** --- Returned response contained no URLs.
  57. - **IGD_STATUS_NO_IGD** = **4** --- Not a valid IGD.
  58. - **IGD_STATUS_DISCONNECTED** = **5** --- Disconnected.
  59. - **IGD_STATUS_UNKNOWN_DEVICE** = **6** --- Unknown device.
  60. - **IGD_STATUS_INVALID_CONTROL** = **7** --- Invalid control.
  61. - **IGD_STATUS_MALLOC_ERROR** = **8** --- Memory allocation error.
  62. - **IGD_STATUS_UNKNOWN_ERROR** = **9** --- Unknown error.
  63. Property Descriptions
  64. ---------------------
  65. .. _class_UPNPDevice_property_description_url:
  66. - :ref:`String<class_String>` **description_url**
  67. +-----------+----------------------------+
  68. | *Default* | ``""`` |
  69. +-----------+----------------------------+
  70. | *Setter* | set_description_url(value) |
  71. +-----------+----------------------------+
  72. | *Getter* | get_description_url() |
  73. +-----------+----------------------------+
  74. URL to the device description.
  75. ----
  76. .. _class_UPNPDevice_property_igd_control_url:
  77. - :ref:`String<class_String>` **igd_control_url**
  78. +-----------+----------------------------+
  79. | *Default* | ``""`` |
  80. +-----------+----------------------------+
  81. | *Setter* | set_igd_control_url(value) |
  82. +-----------+----------------------------+
  83. | *Getter* | get_igd_control_url() |
  84. +-----------+----------------------------+
  85. IDG control URL.
  86. ----
  87. .. _class_UPNPDevice_property_igd_our_addr:
  88. - :ref:`String<class_String>` **igd_our_addr**
  89. +-----------+-------------------------+
  90. | *Default* | ``""`` |
  91. +-----------+-------------------------+
  92. | *Setter* | set_igd_our_addr(value) |
  93. +-----------+-------------------------+
  94. | *Getter* | get_igd_our_addr() |
  95. +-----------+-------------------------+
  96. Address of the local machine in the network connecting it to this ``UPNPDevice``.
  97. ----
  98. .. _class_UPNPDevice_property_igd_service_type:
  99. - :ref:`String<class_String>` **igd_service_type**
  100. +-----------+-----------------------------+
  101. | *Default* | ``""`` |
  102. +-----------+-----------------------------+
  103. | *Setter* | set_igd_service_type(value) |
  104. +-----------+-----------------------------+
  105. | *Getter* | get_igd_service_type() |
  106. +-----------+-----------------------------+
  107. IGD service type.
  108. ----
  109. .. _class_UPNPDevice_property_igd_status:
  110. - :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **igd_status**
  111. +-----------+-----------------------+
  112. | *Default* | ``9`` |
  113. +-----------+-----------------------+
  114. | *Setter* | set_igd_status(value) |
  115. +-----------+-----------------------+
  116. | *Getter* | get_igd_status() |
  117. +-----------+-----------------------+
  118. IGD status. See :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>`.
  119. ----
  120. .. _class_UPNPDevice_property_service_type:
  121. - :ref:`String<class_String>` **service_type**
  122. +-----------+-------------------------+
  123. | *Default* | ``""`` |
  124. +-----------+-------------------------+
  125. | *Setter* | set_service_type(value) |
  126. +-----------+-------------------------+
  127. | *Getter* | get_service_type() |
  128. +-----------+-------------------------+
  129. Service type.
  130. Method Descriptions
  131. -------------------
  132. .. _class_UPNPDevice_method_add_port_mapping:
  133. - :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|
  134. 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>`.
  135. ----
  136. .. _class_UPNPDevice_method_delete_port_mapping:
  137. - :ref:`int<class_int>` **delete_port_mapping** **(** :ref:`int<class_int>` port, :ref:`String<class_String>` proto="UDP" **)** |const|
  138. 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>`.
  139. ----
  140. .. _class_UPNPDevice_method_is_valid_gateway:
  141. - :ref:`bool<class_bool>` **is_valid_gateway** **(** **)** |const|
  142. Returns ``true`` if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
  143. ----
  144. .. _class_UPNPDevice_method_query_external_address:
  145. - :ref:`String<class_String>` **query_external_address** **(** **)** |const|
  146. Returns the external IP address of this ``UPNPDevice`` or an empty string.
  147. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  148. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  149. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`