NetworkEvents.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Core/Object.h"
  5. namespace Urho3D
  6. {
  7. /// Server connection established.
  8. URHO3D_EVENT(E_SERVERCONNECTED, ServerConnected)
  9. {
  10. }
  11. /// Server connection disconnected.
  12. URHO3D_EVENT(E_SERVERDISCONNECTED, ServerDisconnected)
  13. {
  14. }
  15. /// Server connection failed.
  16. URHO3D_EVENT(E_CONNECTFAILED, ConnectFailed)
  17. {
  18. }
  19. /// Server connection failed because its already connected or tries to connect already.
  20. URHO3D_EVENT(E_CONNECTIONINPROGRESS, ConnectionInProgress)
  21. {
  22. }
  23. /// New client connection established.
  24. URHO3D_EVENT(E_CLIENTCONNECTED, ClientConnected)
  25. {
  26. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  27. }
  28. /// Client connection disconnected.
  29. URHO3D_EVENT(E_CLIENTDISCONNECTED, ClientDisconnected)
  30. {
  31. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  32. }
  33. /// Client has sent identity: identity map is in the event data.
  34. URHO3D_EVENT(E_CLIENTIDENTITY, ClientIdentity)
  35. {
  36. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  37. URHO3D_PARAM(P_ALLOW, Allow); // bool
  38. }
  39. /// Client has informed to have loaded the scene.
  40. URHO3D_EVENT(E_CLIENTSCENELOADED, ClientSceneLoaded)
  41. {
  42. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  43. }
  44. /// Unhandled network message received.
  45. URHO3D_EVENT(E_NETWORKMESSAGE, NetworkMessage)
  46. {
  47. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  48. URHO3D_PARAM(P_MESSAGEID, MessageID); // int
  49. URHO3D_PARAM(P_DATA, Data); // Buffer
  50. }
  51. /// About to send network update on the client or server.
  52. URHO3D_EVENT(E_NETWORKUPDATE, NetworkUpdate)
  53. {
  54. }
  55. /// Network update has been sent on the client or server.
  56. URHO3D_EVENT(E_NETWORKUPDATESENT, NetworkUpdateSent)
  57. {
  58. }
  59. /// Scene load failed, either due to file not found or checksum error.
  60. URHO3D_EVENT(E_NETWORKSCENELOADFAILED, NetworkSceneLoadFailed)
  61. {
  62. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  63. }
  64. /// Remote event: adds Connection parameter to the event data.
  65. URHO3D_EVENT(E_REMOTEEVENTDATA, RemoteEventData)
  66. {
  67. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  68. }
  69. /// Server refuses client connection because of the ban.
  70. URHO3D_EVENT(E_NETWORKBANNED, NetworkBanned)
  71. {
  72. }
  73. /// Server refuses connection because of invalid password.
  74. URHO3D_EVENT(E_NETWORKINVALIDPASSWORD, NetworkInvalidPassword)
  75. {
  76. }
  77. /// When LAN discovery found hosted server.
  78. URHO3D_EVENT(E_NETWORKHOSTDISCOVERED, NetworkHostDiscovered)
  79. {
  80. URHO3D_PARAM(P_ADDRESS, Address); // String
  81. URHO3D_PARAM(P_PORT, Port); // int
  82. URHO3D_PARAM(P_BEACON, Beacon); // VariantMap
  83. }
  84. /// NAT punchtrough succeeds.
  85. URHO3D_EVENT(E_NETWORKNATPUNCHTROUGHSUCCEEDED, NetworkNatPunchtroughSucceeded)
  86. {
  87. URHO3D_PARAM(P_ADDRESS, Address); // String
  88. URHO3D_PARAM(P_PORT, Port); // int
  89. }
  90. /// NAT punchtrough fails.
  91. URHO3D_EVENT(E_NETWORKNATPUNCHTROUGHFAILED, NetworkNatPunchtroughFailed)
  92. {
  93. URHO3D_PARAM(P_ADDRESS, Address); // String
  94. URHO3D_PARAM(P_PORT, Port); // int
  95. }
  96. /// Connecting to NAT master server failed.
  97. URHO3D_EVENT(E_NATMASTERCONNECTIONFAILED, NetworkNatMasterConnectionFailed)
  98. {
  99. }
  100. /// Connecting to NAT master server succeeded.
  101. URHO3D_EVENT(E_NATMASTERCONNECTIONSUCCEEDED, NetworkNatMasterConnectionSucceeded)
  102. {
  103. }
  104. /// Disconnected from NAT master server.
  105. URHO3D_EVENT(E_NATMASTERDISCONNECTED, NetworkNatMasterDisconnected)
  106. {
  107. }
  108. }