Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
NetherNetConnector.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/cereal/ContextArea.h"
7#include "mc/deps/nether_net/ESessionError.h"
8#include "mc/deps/nether_net/INetherNetTransportInterfaceCallbacks.h"
9#include "mc/deps/nether_net/NetworkID.h"
10#include "mc/network/Connector.h"
11#include "mc/network/RemoteConnector.h"
12#include "mc/network/TransportLayer.h"
13#include "mc/platform/brstd/copyable_function.h"
14#include "mc/platform/brstd/move_only_function.h"
15#include "mc/platform/threading/UniqueLock.h"
16
17// auto generated forward declare list
18// clang-format off
24namespace Json { class Value; }
25namespace NetherNet { class IIdentityAssertionGenerator; }
26namespace NetherNet { class INetherNetTransportInterface; }
27namespace Social { class GameConnectionInfo; }
28namespace cereal { struct SchemaWriter; }
29// clang-format on
30
31struct NetherNetConnector : public ::RemoteConnector, public ::NetherNet::INetherNetTransportInterfaceCallbacks {
32public:
33 // NetherNetConnector inner types declare
34 // clang-format off
35 struct DisconnectEvent;
38 // clang-format on
39
40 // NetherNetConnector inner types define
41 struct DisconnectEvent {
42 public:
43 // member variables
44 // NOLINTBEGIN
49 // NOLINTEND
50
51 public:
52 // prevent constructor by default
53 DisconnectEvent& operator=(DisconnectEvent const&);
54 DisconnectEvent(DisconnectEvent const&);
55 DisconnectEvent();
56 };
57
58 struct NewIncomingConnectionEvent {
59 public:
60 // member variables
61 // NOLINTBEGIN
64 // NOLINTEND
65
66 public:
67 // prevent constructor by default
68 NewIncomingConnectionEvent& operator=(NewIncomingConnectionEvent const&);
69 NewIncomingConnectionEvent(NewIncomingConnectionEvent const&);
70 NewIncomingConnectionEvent();
71 };
72
73 struct NewOutgoingConnectionEvent {
74 public:
75 // member variables
76 // NOLINTBEGIN
78 // NOLINTEND
79
80 public:
81 // prevent constructor by default
82 NewOutgoingConnectionEvent& operator=(NewOutgoingConnectionEvent const&);
83 NewOutgoingConnectionEvent(NewOutgoingConnectionEvent const&);
84 NewOutgoingConnectionEvent();
85 };
86
87 using BroadcastRequestCallback = ::brstd::move_only_function<
89
90 using BroadcastResponseCallback = ::std::function<void(::NetherNet::NetworkID const&, void const*, int)>;
91
92 using Event = ::std::variant<
96
97 using HttpLibraryToken = ::std::shared_ptr<void>;
98
100
101public:
102 // member variables
103 // NOLINTBEGIN
104 ::ll::TypedStorage<8, 16, ::std::shared_ptr<void> const> mHttpLibrary;
105 ::ll::TypedStorage<8, 24, ::NetherNet::NetworkID const> mNetworkID;
106 ::ll::TypedStorage<
107 8,
108 72,
109 ::std::unique_ptr<
111 ::std::function<void(::NetherNet::INetherNetTransportInterface*)>>>
112 mTransport;
113 ::ll::TypedStorage<8, 80, ::std::mutex> mBroadcastCallbackMutex;
114 ::ll::TypedStorage<
115 8,
116 64,
119 mBroadcastRequestCallback;
120 ::ll::TypedStorage<8, 64, ::std::function<void(::NetherNet::NetworkID const&, void const*, int)>>
121 mBroadcastResponseCallback;
122 ::ll::TypedStorage<8, 80, ::std::recursive_mutex> mEventsMutex;
123 ::ll::TypedStorage<
124 8,
125 8,
126 ::std::unique_ptr<::std::vector<::std::variant<
130 mEvents;
131 ::ll::TypedStorage<8, 24, ::std::vector<::std::weak_ptr<::WebRTCNetworkPeer>>> mPeers;
132 // NOLINTEND
133
134public:
135 // prevent constructor by default
136 NetherNetConnector();
137
138public:
139 // virtual functions
140 // NOLINTBEGIN
141 virtual ~NetherNetConnector() /*override*/;
142
143 virtual bool closeSessionWithUser(::NetherNet::NetworkID remoteId, uint64 sessionId);
144
145 virtual void setDisableLanSignaling(bool disableLanSignaling) /*override*/;
146
147 virtual bool host(::ConnectionDefinition const& definition, ::PrivateKeyManager const& keys) /*override*/;
148
149#ifdef LL_PLAT_S
150 virtual bool connect(
153 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator>
154 ) /*override*/;
155#else // LL_PLAT_C
156 virtual bool connect(
157 ::Social::GameConnectionInfo const& primaryConnection,
158 ::Social::GameConnectionInfo const& backupConnection,
159 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator> identityGenerator
160 ) /*override*/;
161#endif
162
163 virtual void tick() /*override*/;
164
165 virtual void runEvents() /*override*/;
166
167 virtual ::NetworkIdentifier getNetworkIdentifier() const /*override*/;
168
169 virtual void closeNetworkConnection(::NetworkIdentifier const&) /*override*/;
170
171 virtual bool setApplicationHandshakeCompleted(::NetworkIdentifier const&) /*override*/;
172
173 virtual ::TransportLayer getNetworkType() const /*override*/;
174
175 virtual void _onDisable() /*override*/;
176
177 virtual void _onEnable() /*override*/;
178
179 virtual void OnSpopViolation() /*override*/;
180
181 virtual void OnSessionClose(
182 ::NetherNet::NetworkID networkID,
183 uint64 sessionId,
184 ::NetherNet::ESessionError sessionError,
185 ::Json::Value summary
186 ) /*override*/;
187
188 virtual void
189 OnDiscoveryResponse(::NetherNet::NetworkID networkID, void const* pApplicationData, int size) /*override*/;
190
191 virtual ::brstd::move_only_function<bool(::cereal::SchemaWriter&, ::cereal::ContextArea)>
192 OnDiscoveryRequest() /*override*/;
193
194 virtual void OnSessionGetConnectionFlags(::NetherNet::NetworkID, uint* flags) /*override*/;
195 // NOLINTEND
196
197public:
198 // member functions
199 // NOLINTBEGIN
200 MCNAPI NetherNetConnector(
201 ::NetherNetTransportFactory const& factory,
202 ::Connector::ConnectionCallbacks& callbacks,
203 ::std::shared_ptr<void> httpLibrary,
204 ::brstd::copyable_function<bool() const> isNetworkAllowed,
205 ::std::optional<::NetherNet::NetworkID> networkId
206 );
207
208#ifdef LL_PLAT_C
209 MCNAPI void _createEventQueue();
210
211 MCNAPI ::gsl::not_null<::std::shared_ptr<::WebRTCNetworkPeer>> _getOrCreatePeer(
212 ::NetherNet::NetworkID const& remoteId,
213 uint64 sessionId,
214 bool isLan,
216 );
217#endif
218
219 MCNAPI void _resetEventQueue();
220
222 ::std::function<void(::NetherNet::NetworkID const&, void const*, int)>&& broadcastResponseCallback
223 );
224 // NOLINTEND
225
226public:
227 // constructor thunks
228 // NOLINTBEGIN
229 MCNAPI void* $ctor(
230 ::NetherNetTransportFactory const& factory,
232 ::std::shared_ptr<void> httpLibrary,
233 ::brstd::copyable_function<bool() const> isNetworkAllowed,
234 ::std::optional<::NetherNet::NetworkID> networkId
235 );
236 // NOLINTEND
237
238public:
239 // destructor thunk
240 // NOLINTBEGIN
241 MCNAPI void $dtor();
242 // NOLINTEND
243
244public:
245 // virtual function thunks
246 // NOLINTBEGIN
247 MCNAPI bool $closeSessionWithUser(::NetherNet::NetworkID remoteId, uint64 sessionId);
248
249 MCNAPI void $setDisableLanSignaling(bool disableLanSignaling);
250
251 MCNAPI bool $host(::ConnectionDefinition const& definition, ::PrivateKeyManager const& keys);
252
253#ifdef LL_PLAT_S
254 MCNAPI bool $connect(
257 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator>
258 );
259#else // LL_PLAT_C
260 MCNAPI bool $connect(
261 ::Social::GameConnectionInfo const& primaryConnection,
262 ::Social::GameConnectionInfo const& backupConnection,
263 ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator> identityGenerator
264 );
265#endif
266
267 MCNAPI void $tick();
268
269 MCNAPI void $runEvents();
270
271 MCNAPI ::NetworkIdentifier $getNetworkIdentifier() const;
272
274
276
277 MCNAPI ::TransportLayer $getNetworkType() const;
278
279 MCNAPI void $_onDisable();
280
281 MCNAPI void $_onEnable();
282
283 MCNAPI void $OnSpopViolation();
284
285 MCNAPI void $OnSessionClose(
286 ::NetherNet::NetworkID networkID,
287 uint64 sessionId,
288 ::NetherNet::ESessionError sessionError,
289 ::Json::Value summary
290 );
291
292 MCNAPI void $OnDiscoveryResponse(::NetherNet::NetworkID networkID, void const* pApplicationData, int size);
293
294 MCNAPI ::brstd::move_only_function<bool(::cereal::SchemaWriter&, ::cereal::ContextArea)> $OnDiscoveryRequest();
295
297
298
299 // NOLINTEND
300};
Definition UniqueLock.h:8
Definition Value.h:16
Definition NetherNetTransportFactory.h:13
Definition IIdentityAssertionGenerator.h:7
Definition INetherNetTransportInterfaceCallbacks.h:20
Definition INetherNetTransportInterface.h:22
Definition NetworkIdentifier.h:10
Definition PrivateKeyManager.h:10
Definition GameConnectionInfo.h:24
Definition WebRTCNetworkPeer.h:16
Definition copyable_function.h:8
Definition move_only_function.h:9
STL namespace.
Definition ConnectionDefinition.h:5
Definition Connector.h:27
Definition NetherNetConnector.h:41
Definition NetherNetConnector.h:58
Definition NetherNetConnector.h:73
MCAPI void setBroadcastResponseCallback(::std::function< void(::NetherNet::NetworkID const &, void const *, int)> &&broadcastResponseCallback)
MCAPI ::brstd::move_only_function< bool(::cereal::SchemaWriter &, ::cereal::ContextArea)> $OnDiscoveryRequest()
MCAPI void $OnSessionGetConnectionFlags(::NetherNet::NetworkID, uint *flags)
MCAPI void $OnDiscoveryResponse(::NetherNet::NetworkID networkID, void const *pApplicationData, int size)
MCAPI void $setDisableLanSignaling(bool disableLanSignaling)
MCAPI bool $setApplicationHandshakeCompleted(::NetworkIdentifier const &)
MCAPI bool $closeSessionWithUser(::NetherNet::NetworkID remoteId, uint64 sessionId)
MCAPI::TransportLayer $getNetworkType() const
MCAPI void _resetEventQueue()
MCAPI void $closeNetworkConnection(::NetworkIdentifier const &)
MCAPI::NetworkIdentifier $getNetworkIdentifier() const
MCAPI void $OnSessionClose(::NetherNet::NetworkID networkID, uint64 sessionId, ::NetherNet::ESessionError sessionError, ::Json::Value summary)
MCAPI void $_onDisable()
MCAPI bool $connect(::Social::GameConnectionInfo const &primaryConnection, ::Social::GameConnectionInfo const &backupConnection, ::std::shared_ptr<::NetherNet::IIdentityAssertionGenerator > identityGenerator)
MCAPI void $tick()
MCAPI void $dtor()
MCAPI bool $host(::ConnectionDefinition const &definition, ::PrivateKeyManager const &keys)
MCAPI void $runEvents()
MCAPI void $OnSpopViolation()
MCAPI void * $ctor(::NetherNetTransportFactory const &factory, ::Connector::ConnectionCallbacks &callbacks, ::std::shared_ptr< void > httpLibrary, ::brstd::copyable_function< bool() const > isNetworkAllowed, ::std::optional<::NetherNet::NetworkID > networkId)
MCAPI void $_onEnable()
Definition NetworkID.h:17
Definition SchemaWriter.h:16
Definition Alias.h:14