1 #ifndef __LOBBY_2_PLUGIN_H
2 #define __LOBBY_2_PLUGIN_H
3 
4 #include "Lobby2Message.h"
5 #include "PluginInterface2.h"
6 #include "PacketPriority.h"
7 #include "RakPeerInterface.h"
8 
9 /// \defgroup LOBBY_2_GROUP Lobby2Plugin
10 /// \brief SQL based lobby system, with support for users, friends, clans, emails, ranking, and a message board
11 /// \details
12 /// \ingroup PLUGINS_GROUP
13 
14 /// \defgroup LOBBY_2_COMMANDS Lobby2Commands
15 /// \brief Commands that can be sent to Lobby2Server from Lobby2Client
16 /// \details
17 /// \ingroup LOBBY_2_GROUP
18 
19 /// \defgroup LOBBY_2_NOTIFICATIONS Lobby2Notifications
20 /// \brief Callbacks that the Lobby2System will send to you
21 /// \details
22 /// \ingroup LOBBY_2_GROUP
23 
24 /// \defgroup LOBBY_2_SERVER Lobby2Server
25 /// \brief Runs the server modules that asynchronously processes Lobby2Message
26 /// \details
27 /// \ingroup LOBBY_2_GROUP
28 
29 /// \defgroup LOBBY_2_CLIENT Lobby2Client
30 /// \brief Sends commands to Lobby2Server
31 /// \details
32 /// \ingroup LOBBY_2_GROUP
33 
34 
35 namespace RakNet
36 {
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 
48 struct Lobby2MessageFactory;
49 
50 /// \brief Both Lobby2Server and Lobby2Client derive from this class
51 /// \details
52 /// \ingroup LOBBY_2_GROUP
53 class RAK_DLL_EXPORT Lobby2Plugin : public PluginInterface2
54 {
55 public:
56 	Lobby2Plugin();
57 	virtual ~Lobby2Plugin();
58 
59 	/// \brief Ordering channel to send messages on
60 	/// \param[in] oc The ordering channel
61 	void SetOrderingChannel(char oc);
62 
63 	/// \brief Send priority to send messages on
64 	/// \param[in] pp The packet priority
65 	void SetSendPriority(PacketPriority pp);
66 
67 	/// \brief Creates messages from message IDs
68 	/// \details Server should get a factory that creates messages with database functionality.<BR>
69 	/// Client can use the base class
70 	/// \param[in] f Class factory instance, which should remain valid for the scope of the plugin
71 	void SetMessageFactory(Lobby2MessageFactory *f);
72 
73 	/// \brief Returns whatever was passed to SetMessageFactory()
74 	Lobby2MessageFactory* GetMessageFactory(void) const;
75 
76 	/// \brief Set the callback to receive the results of operations via SendMsg()
77 	virtual void SetCallbackInterface(Lobby2Callbacks *cb);
78 
79 	/// \brief You can have more than one callback to get called from the results of operations via SendMsg()
80 	virtual void AddCallbackInterface(Lobby2Callbacks *cb);
81 
82 	/// \brief Removes a callback added with AddCallbackInterface();
83 	virtual void RemoveCallbackInterface(Lobby2Callbacks *cb);
84 
85 	/// \brief Removes all callbacks added with AddCallbackInterface();
86 	virtual void ClearCallbackInterfaces();
87 
88 protected:
89 
90 	char orderingChannel;
91 	PacketPriority packetPriority;
92 	Lobby2MessageFactory *msgFactory;
93 
94 	DataStructures::List<Lobby2Callbacks*> callbacks;
95 };
96 
97 }; // namespace RakNet
98 
99 #endif
100