Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
ClientNetworkSystem.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/threading/Async.h"
7#include "mc/deps/core/threading/TaskGroup.h"
8#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
9#include "mc/deps/core/utility/NonOwnerPointer.h"
10#include "mc/deps/core/utility/UniqueOwnerPointer.h"
11#include "mc/deps/core/utility/pub_sub/Subscription.h"
12#include "mc/network/IGameConnectionInfoProvider.h"
13#include "mc/network/NetworkSystem.h"
14#include "mc/platform/Result.h"
15#include "mc/platform/brstd/function_ref.h"
16#include "mc/platform/brstd/move_only_function.h"
17
18// auto generated forward declare list
19// clang-format off
20class AppPlatform;
26class NetworkSummary;
28class Scheduler;
29class SecureStorage;
32class TrustStore;
36namespace Bedrock::Http { class DispatcherInterface; }
37namespace Json { class Value; }
38namespace NetherNet { class IIdentityAssertionGenerator; }
39namespace PlayerMessaging { struct NetworkID; }
40namespace Social { class GameConnectionInfo; }
41namespace flighting { class IFlightReader; }
42// clang-format on
43
44class ClientNetworkSystem : public ::Social::IGameConnectionInfoProvider,
46 public ::NetworkSystem {
47public:
48 // ClientNetworkSystem inner types define
49 using DependencyFactory = ::brstd::function_ref<::NetworkSystem::Dependencies()>;
50
52
53public:
54 // member variables
55 // NOLINTBEGIN
56 ::ll::TypedStorage<8, 336, ::TaskGroup> mTaskGroup;
57 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::SignalingService>> mSignalingService;
58 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mUserLoggingSub;
59 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mUserConnectionQualitySub;
60 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mDisableLanSignalingSub;
61 ::ll::TypedStorage<8, 16, ::Bedrock::UniqueOwnerPointer<::NetworkSummary>> mNetworkSummary;
62 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::TrustStore>>> mServerTrustStore;
63 // NOLINTEND
64
65#ifdef LL_PLAT_S
66#else // LL_PLAT_C
67public:
68 // prevent constructor by default
69 ClientNetworkSystem();
70
71#endif
72public:
73 // virtual functions
74 // NOLINTBEGIN
75 virtual ~ClientNetworkSystem() /*override*/ = default;
76
77 virtual ::Social::GameConnectionInfo const& getConnectionInfo() const /*override*/;
78
79 virtual ::std::optional<::std::string> getNetworkInfoString() const /*override*/;
80 // NOLINTEND
81
82public:
83 // member functions
84 // NOLINTBEGIN
85#ifdef LL_PLAT_C
86 MCNAPI ClientNetworkSystem(
87 ::Scheduler& receiveThread,
88 ::std::vector<::std::string> const& overrideBroadcastAddresses,
89 ::NetworkSystemToggles const& networkToggles,
92 ::Bedrock::NotNullNonOwnerPtr<::Bedrock::Http::DispatcherInterface> httpDispatcher,
93 ::Bedrock::NotNullNonOwnerPtr<::NetworkSessionOwner> networkSessionOwner,
94 ::std::unique_ptr<::IPacketSerializationController> packetController,
95 ::std::unique_ptr<::SecureStorage> serverTrustStoreStorage,
97 ::std::shared_ptr<void> httpLibraryToken
98 );
99
100 MCNAPI bool _connectLan(::Social::GameConnectionInfo const& primary, ::Social::GameConnectionInfo const& backup);
101
102 MCNAPI bool _connectLocal();
103
104 MCNAPI bool _connectRemote(
105 ::Social::GameConnectionInfo const& primary,
106 ::Social::GameConnectionInfo const& backup,
107 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator> identity
108 );
109
110 MCNAPI bool connect(
111 ::Social::GameConnectionInfo const& primary,
112 ::Social::GameConnectionInfo const& backup,
113 ::PrivateKeyManager const& signingKey,
115 );
116
117 MCNAPI ::std::shared_ptr<::SignalingServiceSignInJob> createSignalingServiceSigninJobIfNeeded(
118 ::std::shared_ptr<::SignalingService> signalingService,
119 ::Bedrock::Threading::Async<::std::optional<::PlayerMessaging::NetworkID>>&& playerMessagingId
120 );
121
122 MCNAPI ::std::pair<::Json::Value, ::Json::Value> getPacketTraces() const;
123
124 MCNAPI void getPingTimeForConnection(
125 ::Social::GameConnectionInfo const& connection,
126 ::brstd::move_only_function<void(::std::chrono::milliseconds)> pingTimeCallback
127 );
128
129 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Result<::std::string>> probeTransportLayer(
130 ::std::string const& host,
131 int port,
132 ::Bedrock::NotNullNonOwnerPtr<::Bedrock::Http::DispatcherInterface> dispatcher
133 ) const;
134
135 MCNAPI void registerForPrimaryUserOptionChanges(::ClientNetworkSystemOptions const& primaryUserOptions);
136
137 MCNAPI void setupNetworkSummary(
138 ::std::function<bool()> isInGame,
139 ::std::function<bool()> isSignedIntoSignalingService,
140 ::std::function<bool()> isHostingLocalDedicatedServer
141 );
142#endif
143
144 MCNAPI ::std::optional<::NetworkIdentifier> tryGetLocalNetworkId() const;
145 // NOLINTEND
146
147public:
148 // constructor thunks
149 // NOLINTBEGIN
150#ifdef LL_PLAT_C
151 MCNAPI void* $ctor(
152 ::Scheduler& receiveThread,
153 ::std::vector<::std::string> const& overrideBroadcastAddresses,
154 ::NetworkSystemToggles const& networkToggles,
157 ::Bedrock::NotNullNonOwnerPtr<::Bedrock::Http::DispatcherInterface> httpDispatcher,
158 ::Bedrock::NotNullNonOwnerPtr<::NetworkSessionOwner> networkSessionOwner,
159 ::std::unique_ptr<::IPacketSerializationController> packetController,
160 ::std::unique_ptr<::SecureStorage> serverTrustStoreStorage,
162 ::std::shared_ptr<void> httpLibraryToken
163 );
164#endif
165 // NOLINTEND
166
167public:
168 // virtual function thunks
169 // NOLINTBEGIN
170#ifdef LL_PLAT_C
171 MCNAPI ::Social::GameConnectionInfo const& $getConnectionInfo() const;
172
173 MCNAPI ::std::optional<::std::string> $getNetworkInfoString() const;
174#endif
175
176
177 // NOLINTEND
178};
Definition AppPlatform.h:79
Definition EnableNonOwnerReferences.h:7
Definition DispatcherInterface.h:17
Definition NonOwnerPointer.h:9
The game spells this as an AsyncImplBase<T> base subobject holding the handle; a member at the same o...
Definition Async.h:13
MCAPI ::std::optional<::NetworkIdentifier > tryGetLocalNetworkId() const
Definition IPacketSerializationController.h:9
Definition Value.h:16
Definition IIdentityAssertionGenerator.h:7
Definition NetworkDebugManager.h:14
Definition NetworkIdentifier.h:10
Definition NetworkSessionOwner.h:9
Definition NetworkStatistics.h:21
Definition NetworkSummary.h:5
Definition PrivateKeyManager.h:10
Definition Scheduler.h:15
Definition SecureStorage.h:10
Definition SignalingServiceSignInJob.h:22
Definition SignalingService.h:37
Definition GameConnectionInfo.h:24
Definition IGameConnectionInfoProvider.h:12
Definition TrustStore.h:13
Definition function_ref.h:60
Definition move_only_function.h:9
Definition IFlightReader.h:7
Definition ClientNetworkSystemOptions.h:5
Definition NetworkSystemToggles.h:11
Definition NetworkSystem.h:54
Definition NetworkID.h:12
Definition RawGameServerToken.h:8