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 MCAPI 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 );
98
99 MCAPI bool _connectLan(::Social::GameConnectionInfo const& primary, ::Social::GameConnectionInfo const& backup);
100
101 MCAPI bool _connectLocal();
102
103 MCAPI bool _connectRemote(
104 ::Social::GameConnectionInfo const& primary,
105 ::Social::GameConnectionInfo const& backup,
106 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator> identity
107 );
108
109 MCAPI bool connect(
110 ::Social::GameConnectionInfo const& primary,
111 ::Social::GameConnectionInfo const& backup,
112 ::PrivateKeyManager const& signingKey,
114 );
115
116 MCAPI ::std::shared_ptr<::SignalingServiceSignInJob> createSignalingServiceSigninJobIfNeeded(
117 ::std::shared_ptr<::SignalingService> signalingService,
118 ::Bedrock::Threading::Async<::std::optional<::PlayerMessaging::NetworkID>>&& playerMessagingId
119 );
120
121 MCAPI ::std::pair<::Json::Value, ::Json::Value> getPacketTraces() const;
122
123 MCAPI void getPingTimeForConnection(
124 ::Social::GameConnectionInfo const& connection,
125 ::brstd::move_only_function<void(::std::chrono::milliseconds)> pingTimeCallback
126 );
127
128 MCAPI ::Bedrock::Threading::Async<::Bedrock::Result<::std::string>> probeTransportLayer(
129 ::std::string const& host,
130 int port,
131 ::Bedrock::NotNullNonOwnerPtr<::Bedrock::Http::DispatcherInterface> dispatcher
132 ) const;
133
134 MCAPI void registerForPrimaryUserOptionChanges(::ClientNetworkSystemOptions const& primaryUserOptions);
135
136 MCAPI void setupNetworkSummary(
137 ::std::function<bool()> isInGame,
138 ::std::function<bool()> isSignedIntoSignalingService,
139 ::std::function<bool()> isHostingLocalDedicatedServer
140 );
141#endif
142
143 MCAPI ::std::optional<::NetworkIdentifier> tryGetLocalNetworkId() const;
144 // NOLINTEND
145
146public:
147 // constructor thunks
148 // NOLINTBEGIN
149#ifdef LL_PLAT_C
150 MCAPI void* $ctor(
151 ::Scheduler& receiveThread,
152 ::std::vector<::std::string> const& overrideBroadcastAddresses,
153 ::NetworkSystemToggles const& networkToggles,
156 ::Bedrock::NotNullNonOwnerPtr<::Bedrock::Http::DispatcherInterface> httpDispatcher,
157 ::Bedrock::NotNullNonOwnerPtr<::NetworkSessionOwner> networkSessionOwner,
158 ::std::unique_ptr<::IPacketSerializationController> packetController,
159 ::std::unique_ptr<::SecureStorage> serverTrustStoreStorage,
161 );
162#endif
163 // NOLINTEND
164
165public:
166 // virtual function thunks
167 // NOLINTBEGIN
168#ifdef LL_PLAT_C
169 MCAPI ::Social::GameConnectionInfo const& $getConnectionInfo() const;
170
171 MCAPI ::std::optional<::std::string> $getNetworkInfoString() const;
172#endif
173
174
175 // NOLINTEND
176};
Definition AppPlatform.h:78
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
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:22
Definition NetworkSummary.h:5
Definition PrivateKeyManager.h:10
Definition Scheduler.h:14
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