SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UDPProxyClient.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
18
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_UDPProxyClient==1
22
23 #ifndef __UDP_PROXY_CLIENT_H
24 #define __UDP_PROXY_CLIENT_H
25
26 #include "Export.h"
27 #include "types.h"
28 #include "PluginInterface2.h"
29 #include "DS_List.h"
30
35
36 namespace SLNet
37 {
38 class UDPProxyClient;
39
42 struct UDPProxyClientResultHandler
43 {
44 UDPProxyClientResultHandler() {}
45 virtual ~UDPProxyClientResultHandler() {}
46
55 virtual void OnForwardingSuccess(const char *proxyIPAddress, unsigned short proxyPort,
56 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
57
67 virtual void OnForwardingNotification(const char *proxyIPAddress, unsigned short proxyPort,
68 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
69
76 virtual void OnNoServersOnline(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
77
84 virtual void OnRecipientNotConnected(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
85
93 virtual void OnAllServersBusy(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
94
104 virtual void OnForwardingInProgress(const char *proxyIPAddress, unsigned short proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
105 };
106
107
115 class RAK_DLL_EXPORT UDPProxyClient : public PluginInterface2
116 {
117 public:
118 // GetInstance() and DestroyInstance(instance*)
119 STATIC_FACTORY_DECLARATIONS(UDPProxyClient)
120
121 UDPProxyClient();
122 ~UDPProxyClient();
123
127 void SetResultHandler(UDPProxyClientResultHandler *rh);
128
141 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0);
142
145 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0);
146
148 virtual void Update(void);
149 virtual PluginReceiveResult OnReceive(Packet *packet);
150 virtual void OnRakPeerShutdown(void);
151
152 struct ServerWithPing
153 {
154 unsigned short ping;
155 SystemAddress serverAddress;
156 };
157 struct SenderAndTargetAddress
158 {
159 SystemAddress senderClientAddress;
160 SystemAddress targetClientAddress;
161 };
162 struct PingServerGroup
163 {
164 SenderAndTargetAddress sata;
165 SLNet::TimeMS startPingTime;
166 SystemAddress coordinatorAddressForPings;
167 //DataStructures::Multilist<ML_UNORDERED_LIST, ServerWithPing> serversToPing;
168 DataStructures::List<ServerWithPing> serversToPing;
169 bool AreAllServersPinged(void) const;
170 void SendPingedServersToCoordinator(RakPeerInterface *rakPeer);
171 };
172 //DataStructures::Multilist<ML_UNORDERED_LIST, PingServerGroup*> pingServerGroups;
173 DataStructures::List<PingServerGroup*> pingServerGroups;
174 protected:
175
176 void OnPingServers(Packet *packet);
177 void Clear(void);
178 UDPProxyClientResultHandler *resultHandler;
179
180 };
181
182 } // End namespace
183
184 #endif
185
186 #endif // _RAKNET_SUPPORT_*