IP.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="IP" inherits="Object" category="Core" version="3.1">
  3. <brief_description>
  4. Internet protocol (IP) support functions like DNS resolution.
  5. </brief_description>
  6. <description>
  7. IP contains support functions for the Internet Protocol (IP). TCP/IP support is in different classes (see [StreamPeerTCP] and [TCP_Server]). IP provides DNS hostname resolution support, both blocking and threaded.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="clear_cache">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="hostname" type="String" default="&quot;&quot;">
  18. </argument>
  19. <description>
  20. Removes all of a "hostname"'s cached references. If no "hostname" is given then all cached IP addresses are removed.
  21. </description>
  22. </method>
  23. <method name="erase_resolve_item">
  24. <return type="void">
  25. </return>
  26. <argument index="0" name="id" type="int">
  27. </argument>
  28. <description>
  29. Removes a given item "id" from the queue. This should be used to free a queue after it has completed to enable more queries to happen.
  30. </description>
  31. </method>
  32. <method name="get_local_addresses" qualifiers="const">
  33. <return type="Array">
  34. </return>
  35. <description>
  36. Returns all of the user's current IPv4 and IPv6 addresses as an array.
  37. </description>
  38. </method>
  39. <method name="get_resolve_item_address" qualifiers="const">
  40. <return type="String">
  41. </return>
  42. <argument index="0" name="id" type="int">
  43. </argument>
  44. <description>
  45. Returns a queued hostname's IP address, given its queue "id". Returns an empty string on error or if resolution hasn't happened yet (see [method get_resolve_item_status]).
  46. </description>
  47. </method>
  48. <method name="get_resolve_item_status" qualifiers="const">
  49. <return type="int" enum="IP.ResolverStatus">
  50. </return>
  51. <argument index="0" name="id" type="int">
  52. </argument>
  53. <description>
  54. Returns a queued hostname's status as a RESOLVER_STATUS_* constant, given its queue "id".
  55. </description>
  56. </method>
  57. <method name="resolve_hostname">
  58. <return type="String">
  59. </return>
  60. <argument index="0" name="host" type="String">
  61. </argument>
  62. <argument index="1" name="ip_type" type="int" enum="IP.Type" default="3">
  63. </argument>
  64. <description>
  65. Returns a given hostname's IPv4 or IPv6 address when resolved (blocking-type method). The address type returned depends on the TYPE_* constant given as "ip_type".
  66. </description>
  67. </method>
  68. <method name="resolve_hostname_queue_item">
  69. <return type="int">
  70. </return>
  71. <argument index="0" name="host" type="String">
  72. </argument>
  73. <argument index="1" name="ip_type" type="int" enum="IP.Type" default="3">
  74. </argument>
  75. <description>
  76. Creates a queue item to resolve a hostname to an IPv4 or IPv6 address depending on the TYPE_* constant given as "ip_type". Returns the queue ID if successful, or RESOLVER_INVALID_ID on error.
  77. </description>
  78. </method>
  79. </methods>
  80. <constants>
  81. <constant name="RESOLVER_STATUS_NONE" value="0" enum="ResolverStatus">
  82. DNS hostname resolver status: No status.
  83. </constant>
  84. <constant name="RESOLVER_STATUS_WAITING" value="1" enum="ResolverStatus">
  85. DNS hostname resolver status: Waiting.
  86. </constant>
  87. <constant name="RESOLVER_STATUS_DONE" value="2" enum="ResolverStatus">
  88. DNS hostname resolver status: Done.
  89. </constant>
  90. <constant name="RESOLVER_STATUS_ERROR" value="3" enum="ResolverStatus">
  91. DNS hostname resolver status: Error.
  92. </constant>
  93. <constant name="RESOLVER_MAX_QUERIES" value="32">
  94. Maximum number of concurrent DNS resolver queries allowed, [code]RESOLVER_INVALID_ID[/code] is returned if exceeded.
  95. </constant>
  96. <constant name="RESOLVER_INVALID_ID" value="-1">
  97. Invalid ID constant. Returned if [code]RESOLVER_MAX_QUERIES[/code] is exceeded.
  98. </constant>
  99. <constant name="TYPE_NONE" value="0" enum="Type">
  100. Address type: None.
  101. </constant>
  102. <constant name="TYPE_IPV4" value="1" enum="Type">
  103. Address type: Internet protocol version 4 (IPv4).
  104. </constant>
  105. <constant name="TYPE_IPV6" value="2" enum="Type">
  106. Address type: Internet protocol version 6 (IPv6).
  107. </constant>
  108. <constant name="TYPE_ANY" value="3" enum="Type">
  109. Address type: Any.
  110. </constant>
  111. </constants>
  112. </class>