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 Packet; }
27namespace RakNet { struct RakNetGUID; }
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
73 ::std::string const& playerName,
74 ::std::string const& worldName,
75 ::GameType gameType,
76 int numPlayers,
77 int maxNumPlayers,
78 bool isJoinableThroughServerScreen,
79 bool isEditorWorld,
80 bool isHardcore,
82 );
83
85 // NOLINTEND
86
87 public:
88 // constructor thunks
89 // NOLINTBEGIN
90 MCNAPI void* $ctor(::RakNetServerLocator::AnnounceServerData const& announceData);
91
92 MCNAPI void* $ctor(
93 ::std::string const& playerName,
94 ::std::string const& worldName,
95 ::GameType gameType,
96 int numPlayers,
97 int maxNumPlayers,
98 bool isJoinableThroughServerScreen,
99 bool isEditorWorld,
100 bool isHardcore,
102 );
103 // NOLINTEND
104
105 public:
106 // destructor thunk
107 // NOLINTBEGIN
108 MCNAPI void $dtor();
109 // NOLINTEND
110 };
111
112 class NatHolePuncherFunctor {
113 public:
114 // member variables
115 // NOLINTBEGIN
117 // NOLINTEND
118
119 public:
120 // prevent constructor by default
121 NatHolePuncherFunctor& operator=(NatHolePuncherFunctor const&);
122 NatHolePuncherFunctor(NatHolePuncherFunctor const&);
123 NatHolePuncherFunctor();
124
125 public:
126 // member functions
127 // NOLINTBEGIN
128#ifdef LL_PLAT_C
129 MCNAPI bool punch(::std::function<bool()> lanDiscoveryPortPuncher, ::std::function<bool()> gamePortPuncher);
130#endif
131 // NOLINTEND
132 };
133
134 class PingRateRecorder {
135 public:
136 // member variables
137 // NOLINTBEGIN
147 // NOLINTEND
148
149 public:
150 // prevent constructor by default
151 PingRateRecorder& operator=(PingRateRecorder const&);
152 PingRateRecorder(PingRateRecorder const&);
153 PingRateRecorder();
154
155 public:
156 // member functions
157 // NOLINTBEGIN
158 MCNAPI bool pingEnd(uint const& endTime, int ipVersion);
159 // NOLINTEND
160 };
161
162 struct StateChangeRequestData {
163 public:
164 // member variables
165 // NOLINTBEGIN
169 // NOLINTEND
170
171 public:
172 // prevent constructor by default
173 StateChangeRequestData& operator=(StateChangeRequestData const&);
174 StateChangeRequestData(StateChangeRequestData const&);
175 StateChangeRequestData();
176
177 public:
178 // member functions
179 // NOLINTBEGIN
181 // NOLINTEND
182
183 public:
184 // destructor thunk
185 // NOLINTBEGIN
186 MCNAPI void $dtor();
187 // NOLINTEND
188 };
189
190 struct SuspendStateData {
191 public:
192 // member variables
193 // NOLINTBEGIN
197 // NOLINTEND
198
199 public:
200 // prevent constructor by default
201 SuspendStateData& operator=(SuspendStateData const&);
202 SuspendStateData(SuspendStateData const&);
203 SuspendStateData();
204
205 public:
206 // member functions
207 // NOLINTBEGIN
209 // NOLINTEND
210
211 public:
212 // destructor thunk
213 // NOLINTBEGIN
214 MCNAPI void $dtor();
215 // NOLINTEND
216 };
217
218public:
219 // member variables
220 // NOLINTBEGIN
248 // NOLINTEND
249
250public:
251 // prevent constructor by default
252 RakNetServerLocator& operator=(RakNetServerLocator const&);
253 RakNetServerLocator(RakNetServerLocator const&);
254 RakNetServerLocator();
255
256public:
257 // virtual functions
258 // NOLINTBEGIN
259 virtual ~RakNetServerLocator() /*override*/;
260
261 virtual void startAnnouncingServer(
262 ::std::string const& playerName,
263 ::std::string const& worldName,
264 ::GameType gameType,
265 int numPlayers,
266 int maxNumPlayers,
267 bool isJoinableThroughServerScreen,
268 bool isEditorWorld,
269 bool isHardcore,
271 ) /*override*/;
272
273 virtual void stopAnnouncingServer() /*override*/;
274
275 virtual void startServerDiscovery(::PortPair ports) /*override*/;
276
277 virtual void stopServerDiscovery() /*override*/;
278
279 virtual void addCustomServer(::AsynchronousIPResolver const& futureIP, int port) /*override*/;
280
281 virtual void addCustomServer(::std::string const& address, int port) /*override*/;
282
283 virtual ::std::vector<::PingedCompatibleServer> getServerList() const /*override*/;
284
285 virtual void clearServerList() /*override*/;
286
287 virtual void update() /*override*/;
288
289 virtual float getPingTimeForGUID(::std::string const& guid) /*override*/;
290
291 virtual void checkCanConnectToCustomServerAsync(
292 ::std::string hostIpAddress,
293 int port,
294 ::std::function<void(::ServerConnectivityTestResult)> callback
295 ) /*override*/;
296
297 virtual void _onDisable() /*override*/;
298
299 virtual void _onEnable() /*override*/;
300 // NOLINTEND
301
302public:
303 // member functions
304 // NOLINTBEGIN
305 MCNAPI RakNetServerLocator(
306 ::RakNetConnector& rakNetConnector,
307 ::RakPeerHelper::IPSupportInterface& ipInterface,
308 ::std::vector<::std::string> overrideBroadcastAddresses,
309 bool isServer,
310 ::RakNetServerLANVisibility serverLanVisibility,
311 ::PermissionLAN permissionLAN,
312 ::PermissionIPv6 permissionIPv6,
313 ::Bedrock::NonOwnerPointer<::AppPlatform> const& appPlatform,
314 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
315 createUniqueRakPeerFunc
316 );
317
318 MCNAPI void _activate();
319
320 MCNAPI void _addCustomServerFromIpResolver(::AsynchronousIPResolver const& futureIP, int port);
321
322 MCNAPI bool _addCustomServerV4(::AsynchronousIPResolver const& futureIP, int port);
323
324 MCNAPI bool _addCustomServerV6(::AsynchronousIPResolver const& futureIP, int port);
325
326 MCNAPI void _announceServer(::RakNetServerLocator::AnnounceServerData const& serverData);
327
329 ::LocatorStateChangeRequest newState,
330 ::RakNetServerLocator::AnnounceServerData newAnnounceData,
331 ::PortPair newPorts
332 );
333
334 MCNAPI ::std::string _getHostGuid(::std::string const& address, int);
335
336 MCNAPI void _getServerOriginalAddress(::std::string& originalAddressToSet, ::std::string const& ip);
337
339 ::std::string const& data,
340 ::RakNet::Packet const* p,
341 bool insertAtBeginning,
342 uint64 readTime
343 );
344
346
347 MCNAPI void _onPingSend(::std::string const& guid, ::std::string const& ipVersion, int);
348
349 MCNAPI bool
350 _onPongReceive(float& latencyToSet, ::RakNet::RakNetGUID const& guid, uint const& receivedTime, int ipVersion);
351
352 MCNAPI bool _pingServerV4(::std::string const& address, int port);
353
354 MCNAPI bool _pingServerV6(::std::string const& address, int port);
355
356 MCNAPI void _setPingResponder(::RakNetServerLocator::AnnounceServerData const& serverData);
357
358 MCNAPI void _startAnnouncingServer(::RakNetServerLocator::AnnounceServerData const& announceData);
359
360 MCNAPI void _startServerDiscovery(::PortPair const& ports);
361
363
364 MCNAPI void _stopServerDiscovery();
365
366 MCNAPI void _updateNetwork();
367
368 MCNAPI bool _updateQueuedPings();
369
370 MCNAPI void _updateState();
371 // NOLINTEND
372
373public:
374 // static functions
375 // NOLINTBEGIN
376 MCNAPI static bool
377 parseUnconnectedPongPacketData(::std::string const& data, ::std::vector<::std::string>& extraData);
378 // NOLINTEND
379
380public:
381 // constructor thunks
382 // NOLINTBEGIN
383 MCNAPI void* $ctor(
384 ::RakNetConnector& rakNetConnector,
385 ::RakPeerHelper::IPSupportInterface& ipInterface,
386 ::std::vector<::std::string> overrideBroadcastAddresses,
387 bool isServer,
388 ::RakNetServerLANVisibility serverLanVisibility,
389 ::PermissionLAN permissionLAN,
390 ::PermissionIPv6 permissionIPv6,
391 ::Bedrock::NonOwnerPointer<::AppPlatform> const& appPlatform,
392 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
393 createUniqueRakPeerFunc
394 );
395 // NOLINTEND
396
397public:
398 // destructor thunk
399 // NOLINTBEGIN
400 MCNAPI void $dtor();
401 // NOLINTEND
402
403public:
404 // virtual function thunks
405 // NOLINTBEGIN
407 ::std::string const& playerName,
408 ::std::string const& worldName,
409 ::GameType gameType,
410 int numPlayers,
411 int maxNumPlayers,
412 bool isJoinableThroughServerScreen,
413 bool isEditorWorld,
414 bool isHardcore,
416 );
417
419
420 MCNAPI void $startServerDiscovery(::PortPair ports);
421
422 MCNAPI void $stopServerDiscovery();
423
424 MCNAPI void $addCustomServer(::AsynchronousIPResolver const& futureIP, int port);
425
426 MCNAPI void $addCustomServer(::std::string const& address, int port);
427
428 MCNAPI ::std::vector<::PingedCompatibleServer> $getServerList() const;
429
430 MCNAPI void $clearServerList();
431
432 MCNAPI void $update();
433
434 MCNAPI float $getPingTimeForGUID(::std::string const& guid);
435
437 ::std::string hostIpAddress,
438 int port,
439 ::std::function<void(::ServerConnectivityTestResult)> callback
440 );
441
442 MCNAPI void $_onDisable();
443
444 MCNAPI void $_onEnable();
445
446
447 // NOLINTEND
448
449public:
450 // vftables
451 // NOLINTBEGIN
452 MCNAPI static void** $vftable();
453 // NOLINTEND
454};
Definition AppPlatform.h:91
Definition AsynchronousIPResolver.h:8
Definition Packet.h:31
Definition RakNetConnector.h:29
Definition RakNetServerLocator.h:112
Definition RakNetServerLocator.h:134
MCAPI bool pingEnd(uint const &endTime, int ipVersion)
MCAPI void $clearServerList()
MCAPI void $stopAnnouncingServer()
MCAPI bool _onPongReceive(float &latencyToSet, ::RakNet::RakNetGUID const &guid, uint const &receivedTime, int ipVersion)
MCAPI void _addCustomServerFromIpResolver(::AsynchronousIPResolver const &futureIP, int port)
MCAPI void _startServerDiscovery(::PortPair const &ports)
MCAPI void _setPingResponder(::RakNetServerLocator::AnnounceServerData const &serverData)
MCAPI void _stopAnnouncingServer()
MCAPI ::std::vector<::PingedCompatibleServer > $getServerList() const
MCAPI bool _handleUnconnectedPong(::std::string const &data, ::RakNet::Packet const *p, bool insertAtBeginning, uint64 readTime)
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)
MCAPI bool _pingServerV6(::std::string const &address, int port)
MCAPI void _updateState()
MCAPI float $getPingTimeForGUID(::std::string const &guid)
MCAPI void * $ctor(::RakNetConnector &rakNetConnector, ::RakPeerHelper::IPSupportInterface &ipInterface, ::std::vector<::std::string > overrideBroadcastAddresses, bool isServer, ::RakNetServerLANVisibility serverLanVisibility, ::PermissionLAN permissionLAN, ::PermissionIPv6 permissionIPv6, ::Bedrock::NonOwnerPointer<::AppPlatform > const &appPlatform, ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void(*)(::RakNet::RakPeerInterface *)>()> createUniqueRakPeerFunc)
static MCAPI void ** $vftable()
MCAPI void $dtor()
MCAPI void _enqueueStateChangeRequest(::LocatorStateChangeRequest newState, ::RakNetServerLocator::AnnounceServerData newAnnounceData, ::PortPair newPorts)
MCAPI void $startServerDiscovery(::PortPair ports)
MCAPI void _announceServer(::RakNetServerLocator::AnnounceServerData const &serverData)
MCAPI void $addCustomServer(::AsynchronousIPResolver const &futureIP, int port)
MCAPI bool _addCustomServerV6(::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 bool _updateQueuedPings()
MCAPI void _updateNetwork()
MCAPI void $stopServerDiscovery()
MCAPI bool _pingServerV4(::std::string const &address, int port)
MCAPI void _onPingSend(::std::string const &guid, ::std::string const &ipVersion, int)
MCAPI void $_onEnable()
MCAPI::std::string _getHostGuid(::std::string const &address, int)
MCAPI bool _addCustomServerV4(::AsynchronousIPResolver const &futureIP, int port)
static MCAPI bool parseUnconnectedPongPacketData(::std::string const &data, ::std::vector<::std::string > &extraData)
MCAPI void _initializeBroadcastAddresses()
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:15
Definition ServerLocator.h:19
STL namespace.
Definition PingedCompatibleServer.h:5
Definition PortPair.h:5
Definition RakNetServerLocator.h:47
MCAPI void * $ctor(::std::string const &playerName, ::std::string const &worldName, ::GameType gameType, int numPlayers, int maxNumPlayers, bool isJoinableThroughServerScreen, bool isEditorWorld, bool isHardcore, ::ServerSupportedAuthenticationTypes supportedAuth)
MCAPI AnnounceServerData(::std::string const &playerName, ::std::string const &worldName, ::GameType gameType, int numPlayers, int maxNumPlayers, bool isJoinableThroughServerScreen, bool isEditorWorld, bool isHardcore, ::ServerSupportedAuthenticationTypes supportedAuth)
MCAPI void * $ctor(::RakNetServerLocator::AnnounceServerData const &announceData)
MCAPI AnnounceServerData(::RakNetServerLocator::AnnounceServerData const &announceData)
Definition RakNetServerLocator.h:162
Definition RakNetServerLocator.h:190
Definition Packet.h:7
Definition RakNetGUID.h:7
Definition ServerSupportedAuthenticationTypes.h:5
Definition Alias.h:14