SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelayPlugin.h
Go to the documentation of this file.
1 /*
2  * Original work: 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  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
19 
20 
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_RelayPlugin==1
23 
24 #ifndef __RELAY_PLUGIN_H
25 #define __RELAY_PLUGIN_H
26 
27 #include "PluginInterface2.h"
28 #include "string.h"
29 #include "DS_Hash.h"
30 
34 
35 namespace SLNet
36 {
37 
39 class RakPeerInterface;
40 
42 {
43  // Server handled messages
51  // Client handled messages
63 };
64 
68 {
69 public:
70  // GetInstance() and DestroyInstance(instance*)
72 
73 
74  RelayPlugin();
75 
77  virtual ~RelayPlugin();
78 
83  RelayPluginEnums AddParticipantOnServer(const RakString &key, const RakNetGUID &guid);
84 
86  void RemoveParticipantOnServer(const RakNetGUID &guid);
87 
91  void SetAcceptAddParticipantRequests(bool accept);
92 
97  void AddParticipantRequestFromClient(const RakString &key, const RakNetGUID &relayPluginServerGuid);
98 
100  void RemoveParticipantRequestFromClient(const RakNetGUID &relayPluginServerGuid);
101 
109  void SendToParticipant(const RakNetGUID &relayPluginServerGuid, const RakString &destinationGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel);
110 
111  void SendGroupMessage(const RakNetGUID &relayPluginServerGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel);
112  void JoinGroupRequest(const RakNetGUID &relayPluginServerGuid, RakString groupName);
113  void LeaveGroup(const RakNetGUID &relayPluginServerGuid);
114  void GetGroupList(const RakNetGUID &relayPluginServerGuid);
115 
117  virtual PluginReceiveResult OnReceive(Packet *packet);
119  virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
120 
122  {
126  };
127 
128  struct StrAndGuid
129  {
132  };
133 
134  struct RP_Group
135  {
138  };
139 
140 protected:
141 
142  RelayPlugin::RP_Group* JoinGroup(RakNetGUID userGuid, RakString roomName);
143  RelayPlugin::RP_Group* JoinGroup(RP_Group* room, StrAndGuidAndRoom **strAndGuidSender);
144  void LeaveGroup(StrAndGuidAndRoom **strAndGuidSender);
145  void NotifyUsersInRoom(RP_Group *room, int msg, const RakString& message);
146  void SendMessageToRoom(StrAndGuidAndRoom **strAndGuidSender, BitStream* message);
147  void SendChatRoomsList(RakNetGUID target);
148  void OnGroupMessageFromClient(Packet *packet);
149  void OnJoinGroupRequestFromClient(Packet *packet);
150  void OnLeaveGroupRequestFromClient(Packet *packet);
151 
156 
157 };
158 
159 } // End namespace
160 
161 #endif
162 
163 #endif // _RAKNET_SUPPORT_*