LeviLamina
Loading...
Searching...
No Matches
SignalingService.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/application/AppPlatformListener.h"
7#include "mc/deps/core/http/PersistentWebSocket.h"
8#include "mc/deps/core/threading/Async.h"
9#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/deps/nether_net/ESessionError.h"
12#include "mc/deps/nether_net/ISignalingInterface.h"
13#include "mc/network/services/signaling/json_rpc/JsonRpcProvider.h"
14#include "mc/platform/ErrorInfo.h"
15#include "mc/platform/Result.h"
16
17// auto generated forward declare list
18// clang-format off
21class Scheduler;
22class WorkerPool;
23namespace Bedrock::Http { class HeaderCollection; }
24namespace Bedrock::Http { class RetryPolicy; }
25namespace Bedrock::Http { struct Url; }
26namespace Bedrock::PubSub { class Subscription; }
27namespace Json { class Value; }
28namespace NetherNet { struct ISignalingEventHandler; }
29namespace NetherNet { struct NetworkID; }
30namespace NetherNet { struct StunRelayServer; }
31namespace cereal { struct ReflectionCtx; }
32// clang-format on
33
36 public ::std::enable_shared_from_this<::SignalingService> {
37public:
38 // SignalingService inner types declare
39 // clang-format off
40 class Channel;
41 class Connection;
45 // clang-format on
46
47 // SignalingService inner types define
48 enum class ConnectionStatus : uchar {
49 Connected = 0,
50 Disconnected = 1,
51 };
52
54 public:
55 // Connection inner types define
56 enum class ServiceError : int {
57 UnknownError = 0,
58 PlayerUnreachable = 1,
59 MessageDeliveryFailed = 2,
60 TurnAuthFailed = 3,
61 FallbackToBestEffortDelivery = 4,
62 };
63
64 public:
65 // member variables
66 // NOLINTBEGIN
78 // NOLINTEND
79
80 public:
81 // prevent constructor by default
82 Connection& operator=(Connection const&);
83 Connection(Connection const&);
84 Connection();
85
86 public:
87 // virtual functions
88 // NOLINTBEGIN
89 // vIndex: 0
90 virtual ~Connection() /*override*/;
91
92 // vIndex: 2
93 virtual void onMessage(::std::string_view incomingMessage) /*override*/;
94
95 // vIndex: 5
96 virtual bool shouldReconnect() const /*override*/;
97
98 // vIndex: 6
99 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() /*override*/;
100
101 // vIndex: 7
102 virtual ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection> getHeaders() /*override*/;
103
104 // vIndex: 8
105 virtual ::Bedrock::Http::RetryPolicy getReconnectPolicy() /*override*/;
106
107 // vIndex: 9
108 virtual void onConnect() /*override*/;
109
110 // vIndex: 10
111 virtual void onDisconnect(bool, uint closeStatus) /*override*/;
112
113 // vIndex: 11
114 virtual void _requestTurnConfig() const;
115
116 // vIndex: 12
117 virtual void _sendPing() const;
118
119 // vIndex: 4
120 virtual void onAppSuspended() /*override*/;
121
122 // vIndex: 5
123 virtual void onAppResumed() /*override*/;
124 // NOLINTEND
125
126 public:
127 // member functions
128 // NOLINTBEGIN
131 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
132 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing
133 );
134
135 MCNAPI void _handleError(
136 ::SignalingService::Connection::ServiceError errorCode,
137 ::std::string const& errorMessage,
138 ::std::string const& messageId
139 );
140
142
143 MCNAPI void _parseError(::std::string const& message, ::std::string messageId);
144
145 MCNAPI void _parseSignal(::NetherNet::NetworkID fromNetworkID, ::std::string message, ::std::string messageId);
146
147 MCNAPI ::Bedrock::Result<::std::vector<::NetherNet::StunRelayServer>, ::NetherNet::ESessionError>
149
151 ::NetherNet::ESessionError result,
152 ::std::vector<::NetherNet::StunRelayServer> const& config
153 );
154
155 MCNAPI ::Bedrock::Threading::Async<::std::error_code> connect();
156
157 MCNAPI void parseTurnConfig(::std::string const& bodyText);
158
159 MCNAPI void parseTurnConfig(::Json::Value const& config);
160
161 MCNAPI ::Bedrock::Threading::Async<::NetherNet::ESessionError>
162 sendTo(::NetherNet::NetworkID to, ::std::string const& message);
163
164 MCNAPI void update();
165 // NOLINTEND
166
167 public:
168 // constructor thunks
169 // NOLINTBEGIN
170 MCNAPI void* $ctor(
172 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
173 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing
174 );
175 // NOLINTEND
176
177 public:
178 // destructor thunk
179 // NOLINTBEGIN
180 MCNAPI void $dtor();
181 // NOLINTEND
182
183 public:
184 // virtual function thunks
185 // NOLINTBEGIN
186 MCNAPI void $onMessage(::std::string_view incomingMessage);
187
188 MCNAPI bool $shouldReconnect() const;
189
190 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url> $getUrl();
191
192 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection> $getHeaders();
193
194 MCNAPI ::Bedrock::Http::RetryPolicy $getReconnectPolicy();
195
196 MCNAPI void $onConnect();
197
198 MCNAPI void $onDisconnect(bool, uint closeStatus);
199
200 MCNAPI void $_requestTurnConfig() const;
201
202 MCNAPI void $_sendPing() const;
203
204 MCNAPI void $onAppSuspended();
205
206 MCNAPI void $onAppResumed();
207 // NOLINTEND
208
209 public:
210 // vftables
211 // NOLINTBEGIN
212 MCNAPI static void** $vftableForPersistentWebSocket();
213
214 MCNAPI static void** $vftableForAppPlatformListener();
215 // NOLINTEND
216 };
217
219 public:
220 // member variables
221 // NOLINTBEGIN
223 // NOLINTEND
224
225 public:
226 // prevent constructor by default
227 JsonRpcConnection& operator=(JsonRpcConnection const&);
230
231 public:
232 // virtual functions
233 // NOLINTBEGIN
234 // vIndex: 6
235 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() /*override*/;
236
237 // vIndex: 2
238 virtual void onMessage(::std::string_view incomingMessage) /*override*/;
239
240 // vIndex: 9
241 virtual void onConnect() /*override*/;
242
243 // vIndex: 0
244 virtual ~JsonRpcConnection() /*override*/ = default;
245
246 // vIndex: 12
247 virtual void _sendPing() const /*override*/;
248
249 // vIndex: 11
250 virtual void _requestTurnConfig() const /*override*/;
251 // NOLINTEND
252
253 public:
254 // member functions
255 // NOLINTBEGIN
256 MCNAPI void
257 handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value> const& result);
258
259 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
260 sendJsonRpc(::std::string const& message);
261
262 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> sendJsonRpcTo(
263 ::NetherNet::NetworkID networkIdTo,
264 ::std::optional<::std::string> const& messageId,
265 ::std::string const& message
266 );
267 // NOLINTEND
268
269 public:
270 // virtual function thunks
271 // NOLINTBEGIN
272 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url> $getUrl();
273
274 MCNAPI void $onMessage(::std::string_view incomingMessage);
275
276 MCNAPI void $onConnect();
277
278 MCNAPI void $_sendPing() const;
279
280 MCNAPI void $_requestTurnConfig() const;
281 // NOLINTEND
282
283 public:
284 // vftables
285 // NOLINTBEGIN
286 MCNAPI static void** $vftableForPersistentWebSocket();
287
288 MCNAPI static void** $vftableForAppPlatformListener();
289 // NOLINTEND
290 };
291
293
295
297 public:
298 // member variables
299 // NOLINTBEGIN
302 // NOLINTEND
303
304 public:
305 // prevent constructor by default
306 Channel& operator=(Channel const&);
307 Channel(Channel const&);
308 Channel();
309
310 public:
311 // virtual functions
312 // NOLINTBEGIN
313 // vIndex: 0
314 virtual ~Channel() /*override*/ = default;
315
316 // vIndex: 1
317 virtual void SendSignal(
319 ::std::string const& message,
320 ::std::function<void(::NetherNet::ESessionError)>&& onComplete
321 ) /*override*/;
322
323 // vIndex: 2
324 virtual ::Bedrock::PubSub::Subscription
325 RegisterEventHandler(::NetherNet::ISignalingEventHandler* handler) /*override*/;
326 // NOLINTEND
327
328 public:
329 // virtual function thunks
330 // NOLINTBEGIN
331 MCNAPI void $SendSignal(
333 ::std::string const& message,
334 ::std::function<void(::NetherNet::ESessionError)>&& onComplete
335 );
336
337 MCNAPI ::Bedrock::PubSub::Subscription $RegisterEventHandler(::NetherNet::ISignalingEventHandler* handler);
338 // NOLINTEND
339
340 public:
341 // vftables
342 // NOLINTBEGIN
343 MCNAPI static void** $vftable();
344 // NOLINTEND
345 };
346
347public:
348 // member variables
349 // NOLINTBEGIN
357 // NOLINTEND
358
359public:
360 // prevent constructor by default
361 SignalingService& operator=(SignalingService const&);
364
365public:
366 // virtual functions
367 // NOLINTBEGIN
368 // vIndex: 0
369 virtual ~SignalingService() /*override*/;
370
371 // vIndex: 1
372 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> sendJsonRpcTo(
373 ::NetherNet::NetworkID networkIdTo,
374 ::std::optional<::std::string> const& messageId,
375 ::std::string const& message
376 ) const /*override*/;
377
378 // vIndex: 2
379 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
380 sendJsonRpc(::std::string const& message) const /*override*/;
381
382 // vIndex: 3
383 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> sendPing() const /*override*/;
384
385 // vIndex: 4
386 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
387 sendTurnConfigRequest() /*override*/;
388
389 // vIndex: 5
390 virtual ::cereal::ReflectionCtx& getReflectionContext() /*override*/;
391
392 // vIndex: 6
393 virtual ::std::unique_ptr<::std::string, ::std::function<void(::std::string*)>> registerJsonRpcMethod(
394 ::std::string method,
395 ::std::function<void(::std::string, ::Json::Value const&)> handler
396 ) /*override*/;
397
398 // vIndex: 9
399 virtual void _unregisterJsonRpcMethod(::std::string method) /*override*/;
400
401 // vIndex: 7
402 virtual void dispatchJsonRpc(::std::string const& method, ::Json::Value const& params) /*override*/;
403
404 // vIndex: 8
405 virtual void
406 handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value> const& result) /*override*/;
407 // NOLINTEND
408
409public:
410 // member functions
411 // NOLINTBEGIN
413 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing,
414 ::WorkerPool& pool,
415 ::Scheduler& scheduler
416 );
417
418 MCNAPI ::std::shared_ptr<::SignalingService::Connection> _makeConnection(::NetherNet::NetworkID id, bool jsonRpc);
419
420 MCNAPI ::gsl::not_null<::std::shared_ptr<::NetherNet::ISignalingInterface>> getChannel() const;
421
422 MCNAPI ::Bedrock::Threading::Async<::std::vector<::NetherNet::StunRelayServer>> getRelayConfig() const;
423
424 MCNAPI ::Bedrock::Threading::Async<::std::error_code> signIn(::NetherNet::NetworkID id, bool useJsonRpc);
425 // NOLINTEND
426
427public:
428 // constructor thunks
429 // NOLINTBEGIN
430 MCNAPI void*
431 $ctor(::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing, ::WorkerPool& pool, ::Scheduler& scheduler);
432 // NOLINTEND
433
434public:
435 // destructor thunk
436 // NOLINTBEGIN
437 MCNAPI void $dtor();
438 // NOLINTEND
439
440public:
441 // virtual function thunks
442 // NOLINTBEGIN
443 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> $sendJsonRpcTo(
444 ::NetherNet::NetworkID networkIdTo,
445 ::std::optional<::std::string> const& messageId,
446 ::std::string const& message
447 ) const;
448
449 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
450 $sendJsonRpc(::std::string const& message) const;
451
452 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> $sendPing() const;
453
454 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> $sendTurnConfigRequest();
455
456 MCNAPI ::cereal::ReflectionCtx& $getReflectionContext();
457
458 MCNAPI ::std::unique_ptr<::std::string, ::std::function<void(::std::string*)>>
459 $registerJsonRpcMethod(::std::string method, ::std::function<void(::std::string, ::Json::Value const&)> handler);
460
461 MCNAPI void $_unregisterJsonRpcMethod(::std::string method);
462
463 MCNAPI void $dispatchJsonRpc(::std::string const& method, ::Json::Value const& params);
464
465 MCNAPI void $handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value> const& result);
466 // NOLINTEND
467
468public:
469 // vftables
470 // NOLINTBEGIN
471 MCNAPI static void** $vftableForJsonRpcProvider();
472
474 // NOLINTEND
475};
Definition AppPlatformListener.h:15
Definition EnableNonOwnerReferences.h:7
Definition PersistentWebSocket.h:20
Definition IMinecraftEventing.h:147
Definition ISignalingServiceConfigProvider.h:14
Definition JsonRpcProvider.h:17
Definition Value.h:16
Definition ISignalingInterface.h:17
Definition Scheduler.h:13
Definition SignalingService.h:296
MCAPI void $SendSignal(::NetherNet::NetworkID to, ::std::string const &message, ::std::function< void(::NetherNet::ESessionError)> &&onComplete)
MCAPI::Bedrock::PubSub::Subscription $RegisterEventHandler(::NetherNet::ISignalingEventHandler *handler)
static MCAPI void ** $vftable()
Definition SignalingService.h:53
MCAPI void _parseError(::std::string const &message, ::std::string messageId)
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url > $getUrl()
MCAPI ::Bedrock::Result<::std::vector<::NetherNet::StunRelayServer >, ::NetherNet::ESessionError > _parseTurnConfig(::Json::Value const &config)
MCAPI void parseTurnConfig(::std::string const &bodyText)
static MCAPI void ** $vftableForAppPlatformListener()
MCAPI void _onTurnConfigFailure(::Bedrock::ErrorInfo<::NetherNet::ESessionError > const &error)
MCAPI Connection(::NetherNet::NetworkID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing)
MCAPI void _parseSignal(::NetherNet::NetworkID fromNetworkID, ::std::string message, ::std::string messageId)
MCAPI void _sendTurnConfigTelemetry(::NetherNet::ESessionError result, ::std::vector<::NetherNet::StunRelayServer > const &config)
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI void * $ctor(::NetherNet::NetworkID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing)
MCAPI void $onDisconnect(bool, uint closeStatus)
MCAPI::Bedrock::Http::RetryPolicy $getReconnectPolicy()
MCAPI bool $shouldReconnect() const
MCAPI void parseTurnConfig(::Json::Value const &config)
MCAPI void $_sendPing() const
MCAPI ::Bedrock::Threading::Async<::std::error_code > connect()
MCAPI void $_requestTurnConfig() const
MCAPI ::Bedrock::Threading::Async<::NetherNet::ESessionError > sendTo(::NetherNet::NetworkID to, ::std::string const &message)
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void _handleError(::SignalingService::Connection::ServiceError errorCode, ::std::string const &errorMessage, ::std::string const &messageId)
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection > $getHeaders()
Definition SignalingService.h:292
Definition SignalingService.h:218
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > sendJsonRpc(::std::string const &message)
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value > const &result)
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > sendJsonRpcTo(::NetherNet::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message)
MCAPI void $_requestTurnConfig() const
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url > $getUrl()
static MCAPI void ** $vftableForAppPlatformListener()
Definition SignalingService.h:294
Definition SignalingService.h:36
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendJsonRpcTo(::NetherNet::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message) const
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendTurnConfigRequest()
MCAPI void $_unregisterJsonRpcMethod(::std::string method)
MCAPI ::Bedrock::Threading::Async<::std::error_code > signIn(::NetherNet::NetworkID id, bool useJsonRpc)
MCAPI ::std::shared_ptr<::SignalingService::Connection > _makeConnection(::NetherNet::NetworkID id, bool jsonRpc)
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendJsonRpc(::std::string const &message) const
MCAPI::cereal::ReflectionCtx & $getReflectionContext()
MCAPI void $dtor()
MCAPI void $dispatchJsonRpc(::std::string const &method, ::Json::Value const &params)
static MCAPI void ** $vftableForJsonRpcProvider()
MCAPI ::gsl::not_null<::std::shared_ptr<::NetherNet::ISignalingInterface > > getChannel() const
static MCAPI void ** $vftableForEnableNonOwnerReferences()
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendPing() const
MCAPI void $handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value > const &result)
MCAPI ::Bedrock::Threading::Async<::std::vector<::NetherNet::StunRelayServer > > getRelayConfig() const
MCAPI ::std::unique_ptr<::std::string, ::std::function< void(::std::string *)> > $registerJsonRpcMethod(::std::string method, ::std::function< void(::std::string, ::Json::Value const &)> handler)
Definition WorkerPool.h:19
STL namespace.
Definition ErrorInfo.h:9
Definition ISignalingEventHandler.h:12
Definition NetworkID.h:21
Definition Alias.h:14