PacketPeerDTLS.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PacketPeerDTLS" inherits="PacketPeer" version="3.4">
  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. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="connect_to_peer">
  13. <return type="int" enum="Error">
  14. </return>
  15. <argument index="0" name="packet_peer" type="PacketPeerUDP">
  16. </argument>
  17. <argument index="1" name="validate_certs" type="bool" default="true">
  18. </argument>
  19. <argument index="2" name="for_hostname" type="String" default="&quot;&quot;">
  20. </argument>
  21. <argument index="3" name="valid_certificate" type="X509Certificate" default="null">
  22. </argument>
  23. <description>
  24. 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.
  25. </description>
  26. </method>
  27. <method name="disconnect_from_peer">
  28. <return type="void">
  29. </return>
  30. <description>
  31. Disconnects this peer, terminating the DTLS session.
  32. </description>
  33. </method>
  34. <method name="get_status" qualifiers="const">
  35. <return type="int" enum="PacketPeerDTLS.Status">
  36. </return>
  37. <description>
  38. Returns the status of the connection. See [enum Status] for values.
  39. </description>
  40. </method>
  41. <method name="poll">
  42. <return type="void">
  43. </return>
  44. <description>
  45. Poll the connection to check for incoming packets. Call this frequently to update the status and keep the connection working.
  46. </description>
  47. </method>
  48. </methods>
  49. <constants>
  50. <constant name="STATUS_DISCONNECTED" value="0" enum="Status">
  51. A status representing a [PacketPeerDTLS] that is disconnected.
  52. </constant>
  53. <constant name="STATUS_HANDSHAKING" value="1" enum="Status">
  54. A status representing a [PacketPeerDTLS] that is currently performing the handshake with a remote peer.
  55. </constant>
  56. <constant name="STATUS_CONNECTED" value="2" enum="Status">
  57. A status representing a [PacketPeerDTLS] that is connected to a remote peer.
  58. </constant>
  59. <constant name="STATUS_ERROR" value="3" enum="Status">
  60. A status representing a [PacketPeerDTLS] in a generic error state.
  61. </constant>
  62. <constant name="STATUS_ERROR_HOSTNAME_MISMATCH" value="4" enum="Status">
  63. An error status that shows a mismatch in the DTLS certificate domain presented by the host and the domain requested for validation.
  64. </constant>
  65. </constants>
  66. </class>