class_upnpdevice.rst 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. UPNP device.
  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>` |
  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. Description
  64. -----------
  65. 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.
  66. Property Descriptions
  67. ---------------------
  68. .. _class_UPNPDevice_property_description_url:
  69. - :ref:`String<class_String>` **description_url**
  70. +----------+----------------------------+
  71. | *Setter* | set_description_url(value) |
  72. +----------+----------------------------+
  73. | *Getter* | get_description_url() |
  74. +----------+----------------------------+
  75. URL to the device description.
  76. ----
  77. .. _class_UPNPDevice_property_igd_control_url:
  78. - :ref:`String<class_String>` **igd_control_url**
  79. +----------+----------------------------+
  80. | *Setter* | set_igd_control_url(value) |
  81. +----------+----------------------------+
  82. | *Getter* | get_igd_control_url() |
  83. +----------+----------------------------+
  84. IDG control URL.
  85. ----
  86. .. _class_UPNPDevice_property_igd_our_addr:
  87. - :ref:`String<class_String>` **igd_our_addr**
  88. +----------+-------------------------+
  89. | *Setter* | set_igd_our_addr(value) |
  90. +----------+-------------------------+
  91. | *Getter* | get_igd_our_addr() |
  92. +----------+-------------------------+
  93. Address of the local machine in the network connecting it to this :ref:`UPNPDevice<class_UPNPDevice>`.
  94. ----
  95. .. _class_UPNPDevice_property_igd_service_type:
  96. - :ref:`String<class_String>` **igd_service_type**
  97. +----------+-----------------------------+
  98. | *Setter* | set_igd_service_type(value) |
  99. +----------+-----------------------------+
  100. | *Getter* | get_igd_service_type() |
  101. +----------+-----------------------------+
  102. IGD service type.
  103. ----
  104. .. _class_UPNPDevice_property_igd_status:
  105. - :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>` **igd_status**
  106. +----------+-----------------------+
  107. | *Setter* | set_igd_status(value) |
  108. +----------+-----------------------+
  109. | *Getter* | get_igd_status() |
  110. +----------+-----------------------+
  111. IGD status. See :ref:`IGDStatus<enum_UPNPDevice_IGDStatus>`.
  112. ----
  113. .. _class_UPNPDevice_property_service_type:
  114. - :ref:`String<class_String>` **service_type**
  115. +----------+-------------------------+
  116. | *Setter* | set_service_type(value) |
  117. +----------+-------------------------+
  118. | *Getter* | get_service_type() |
  119. +----------+-------------------------+
  120. Service type.
  121. Method Descriptions
  122. -------------------
  123. .. _class_UPNPDevice_method_add_port_mapping:
  124. - :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
  125. Adds a port mapping to forward the given external port on this :ref:`UPNPDevice<class_UPNPDevice>` for the given protocol to the local machine. See :ref:`UPNP.add_port_mapping<class_UPNP_method_add_port_mapping>`.
  126. ----
  127. .. _class_UPNPDevice_method_delete_port_mapping:
  128. - :ref:`int<class_int>` **delete_port_mapping** **(** :ref:`int<class_int>` port, :ref:`String<class_String>` proto="UDP" **)** const
  129. 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>`.
  130. ----
  131. .. _class_UPNPDevice_method_is_valid_gateway:
  132. - :ref:`bool<class_bool>` **is_valid_gateway** **(** **)** const
  133. Returns ``true`` if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
  134. ----
  135. .. _class_UPNPDevice_method_query_external_address:
  136. - :ref:`String<class_String>` **query_external_address** **(** **)** const
  137. Returns the external IP address of this :ref:`UPNPDevice<class_UPNPDevice>` or an empty string.