forked from microsoft/msquic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msquic.h
1897 lines (1675 loc) · 68.8 KB
/
msquic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*++
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
Abstract:
Declarations for the MsQuic API, which enables applications and drivers to
create QUIC connections as a client or server.
For more detailed information, see ../docs/API.md
Supported Platforms:
Windows User mode
Windows Kernel mode
Linux User mode
--*/
#ifndef _MSQUIC_
#define _MSQUIC_
#ifdef _WIN32
#pragma once
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int
#endif
#ifdef _KERNEL_MODE
#include "msquic_winkernel.h"
#elif _WIN32
#include "msquic_winuser.h"
#elif __linux__ || __APPLE__ || __FreeBSD__
#include "msquic_posix.h"
#else
#error "Unsupported Platform"
#endif
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct QUIC_HANDLE *HQUIC;
//
// The maximum value that can be encoded in a 62-bit integer.
//
#define QUIC_UINT62_MAX ((1ULL << 62U) - 1)
//
// Represents a 62-bit integer.
//
typedef _In_range_(0, QUIC_UINT62_MAX) uint64_t QUIC_UINT62;
//
// An ALPN must not exceed 255 bytes, and must not be zero-length.
//
#define QUIC_MAX_ALPN_LENGTH 255
//
// A server name must not exceed 65535 bytes.
//
#define QUIC_MAX_SNI_LENGTH 65535
//
// The maximum number of bytes of application data a server application can
// send in a resumption ticket.
//
#define QUIC_MAX_RESUMPTION_APP_DATA_LENGTH 1000
//
// The number of bytes of stateless reset key.
//
#define QUIC_STATELESS_RESET_KEY_LENGTH 32
typedef enum QUIC_TLS_PROVIDER {
QUIC_TLS_PROVIDER_SCHANNEL = 0x0000,
QUIC_TLS_PROVIDER_OPENSSL = 0x0001,
} QUIC_TLS_PROVIDER;
typedef enum QUIC_EXECUTION_PROFILE {
QUIC_EXECUTION_PROFILE_LOW_LATENCY, // Default
QUIC_EXECUTION_PROFILE_TYPE_MAX_THROUGHPUT,
QUIC_EXECUTION_PROFILE_TYPE_SCAVENGER,
QUIC_EXECUTION_PROFILE_TYPE_REAL_TIME,
} QUIC_EXECUTION_PROFILE;
typedef enum QUIC_LOAD_BALANCING_MODE {
QUIC_LOAD_BALANCING_DISABLED, // Default
QUIC_LOAD_BALANCING_SERVER_ID_IP, // Encodes IP address in Server ID
QUIC_LOAD_BALANCING_SERVER_ID_FIXED, // Encodes a fixed 4-byte value in Server ID
QUIC_LOAD_BALANCING_COUNT, // The number of supported load balancing modes
// MUST BE LAST
} QUIC_LOAD_BALANCING_MODE;
typedef enum QUIC_TLS_ALERT_CODES {
QUIC_TLS_ALERT_CODE_SUCCESS = 0xFFFF, // Not a real TlsAlert
QUIC_TLS_ALERT_CODE_UNEXPECTED_MESSAGE = 10,
QUIC_TLS_ALERT_CODE_BAD_CERTIFICATE = 42,
QUIC_TLS_ALERT_CODE_UNSUPPORTED_CERTIFICATE = 43,
QUIC_TLS_ALERT_CODE_CERTIFICATE_REVOKED = 44,
QUIC_TLS_ALERT_CODE_CERTIFICATE_EXPIRED = 45,
QUIC_TLS_ALERT_CODE_CERTIFICATE_UNKNOWN = 46,
QUIC_TLS_ALERT_CODE_ILLEGAL_PARAMETER = 47,
QUIC_TLS_ALERT_CODE_UNKNOWN_CA = 48,
QUIC_TLS_ALERT_CODE_ACCESS_DENIED = 49,
QUIC_TLS_ALERT_CODE_INSUFFICIENT_SECURITY = 71,
QUIC_TLS_ALERT_CODE_INTERNAL_ERROR = 80,
QUIC_TLS_ALERT_CODE_USER_CANCELED = 90,
QUIC_TLS_ALERT_CODE_CERTIFICATE_REQUIRED = 116,
QUIC_TLS_ALERT_CODE_MAX = 255,
} QUIC_TLS_ALERT_CODES;
typedef enum QUIC_CREDENTIAL_TYPE {
QUIC_CREDENTIAL_TYPE_NONE,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_HASH,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_HASH_STORE,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_CONTEXT,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_FILE,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_FILE_PROTECTED,
QUIC_CREDENTIAL_TYPE_CERTIFICATE_PKCS12,
} QUIC_CREDENTIAL_TYPE;
typedef enum QUIC_CREDENTIAL_FLAGS {
QUIC_CREDENTIAL_FLAG_NONE = 0x00000000,
QUIC_CREDENTIAL_FLAG_CLIENT = 0x00000001, // Lack of client flag indicates server.
QUIC_CREDENTIAL_FLAG_LOAD_ASYNCHRONOUS = 0x00000002,
QUIC_CREDENTIAL_FLAG_NO_CERTIFICATE_VALIDATION = 0x00000004,
QUIC_CREDENTIAL_FLAG_ENABLE_OCSP = 0x00000008, // Schannel only currently
QUIC_CREDENTIAL_FLAG_INDICATE_CERTIFICATE_RECEIVED = 0x00000010,
QUIC_CREDENTIAL_FLAG_DEFER_CERTIFICATE_VALIDATION = 0x00000020,
QUIC_CREDENTIAL_FLAG_REQUIRE_CLIENT_AUTHENTICATION = 0x00000040,
QUIC_CREDENTIAL_FLAG_USE_TLS_BUILTIN_CERTIFICATE_VALIDATION = 0x00000080, // OpenSSL only currently
QUIC_CREDENTIAL_FLAG_REVOCATION_CHECK_END_CERT = 0x00000100, // Schannel only currently
QUIC_CREDENTIAL_FLAG_REVOCATION_CHECK_CHAIN = 0x00000200, // Schannel only currently
QUIC_CREDENTIAL_FLAG_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x00000400, // Schannel only currently
QUIC_CREDENTIAL_FLAG_IGNORE_NO_REVOCATION_CHECK = 0x00000800, // Schannel only currently
QUIC_CREDENTIAL_FLAG_IGNORE_REVOCATION_OFFLINE = 0x00001000, // Schannel only currently
QUIC_CREDENTIAL_FLAG_SET_ALLOWED_CIPHER_SUITES = 0x00002000,
QUIC_CREDENTIAL_FLAG_USE_PORTABLE_CERTIFICATES = 0x00004000,
QUIC_CREDENTIAL_FLAG_USE_SUPPLIED_CREDENTIALS = 0x00008000, // Schannel only
QUIC_CREDENTIAL_FLAG_USE_SYSTEM_MAPPER = 0x00010000, // Schannel only
QUIC_CREDENTIAL_FLAG_CACHE_ONLY_URL_RETRIEVAL = 0x00020000, // Windows only currently
QUIC_CREDENTIAL_FLAG_REVOCATION_CHECK_CACHE_ONLY = 0x00040000, // Windows only currently
QUIC_CREDENTIAL_FLAG_INPROC_PEER_CERTIFICATE = 0x00080000, // Schannel only
QUIC_CREDENTIAL_FLAG_SET_CA_CERTIFICATE_FILE = 0x00100000, // OpenSSL only currently
} QUIC_CREDENTIAL_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_CREDENTIAL_FLAGS)
typedef enum QUIC_ALLOWED_CIPHER_SUITE_FLAGS {
QUIC_ALLOWED_CIPHER_SUITE_NONE = 0x0,
QUIC_ALLOWED_CIPHER_SUITE_AES_128_GCM_SHA256 = 0x1,
QUIC_ALLOWED_CIPHER_SUITE_AES_256_GCM_SHA384 = 0x2,
QUIC_ALLOWED_CIPHER_SUITE_CHACHA20_POLY1305_SHA256 = 0x4, // Not supported on Schannel
} QUIC_ALLOWED_CIPHER_SUITE_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_ALLOWED_CIPHER_SUITE_FLAGS);
typedef enum QUIC_CERTIFICATE_HASH_STORE_FLAGS {
QUIC_CERTIFICATE_HASH_STORE_FLAG_NONE = 0x0000,
QUIC_CERTIFICATE_HASH_STORE_FLAG_MACHINE_STORE = 0x0001,
} QUIC_CERTIFICATE_HASH_STORE_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_CERTIFICATE_HASH_STORE_FLAGS)
typedef enum QUIC_CONNECTION_SHUTDOWN_FLAGS {
QUIC_CONNECTION_SHUTDOWN_FLAG_NONE = 0x0000,
QUIC_CONNECTION_SHUTDOWN_FLAG_SILENT = 0x0001, // Don't send the close frame over the network.
} QUIC_CONNECTION_SHUTDOWN_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_CONNECTION_SHUTDOWN_FLAGS)
typedef enum QUIC_SERVER_RESUMPTION_LEVEL {
QUIC_SERVER_NO_RESUME,
QUIC_SERVER_RESUME_ONLY,
QUIC_SERVER_RESUME_AND_ZERORTT,
} QUIC_SERVER_RESUMPTION_LEVEL;
typedef enum QUIC_SEND_RESUMPTION_FLAGS {
QUIC_SEND_RESUMPTION_FLAG_NONE = 0x0000,
QUIC_SEND_RESUMPTION_FLAG_FINAL = 0x0001, // Free TLS state after sending this ticket.
} QUIC_SEND_RESUMPTION_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_SEND_RESUMPTION_FLAGS)
typedef enum QUIC_STREAM_SCHEDULING_SCHEME {
QUIC_STREAM_SCHEDULING_SCHEME_FIFO = 0x0000, // Sends stream data first come, first served. (Default)
QUIC_STREAM_SCHEDULING_SCHEME_ROUND_ROBIN = 0x0001, // Sends stream data evenly multiplexed.
QUIC_STREAM_SCHEDULING_SCHEME_COUNT, // The number of stream scheduling schemes.
} QUIC_STREAM_SCHEDULING_SCHEME;
typedef enum QUIC_STREAM_OPEN_FLAGS {
QUIC_STREAM_OPEN_FLAG_NONE = 0x0000,
QUIC_STREAM_OPEN_FLAG_UNIDIRECTIONAL = 0x0001, // Indicates the stream is unidirectional.
QUIC_STREAM_OPEN_FLAG_0_RTT = 0x0002, // The stream was opened via a 0-RTT packet.
QUIC_STREAM_OPEN_FLAG_DELAY_ID_FC_UPDATES = 0x0004, // Indicates stream ID flow control limit updates for the
// connection should be delayed to StreamClose.
} QUIC_STREAM_OPEN_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_STREAM_OPEN_FLAGS)
typedef enum QUIC_STREAM_START_FLAGS {
QUIC_STREAM_START_FLAG_NONE = 0x0000,
QUIC_STREAM_START_FLAG_IMMEDIATE = 0x0001, // Immediately informs peer that stream is open.
QUIC_STREAM_START_FLAG_FAIL_BLOCKED = 0x0002, // Only opens the stream if flow control allows.
QUIC_STREAM_START_FLAG_SHUTDOWN_ON_FAIL = 0x0004, // Shutdown the stream immediately after start failure.
QUIC_STREAM_START_FLAG_INDICATE_PEER_ACCEPT = 0x0008, // Indicate PEER_ACCEPTED event if not accepted at start.
} QUIC_STREAM_START_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_STREAM_START_FLAGS)
typedef enum QUIC_STREAM_SHUTDOWN_FLAGS {
QUIC_STREAM_SHUTDOWN_FLAG_NONE = 0x0000,
QUIC_STREAM_SHUTDOWN_FLAG_GRACEFUL = 0x0001, // Cleanly closes the send path.
QUIC_STREAM_SHUTDOWN_FLAG_ABORT_SEND = 0x0002, // Abruptly closes the send path.
QUIC_STREAM_SHUTDOWN_FLAG_ABORT_RECEIVE = 0x0004, // Abruptly closes the receive path.
QUIC_STREAM_SHUTDOWN_FLAG_ABORT = 0x0006, // Abruptly closes both send and receive paths.
QUIC_STREAM_SHUTDOWN_FLAG_IMMEDIATE = 0x0008, // Immediately sends completion events to app.
QUIC_STREAM_SHUTDOWN_FLAG_INLINE = 0x0010, // Process the shutdown immediately inline. Only for calls on callbacks.
// WARNING: Can cause reentrant callbacks!
} QUIC_STREAM_SHUTDOWN_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_STREAM_SHUTDOWN_FLAGS)
typedef enum QUIC_RECEIVE_FLAGS {
QUIC_RECEIVE_FLAG_NONE = 0x0000,
QUIC_RECEIVE_FLAG_0_RTT = 0x0001, // Data was encrypted with 0-RTT key.
QUIC_RECEIVE_FLAG_FIN = 0x0002, // FIN was included with this data.
} QUIC_RECEIVE_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_RECEIVE_FLAGS)
typedef enum QUIC_SEND_FLAGS {
QUIC_SEND_FLAG_NONE = 0x0000,
QUIC_SEND_FLAG_ALLOW_0_RTT = 0x0001, // Allows the use of encrypting with 0-RTT key.
QUIC_SEND_FLAG_START = 0x0002, // Asynchronously starts the stream with the sent data.
QUIC_SEND_FLAG_FIN = 0x0004, // Indicates the request is the one last sent on the stream.
QUIC_SEND_FLAG_DGRAM_PRIORITY = 0x0008, // Indicates the datagram is higher priority than others.
QUIC_SEND_FLAG_DELAY_SEND = 0x0010, // Indicates the send should be delayed because more will be queued soon.
QUIC_SEND_FLAG_CANCEL_ON_LOSS = 0x0020, // Indicates that a stream is to be cancelled when packet loss is detected.
} QUIC_SEND_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_SEND_FLAGS)
typedef enum QUIC_DATAGRAM_SEND_STATE {
QUIC_DATAGRAM_SEND_UNKNOWN, // Not yet sent.
QUIC_DATAGRAM_SEND_SENT, // Sent and awaiting acknowledgment
QUIC_DATAGRAM_SEND_LOST_SUSPECT, // Suspected as lost, but still tracked
QUIC_DATAGRAM_SEND_LOST_DISCARDED, // Lost and not longer being tracked
QUIC_DATAGRAM_SEND_ACKNOWLEDGED, // Acknowledged
QUIC_DATAGRAM_SEND_ACKNOWLEDGED_SPURIOUS, // Acknowledged after being suspected lost
QUIC_DATAGRAM_SEND_CANCELED, // Canceled before send
} QUIC_DATAGRAM_SEND_STATE;
//
// Helper to determine if a datagrams state is final, and no longer tracked
// by MsQuic.
//
#define QUIC_DATAGRAM_SEND_STATE_IS_FINAL(State) \
((State) >= QUIC_DATAGRAM_SEND_LOST_DISCARDED)
typedef enum QUIC_EXECUTION_CONFIG_FLAGS {
QUIC_EXECUTION_CONFIG_FLAG_NONE = 0x0000,
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
QUIC_EXECUTION_CONFIG_FLAG_QTIP = 0x0001,
QUIC_EXECUTION_CONFIG_FLAG_RIO = 0x0002,
QUIC_EXECUTION_CONFIG_FLAG_XDP = 0x0004,
#endif
} QUIC_EXECUTION_CONFIG_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(QUIC_EXECUTION_CONFIG_FLAGS)
//
// A custom configuration for thread execution in QUIC.
//
typedef struct QUIC_EXECUTION_CONFIG {
QUIC_EXECUTION_CONFIG_FLAGS Flags;
uint32_t PollingIdleTimeoutUs; // Time before a polling thread, with no work to do, sleeps.
uint32_t ProcessorCount;
_Field_size_(ProcessorCount)
uint16_t ProcessorList[1]; // List of processors to use for threads.
} QUIC_EXECUTION_CONFIG;
#define QUIC_EXECUTION_CONFIG_MIN_SIZE \
(uint32_t)FIELD_OFFSET(QUIC_EXECUTION_CONFIG, ProcessorList)
typedef struct QUIC_REGISTRATION_CONFIG { // All fields may be NULL/zero.
const char* AppName;
QUIC_EXECUTION_PROFILE ExecutionProfile;
} QUIC_REGISTRATION_CONFIG;
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
_Function_class_(QUIC_CREDENTIAL_LOAD_COMPLETE)
void
(QUIC_API QUIC_CREDENTIAL_LOAD_COMPLETE)(
_In_ HQUIC Configuration,
_In_opt_ void* Context,
_In_ QUIC_STATUS Status
);
typedef QUIC_CREDENTIAL_LOAD_COMPLETE *QUIC_CREDENTIAL_LOAD_COMPLETE_HANDLER;
typedef struct QUIC_CERTIFICATE_HASH {
uint8_t ShaHash[20];
} QUIC_CERTIFICATE_HASH;
typedef struct QUIC_CERTIFICATE_HASH_STORE {
QUIC_CERTIFICATE_HASH_STORE_FLAGS Flags;
uint8_t ShaHash[20];
char StoreName[128];
} QUIC_CERTIFICATE_HASH_STORE;
typedef struct QUIC_CERTIFICATE_FILE {
const char *PrivateKeyFile;
const char *CertificateFile;
} QUIC_CERTIFICATE_FILE;
typedef struct QUIC_CERTIFICATE_FILE_PROTECTED {
const char *PrivateKeyFile;
const char *CertificateFile;
const char *PrivateKeyPassword;
} QUIC_CERTIFICATE_FILE_PROTECTED;
typedef struct QUIC_CERTIFICATE_PKCS12 {
const uint8_t *Asn1Blob;
uint32_t Asn1BlobLength;
const char *PrivateKeyPassword; // Optional: used if provided. Ignored if NULL
} QUIC_CERTIFICATE_PKCS12;
typedef void QUIC_CERTIFICATE; // Platform specific certificate object
typedef void QUIC_CERTIFICATE_CHAIN; // Platform specific certificate chain object
typedef struct QUIC_CREDENTIAL_CONFIG {
QUIC_CREDENTIAL_TYPE Type;
QUIC_CREDENTIAL_FLAGS Flags;
union {
QUIC_CERTIFICATE_HASH* CertificateHash;
QUIC_CERTIFICATE_HASH_STORE* CertificateHashStore;
QUIC_CERTIFICATE* CertificateContext;
QUIC_CERTIFICATE_FILE* CertificateFile;
QUIC_CERTIFICATE_FILE_PROTECTED* CertificateFileProtected;
QUIC_CERTIFICATE_PKCS12* CertificatePkcs12;
};
const char* Principal;
void* Reserved; // Currently unused
QUIC_CREDENTIAL_LOAD_COMPLETE_HANDLER AsyncHandler; // Optional
QUIC_ALLOWED_CIPHER_SUITE_FLAGS AllowedCipherSuites;// Optional
const char* CaCertificateFile; // Optional
} QUIC_CREDENTIAL_CONFIG;
//
// The maximum number of QUIC_TICKET_KEY_CONFIG that can be used at one time.
//
#define QUIC_MAX_TICKET_KEY_COUNT 16
//
// TLS New Session Ticket encryption key configuration.
//
typedef struct QUIC_TICKET_KEY_CONFIG {
uint8_t Id[16];
uint8_t Material[64];
uint8_t MaterialLength;
} QUIC_TICKET_KEY_CONFIG;
//
// A single contiguous buffer.
//
typedef struct QUIC_BUFFER {
uint32_t Length;
_Field_size_bytes_(Length)
uint8_t* Buffer;
} QUIC_BUFFER;
//
// All the available information describing a new incoming connection.
//
typedef struct QUIC_NEW_CONNECTION_INFO {
uint32_t QuicVersion;
const QUIC_ADDR* LocalAddress;
const QUIC_ADDR* RemoteAddress;
uint32_t CryptoBufferLength;
uint16_t ClientAlpnListLength;
uint16_t ServerNameLength;
uint8_t NegotiatedAlpnLength;
_Field_size_bytes_(CryptoBufferLength)
const uint8_t* CryptoBuffer;
_Field_size_bytes_(ClientAlpnListLength)
const uint8_t* ClientAlpnList;
_Field_size_bytes_(NegotiatedAlpnLength)
const uint8_t* NegotiatedAlpn;
_Field_size_bytes_opt_(ServerNameLength)
const char* ServerName;
} QUIC_NEW_CONNECTION_INFO;
typedef enum QUIC_TLS_PROTOCOL_VERSION {
QUIC_TLS_PROTOCOL_UNKNOWN = 0,
QUIC_TLS_PROTOCOL_1_3 = 0x3000,
} QUIC_TLS_PROTOCOL_VERSION;
typedef enum QUIC_CIPHER_ALGORITHM {
QUIC_CIPHER_ALGORITHM_NONE = 0,
QUIC_CIPHER_ALGORITHM_AES_128 = 0x660E,
QUIC_CIPHER_ALGORITHM_AES_256 = 0x6610,
QUIC_CIPHER_ALGORITHM_CHACHA20 = 0x6612, // Not supported on Schannel/BCrypt
} QUIC_CIPHER_ALGORITHM;
typedef enum QUIC_HASH_ALGORITHM {
QUIC_HASH_ALGORITHM_NONE = 0,
QUIC_HASH_ALGORITHM_SHA_256 = 0x800C,
QUIC_HASH_ALGORITHM_SHA_384 = 0x800D,
} QUIC_HASH_ALGORITHM;
typedef enum QUIC_KEY_EXCHANGE_ALGORITHM {
QUIC_KEY_EXCHANGE_ALGORITHM_NONE = 0,
} QUIC_KEY_EXCHANGE_ALGORITHM;
typedef enum QUIC_CIPHER_SUITE {
QUIC_CIPHER_SUITE_TLS_AES_128_GCM_SHA256 = 0x1301,
QUIC_CIPHER_SUITE_TLS_AES_256_GCM_SHA384 = 0x1302,
QUIC_CIPHER_SUITE_TLS_CHACHA20_POLY1305_SHA256 = 0x1303, // Not supported on Schannel
} QUIC_CIPHER_SUITE;
typedef enum QUIC_CONGESTION_CONTROL_ALGORITHM {
QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC,
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
QUIC_CONGESTION_CONTROL_ALGORITHM_BBR,
#endif
QUIC_CONGESTION_CONTROL_ALGORITHM_MAX,
} QUIC_CONGESTION_CONTROL_ALGORITHM;
//
// All the available information describing a handshake.
//
typedef struct QUIC_HANDSHAKE_INFO {
QUIC_TLS_PROTOCOL_VERSION TlsProtocolVersion;
QUIC_CIPHER_ALGORITHM CipherAlgorithm;
int32_t CipherStrength;
QUIC_HASH_ALGORITHM Hash;
int32_t HashStrength;
QUIC_KEY_EXCHANGE_ALGORITHM KeyExchangeAlgorithm;
int32_t KeyExchangeStrength;
QUIC_CIPHER_SUITE CipherSuite;
} QUIC_HANDSHAKE_INFO;
//
// All statistics available to query about a connection.
//
typedef struct QUIC_STATISTICS {
uint64_t CorrelationId;
uint32_t VersionNegotiation : 1;
uint32_t StatelessRetry : 1;
uint32_t ResumptionAttempted : 1;
uint32_t ResumptionSucceeded : 1;
uint32_t Rtt; // In microseconds
uint32_t MinRtt; // In microseconds
uint32_t MaxRtt; // In microseconds
struct {
uint64_t Start;
uint64_t InitialFlightEnd; // Processed all peer's Initial packets
uint64_t HandshakeFlightEnd; // Processed all peer's Handshake packets
} Timing;
struct {
uint32_t ClientFlight1Bytes; // Sum of TLS payloads
uint32_t ServerFlight1Bytes; // Sum of TLS payloads
uint32_t ClientFlight2Bytes; // Sum of TLS payloads
} Handshake;
struct {
uint16_t PathMtu; // Current path MTU.
uint64_t TotalPackets; // QUIC packets; could be coalesced into fewer UDP datagrams.
uint64_t RetransmittablePackets;
uint64_t SuspectedLostPackets;
uint64_t SpuriousLostPackets; // Actual lost is (SuspectedLostPackets - SpuriousLostPackets)
uint64_t TotalBytes; // Sum of UDP payloads
uint64_t TotalStreamBytes; // Sum of stream payloads
uint32_t CongestionCount; // Number of congestion events
uint32_t PersistentCongestionCount; // Number of persistent congestion events
} Send;
struct {
uint64_t TotalPackets; // QUIC packets; could be coalesced into fewer UDP datagrams.
uint64_t ReorderedPackets; // Packets where packet number is less than highest seen.
uint64_t DroppedPackets; // Includes DuplicatePackets.
uint64_t DuplicatePackets;
uint64_t TotalBytes; // Sum of UDP payloads
uint64_t TotalStreamBytes; // Sum of stream payloads
uint64_t DecryptionFailures; // Count of packet decryption failures.
uint64_t ValidAckFrames; // Count of receive ACK frames.
} Recv;
struct {
uint32_t KeyUpdateCount;
} Misc;
} QUIC_STATISTICS;
//
// N.B. Consumers of this struct depend on it being the same for 32-bit and
// 64-bit systems. DO NOT include any fields that have different sizes on those
// platforms, such as size_t or pointers.
//
typedef struct QUIC_STATISTICS_V2 {
uint64_t CorrelationId;
uint32_t VersionNegotiation : 1;
uint32_t StatelessRetry : 1;
uint32_t ResumptionAttempted : 1;
uint32_t ResumptionSucceeded : 1;
uint32_t GreaseBitNegotiated : 1; // Set if we negotiated the GREASE bit.
uint32_t EcnCapable : 1;
uint32_t EncryptionOffloaded : 1; // At least one path successfully offloaded encryption
uint32_t RESERVED : 25;
uint32_t Rtt; // In microseconds
uint32_t MinRtt; // In microseconds
uint32_t MaxRtt; // In microseconds
uint64_t TimingStart;
uint64_t TimingInitialFlightEnd; // Processed all peer's Initial packets
uint64_t TimingHandshakeFlightEnd; // Processed all peer's Handshake packets
uint32_t HandshakeClientFlight1Bytes; // Sum of TLS payloads
uint32_t HandshakeServerFlight1Bytes; // Sum of TLS payloads
uint32_t HandshakeClientFlight2Bytes; // Sum of TLS payloads
uint16_t SendPathMtu; // Current path MTU.
uint64_t SendTotalPackets; // QUIC packets; could be coalesced into fewer UDP datagrams.
uint64_t SendRetransmittablePackets;
uint64_t SendSuspectedLostPackets;
uint64_t SendSpuriousLostPackets; // Actual lost is (SuspectedLostPackets - SpuriousLostPackets)
uint64_t SendTotalBytes; // Sum of UDP payloads
uint64_t SendTotalStreamBytes; // Sum of stream payloads
uint32_t SendCongestionCount; // Number of congestion events
uint32_t SendPersistentCongestionCount; // Number of persistent congestion events
uint64_t RecvTotalPackets; // QUIC packets; could be coalesced into fewer UDP datagrams.
uint64_t RecvReorderedPackets; // Packets where packet number is less than highest seen.
uint64_t RecvDroppedPackets; // Includes DuplicatePackets.
uint64_t RecvDuplicatePackets;
uint64_t RecvTotalBytes; // Sum of UDP payloads
uint64_t RecvTotalStreamBytes; // Sum of stream payloads
uint64_t RecvDecryptionFailures; // Count of packet decryption failures.
uint64_t RecvValidAckFrames; // Count of receive ACK frames.
uint32_t KeyUpdateCount;
uint32_t SendCongestionWindow; // Congestion window size
uint32_t DestCidUpdateCount; // Number of times the destionation CID changed.
uint32_t SendEcnCongestionCount; // Number of congestion events caused by ECN.
// N.B. New fields must be appended to end
} QUIC_STATISTICS_V2;
#define QUIC_STRUCT_SIZE_THRU_FIELD(Struct, Field) \
(FIELD_OFFSET(Struct, Field) + sizeof(((Struct*)0)->Field))
#define QUIC_STATISTICS_V2_SIZE_1 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, KeyUpdateCount) // v2.0 final size
#define QUIC_STATISTICS_V2_SIZE_2 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, DestCidUpdateCount) // v2.1 final size
#define QUIC_STATISTICS_V2_SIZE_3 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, SendEcnCongestionCount) // v2.2 final size
typedef struct QUIC_LISTENER_STATISTICS {
uint64_t TotalAcceptedConnections;
uint64_t TotalRejectedConnections;
uint64_t BindingRecvDroppedPackets;
} QUIC_LISTENER_STATISTICS;
typedef enum QUIC_PERFORMANCE_COUNTERS {
QUIC_PERF_COUNTER_CONN_CREATED, // Total connections ever allocated.
QUIC_PERF_COUNTER_CONN_HANDSHAKE_FAIL, // Total connections that failed during handshake.
QUIC_PERF_COUNTER_CONN_APP_REJECT, // Total connections rejected by the application.
QUIC_PERF_COUNTER_CONN_RESUMED, // Total connections resumed.
QUIC_PERF_COUNTER_CONN_ACTIVE, // Connections currently allocated.
QUIC_PERF_COUNTER_CONN_CONNECTED, // Connections currently in the connected state.
QUIC_PERF_COUNTER_CONN_PROTOCOL_ERRORS, // Total connections shutdown with a protocol error.
QUIC_PERF_COUNTER_CONN_NO_ALPN, // Total connection attempts with no matching ALPN.
QUIC_PERF_COUNTER_STRM_ACTIVE, // Current streams allocated.
QUIC_PERF_COUNTER_PKTS_SUSPECTED_LOST, // Total suspected packets lost
QUIC_PERF_COUNTER_PKTS_DROPPED, // Total packets dropped for any reason.
QUIC_PERF_COUNTER_PKTS_DECRYPTION_FAIL, // Total packets with decryption failures.
QUIC_PERF_COUNTER_UDP_RECV, // Total UDP datagrams received.
QUIC_PERF_COUNTER_UDP_SEND, // Total UDP datagrams sent.
QUIC_PERF_COUNTER_UDP_RECV_BYTES, // Total UDP payload bytes received.
QUIC_PERF_COUNTER_UDP_SEND_BYTES, // Total UDP payload bytes sent.
QUIC_PERF_COUNTER_UDP_RECV_EVENTS, // Total UDP receive events.
QUIC_PERF_COUNTER_UDP_SEND_CALLS, // Total UDP send API calls.
QUIC_PERF_COUNTER_APP_SEND_BYTES, // Total bytes sent by applications.
QUIC_PERF_COUNTER_APP_RECV_BYTES, // Total bytes received by applications.
QUIC_PERF_COUNTER_CONN_QUEUE_DEPTH, // Current connections queued for processing.
QUIC_PERF_COUNTER_CONN_OPER_QUEUE_DEPTH,// Current connection operations queued.
QUIC_PERF_COUNTER_CONN_OPER_QUEUED, // Total connection operations queued ever.
QUIC_PERF_COUNTER_CONN_OPER_COMPLETED, // Total connection operations processed ever.
QUIC_PERF_COUNTER_WORK_OPER_QUEUE_DEPTH,// Current worker operations queued.
QUIC_PERF_COUNTER_WORK_OPER_QUEUED, // Total worker operations queued ever.
QUIC_PERF_COUNTER_WORK_OPER_COMPLETED, // Total worker operations processed ever.
QUIC_PERF_COUNTER_PATH_VALIDATED, // Total path challenges that succeed ever.
QUIC_PERF_COUNTER_PATH_FAILURE, // Total path challenges that fail ever.
QUIC_PERF_COUNTER_SEND_STATELESS_RESET, // Total stateless reset packets sent ever.
QUIC_PERF_COUNTER_SEND_STATELESS_RETRY, // Total stateless retry packets sent ever.
QUIC_PERF_COUNTER_CONN_LOAD_REJECT, // Total connections rejected due to worker load.
QUIC_PERF_COUNTER_MAX,
} QUIC_PERFORMANCE_COUNTERS;
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
typedef struct QUIC_VERSION_SETTINGS {
const uint32_t* AcceptableVersions;
const uint32_t* OfferedVersions;
const uint32_t* FullyDeployedVersions;
uint32_t AcceptableVersionsLength;
uint32_t OfferedVersionsLength;
uint32_t FullyDeployedVersionsLength;
} QUIC_VERSION_SETTINGS;
#endif
typedef struct QUIC_GLOBAL_SETTINGS {
union {
uint64_t IsSetFlags;
struct {
uint64_t RetryMemoryLimit : 1;
uint64_t LoadBalancingMode : 1;
uint64_t FixedServerID : 1;
uint64_t RESERVED : 61;
} IsSet;
};
uint16_t RetryMemoryLimit;
uint16_t LoadBalancingMode;
uint32_t FixedServerID;
} QUIC_GLOBAL_SETTINGS;
typedef struct QUIC_SETTINGS {
union {
uint64_t IsSetFlags;
struct {
uint64_t MaxBytesPerKey : 1;
uint64_t HandshakeIdleTimeoutMs : 1;
uint64_t IdleTimeoutMs : 1;
uint64_t MtuDiscoverySearchCompleteTimeoutUs : 1;
uint64_t TlsClientMaxSendBuffer : 1;
uint64_t TlsServerMaxSendBuffer : 1;
uint64_t StreamRecvWindowDefault : 1;
uint64_t StreamRecvBufferDefault : 1;
uint64_t ConnFlowControlWindow : 1;
uint64_t MaxWorkerQueueDelayUs : 1;
uint64_t MaxStatelessOperations : 1;
uint64_t InitialWindowPackets : 1;
uint64_t SendIdleTimeoutMs : 1;
uint64_t InitialRttMs : 1;
uint64_t MaxAckDelayMs : 1;
uint64_t DisconnectTimeoutMs : 1;
uint64_t KeepAliveIntervalMs : 1;
uint64_t CongestionControlAlgorithm : 1;
uint64_t PeerBidiStreamCount : 1;
uint64_t PeerUnidiStreamCount : 1;
uint64_t MaxBindingStatelessOperations : 1;
uint64_t StatelessOperationExpirationMs : 1;
uint64_t MinimumMtu : 1;
uint64_t MaximumMtu : 1;
uint64_t SendBufferingEnabled : 1;
uint64_t PacingEnabled : 1;
uint64_t MigrationEnabled : 1;
uint64_t DatagramReceiveEnabled : 1;
uint64_t ServerResumptionLevel : 1;
uint64_t MaxOperationsPerDrain : 1;
uint64_t MtuDiscoveryMissingProbeCount : 1;
uint64_t DestCidUpdateIdleTimeoutMs : 1;
uint64_t GreaseQuicBitEnabled : 1;
uint64_t EcnEnabled : 1;
uint64_t HyStartEnabled : 1;
uint64_t StreamRecvWindowBidiLocalDefault : 1;
uint64_t StreamRecvWindowBidiRemoteDefault : 1;
uint64_t StreamRecvWindowUnidiDefault : 1;
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
uint64_t EncryptionOffloadAllowed : 1;
uint64_t ReliableResetEnabled : 1;
uint64_t OneWayDelayEnabled : 1;
uint64_t NetStatsEventEnabled : 1;
uint64_t RESERVED : 22;
#else
uint64_t RESERVED : 26;
#endif
} IsSet;
};
uint64_t MaxBytesPerKey;
uint64_t HandshakeIdleTimeoutMs;
uint64_t IdleTimeoutMs;
uint64_t MtuDiscoverySearchCompleteTimeoutUs;
uint32_t TlsClientMaxSendBuffer;
uint32_t TlsServerMaxSendBuffer;
uint32_t StreamRecvWindowDefault;
uint32_t StreamRecvBufferDefault;
uint32_t ConnFlowControlWindow;
uint32_t MaxWorkerQueueDelayUs;
uint32_t MaxStatelessOperations;
uint32_t InitialWindowPackets;
uint32_t SendIdleTimeoutMs;
uint32_t InitialRttMs;
uint32_t MaxAckDelayMs;
uint32_t DisconnectTimeoutMs;
uint32_t KeepAliveIntervalMs;
uint16_t CongestionControlAlgorithm; // QUIC_CONGESTION_CONTROL_ALGORITHM
uint16_t PeerBidiStreamCount;
uint16_t PeerUnidiStreamCount;
uint16_t MaxBindingStatelessOperations;
uint16_t StatelessOperationExpirationMs;
uint16_t MinimumMtu;
uint16_t MaximumMtu;
uint8_t SendBufferingEnabled : 1;
uint8_t PacingEnabled : 1;
uint8_t MigrationEnabled : 1;
uint8_t DatagramReceiveEnabled : 1;
uint8_t ServerResumptionLevel : 2; // QUIC_SERVER_RESUMPTION_LEVEL
uint8_t GreaseQuicBitEnabled : 1;
uint8_t EcnEnabled : 1;
uint8_t MaxOperationsPerDrain;
uint8_t MtuDiscoveryMissingProbeCount;
uint32_t DestCidUpdateIdleTimeoutMs;
union {
uint64_t Flags;
struct {
uint64_t HyStartEnabled : 1;
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
uint64_t EncryptionOffloadAllowed : 1;
uint64_t ReliableResetEnabled : 1;
uint64_t OneWayDelayEnabled : 1;
uint64_t NetStatsEventEnabled : 1;
uint64_t ReservedFlags : 59;
#else
uint64_t ReservedFlags : 63;
#endif
};
};
uint32_t StreamRecvWindowBidiLocalDefault;
uint32_t StreamRecvWindowBidiRemoteDefault;
uint32_t StreamRecvWindowUnidiDefault;
} QUIC_SETTINGS;
//
// This struct enables QUIC applications to support SSLKEYLOGFILE
// for debugging packet captures with e.g. Wireshark.
//
#define QUIC_TLS_SECRETS_MAX_SECRET_LEN 64
typedef struct QUIC_TLS_SECRETS {
uint8_t SecretLength;
struct {
uint8_t ClientRandom : 1;
uint8_t ClientEarlyTrafficSecret : 1;
uint8_t ClientHandshakeTrafficSecret : 1;
uint8_t ServerHandshakeTrafficSecret : 1;
uint8_t ClientTrafficSecret0 : 1;
uint8_t ServerTrafficSecret0 : 1;
} IsSet;
uint8_t ClientRandom[32];
uint8_t ClientEarlyTrafficSecret[QUIC_TLS_SECRETS_MAX_SECRET_LEN];
uint8_t ClientHandshakeTrafficSecret[QUIC_TLS_SECRETS_MAX_SECRET_LEN];
uint8_t ServerHandshakeTrafficSecret[QUIC_TLS_SECRETS_MAX_SECRET_LEN];
uint8_t ClientTrafficSecret0[QUIC_TLS_SECRETS_MAX_SECRET_LEN];
uint8_t ServerTrafficSecret0[QUIC_TLS_SECRETS_MAX_SECRET_LEN];
} QUIC_TLS_SECRETS;
typedef struct QUIC_STREAM_STATISTICS {
uint64_t ConnBlockedBySchedulingUs;
uint64_t ConnBlockedByPacingUs;
uint64_t ConnBlockedByAmplificationProtUs;
uint64_t ConnBlockedByCongestionControlUs;
uint64_t ConnBlockedByFlowControlUs;
uint64_t StreamBlockedByIdFlowControlUs;
uint64_t StreamBlockedByFlowControlUs;
uint64_t StreamBlockedByAppUs;
} QUIC_STREAM_STATISTICS;
//
// Functions for associating application contexts with QUIC handles. MsQuic
// provides no explicit synchronization between parallel calls to these
// functions.
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
void
(QUIC_API * QUIC_SET_CONTEXT_FN)(
_In_ _Pre_defensive_ HQUIC Handle,
_In_opt_ void* Context
);
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
void*
(QUIC_API * QUIC_GET_CONTEXT_FN)(
_In_ _Pre_defensive_ HQUIC Handle
);
//
// Sets the event handler for the QUIC handle. The type of the handler must be
// appropriate for the type of the handle. MsQuic provides no explicit
// synchronization between parallel calls to this function or the ones above.
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
void
(QUIC_API * QUIC_SET_CALLBACK_HANDLER_FN)(
_In_ _Pre_defensive_ HQUIC Handle,
_In_ void* Handler,
_In_opt_ void* Context
);
//
// Get and Set parameters on a handle.
//
#define QUIC_PARAM_PREFIX_GLOBAL 0x01000000
#define QUIC_PARAM_PREFIX_REGISTRATION 0x02000000
#define QUIC_PARAM_PREFIX_CONFIGURATION 0x03000000
#define QUIC_PARAM_PREFIX_LISTENER 0x04000000
#define QUIC_PARAM_PREFIX_CONNECTION 0x05000000
#define QUIC_PARAM_PREFIX_TLS 0x06000000
#define QUIC_PARAM_PREFIX_TLS_SCHANNEL 0x07000000
#define QUIC_PARAM_PREFIX_STREAM 0x08000000
#define QUIC_PARAM_IS_GLOBAL(Param) ((Param & 0x7F000000) == QUIC_PARAM_PREFIX_GLOBAL)
//
// Parameters for Global.
//
#define QUIC_PARAM_GLOBAL_RETRY_MEMORY_PERCENT 0x01000000 // uint16_t
#define QUIC_PARAM_GLOBAL_SUPPORTED_VERSIONS 0x01000001 // uint32_t[] - network byte order
#define QUIC_PARAM_GLOBAL_LOAD_BALACING_MODE 0x01000002 // uint16_t - QUIC_LOAD_BALANCING_MODE
#define QUIC_PARAM_GLOBAL_PERF_COUNTERS 0x01000003 // uint64_t[] - Array size is QUIC_PERF_COUNTER_MAX
#define QUIC_PARAM_GLOBAL_LIBRARY_VERSION 0x01000004 // uint32_t[4]
#define QUIC_PARAM_GLOBAL_SETTINGS 0x01000005 // QUIC_SETTINGS
#define QUIC_PARAM_GLOBAL_GLOBAL_SETTINGS 0x01000006 // QUIC_GLOBAL_SETTINGS
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_GLOBAL_VERSION_SETTINGS 0x01000007 // QUIC_VERSION_SETTINGS
#endif
#define QUIC_PARAM_GLOBAL_LIBRARY_GIT_HASH 0x01000008 // char[64]
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_GLOBAL_EXECUTION_CONFIG 0x01000009 // QUIC_EXECUTION_CONFIG
#endif
#define QUIC_PARAM_GLOBAL_TLS_PROVIDER 0x0100000A // QUIC_TLS_PROVIDER
#define QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY 0x0100000B // uint8_t[] - Array size is QUIC_STATELESS_RESET_KEY_LENGTH
//
// Parameters for Registration.
//
//
// Parameters for Configuration.
//
#define QUIC_PARAM_CONFIGURATION_SETTINGS 0x03000000 // QUIC_SETTINGS
#define QUIC_PARAM_CONFIGURATION_TICKET_KEYS 0x03000001 // QUIC_TICKET_KEY_CONFIG[]
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS 0x03000002 // QUIC_VERSION_SETTINGS
#endif
// Schannel-specific Configuration parameter
typedef struct QUIC_SCHANNEL_CREDENTIAL_ATTRIBUTE_W {
unsigned long Attribute;
unsigned long BufferLength;
void* Buffer;
} QUIC_SCHANNEL_CREDENTIAL_ATTRIBUTE_W;
#define QUIC_PARAM_CONFIGURATION_SCHANNEL_CREDENTIAL_ATTRIBUTE_W 0x03000003 // QUIC_SCHANNEL_CREDENTIAL_ATTRIBUTE_W
//
// Parameters for Listener.
//
#define QUIC_PARAM_LISTENER_LOCAL_ADDRESS 0x04000000 // QUIC_ADDR
#define QUIC_PARAM_LISTENER_STATS 0x04000001 // QUIC_LISTENER_STATISTICS
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_LISTENER_CIBIR_ID 0x04000002 // uint8_t[] {offset, id[]}
#endif
//
// Parameters for Connection.
//
#define QUIC_PARAM_CONN_QUIC_VERSION 0x05000000 // uint32_t
#define QUIC_PARAM_CONN_LOCAL_ADDRESS 0x05000001 // QUIC_ADDR
#define QUIC_PARAM_CONN_REMOTE_ADDRESS 0x05000002 // QUIC_ADDR
#define QUIC_PARAM_CONN_IDEAL_PROCESSOR 0x05000003 // uint16_t
#define QUIC_PARAM_CONN_SETTINGS 0x05000004 // QUIC_SETTINGS
#define QUIC_PARAM_CONN_STATISTICS 0x05000005 // QUIC_STATISTICS
#define QUIC_PARAM_CONN_STATISTICS_PLAT 0x05000006 // QUIC_STATISTICS
#define QUIC_PARAM_CONN_SHARE_UDP_BINDING 0x05000007 // uint8_t (BOOLEAN)
#define QUIC_PARAM_CONN_LOCAL_BIDI_STREAM_COUNT 0x05000008 // uint16_t
#define QUIC_PARAM_CONN_LOCAL_UNIDI_STREAM_COUNT 0x05000009 // uint16_t
#define QUIC_PARAM_CONN_MAX_STREAM_IDS 0x0500000A // uint64_t[4]
#define QUIC_PARAM_CONN_CLOSE_REASON_PHRASE 0x0500000B // char[]
#define QUIC_PARAM_CONN_STREAM_SCHEDULING_SCHEME 0x0500000C // QUIC_STREAM_SCHEDULING_SCHEME
#define QUIC_PARAM_CONN_DATAGRAM_RECEIVE_ENABLED 0x0500000D // uint8_t (BOOLEAN)
#define QUIC_PARAM_CONN_DATAGRAM_SEND_ENABLED 0x0500000E // uint8_t (BOOLEAN)
#ifdef QUIC_API_ENABLE_INSECURE_FEATURES
#define QUIC_PARAM_CONN_DISABLE_1RTT_ENCRYPTION 0x0500000F // uint8_t (BOOLEAN)
#endif
#define QUIC_PARAM_CONN_RESUMPTION_TICKET 0x05000010 // uint8_t[]
#define QUIC_PARAM_CONN_PEER_CERTIFICATE_VALID 0x05000011 // uint8_t (BOOLEAN)
#define QUIC_PARAM_CONN_LOCAL_INTERFACE 0x05000012 // uint32_t
#define QUIC_PARAM_CONN_TLS_SECRETS 0x05000013 // QUIC_TLS_SECRETS (SSLKEYLOGFILE compatible)
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_CONN_VERSION_SETTINGS 0x05000014 // QUIC_VERSION_SETTINGS
#define QUIC_PARAM_CONN_CIBIR_ID 0x05000015 // uint8_t[] {offset, id[]}
#endif
#define QUIC_PARAM_CONN_STATISTICS_V2 0x05000016 // QUIC_STATISTICS_V2
#define QUIC_PARAM_CONN_STATISTICS_V2_PLAT 0x05000017 // QUIC_STATISTICS_V2
#define QUIC_PARAM_CONN_ORIG_DEST_CID 0x05000018 // uint8_t[]
//
// Parameters for TLS.
//
#define QUIC_PARAM_TLS_HANDSHAKE_INFO 0x06000000 // QUIC_HANDSHAKE_INFO
#define QUIC_PARAM_TLS_NEGOTIATED_ALPN 0x06000001 // uint8_t[] (max 255 bytes)
#ifdef WIN32 // Schannel specific TLS parameters
typedef struct QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_W {
unsigned long Attribute;
void* Buffer;
} QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_W;
#define QUIC_PARAM_TLS_SCHANNEL_CONTEXT_ATTRIBUTE_W 0x07000000 // QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_W
typedef struct QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_EX_W {
unsigned long Attribute;
unsigned long BufferLength;
void* Buffer;
} QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_EX_W;
#define QUIC_PARAM_TLS_SCHANNEL_CONTEXT_ATTRIBUTE_EX_W 0x07000001 // QUIC_SCHANNEL_CONTEXT_ATTRIBUTE_EX_W
#define QUIC_PARAM_TLS_SCHANNEL_SECURITY_CONTEXT_TOKEN 0x07000002 // HANDLE
#endif
//
// Parameters for Stream.
//
#define QUIC_PARAM_STREAM_ID 0x08000000 // QUIC_UINT62
#define QUIC_PARAM_STREAM_0RTT_LENGTH 0x08000001 // uint64_t
#define QUIC_PARAM_STREAM_IDEAL_SEND_BUFFER_SIZE 0x08000002 // uint64_t - bytes
#define QUIC_PARAM_STREAM_PRIORITY 0x08000003 // uint16_t - 0 (low) to 0xFFFF (high) - 0x7FFF (default)
#define QUIC_PARAM_STREAM_STATISTICS 0X08000004 // QUIC_STREAM_STATISTICS
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#define QUIC_PARAM_STREAM_RELIABLE_OFFSET 0x08000005 // uint64_t
#endif
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
QUIC_STATUS
(QUIC_API * QUIC_SET_PARAM_FN)(
_When_(QUIC_PARAM_IS_GLOBAL(Param), _Reserved_)
_When_(!QUIC_PARAM_IS_GLOBAL(Param), _In_ _Pre_defensive_)
HQUIC Handle,
_In_ uint32_t Param,
_In_ uint32_t BufferLength,
_In_reads_bytes_(BufferLength)
const void* Buffer
);
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
QUIC_STATUS
(QUIC_API * QUIC_GET_PARAM_FN)(
_When_(QUIC_PARAM_IS_GLOBAL(Param), _Reserved_)
_When_(!QUIC_PARAM_IS_GLOBAL(Param), _In_ _Pre_defensive_)
HQUIC Handle,
_In_ uint32_t Param,
_Inout_ _Pre_defensive_ uint32_t* BufferLength,
_Out_writes_bytes_opt_(*BufferLength)
void* Buffer
);
//
// Registration Context Interface.
//
//
// Opens a new registration.
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
QUIC_STATUS
(QUIC_API * QUIC_REGISTRATION_OPEN_FN)(
_In_opt_ const QUIC_REGISTRATION_CONFIG* Config,
_Outptr_ _At_(*Registration, __drv_allocatesMem(Mem)) _Pre_defensive_
HQUIC* Registration
);
//
// Closes the registration. This function synchronizes the cleanup of all
// child objects. It does this by blocking until all those child objects have
// been closed by the application.
// N.B. This function will deadlock if called in any MsQuic callbacks.
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
void
(QUIC_API * QUIC_REGISTRATION_CLOSE_FN)(
_In_ _Pre_defensive_ __drv_freesMem(Mem)
HQUIC Registration