PacketPeerDTLS.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PacketPeerDTLS" inherits="PacketPeer" version="4.0">
  3. <brief_description>
  4. DTLS packet peer.
  5. </brief_description>
  6. <description>
  7. This class represents a DTLS peer connection. It can be used to connect to a DTLS server, and is returned by [method DTLSServer.take_connection].
  8. [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
  9. [b]Warning:[/b] SSL/TLS certificate revocation and certificate pinning are currently not supported. Revoked certificates are accepted as long as they are otherwise valid. If this is a concern, you may want to use automatically managed certificates with a short validity period.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="connect_to_peer">
  15. <return type="int" enum="Error" />
  16. <argument index="0" name="packet_peer" type="PacketPeerUDP" />
  17. <argument index="1" name="validate_certs" type="bool" default="true" />
  18. <argument index="2" name="for_hostname" type="String" default="&quot;&quot;" />
  19. <argument index="3" name="valid_certificate" type="X509Certificate" default="null" />
  20. <description>
  21. Connects a [code]peer[/code] beginning the DTLS handshake using the underlying [PacketPeerUDP] which must be connected (see [method PacketPeerUDP.connect_to_host]). If [code]validate_certs[/code] is [code]true[/code], [PacketPeerDTLS] will validate that the certificate presented by the remote peer and match it with the [code]for_hostname[/code] argument. You can specify a custom [X509Certificate] to use for validation via the [code]valid_certificate[/code] argument.
  22. </description>
  23. </method>
  24. <method name="disconnect_from_peer">
  25. <return type="void" />
  26. <description>
  27. Disconnects this peer, terminating the DTLS session.
  28. </description>
  29. </method>
  30. <method name="get_status" qualifiers="const">
  31. <return type="int" enum="PacketPeerDTLS.Status" />
  32. <description>
  33. Returns the status of the connection. See [enum Status] for values.
  34. </description>
  35. </method>
  36. <method name="poll">
  37. <return type="void" />
  38. <description>
  39. Poll the connection to check for incoming packets. Call this frequently to update the status and keep the connection working.
  40. </description>
  41. </method>
  42. </methods>
  43. <constants>
  44. <constant name="STATUS_DISCONNECTED" value="0" enum="Status">
  45. A status representing a [PacketPeerDTLS] that is disconnected.
  46. </constant>
  47. <constant name="STATUS_HANDSHAKING" value="1" enum="Status">
  48. A status representing a [PacketPeerDTLS] that is currently performing the handshake with a remote peer.
  49. </constant>
  50. <constant name="STATUS_CONNECTED" value="2" enum="Status">
  51. A status representing a [PacketPeerDTLS] that is connected to a remote peer.
  52. </constant>
  53. <constant name="STATUS_ERROR" value="3" enum="Status">
  54. A status representing a [PacketPeerDTLS] in a generic error state.
  55. </constant>
  56. <constant name="STATUS_ERROR_HOSTNAME_MISMATCH" value="4" enum="Status">
  57. An error status that shows a mismatch in the DTLS certificate domain presented by the host and the domain requested for validation.
  58. </constant>
  59. </constants>
  60. </class>