Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MsQuicNativeMethods.cs
Go to the documentation of this file.
2
4
5internal static class MsQuicNativeMethods
6{
67
68 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
69 internal delegate void SetCallbackHandlerDelegate(SafeHandle handle, Delegate del, IntPtr context);
70
71 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
72 internal unsafe delegate uint SetParamDelegate(SafeHandle handle, QUIC_PARAM_LEVEL level, uint param, uint bufferLength, byte* buffer);
73
74 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
75 internal unsafe delegate uint GetParamDelegate(SafeHandle handle, QUIC_PARAM_LEVEL level, uint param, ref uint bufferLength, byte* buffer);
76
77 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
78 internal delegate uint RegistrationOpenDelegate(ref RegistrationConfig config, out SafeMsQuicRegistrationHandle registrationContext);
79
80 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
81 internal delegate void RegistrationCloseDelegate(IntPtr registrationContext);
82
83 internal struct RegistrationConfig
84 {
85 [MarshalAs(UnmanagedType.LPUTF8Str)]
86 internal string AppName;
87
89 }
90
91 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
92 internal unsafe delegate uint ConfigurationOpenDelegate(SafeMsQuicRegistrationHandle registrationContext, QuicBuffer* alpnBuffers, uint alpnBufferCount, ref QuicSettings settings, uint settingsSize, IntPtr context, out SafeMsQuicConfigurationHandle configuration);
93
94 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
95 internal delegate void ConfigurationCloseDelegate(IntPtr configuration);
96
97 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
98 internal delegate uint ConfigurationLoadCredentialDelegate(SafeMsQuicConfigurationHandle configuration, ref CredentialConfig credConfig);
99
100 internal struct QuicSettings
101 {
103
104 internal ulong MaxBytesPerKey;
105
107
108 internal ulong IdleTimeoutMs;
109
111
113
115
117
119
121
123
124 internal uint InitialWindowPackets;
125
126 internal uint SendIdleTimeoutMs;
127
128 internal uint InitialRttMs;
129
130 internal uint MaxAckDelayMs;
131
132 internal uint DisconnectTimeoutMs;
133
134 internal uint KeepAliveIntervalMs;
135
136 internal ushort PeerBidiStreamCount;
137
138 internal ushort PeerUnidiStreamCount;
139
140 internal ushort RetryMemoryLimit;
141
142 internal ushort LoadBalancingMode;
143
145
147
148 internal unsafe uint* DesiredVersionsList;
149
151 }
152
153 [Flags]
154 internal enum QuicSettingsIsSetFlags : ulong
155 {
156 MaxBytesPerKey = 1uL,
158 IdleTimeoutMs = 4uL,
160 TlsServerMaxSendBuffer = 0x10uL,
163 ConnFlowControlWindow = 0x80uL,
164 MaxWorkerQueueDelayUs = 0x100uL,
165 MaxStatelessOperations = 0x200uL,
166 InitialWindowPackets = 0x400uL,
167 SendIdleTimeoutMs = 0x800uL,
168 InitialRttMs = 0x1000uL,
169 MaxAckDelayMs = 0x2000uL,
170 DisconnectTimeoutMs = 0x4000uL,
171 KeepAliveIntervalMs = 0x8000uL,
172 PeerBidiStreamCount = 0x10000uL,
173 PeerUnidiStreamCount = 0x20000uL,
174 RetryMemoryLimit = 0x40000uL,
175 LoadBalancingMode = 0x80000uL,
176 MaxOperationsPerDrain = 0x100000uL,
177 SendBufferingEnabled = 0x200000uL,
178 PacingEnabled = 0x400000uL,
179 MigrationEnabled = 0x800000uL,
180 DatagramReceiveEnabled = 0x1000000uL,
181 ServerResumptionLevel = 0x2000000uL,
182 DesiredVersionsList = 0x4000000uL,
183 VersionNegotiationExtEnabled = 0x8000000uL
184 }
185
186 [Flags]
196
197 internal struct CredentialConfig
198 {
200
202
204
205 [MarshalAs(UnmanagedType.LPUTF8Str)]
206 internal string Principal;
207
208 internal IntPtr Reserved;
209
211 }
212
214 {
215 internal IntPtr Asn1Blob;
216
217 internal uint Asn1BlobLength;
218
220 }
221
222 internal struct ListenerEvent
223 {
225
227 }
228
229 [StructLayout(LayoutKind.Explicit)]
231 {
232 [FieldOffset(0)]
234 }
235
237 {
238 internal unsafe NewConnectionInfo* Info;
239
241 }
242
243 internal struct NewConnectionInfo
244 {
245 internal uint QuicVersion;
246
248
250
251 internal uint CryptoBufferLength;
252
253 internal ushort ClientAlpnListLength;
254
255 internal ushort ServerNameLength;
256
257 internal byte NegotiatedAlpnLength;
258
260
262
264
266 }
267
268 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
269 internal delegate uint ListenerCallbackDelegate(IntPtr listener, IntPtr context, ref ListenerEvent evt);
270
271 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
272 internal delegate uint ListenerOpenDelegate(SafeMsQuicRegistrationHandle registration, ListenerCallbackDelegate handler, IntPtr context, out SafeMsQuicListenerHandle listener);
273
274 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
275 internal delegate void ListenerCloseDelegate(IntPtr listener);
276
277 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
278 internal unsafe delegate uint ListenerStartDelegate(SafeMsQuicListenerHandle listener, QuicBuffer* alpnBuffers, uint alpnBufferCount, ref SOCKADDR_INET localAddress);
279
280 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
281 internal delegate void ListenerStopDelegate(SafeMsQuicListenerHandle listener);
282
284 {
285 internal byte SessionResumed;
286
287 internal byte NegotiatedAlpnLength;
288
290 }
291
293 {
294 internal uint Status;
295 }
296
298 {
299 internal long ErrorCode;
300 }
301
306
307 [Flags]
314
316 {
317 internal IntPtr Address;
318 }
319
321 {
322 internal IntPtr Address;
323 }
324
326 {
327 internal IntPtr Stream;
328
330 }
331
333 {
334 internal ushort BiDirectionalCount;
335
336 internal ushort UniDirectionalCount;
337 }
338
349
350 [StructLayout(LayoutKind.Explicit)]
380
381 internal struct ConnectionEvent
382 {
384
386 }
387
388 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
389 internal delegate uint ConnectionCallbackDelegate(IntPtr connection, IntPtr context, ref ConnectionEvent connectionEvent);
390
391 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
392 internal delegate uint ConnectionOpenDelegate(SafeMsQuicRegistrationHandle registration, ConnectionCallbackDelegate handler, IntPtr context, out SafeMsQuicConnectionHandle connection);
393
394 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
395 internal delegate void ConnectionCloseDelegate(IntPtr connection);
396
397 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
399
400 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
401 internal delegate uint ConnectionStartDelegate(SafeMsQuicConnectionHandle connection, SafeMsQuicConfigurationHandle configuration, QUIC_ADDRESS_FAMILY family, [MarshalAs(UnmanagedType.LPUTF8Str)] string serverName, ushort serverPort);
402
403 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
404 internal delegate void ConnectionShutdownDelegate(SafeMsQuicConnectionHandle connection, QUIC_CONNECTION_SHUTDOWN_FLAGS flags, long errorCode);
405
407 {
408 internal ulong AbsoluteOffset;
409
410 internal ulong TotalBufferLength;
411
412 internal unsafe QuicBuffer* Buffers;
413
414 internal uint BufferCount;
415
417 }
418
420 {
421 internal byte Canceled;
422
424 }
425
427 {
428 internal long ErrorCode;
429 }
430
432 {
433 internal long ErrorCode;
434 }
435
437 {
438 internal byte Graceful;
439 }
440
442 {
443 internal byte ConnectionShutdown;
444 }
445
446 [StructLayout(LayoutKind.Explicit)]
447 internal struct StreamEventDataUnion
448 {
449 [FieldOffset(0)]
451
452 [FieldOffset(0)]
454
455 [FieldOffset(0)]
457
458 [FieldOffset(0)]
460
461 [FieldOffset(0)]
463
464 [FieldOffset(0)]
466 }
467
468 internal struct StreamEvent
469 {
471
473 }
474
475 internal struct SOCKADDR_IN
476 {
477 internal ushort sin_family;
478
479 internal ushort sin_port;
480
481 internal unsafe fixed byte sin_addr[4];
482 }
483
484 internal struct SOCKADDR_IN6
485 {
486 internal ushort sin6_family;
487
488 internal ushort sin6_port;
489
490 internal uint sin6_flowinfo;
491
492 internal unsafe fixed byte sin6_addr[16];
493
494 internal uint sin6_scope_id;
495 }
496
497 [StructLayout(LayoutKind.Explicit)]
498 internal struct SOCKADDR_INET
499 {
500 [FieldOffset(0)]
502
503 [FieldOffset(0)]
505
506 [FieldOffset(0)]
507 internal ushort si_family;
508 }
509
510 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
511 internal delegate uint StreamCallbackDelegate(IntPtr stream, IntPtr context, ref StreamEvent streamEvent);
512
513 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
515
516 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
518
519 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
520 internal delegate void StreamCloseDelegate(IntPtr stream);
521
522 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
524
525 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
526 internal unsafe delegate uint StreamSendDelegate(SafeMsQuicStreamHandle stream, QuicBuffer* buffers, uint bufferCount, QUIC_SEND_FLAGS flags, IntPtr clientSendContext);
527
528 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
529 internal delegate uint StreamReceiveCompleteDelegate(SafeMsQuicStreamHandle stream, ulong bufferLength);
530
531 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
532 internal delegate uint StreamReceiveSetEnabledDelegate(SafeMsQuicStreamHandle stream, [MarshalAs(UnmanagedType.U1)] bool enabled);
533
534 internal struct QuicBuffer
535 {
536 internal uint Length;
537
538 internal unsafe byte* Buffer;
539 }
540}
delegate uint ConnectionOpenDelegate(SafeMsQuicRegistrationHandle registration, ConnectionCallbackDelegate handler, IntPtr context, out SafeMsQuicConnectionHandle connection)
delegate uint ConnectionStartDelegate(SafeMsQuicConnectionHandle connection, SafeMsQuicConfigurationHandle configuration, QUIC_ADDRESS_FAMILY family, [MarshalAs(UnmanagedType.LPUTF8Str)] string serverName, ushort serverPort)
delegate uint ListenerCallbackDelegate(IntPtr listener, IntPtr context, ref ListenerEvent evt)
delegate void ConnectionShutdownDelegate(SafeMsQuicConnectionHandle connection, QUIC_CONNECTION_SHUTDOWN_FLAGS flags, long errorCode)
delegate uint RegistrationOpenDelegate(ref RegistrationConfig config, out SafeMsQuicRegistrationHandle registrationContext)
unsafe delegate uint SetParamDelegate(SafeHandle handle, QUIC_PARAM_LEVEL level, uint param, uint bufferLength, byte *buffer)
delegate uint ListenerOpenDelegate(SafeMsQuicRegistrationHandle registration, ListenerCallbackDelegate handler, IntPtr context, out SafeMsQuicListenerHandle listener)
delegate uint ConnectionSetConfigurationDelegate(SafeMsQuicConnectionHandle connection, SafeMsQuicConfigurationHandle configuration)
delegate uint StreamReceiveSetEnabledDelegate(SafeMsQuicStreamHandle stream, [MarshalAs(UnmanagedType.U1)] bool enabled)
delegate uint StreamCallbackDelegate(IntPtr stream, IntPtr context, ref StreamEvent streamEvent)
delegate uint StreamStartDelegate(SafeMsQuicStreamHandle stream, QUIC_STREAM_START_FLAGS flags)
delegate void ListenerStopDelegate(SafeMsQuicListenerHandle listener)
delegate uint StreamOpenDelegate(SafeMsQuicConnectionHandle connection, QUIC_STREAM_OPEN_FLAGS flags, StreamCallbackDelegate handler, IntPtr context, out SafeMsQuicStreamHandle stream)
delegate void SetCallbackHandlerDelegate(SafeHandle handle, Delegate del, IntPtr context)
delegate uint StreamReceiveCompleteDelegate(SafeMsQuicStreamHandle stream, ulong bufferLength)
unsafe delegate uint ListenerStartDelegate(SafeMsQuicListenerHandle listener, QuicBuffer *alpnBuffers, uint alpnBufferCount, ref SOCKADDR_INET localAddress)
delegate uint StreamShutdownDelegate(SafeMsQuicStreamHandle stream, QUIC_STREAM_SHUTDOWN_FLAGS flags, long errorCode)
unsafe delegate uint StreamSendDelegate(SafeMsQuicStreamHandle stream, QuicBuffer *buffers, uint bufferCount, QUIC_SEND_FLAGS flags, IntPtr clientSendContext)
delegate uint ConnectionCallbackDelegate(IntPtr connection, IntPtr context, ref ConnectionEvent connectionEvent)
delegate uint ConfigurationLoadCredentialDelegate(SafeMsQuicConfigurationHandle configuration, ref CredentialConfig credConfig)
unsafe delegate uint ConfigurationOpenDelegate(SafeMsQuicRegistrationHandle registrationContext, QuicBuffer *alpnBuffers, uint alpnBufferCount, ref QuicSettings settings, uint settingsSize, IntPtr context, out SafeMsQuicConfigurationHandle configuration)
delegate void RegistrationCloseDelegate(IntPtr registrationContext)
unsafe delegate uint GetParamDelegate(SafeHandle handle, QUIC_PARAM_LEVEL level, uint param, ref uint bufferLength, byte *buffer)