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
UDPProxyServer.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) 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_UDPProxyServer==1 && _RAKNET_SUPPORT_UDPForwarder==1
23
24 #ifndef __UDP_PROXY_SERVER_H
25 #define __UDP_PROXY_SERVER_H
26
27 #include "Export.h"
28 #include "types.h"
29 #include "PluginInterface2.h"
30 #include "UDPForwarder.h"
31 #include "string.h"
32
33 namespace SLNet
34 {
35 class UDPProxyServer;
36
39 struct UDPProxyServerResultHandler
40 {
41 UDPProxyServerResultHandler() {}
42 virtual ~UDPProxyServerResultHandler() {}
43
47 virtual void OnLoginSuccess(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
48
53 virtual void OnAlreadyLoggedIn(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
54
58 virtual void OnNoPasswordSet(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
59
63 virtual void OnWrongPassword(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
64 };
65
71 class RAK_DLL_EXPORT UDPProxyServer : public PluginInterface2
72 {
73 public:
74 // GetInstance() and DestroyInstance(instance*)
75 STATIC_FACTORY_DECLARATIONS(UDPProxyServer)
76
77 UDPProxyServer();
78 ~UDPProxyServer();
79
82 void SetSocketFamily(unsigned short _socketFamily);
83
87 void SetResultHandler(UDPProxyServerResultHandler *rh);
88
93 bool LoginToCoordinator(SLNet::RakString password, SystemAddress coordinatorAddress);
94
98 void SetServerPublicIP(RakString ip);
99
103 UDPForwarder udpForwarder;
104
105 virtual void OnAttach(void);
106 virtual void OnDetach(void);
107
109 virtual void Update(void);
110 virtual PluginReceiveResult OnReceive(Packet *packet);
111 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
112 virtual void OnRakPeerStartup(void);
113 virtual void OnRakPeerShutdown(void);
114
115 protected:
116 void OnForwardingRequestFromCoordinatorToServer(Packet *packet);
117
118 DataStructures::OrderedList<SystemAddress, SystemAddress> loggingInCoordinators;
119 DataStructures::OrderedList<SystemAddress, SystemAddress> loggedInCoordinators;
120
121 UDPProxyServerResultHandler *resultHandler;
122 unsigned short socketFamily;
123 RakString serverPublicIp;
124
125 };
126
127 } // End namespace
128
129 #endif
130
131 #endif // _RAKNET_SUPPORT_*