Lobby2Plugin.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #ifndef __LOBBY_2_PLUGIN_H
  11. #define __LOBBY_2_PLUGIN_H
  12. #include "Lobby2Message.h"
  13. #include "PluginInterface2.h"
  14. #include "PacketPriority.h"
  15. #include "RakPeerInterface.h"
  16. /// \defgroup LOBBY_2_GROUP Lobby2Plugin
  17. /// \brief SQL based lobby system, with support for users, friends, clans, emails, ranking, and a message board
  18. /// \details
  19. /// \ingroup PLUGINS_GROUP
  20. /// \defgroup LOBBY_2_COMMANDS Lobby2Commands
  21. /// \brief Commands that can be sent to Lobby2Server from Lobby2Client
  22. /// \details
  23. /// \ingroup LOBBY_2_GROUP
  24. /// \defgroup LOBBY_2_NOTIFICATIONS Lobby2Notifications
  25. /// \brief Callbacks that the Lobby2System will send to you
  26. /// \details
  27. /// \ingroup LOBBY_2_GROUP
  28. /// \defgroup LOBBY_2_SERVER Lobby2Server
  29. /// \brief Runs the server modules that asynchronously processes Lobby2Message
  30. /// \details
  31. /// \ingroup LOBBY_2_GROUP
  32. /// \defgroup LOBBY_2_CLIENT Lobby2Client
  33. /// \brief Sends commands to Lobby2Server
  34. /// \details
  35. /// \ingroup LOBBY_2_GROUP
  36. namespace RakNet
  37. {
  38. /// \ingroup LOBBY_2_GROUP
  39. enum ServerErrors
  40. {
  41. // Class factory could not create a message of the given type
  42. // Followed by 4 bytes, with the message number
  43. L2SE_UNKNOWN_MESSAGE_ID,
  44. // Client is trying to run a function that requires admin access. Use Lobby2Server::AddAdminAddress() to add this client.
  45. L2SE_REQUIRES_ADMIN,
  46. };
  47. struct Lobby2MessageFactory;
  48. /// \brief Both Lobby2Server and Lobby2Client derive from this class
  49. /// \details
  50. /// \ingroup LOBBY_2_GROUP
  51. class RAK_DLL_EXPORT Lobby2Plugin : public PluginInterface2
  52. {
  53. public:
  54. Lobby2Plugin();
  55. virtual ~Lobby2Plugin();
  56. /// \brief Ordering channel to send messages on
  57. /// \param[in] oc The ordering channel
  58. void SetOrderingChannel(char oc);
  59. /// \brief Send priority to send messages on
  60. /// \param[in] pp The packet priority
  61. void SetSendPriority(PacketPriority pp);
  62. /// \brief Creates messages from message IDs
  63. /// \details Server should get a factory that creates messages with database functionality.<BR>
  64. /// Client can use the base class
  65. /// \param[in] f Class factory instance, which should remain valid for the scope of the plugin
  66. void SetMessageFactory(Lobby2MessageFactory *f);
  67. /// \brief Returns whatever was passed to SetMessageFactory()
  68. Lobby2MessageFactory* GetMessageFactory(void) const;
  69. /// \brief Set the callback to receive the results of operations via SendMsg()
  70. virtual void SetCallbackInterface(Lobby2Callbacks *cb);
  71. /// \brief You can have more than one callback to get called from the results of operations via SendMsg()
  72. virtual void AddCallbackInterface(Lobby2Callbacks *cb);
  73. /// \brief Removes a callback added with AddCallbackInterface();
  74. virtual void RemoveCallbackInterface(Lobby2Callbacks *cb);
  75. /// \brief Removes all callbacks added with AddCallbackInterface();
  76. virtual void ClearCallbackInterfaces();
  77. protected:
  78. char orderingChannel;
  79. PacketPriority packetPriority;
  80. Lobby2MessageFactory *msgFactory;
  81. DataStructures::List<Lobby2Callbacks*> callbacks;
  82. };
  83. }; // namespace RakNet
  84. #endif
粤ICP备19079148号