Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
RakNetServerLocator.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/NonOwnerPointer.h"
7#include "mc/network/LocatorStateChangeRequest.h"
8#include "mc/network/PermissionIPv6.h"
9#include "mc/network/PermissionLAN.h"
10#include "mc/network/RakNetServerLANVisibility.h"
11#include "mc/network/RakPeerHelper.h"
12#include "mc/network/ServerConnectivityTestResult.h"
13#include "mc/network/ServerLocator.h"
14#include "mc/platform/threading/LockGuard.h"
15#include "mc/world/level/GameType.h"
16
17// auto generated forward declare list
18// clang-format off
19class AppPlatform;
21class RakNetConnector;
23struct PortPair;
25namespace RakNet { class RakPeerInterface; }
26namespace RakNet { struct RakNetGUID; }
27namespace Social { struct Nonce; }
28// clang-format on
29
30class RakNetServerLocator : public ::ServerLocator {
31public:
32 // RakNetServerLocator inner types declare
33 // clang-format off
34 struct AnnounceServerData;
36 class PingRateRecorder;
38 struct SuspendStateData;
39 // clang-format on
40
41 // RakNetServerLocator inner types define
42 enum class protocolVersion : int {
43 Ipv4 = 4,
44 Ipv6 = 6,
45 };
46
47 struct AnnounceServerData {
48 public:
49 // member variables
50 // NOLINTBEGIN
60 // NOLINTEND
61
62 public:
63 // prevent constructor by default
64 AnnounceServerData& operator=(AnnounceServerData const&);
65 AnnounceServerData();
66
67 public:
68 // member functions
69 // NOLINTBEGIN
71 // NOLINTEND
72
73 public:
74 // constructor thunks
75 // NOLINTBEGIN
76 MCNAPI void* $ctor(::RakNetServerLocator::AnnounceServerData const& announceData);
77 // NOLINTEND
78 };
79
80 class NatHolePuncherFunctor {
81 public:
82 // member variables
83 // NOLINTBEGIN
85 // NOLINTEND
86
87 public:
88 // prevent constructor by default
89 NatHolePuncherFunctor& operator=(NatHolePuncherFunctor const&);
90 NatHolePuncherFunctor(NatHolePuncherFunctor const&);
91 NatHolePuncherFunctor();
92 };
93
94 class PingRateRecorder {
95 public:
96 // member variables
97 // NOLINTBEGIN
107 // NOLINTEND
108
109 public:
110 // prevent constructor by default
111 PingRateRecorder& operator=(PingRateRecorder const&);
112 PingRateRecorder(PingRateRecorder const&);
113 PingRateRecorder();
114 };
115
116 struct StateChangeRequestData {
117 public:
118 // member variables
119 // NOLINTBEGIN
123 // NOLINTEND
124
125 public:
126 // prevent constructor by default
127 StateChangeRequestData& operator=(StateChangeRequestData const&);
128 StateChangeRequestData(StateChangeRequestData const&);
129 StateChangeRequestData();
130 };
131
132 struct SuspendStateData {
133 public:
134 // member variables
135 // NOLINTBEGIN
139 // NOLINTEND
140
141 public:
142 // prevent constructor by default
143 SuspendStateData& operator=(SuspendStateData const&);
144 SuspendStateData(SuspendStateData const&);
145 SuspendStateData();
146 };
147
148public:
149 // member variables
150 // NOLINTBEGIN
179 // NOLINTEND
180
181public:
182 // prevent constructor by default
183 RakNetServerLocator& operator=(RakNetServerLocator const&);
184 RakNetServerLocator(RakNetServerLocator const&);
185 RakNetServerLocator();
186
187public:
188 // virtual functions
189 // NOLINTBEGIN
190 virtual ~RakNetServerLocator() /*override*/ = default;
191
192 virtual void startAnnouncingServer(
193 ::std::string const& playerName,
194 ::std::string const& worldName,
195 ::GameType gameType,
196 int numPlayers,
197 int maxNumPlayers,
198 bool isJoinableThroughServerScreen,
199 bool isEditorWorld,
200 bool isHardcore,
202 ::Social::Nonce const&
203 ) /*override*/;
204
205 virtual void stopAnnouncingServer() /*override*/;
206
207 virtual void startServerDiscovery(::PortPair ports) /*override*/;
208
209 virtual void stopServerDiscovery() /*override*/;
210
211 virtual void addCustomServer(::AsynchronousIPResolver const& futureIP, int port) /*override*/;
212
213 virtual ::std::vector<::PingedCompatibleServer> getServerList() const /*override*/;
214
215 virtual void update() /*override*/;
216
217 virtual ::std::chrono::milliseconds getPingTimeForGUID(::std::string const& guid) /*override*/;
218
219 virtual void checkCanConnectToCustomServerAsync(
220 ::std::string hostIpAddress,
221 int port,
222 ::std::function<void(::ServerConnectivityTestResult)> callback
223 ) /*override*/;
224
225 virtual void _onDisable() /*override*/;
226
227 virtual void _onEnable() /*override*/;
228 // NOLINTEND
229
230public:
231 // member functions
232 // NOLINTBEGIN
233#ifdef LL_PLAT_C
234 MCNAPI RakNetServerLocator(
235 ::RakNetConnector& rakNetConnector,
237 ::std::vector<::std::string> overrideBroadcastAddresses,
238 bool isServer,
239 ::RakNetServerLANVisibility serverLanVisibility,
240 ::PermissionLAN permissionLAN,
241 ::PermissionIPv6 permissionIPv6,
243 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
244 createUniqueRakPeerFunc
245 );
246#endif
247
248 MCNAPI void _activate();
249
250 MCNAPI void _addCustomServerFromIpResolver(::AsynchronousIPResolver const& futureIP, int port);
251
253
255 ::LocatorStateChangeRequest newState,
257 ::PortPair newPorts
258 );
259
260 MCNAPI ::std::string _getHostGuid(::std::string const& address, int port);
261
262 MCNAPI void _getServerOriginalAddress(::std::string& originalAddressToSet, ::std::string const& ip);
263
264#ifdef LL_PLAT_C
265 MCNAPI void _initializeBroadcastAddresses();
266#endif
267
268 MCNAPI void _onPingSend(::std::string const& guid, ::std::string const& addr, int ipVersion);
269
270 MCNAPI bool _onPongReceive(
271 ::std::chrono::milliseconds& latencyToSet,
272 ::RakNet::RakNetGUID const& guid,
273 ::std::chrono::steady_clock::time_point const& receivedTime,
274 int ipVersion
275 );
276
277 MCNAPI bool _pingServerV4(::std::string const& address, int port);
278
279 MCNAPI bool _pingServerV6(::std::string const& address, int port);
280
281#ifdef LL_PLAT_C
282 MCNAPI void _punchHoles();
283#endif
284
286
287 MCNAPI void _startServerDiscovery(::PortPair const& ports);
288
290
291 MCNAPI void _stopServerDiscovery();
292 // NOLINTEND
293
294public:
295 // constructor thunks
296 // NOLINTBEGIN
297#ifdef LL_PLAT_C
298 MCNAPI void* $ctor(
299 ::RakNetConnector& rakNetConnector,
301 ::std::vector<::std::string> overrideBroadcastAddresses,
302 bool isServer,
303 ::RakNetServerLANVisibility serverLanVisibility,
304 ::PermissionLAN permissionLAN,
305 ::PermissionIPv6 permissionIPv6,
307 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
308 createUniqueRakPeerFunc
309 );
310#endif
311 // NOLINTEND
312
313public:
314 // virtual function thunks
315 // NOLINTBEGIN
317 ::std::string const& playerName,
318 ::std::string const& worldName,
319 ::GameType gameType,
320 int numPlayers,
321 int maxNumPlayers,
322 bool isJoinableThroughServerScreen,
323 bool isEditorWorld,
324 bool isHardcore,
326 ::Social::Nonce const&
327 );
328
330
332
333 MCNAPI void $stopServerDiscovery();
334
335 MCNAPI void $addCustomServer(::AsynchronousIPResolver const& futureIP, int port);
336
337 MCNAPI ::std::vector<::PingedCompatibleServer> $getServerList() const;
338
339 MCNAPI void $update();
340
341 MCNAPI ::std::chrono::milliseconds $getPingTimeForGUID(::std::string const& guid);
342
344 ::std::string hostIpAddress,
345 int port,
346 ::std::function<void(::ServerConnectivityTestResult)> callback
347 );
348
349 MCNAPI void $_onDisable();
350
351 MCNAPI void $_onEnable();
352
353
354 // NOLINTEND
355};
Definition AppPlatform.h:79
Definition AsynchronousIPResolver.h:5
Definition NonOwnerPointer.h:9
Definition RakNetConnector.h:30
Definition RakNetServerLocator.h:80
Definition RakNetServerLocator.h:94
MCAPI bool _onPongReceive(::std::chrono::milliseconds &latencyToSet, ::RakNet::RakNetGUID const &guid, ::std::chrono::steady_clock::time_point const &receivedTime, int ipVersion)
MCAPI void _onPingSend(::std::string const &guid, ::std::string const &addr, int ipVersion)
MCAPI void $startAnnouncingServer(::std::string const &playerName, ::std::string const &worldName, ::GameType gameType, int numPlayers, int maxNumPlayers, bool isJoinableThroughServerScreen, bool isEditorWorld, bool isHardcore, ::ServerSupportedAuthenticationTypes supportedAuth, ::Social::Nonce const &)
MCAPI void $stopAnnouncingServer()
MCAPI void _addCustomServerFromIpResolver(::AsynchronousIPResolver const &futureIP, int port)
MCAPI void _startServerDiscovery(::PortPair const &ports)
MCAPI void _stopAnnouncingServer()
MCAPI ::std::vector<::PingedCompatibleServer > $getServerList() const
MCAPI bool _pingServerV6(::std::string const &address, int port)
MCAPI::std::chrono::milliseconds $getPingTimeForGUID(::std::string const &guid)
MCAPI void _enqueueStateChangeRequest(::LocatorStateChangeRequest newState, ::RakNetServerLocator::AnnounceServerData newAnnounceData, ::PortPair newPorts)
MCAPI void $startServerDiscovery(::PortPair ports)
MCAPI void _announceServer(::RakNetServerLocator::AnnounceServerData const &serverData)
MCAPI::std::string _getHostGuid(::std::string const &address, int port)
MCAPI void $addCustomServer(::AsynchronousIPResolver const &futureIP, int port)
MCAPI void _getServerOriginalAddress(::std::string &originalAddressToSet, ::std::string const &ip)
MCAPI void _startAnnouncingServer(::RakNetServerLocator::AnnounceServerData const &announceData)
MCAPI void $update()
MCAPI void $stopServerDiscovery()
MCAPI bool _pingServerV4(::std::string const &address, int port)
MCAPI void $_onEnable()
MCAPI void _stopServerDiscovery()
MCAPI void $checkCanConnectToCustomServerAsync(::std::string hostIpAddress, int port, ::std::function< void(::ServerConnectivityTestResult)> callback)
MCAPI void $_onDisable()
MCAPI void _activate()
Definition RakPeerInterface.h:32
Definition RakPeerHelper.h:35
Definition ServerLocator.h:22
STL namespace.
Definition PingedCompatibleServer.h:5
Definition PortPair.h:5
Definition RakNetServerLocator.h:47
MCAPI void * $ctor(::RakNetServerLocator::AnnounceServerData const &announceData)
MCAPI AnnounceServerData(::RakNetServerLocator::AnnounceServerData const &announceData)
Definition RakNetServerLocator.h:116
Definition RakNetServerLocator.h:132
Definition RakNetGUID.h:7
Definition ServerSupportedAuthenticationTypes.h:5
Definition Nonce.h:10
Definition Alias.h:14