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
178 // NOLINTEND
179
180public:
181 // prevent constructor by default
182 RakNetServerLocator& operator=(RakNetServerLocator const&);
183 RakNetServerLocator(RakNetServerLocator const&);
184 RakNetServerLocator();
185
186public:
187 // virtual functions
188 // NOLINTBEGIN
189 virtual ~RakNetServerLocator() /*override*/ = default;
190
191 virtual void startAnnouncingServer(
192 ::std::string const& playerName,
193 ::std::string const& worldName,
194 ::GameType gameType,
195 int numPlayers,
196 int maxNumPlayers,
197 bool isJoinableThroughServerScreen,
198 bool isEditorWorld,
199 bool isHardcore,
201 ::Social::Nonce const&
202 ) /*override*/;
203
204 virtual void stopAnnouncingServer() /*override*/;
205
206 virtual void startServerDiscovery(::PortPair ports) /*override*/;
207
208 virtual void stopServerDiscovery() /*override*/;
209
210 virtual void addCustomServer(::AsynchronousIPResolver const& futureIP, int port) /*override*/;
211
212 virtual ::std::vector<::PingedCompatibleServer> getServerList() const /*override*/;
213
214 virtual void update() /*override*/;
215
216 virtual ::std::chrono::milliseconds getPingTimeForGUID(::std::string const& guid) /*override*/;
217
218 virtual void checkCanConnectToCustomServerAsync(
219 ::std::string hostIpAddress,
220 int port,
221 ::std::function<void(::ServerConnectivityTestResult)> callback
222 ) /*override*/;
223
224 virtual void _onDisable() /*override*/;
225
226 virtual void _onEnable() /*override*/;
227 // NOLINTEND
228
229public:
230 // member functions
231 // NOLINTBEGIN
232 MCNAPI RakNetServerLocator(
233 ::RakNetConnector& rakNetConnector,
234 ::RakPeerHelper::IPSupportInterface& ipInterface,
235 ::std::vector<::std::string> overrideBroadcastAddresses,
236 bool isServer,
237 ::RakNetServerLANVisibility serverLanVisibility,
238 ::PermissionLAN permissionLAN,
239 ::PermissionIPv6 permissionIPv6,
240 ::Bedrock::NonOwnerPointer<::AppPlatform> const& appPlatform,
241 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
242 createUniqueRakPeerFunc
243 );
244
245 MCNAPI void _activate();
246
247 MCNAPI void _addCustomServerFromIpResolver(::AsynchronousIPResolver const& futureIP, int port);
248
249 MCNAPI void _announceServer(::RakNetServerLocator::AnnounceServerData const& serverData);
250
252 ::LocatorStateChangeRequest newState,
253 ::RakNetServerLocator::AnnounceServerData newAnnounceData,
254 ::PortPair newPorts
255 );
256
257 MCNAPI ::std::string _getHostGuid(::std::string const& address, int port);
258
259 MCNAPI void _getServerOriginalAddress(::std::string& originalAddressToSet, ::std::string const& ip);
260
261#ifdef LL_PLAT_C
262 MCNAPI void _initializeBroadcastAddresses();
263#endif
264
265 MCNAPI void _onPingSend(::std::string const& guid, ::std::string const& addr, int ipVersion);
266
267 MCNAPI bool _onPongReceive(
268 ::std::chrono::milliseconds& latencyToSet,
269 ::RakNet::RakNetGUID const& guid,
270 ::std::chrono::steady_clock::time_point const& receivedTime,
271 int ipVersion
272 );
273
274 MCNAPI bool _pingServerV4(::std::string const& address, int port);
275
276 MCNAPI bool _pingServerV6(::std::string const& address, int port);
277
278#ifdef LL_PLAT_C
279 MCNAPI void _punchHoles();
280#endif
281
283
284 MCNAPI void _startServerDiscovery(::PortPair const& ports);
285
287
288 MCNAPI void _stopServerDiscovery();
289 // NOLINTEND
290
291public:
292 // constructor thunks
293 // NOLINTBEGIN
294 MCNAPI void* $ctor(
295 ::RakNetConnector& rakNetConnector,
297 ::std::vector<::std::string> overrideBroadcastAddresses,
298 bool isServer,
299 ::RakNetServerLANVisibility serverLanVisibility,
300 ::PermissionLAN permissionLAN,
301 ::PermissionIPv6 permissionIPv6,
303 ::std::function<::std::unique_ptr<::RakNet::RakPeerInterface, void (*)(::RakNet::RakPeerInterface*)>()>
304 createUniqueRakPeerFunc
305 );
306 // NOLINTEND
307
308public:
309 // virtual function thunks
310 // NOLINTBEGIN
312 ::std::string const& playerName,
313 ::std::string const& worldName,
314 ::GameType gameType,
315 int numPlayers,
316 int maxNumPlayers,
317 bool isJoinableThroughServerScreen,
318 bool isEditorWorld,
319 bool isHardcore,
321 ::Social::Nonce const&
322 );
323
325
327
328 MCNAPI void $stopServerDiscovery();
329
330 MCNAPI void $addCustomServer(::AsynchronousIPResolver const& futureIP, int port);
331
332 MCNAPI ::std::vector<::PingedCompatibleServer> $getServerList() const;
333
334 MCNAPI void $update();
335
336 MCNAPI ::std::chrono::milliseconds $getPingTimeForGUID(::std::string const& guid);
337
339 ::std::string hostIpAddress,
340 int port,
341 ::std::function<void(::ServerConnectivityTestResult)> callback
342 );
343
344 MCNAPI void $_onDisable();
345
346 MCNAPI void $_onEnable();
347
348
349 // NOLINTEND
350};
Definition AppPlatform.h:78
Definition AsynchronousIPResolver.h:5
Definition NonOwnerPointer.h:9
Definition RakNetConnector.h:31
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 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)
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 RakPeerHelper.h:15
Definition ServerLocator.h:20
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