LeviLamina
Loading...
Searching...
No Matches
NetworkSystem.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/SubClientId.h"
7#include "mc/deps/core/threading/Async.h"
8#include "mc/deps/core/utility/BinaryStream.h"
9#include "mc/deps/core/utility/NonOwnerPointer.h"
10#include "mc/deps/core/utility/pub_sub/Publisher.h"
11#include "mc/network/DevConnectionQuality.h"
12#include "mc/network/NetworkEnableDisableListener.h"
13#include "mc/network/NetworkSettingOptions.h"
14#include "mc/network/PacketGroupDefinition.h"
15#include "mc/network/RakNetConnector.h"
16#include "mc/network/RakPeerHelper.h"
17#include "mc/network/connection/DisconnectFailReason.h"
18
19// auto generated forward declare list
20// clang-format off
21class IPacketObserver;
23class LocalConnector;
26class NetworkPeer;
29class Packet;
30class RemoteConnector;
31class Scheduler;
32class ServerLocator;
33class TaskGroup;
34class WeakEntityRef;
36namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
37namespace Json { class Value; }
38namespace cereal { struct ReflectionCtx; }
39// clang-format on
40
44public:
45 // NetworkSystem inner types declare
46 // clang-format off
47 struct Dependencies;
49 // clang-format on
50
51 // NetworkSystem inner types define
52 struct Dependencies {
53 public:
54 // member variables
55 // NOLINTBEGIN
63 // NOLINTEND
64
65 public:
66 // prevent constructor by default
67 Dependencies& operator=(Dependencies const&);
70
71 public:
72 // member functions
73 // NOLINTBEGIN
74 MCNAPI ~Dependencies();
75 // NOLINTEND
76
77 public:
78 // destructor thunk
79 // NOLINTBEGIN
80 MCNAPI void $dtor();
81 // NOLINTEND
82 };
83
85 public:
86 // member variables
87 // NOLINTBEGIN
90 // NOLINTEND
91
92 public:
93 // prevent constructor by default
97 };
98
99public:
100 // member variables
101 // NOLINTBEGIN
102 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::NetworkSessionOwner>> mNetworkSessionOwner;
103 ::ll::TypedStorage<8, 80, ::std::recursive_mutex> mConnectionsMutex;
104 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::NetworkConnection>>> mConnections;
105 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LocalConnector>> mLocalConnector;
106 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PacketGroupDefinition::PacketGroupBuilder>> mPacketGroupBuilder;
107 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::RemoteConnector>> mRemoteConnector;
108 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ServerLocator>> mServerLocator;
109 ::ll::TypedStorage<8, 8, uint64> mCurrentConnection;
110 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mReceiveTask;
111 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mReceiveTaskGroup;
112 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IPacketObserver>> mPacketObserver;
113 ::ll::TypedStorage<8, 8, ::Scheduler&> mMainThread;
114 ::ll::TypedStorage<8, 32, ::std::string> mReceiveBuffer;
115 ::ll::TypedStorage<8, 32, ::std::string> mSendBuffer;
116 ::ll::TypedStorage<8, 80, ::BinaryStream> mSendStream;
117 ::ll::TypedStorage<8, 32, ::std::unique_ptr<::NetworkSystem::IncomingPacketQueue>[4]> mIncomingPackets;
118 ::ll::TypedStorage<1, 1, bool> mUseIPv6Only;
119 ::ll::TypedStorage<2, 2, ushort> mDefaultGamePort;
120 ::ll::TypedStorage<2, 2, ushort> mDefaultGamePortv6;
121 ::ll::TypedStorage<1, 1, bool> mIsLanDiscoveryEnabled;
122 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::NetworkStatistics>> mNetworkStatistics;
123 ::ll::TypedStorage<1, 1, bool> mWebsocketsEnabled;
124 ::ll::TypedStorage<4, 20, ::NetworkSettingOptions> mNetworkSettingOptions;
125 ::ll::TypedStorage<1, 1, bool> mRawRecordingEnabled;
126 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::cereal::ReflectionCtx>>> mReflectionCtx;
127 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::IPacketSerializationController>>> mPacketOverrides;
128 ::ll::TypedStorage<
129 8,
130 8,
131 ::gsl::not_null<::std::unique_ptr<
132 ::Bedrock::PubSub::
134 mSessionSummaryPublisher;
135 // NOLINTEND
136
137public:
138 // prevent constructor by default
139 NetworkSystem& operator=(NetworkSystem const&);
142
143public:
144 LLNDAPI NetworkConnection* getConnectionFromId(NetworkIdentifier const& id);
145
146public:
147 // virtual functions
148 // NOLINTBEGIN
149 // vIndex: 1
150 virtual bool useIPv4Only() const /*override*/;
151
152 // vIndex: 2
153 virtual bool useIPv6Only() const /*override*/;
154
155 // vIndex: 3
156 virtual ushort getDefaultGamePort() const /*override*/;
157
158 // vIndex: 4
159 virtual ushort getDefaultGamePortv6() const /*override*/;
160
161 // vIndex: 0
162 virtual ~NetworkSystem() /*override*/;
163
164 // vIndex: 1
165 virtual void _onDisable() /*override*/;
166
167 // vIndex: 2
168 virtual void _onEnable() /*override*/;
169
170 // vIndex: 1
171 virtual bool
172 onNewIncomingConnection(::NetworkIdentifier const& id, ::std::shared_ptr<::NetworkPeer>&& peer) /*override*/;
173
174 // vIndex: 2
175 virtual bool
176 onNewOutgoingConnection(::NetworkIdentifier const& id, ::std::shared_ptr<::NetworkPeer>&& peer) /*override*/;
177
178 // vIndex: 3
179 virtual void onConnectionClosed(
180 ::NetworkIdentifier const& id,
181 ::Connection::DisconnectFailReason const discoReason,
182 ::std::string const& reasonMessage,
183 bool skipDisconnectMessage,
184 ::Json::Value const& sessionSummary
185 ) /*override*/;
186
187 // vIndex: 4
188 virtual void onAllConnectionsClosed(
189 ::Connection::DisconnectFailReason discoReason,
190 ::std::string const& reasonMessage,
191 bool skipDisconnectMessage
192 ) /*override*/;
193
194 // vIndex: 5
195 virtual void onAllRemoteConnectionsClosed(
196 ::Connection::DisconnectFailReason discoReason,
197 ::std::string const& reasonMessage,
198 bool skipDisconnectMessage
199 ) /*override*/;
200
201 // vIndex: 6
202 virtual void onOutgoingConnectionFailed(
203 ::Connection::DisconnectFailReason discoReason,
204 ::std::string const& reasonMessage
205 ) /*override*/;
206
207 // vIndex: 7
208 virtual void onWebsocketRequest(
209 ::std::string const& serverAddress,
210 ::std::string const& payload,
211 ::std::function<void()> errorCallback
212 ) /*override*/;
213 // NOLINTEND
214
215public:
216 // member functions
217 // NOLINTBEGIN
218 MCAPI explicit NetworkSystem(::NetworkSystem::Dependencies&& deps);
219
220 MCAPI void _sendInternal(::NetworkIdentifier const& id, ::Packet const& packet, ::std::string const& data);
221
222 MCAPI bool
223 _sortAndPacketizeEvents(::NetworkConnection& connection, ::std::chrono::steady_clock::time_point endTime);
224
225 MCAPI void disconnect();
226
227 MCAPI void enableAsyncFlush(::NetworkIdentifier const& id);
228
229 MCAPI ::NetworkPeer* getPeerForUser(::NetworkIdentifier const& id);
230
231 MCAPI ::Bedrock::NotNullNonOwnerPtr<::RemoteConnector> getRemoteConnector();
232
233 MCAPI bool isServer() const;
234
235 MCAPI void runEvents(bool networkIsCritical);
236
237 MCAPI void send(::NetworkIdentifier const& id, ::Packet const& packet, ::SubClientId recipientSubId);
238
239 MCAPI void sendToMultiple(::std::vector<::NetworkIdentifierWithSubId> const& ids, ::Packet const& packet);
240
241 MCAPI void setDevConnectionQuality(::DevConnectionQuality quality);
242
243 MCAPI void update(::std::vector<::WeakEntityRef> const* userList);
244 // NOLINTEND
245
246public:
247 // constructor thunks
248 // NOLINTBEGIN
249 MCAPI void* $ctor(::NetworkSystem::Dependencies&& deps);
250 // NOLINTEND
251
252public:
253 // destructor thunk
254 // NOLINTBEGIN
255 MCAPI void $dtor();
256 // NOLINTEND
257
258public:
259 // virtual function thunks
260 // NOLINTBEGIN
261 MCFOLD bool $useIPv4Only() const;
262
263 MCAPI bool $useIPv6Only() const;
264
265 MCAPI ushort $getDefaultGamePort() const;
266
267 MCAPI ushort $getDefaultGamePortv6() const;
268
269 MCAPI void $_onDisable();
270
271 MCAPI void $_onEnable();
272
273 MCAPI bool $onNewIncomingConnection(::NetworkIdentifier const& id, ::std::shared_ptr<::NetworkPeer>&& peer);
274
275 MCAPI bool $onNewOutgoingConnection(::NetworkIdentifier const& id, ::std::shared_ptr<::NetworkPeer>&& peer);
276
277 MCAPI void $onConnectionClosed(
278 ::NetworkIdentifier const& id,
279 ::Connection::DisconnectFailReason const discoReason,
280 ::std::string const& reasonMessage,
281 bool skipDisconnectMessage,
282 ::Json::Value const& sessionSummary
283 );
284
285 MCAPI void $onAllConnectionsClosed(
286 ::Connection::DisconnectFailReason discoReason,
287 ::std::string const& reasonMessage,
288 bool skipDisconnectMessage
289 );
290
291 MCAPI void $onAllRemoteConnectionsClosed(
292 ::Connection::DisconnectFailReason discoReason,
293 ::std::string const& reasonMessage,
294 bool skipDisconnectMessage
295 );
296
297 MCAPI void
298 $onOutgoingConnectionFailed(::Connection::DisconnectFailReason discoReason, ::std::string const& reasonMessage);
299
300 MCAPI void $onWebsocketRequest(
301 ::std::string const& serverAddress,
302 ::std::string const& payload,
303 ::std::function<void()> errorCallback
304 );
305 // NOLINTEND
306
307public:
308 // vftables
309 // NOLINTBEGIN
310 MCNAPI static void** $vftableForConnectionCallbacks();
311
312 MCNAPI static void** $vftableForIPSupportInterface();
313
315 // NOLINTEND
316};
Definition IPacketObserver.h:14
Definition IPacketSerializationController.h:9
Definition Value.h:16
Definition LocalConnector.h:16
Definition NetworkConnection.h:30
Definition NetworkEnableDisableListener.h:5
Definition NetworkIdentifier.h:10
Definition NetworkPeer.h:8
Definition NetworkSessionOwner.h:9
Definition NetworkStatistics.h:24
Definition NetworkSystem.h:43
static MCAPI void ** $vftableForIPSupportInterface()
static MCAPI void ** $vftableForNetworkEnableDisableListener()
static MCAPI void ** $vftableForConnectionCallbacks()
Definition Packet.h:28
Definition RakPeerHelper.h:23
Definition RemoteConnector.h:19
Definition Scheduler.h:13
Definition ServerLocator.h:19
Definition TaskGroup.h:53
Definition WeakEntityRef.h:14
STL namespace.
Definition NetworkIdentifierWithSubId.h:10
Definition NetworkSystem.h:52
Definition NetworkSystem.h:84
Definition RakNetConnector.h:39
Definition Alias.h:14