-
Notifications
You must be signed in to change notification settings - Fork 1
/
ngtcp2.nim
3812 lines (3772 loc) · 255 KB
/
ngtcp2.nim
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
import os
import strformat
# Socket definitions
import nativesockets
when defined(windows):
{.passl: "-lws2_32".}
else:
{.passc: "-DHAVE_UNISTD_H".}
# C include directories
const root = currentSourcePath.parentDir
const sourceInclude = root/"sources"/"lib"/"includes"
const buildInclude = root/"build"/"lib"/"includes"
{.passc: fmt"-I{sourceInclude} -I{buildInclude}".}
# Generated @ 2024-07-03T20:14:17+02:00
# Command line:
# /nim/1.6.20/nimble/pkgs/nimterop-0.6.11/nimterop/toast --compile=./sources/lib/ngtcp2_acktr.c --compile=./sources/lib/ngtcp2_addr.c --compile=./sources/lib/ngtcp2_balloc.c --compile=./sources/lib/ngtcp2_bbr.c --compile=./sources/lib/ngtcp2_buf.c --compile=./sources/lib/ngtcp2_cc.c --compile=./sources/lib/ngtcp2_cid.c --compile=./sources/lib/ngtcp2_conn.c --compile=./sources/lib/ngtcp2_conv.c --compile=./sources/lib/ngtcp2_crypto.c --compile=./sources/lib/ngtcp2_err.c --compile=./sources/lib/ngtcp2_frame_chain.c --compile=./sources/lib/ngtcp2_gaptr.c --compile=./sources/lib/ngtcp2_idtr.c --compile=./sources/lib/ngtcp2_ksl.c --compile=./sources/lib/ngtcp2_log.c --compile=./sources/lib/ngtcp2_map.c --compile=./sources/lib/ngtcp2_mem.c --compile=./sources/lib/ngtcp2_objalloc.c --compile=./sources/lib/ngtcp2_opl.c --compile=./sources/lib/ngtcp2_path.c --compile=./sources/lib/ngtcp2_pkt.c --compile=./sources/lib/ngtcp2_pmtud.c --compile=./sources/lib/ngtcp2_ppe.c --compile=./sources/lib/ngtcp2_pq.c --compile=./sources/lib/ngtcp2_pv.c --compile=./sources/lib/ngtcp2_qlog.c --compile=./sources/lib/ngtcp2_range.c --compile=./sources/lib/ngtcp2_ringbuf.c --compile=./sources/lib/ngtcp2_rob.c --compile=./sources/lib/ngtcp2_rst.c --compile=./sources/lib/ngtcp2_rtb.c --compile=./sources/lib/ngtcp2_settings.c --compile=./sources/lib/ngtcp2_str.c --compile=./sources/lib/ngtcp2_strm.c --compile=./sources/lib/ngtcp2_transport_params.c --compile=./sources/lib/ngtcp2_unreachable.c --compile=./sources/lib/ngtcp2_vec.c --compile=./sources/lib/ngtcp2_version.c --compile=./sources/lib/ngtcp2_window_filter.c --pnim --preprocess --noHeader --defines=NGTCP2_STATICLIB --replace=sockaddr=SockAddr,SockAddr_storage=Sockaddr_storage,socklen_t=SockLen --includeDirs=./sources/lib/includes --includeDirs=./build/lib/includes ./sources/lib/includes/ngtcp2/ngtcp2.h
# const 'NGTCP2_PROTO_VER_MAX' has unsupported value 'NGTCP2_PROTO_VER_V1'
# const 'NGTCP2_PROTO_VER_MIN' has unsupported value 'NGTCP2_PROTO_VER_V1'
# const 'NGTCP2_PKT_INFO_VERSION' has unsupported value 'NGTCP2_PKT_INFO_V1'
# const 'NGTCP2_AF_INET' has unsupported value 'AF_INET'
# const 'NGTCP2_AF_INET6' has unsupported value 'AF_INET6'
# const 'NGTCP2_TRANSPORT_PARAMS_VERSION' has unsupported value 'NGTCP2_TRANSPORT_PARAMS_V1'
# const 'NGTCP2_CONN_INFO_VERSION' has unsupported value 'NGTCP2_CONN_INFO_V1'
# const 'NGTCP2_SETTINGS_VERSION' has unsupported value 'NGTCP2_SETTINGS_V2'
# const 'NGTCP2_CALLBACKS_VERSION' has unsupported value 'NGTCP2_CALLBACKS_V1'
import macros
macro defineEnum(typ: untyped): untyped =
result = newNimNode(nnkStmtList)
# Enum mapped to distinct cint
result.add quote do:
type `typ`* = distinct cint
for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "==", ">", ">="]:
let
ni = newIdentNode(i)
typout = if i[0] in "<=>": newIdentNode("bool") else: typ # comparisons return bool
if i[0] == '>': # cannot borrow `>` and `>=` from templates
let
nopp = if i.len == 2: newIdentNode("<=") else: newIdentNode("<")
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` = `nopp`(y, x)
proc `ni`*(x: cint, y: `typ`): `typout` = `nopp`(y, x)
proc `ni`*(x, y: `typ`): `typout` = `nopp`(y, x)
else:
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.}
proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.}
proc `ni`*(x, y: `typ`): `typout` {.borrow.}
result.add quote do:
proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y)
let
divop = newIdentNode("/") # `/`()
dlrop = newIdentNode("$") # `$`()
notop = newIdentNode("not") # `not`()
result.add quote do:
proc `divop`*(x, y: `typ`): `typ` = `typ`((x.float / y.float).cint)
proc `divop`*(x: `typ`, y: cint): `typ` = `divop`(x, `typ`(y))
proc `divop`*(x: cint, y: `typ`): `typ` = `divop`(`typ`(x), y)
proc `divop`*(x: `typ`, y: int): `typ` = `divop`(x, y.cint)
proc `divop`*(x: int, y: `typ`): `typ` = `divop`(x.cint, y)
proc `dlrop`*(x: `typ`): string {.borrow.}
proc `notop`*(x: `typ`): `typ` {.borrow.}
{.experimental: "codeReordering".}
{.passc: "-DNGTCP2_STATICLIB".}
{.passc: "-I./sources/lib/includes".}
{.passc: "-I./build/lib/includes".}
{.compile: "./sources/lib/ngtcp2_acktr.c".}
{.compile: "./sources/lib/ngtcp2_addr.c".}
{.compile: "./sources/lib/ngtcp2_balloc.c".}
{.compile: "./sources/lib/ngtcp2_bbr.c".}
{.compile: "./sources/lib/ngtcp2_buf.c".}
{.compile: "./sources/lib/ngtcp2_cc.c".}
{.compile: "./sources/lib/ngtcp2_cid.c".}
{.compile: "./sources/lib/ngtcp2_conn.c".}
{.compile: "./sources/lib/ngtcp2_conv.c".}
{.compile: "./sources/lib/ngtcp2_crypto.c".}
{.compile: "./sources/lib/ngtcp2_err.c".}
{.compile: "./sources/lib/ngtcp2_frame_chain.c".}
{.compile: "./sources/lib/ngtcp2_gaptr.c".}
{.compile: "./sources/lib/ngtcp2_idtr.c".}
{.compile: "./sources/lib/ngtcp2_ksl.c".}
{.compile: "./sources/lib/ngtcp2_log.c".}
{.compile: "./sources/lib/ngtcp2_map.c".}
{.compile: "./sources/lib/ngtcp2_mem.c".}
{.compile: "./sources/lib/ngtcp2_objalloc.c".}
{.compile: "./sources/lib/ngtcp2_opl.c".}
{.compile: "./sources/lib/ngtcp2_path.c".}
{.compile: "./sources/lib/ngtcp2_pkt.c".}
{.compile: "./sources/lib/ngtcp2_pmtud.c".}
{.compile: "./sources/lib/ngtcp2_ppe.c".}
{.compile: "./sources/lib/ngtcp2_pq.c".}
{.compile: "./sources/lib/ngtcp2_pv.c".}
{.compile: "./sources/lib/ngtcp2_qlog.c".}
{.compile: "./sources/lib/ngtcp2_range.c".}
{.compile: "./sources/lib/ngtcp2_ringbuf.c".}
{.compile: "./sources/lib/ngtcp2_rob.c".}
{.compile: "./sources/lib/ngtcp2_rst.c".}
{.compile: "./sources/lib/ngtcp2_rtb.c".}
{.compile: "./sources/lib/ngtcp2_settings.c".}
{.compile: "./sources/lib/ngtcp2_str.c".}
{.compile: "./sources/lib/ngtcp2_strm.c".}
{.compile: "./sources/lib/ngtcp2_transport_params.c".}
{.compile: "./sources/lib/ngtcp2_unreachable.c".}
{.compile: "./sources/lib/ngtcp2_vec.c".}
{.compile: "./sources/lib/ngtcp2_version.c".}
{.compile: "./sources/lib/ngtcp2_window_filter.c".}
defineEnum(ngtcp2_pkt_type) ## ```
## @enum
##
## :type:ngtcp2_pkt_type defines QUIC version-independent QUIC
## packet types.
## ```
defineEnum(ngtcp2_path_validation_result) ## ```
## @enum
##
## :type:ngtcp2_path_validation_result defines path validation
## result code.
## ```
defineEnum(ngtcp2_cc_algo) ## ```
## @enum
##
## :type:ngtcp2_cc_algo defines congestion control algorithms.
## ```
defineEnum(ngtcp2_token_type) ## ```
## @enum
##
## :type:ngtcp2_token_type defines the type of token.
## ```
defineEnum(ngtcp2_encryption_level) ## ```
## @enum
##
## :type:ngtcp2_encryption_level is QUIC encryption level.
## ```
defineEnum(ngtcp2_connection_id_status_type) ## ```
## @enum
##
## :type:ngtcp2_connection_id_status_type defines a set of status
## for Destination Connection ID.
## ```
defineEnum(ngtcp2_ccerr_type) ## ```
## @enum
##
## :type:ngtcp2_ccerr_type defines connection error type.
## ```
const
NGTCP2_SECONDS* = (cast[ngtcp2_duration](1000000000'u64))
NGTCP2_MILLISECONDS* = (cast[ngtcp2_duration](1000000'u64))
NGTCP2_MICROSECONDS* = (cast[ngtcp2_duration](1000'u64))
NGTCP2_NANOSECONDS* = (cast[ngtcp2_duration](1'u64))
NGTCP2_PROTO_VER_V1* = (cast[uint32](0x00000001'u))
NGTCP2_PROTO_VER_V2* = (cast[uint32](0x6B3343CF'u))
NGTCP2_RESERVED_VERSION_MASK* = 0x0A0A0A0A'u
NGTCP2_MAX_UDP_PAYLOAD_SIZE* = 1200
NGTCP2_MAX_PMTUD_UDP_PAYLOAD_SIZE* = 1452
NGTCP2_MAX_VARINT* = ((1'u64 shl typeof(1'u64)(62)) - typeof(1'u64)(1))
NGTCP2_STATELESS_RESET_TOKENLEN* = 16
NGTCP2_MIN_STATELESS_RESET_RANDLEN* = 5
NGTCP2_PATH_CHALLENGE_DATALEN* = 8
NGTCP2_RETRY_KEY_V1* = "�\fi\v�fWZ\x1DvkT�h�N"
NGTCP2_RETRY_NONCE_V1* = "F\x15��]c+�#�%�"
NGTCP2_RETRY_KEY_V2* = "���\eV�H�`��έ|̒"
NGTCP2_RETRY_NONCE_V2* = "�ii�-|m���J"
NGTCP2_HP_MASKLEN* = 5
NGTCP2_HP_SAMPLELEN* = 16
NGTCP2_DEFAULT_INITIAL_RTT* = (333 * typeof(333)(NGTCP2_MILLISECONDS))
NGTCP2_MAX_CIDLEN* = 20
NGTCP2_MIN_CIDLEN* = 1
NGTCP2_MIN_INITIAL_DCIDLEN* = 8
NGTCP2_ECN_NOT_ECT* = 0x00000000
NGTCP2_ECN_ECT_1* = 0x00000001
NGTCP2_ECN_ECT_0* = 0x00000002
NGTCP2_ECN_CE* = 0x00000003
NGTCP2_ECN_MASK* = 0x00000003
NGTCP2_PKT_INFO_V1* = 1
NGTCP2_ERR_INVALID_ARGUMENT* = -201
NGTCP2_ERR_NOBUF* = -202
NGTCP2_ERR_PROTO* = -203
NGTCP2_ERR_INVALID_STATE* = -204
NGTCP2_ERR_ACK_FRAME* = -205
NGTCP2_ERR_STREAM_ID_BLOCKED* = -206
NGTCP2_ERR_STREAM_IN_USE* = -207
NGTCP2_ERR_STREAM_DATA_BLOCKED* = -208
NGTCP2_ERR_FLOW_CONTROL* = -209
NGTCP2_ERR_CONNECTION_ID_LIMIT* = -210
NGTCP2_ERR_STREAM_LIMIT* = -211
NGTCP2_ERR_FINAL_SIZE* = -212
NGTCP2_ERR_CRYPTO* = -213
NGTCP2_ERR_PKT_NUM_EXHAUSTED* = -214
NGTCP2_ERR_REQUIRED_TRANSPORT_PARAM* = -215
NGTCP2_ERR_MALFORMED_TRANSPORT_PARAM* = -216
NGTCP2_ERR_FRAME_ENCODING* = -217
NGTCP2_ERR_DECRYPT* = -218
NGTCP2_ERR_STREAM_SHUT_WR* = -219
NGTCP2_ERR_STREAM_NOT_FOUND* = -220
NGTCP2_ERR_STREAM_STATE* = -221
NGTCP2_ERR_RECV_VERSION_NEGOTIATION* = -222
NGTCP2_ERR_CLOSING* = -223
NGTCP2_ERR_DRAINING* = -224
NGTCP2_ERR_TRANSPORT_PARAM* = -225
NGTCP2_ERR_DISCARD_PKT* = -226
NGTCP2_ERR_CONN_ID_BLOCKED* = -227
NGTCP2_ERR_INTERNAL* = -228
NGTCP2_ERR_CRYPTO_BUFFER_EXCEEDED* = -229
NGTCP2_ERR_WRITE_MORE* = -230
NGTCP2_ERR_RETRY* = -231
NGTCP2_ERR_DROP_CONN* = -232
NGTCP2_ERR_AEAD_LIMIT_REACHED* = -233
NGTCP2_ERR_NO_VIABLE_PATH* = -234
NGTCP2_ERR_VERSION_NEGOTIATION* = -235
NGTCP2_ERR_HANDSHAKE_TIMEOUT* = -236
NGTCP2_ERR_VERSION_NEGOTIATION_FAILURE* = -237
NGTCP2_ERR_IDLE_CLOSE* = -238
NGTCP2_ERR_FATAL* = -500
NGTCP2_ERR_NOMEM* = -501
NGTCP2_ERR_CALLBACK_FAILURE* = -502
NGTCP2_PKT_FLAG_NONE* = 0x00000000'u
NGTCP2_PKT_FLAG_LONG_FORM* = 0x00000001'u
NGTCP2_PKT_FLAG_FIXED_BIT_CLEAR* = 0x00000002'u
NGTCP2_PKT_FLAG_KEY_PHASE* = 0x00000004'u
NGTCP2_PKT_VERSION_NEGOTIATION* = (0x00000080).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_VERSION_NEGOTIATION is defined by libngtcp2
## for convenience.
## ```
NGTCP2_PKT_STATELESS_RESET* = (0x00000081).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_STATELESS_RESET is defined by libngtcp2 for
## convenience.
## ```
NGTCP2_PKT_INITIAL* = (0x00000010).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_INITIAL indicates Initial packet.
## ```
NGTCP2_PKT_0RTT* = (0x00000011).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_0RTT indicates 0-RTT packet.
## ```
NGTCP2_PKT_HANDSHAKE* = (0x00000012).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_HANDSHAKE indicates Handshake packet.
## ```
NGTCP2_PKT_RETRY* = (0x00000013).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_RETRY indicates Retry packet.
## ```
NGTCP2_PKT_1RTT* = (0x00000040).ngtcp2_pkt_type ## ```
## :enum:NGTCP2_PKT_1RTT is defined by libngtcp2 for convenience.
## ```
NGTCP2_NO_ERROR* = 0x00000000'u
NGTCP2_INTERNAL_ERROR* = 0x00000001'u
NGTCP2_CONNECTION_REFUSED* = 0x00000002'u
NGTCP2_FLOW_CONTROL_ERROR* = 0x00000003'u
NGTCP2_STREAM_LIMIT_ERROR* = 0x00000004'u
NGTCP2_STREAM_STATE_ERROR* = 0x00000005'u
NGTCP2_FINAL_SIZE_ERROR* = 0x00000006'u
NGTCP2_FRAME_ENCODING_ERROR* = 0x00000007'u
NGTCP2_TRANSPORT_PARAMETER_ERROR* = 0x00000008'u
NGTCP2_CONNECTION_ID_LIMIT_ERROR* = 0x00000009'u
NGTCP2_PROTOCOL_VIOLATION* = 0x0000000A'u
NGTCP2_INVALID_TOKEN* = 0x0000000B'u
NGTCP2_APPLICATION_ERROR* = 0x0000000C'u
NGTCP2_CRYPTO_BUFFER_EXCEEDED* = 0x0000000D'u
NGTCP2_KEY_UPDATE_ERROR* = 0x0000000E'u
NGTCP2_AEAD_LIMIT_REACHED* = 0x0000000F'u
NGTCP2_NO_VIABLE_PATH* = 0x00000010'u
NGTCP2_CRYPTO_ERROR* = 0x00000100'u
NGTCP2_VERSION_NEGOTIATION_ERROR* = 0x00000011
NGTCP2_PATH_VALIDATION_RESULT_SUCCESS* = (0).ngtcp2_path_validation_result ## ```
## :enum:NGTCP2_PATH_VALIDATION_RESULT_SUCCESS indicates
## successful validation.
## ```
NGTCP2_PATH_VALIDATION_RESULT_FAILURE* = (
NGTCP2_PATH_VALIDATION_RESULT_SUCCESS + 1).ngtcp2_path_validation_result ## ```
## :enum:NGTCP2_PATH_VALIDATION_RESULT_FAILURE indicates
## validation failure.
## ```
NGTCP2_PATH_VALIDATION_RESULT_ABORTED* = (
NGTCP2_PATH_VALIDATION_RESULT_FAILURE + 1).ngtcp2_path_validation_result ## ```
## :enum:NGTCP2_PATH_VALIDATION_RESULT_ABORTED indicates that path
## validation was aborted.
## ```
NGTCP2_DEFAULT_MAX_RECV_UDP_PAYLOAD_SIZE* = 65527
NGTCP2_DEFAULT_ACK_DELAY_EXPONENT* = 3
NGTCP2_DEFAULT_MAX_ACK_DELAY* = (25 * typeof(25)(NGTCP2_MILLISECONDS))
NGTCP2_DEFAULT_ACTIVE_CONNECTION_ID_LIMIT* = 2
NGTCP2_TLSEXT_QUIC_TRANSPORT_PARAMETERS_V1* = 0x00000039'u
NGTCP2_TRANSPORT_PARAMS_V1* = 1
NGTCP2_CONN_INFO_V1* = 1
NGTCP2_CC_ALGO_RENO* = (0x00000000).ngtcp2_cc_algo ## ```
## :enum:NGTCP2_CC_ALGO_RENO represents Reno.
## ```
NGTCP2_CC_ALGO_CUBIC* = (0x00000001).ngtcp2_cc_algo ## ```
## :enum:NGTCP2_CC_ALGO_CUBIC represents Cubic.
## ```
NGTCP2_CC_ALGO_BBR* = (0x00000002).ngtcp2_cc_algo ## ```
## :enum:NGTCP2_CC_ALGO_BBR represents BBR v2.
## ```
NGTCP2_QLOG_WRITE_FLAG_NONE* = 0x00000000'u
NGTCP2_QLOG_WRITE_FLAG_FIN* = 0x00000001'u
NGTCP2_TOKEN_TYPE_UNKNOWN* = (0).ngtcp2_token_type ## ```
## :enum:NGTCP2_TOKEN_TYPE_UNKNOWN indicates that the type of
## token is unknown.
## ```
NGTCP2_TOKEN_TYPE_RETRY* = (NGTCP2_TOKEN_TYPE_UNKNOWN + 1).ngtcp2_token_type ## ```
## :enum:NGTCP2_TOKEN_TYPE_RETRY indicates that a token comes from
## Retry packet.
## ```
NGTCP2_TOKEN_TYPE_NEW_TOKEN* = (NGTCP2_TOKEN_TYPE_RETRY + 1).ngtcp2_token_type ## ```
## :enum:NGTCP2_TOKEN_TYPE_NEW_TOKEN indicates that a token comes
## from NEW_TOKEN frame.
## ```
NGTCP2_SETTINGS_V1* = 1
NGTCP2_SETTINGS_V2* = 2
NGTCP2_ENCRYPTION_LEVEL_INITIAL* = (0).ngtcp2_encryption_level ## ```
## :enum:NGTCP2_ENCRYPTION_LEVEL_INITIAL is Initial encryption
## level.
## ```
NGTCP2_ENCRYPTION_LEVEL_HANDSHAKE* = (NGTCP2_ENCRYPTION_LEVEL_INITIAL + 1).ngtcp2_encryption_level ## ```
## :enum:NGTCP2_ENCRYPTION_LEVEL_HANDSHAKE is Handshake encryption
## level.
## ```
NGTCP2_ENCRYPTION_LEVEL_1RTT* = (NGTCP2_ENCRYPTION_LEVEL_HANDSHAKE + 1).ngtcp2_encryption_level ## ```
## :enum:NGTCP2_ENCRYPTION_LEVEL_1RTT is 1-RTT encryption level.
## ```
NGTCP2_ENCRYPTION_LEVEL_0RTT* = (NGTCP2_ENCRYPTION_LEVEL_1RTT + 1).ngtcp2_encryption_level ## ```
## :enum:NGTCP2_ENCRYPTION_LEVEL_0RTT is 0-RTT encryption level.
## ```
NGTCP2_STREAM_DATA_FLAG_NONE* = 0x00000000'u
NGTCP2_STREAM_DATA_FLAG_FIN* = 0x00000001'u
NGTCP2_STREAM_DATA_FLAG_0RTT* = 0x00000002'u
NGTCP2_STREAM_CLOSE_FLAG_NONE* = 0x00000000'u
NGTCP2_STREAM_CLOSE_FLAG_APP_ERROR_CODE_SET* = 0x00000001'u
NGTCP2_PATH_VALIDATION_FLAG_NONE* = 0x00000000'u
NGTCP2_PATH_VALIDATION_FLAG_PREFERRED_ADDR* = 0x00000001'u
NGTCP2_PATH_VALIDATION_FLAG_NEW_TOKEN* = 0x00000002'u
NGTCP2_CONNECTION_ID_STATUS_TYPE_ACTIVATE* = (0).ngtcp2_connection_id_status_type ## ```
## :enum:NGTCP2_CONNECTION_ID_STATUS_TYPE_ACTIVATE indicates that
## a local endpoint starts using new Destination Connection ID.
## ```
NGTCP2_CONNECTION_ID_STATUS_TYPE_DEACTIVATE* = (
NGTCP2_CONNECTION_ID_STATUS_TYPE_ACTIVATE + 1).ngtcp2_connection_id_status_type ## ```
## :enum:NGTCP2_CONNECTION_ID_STATUS_TYPE_DEACTIVATE indicates
## that a local endpoint stops using a given Destination Connection
## ID.
## ```
NGTCP2_DATAGRAM_FLAG_NONE* = 0x00000000'u
NGTCP2_DATAGRAM_FLAG_0RTT* = 0x00000001'u
NGTCP2_CALLBACKS_V1* = 1
NGTCP2_WRITE_STREAM_FLAG_NONE* = 0x00000000'u
NGTCP2_WRITE_STREAM_FLAG_MORE* = 0x00000001'u
NGTCP2_WRITE_STREAM_FLAG_FIN* = 0x00000002'u
NGTCP2_WRITE_DATAGRAM_FLAG_NONE* = 0x00000000'u
NGTCP2_WRITE_DATAGRAM_FLAG_MORE* = 0x00000001'u
NGTCP2_CCERR_TYPE_TRANSPORT* = (0).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_TRANSPORT indicates the QUIC transport
## error, and the error code is QUIC transport error code.
## ```
NGTCP2_CCERR_TYPE_APPLICATION* = (NGTCP2_CCERR_TYPE_TRANSPORT + 1).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_APPLICATION indicates an application
## error, and the error code is application error code.
## ```
NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION* = (NGTCP2_CCERR_TYPE_APPLICATION + 1).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION is a special case
## of QUIC transport error, and it indicates that client receives
## Version Negotiation packet.
## ```
NGTCP2_CCERR_TYPE_IDLE_CLOSE* = (NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION + 1).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_IDLE_CLOSE is a special case of QUIC
## transport error, and it indicates that connection is closed
## because of idle timeout.
## ```
NGTCP2_CCERR_TYPE_DROP_CONN* = (NGTCP2_CCERR_TYPE_IDLE_CLOSE + 1).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_DROP_CONN is a special case of QUIC
## transport error, and it indicates that connection should be
## dropped without sending a CONNECTION_CLOSE frame.
## ```
NGTCP2_CCERR_TYPE_RETRY* = (NGTCP2_CCERR_TYPE_DROP_CONN + 1).ngtcp2_ccerr_type ## ```
## :enum:NGTCP2_CCERR_TYPE_RETRY is a special case of QUIC
## transport error, and it indicates that RETRY packet should be
## sent to a client.
## ```
NGTCP2_VERSION_AGE* = 1
type
ngtcp2_ssize* = ByteAddress ## ```
## @typedef
##
## :type:ngtcp2_ssize is signed counterpart of size_t.
## ```
ngtcp2_malloc* = proc (size: uint; user_data: pointer): pointer {.cdecl.}
ngtcp2_free* = proc (`ptr`: pointer; user_data: pointer) {.cdecl.}
ngtcp2_calloc* = proc (nmemb: uint; size: uint; user_data: pointer): pointer {.
cdecl.}
ngtcp2_realloc* = proc (`ptr`: pointer; size: uint; user_data: pointer): pointer {.
cdecl.}
ngtcp2_mem* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_mem is a custom memory allocator. The
## :member:user_data field is passed to each allocator function.
## This can be used, for example, to achieve per-connection memory
## pool.
##
## In the following example code, my_malloc, my_free,
## my_calloc and my_realloc are the replacement of the
## standard allocators :manpage:malloc(3), :manpage:free(3),
## :manpage:calloc(3) and :manpage:realloc(3) respectively::
##
## voidmy_malloc_cb(size_t size, voiduser_data) {
## (void)user_data;
## return my_malloc(size);
## }
##
## void my_free_cb(voidptr, voiduser_data) {
## (void)user_data;
## my_free(ptr);
## }
##
## voidmy_calloc_cb(size_t nmemb, size_t size, voiduser_data) {
## (void)user_data;
## return my_calloc(nmemb, size);
## }
##
## voidmy_realloc_cb(voidptr, size_t size, voiduser_data) {
## (void)user_data;
## return my_realloc(ptr, size);
## }
##
## void conn_new() {
## ngtcp2_mem mem = {NULL, my_malloc_cb, my_free_cb, my_calloc_cb,
## my_realloc_cb};
##
## ...
## }
## ```
user_data*: pointer ## ```
## :member:user_data is an arbitrary user supplied data. This
## is passed to each allocator function.
## ```
malloc*: ngtcp2_malloc ## ```
## :member:malloc is a custom allocator function to replace
## :manpage:malloc(3).
## ```
free*: ngtcp2_free ## ```
## :member:free is a custom allocator function to replace
## :manpage:free(3).
## ```
calloc*: ngtcp2_calloc ## ```
## :member:calloc is a custom allocator function to replace
## :manpage:calloc(3).
## ```
realloc*: ngtcp2_realloc ## ```
## :member:realloc is a custom allocator function to replace
## :manpage:realloc(3).
## ```
ngtcp2_pkt_info* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_pkt_info is a packet metadata.
## ```
ecn*: uint8 ## ```
## :member:ecn is ECN marking, and when it is passed to
## ngtcp2_conn_read_pkt(), it should be either
## :macro:NGTCP2_ECN_NOT_ECT, :macro:NGTCP2_ECN_ECT_1,
## :macro:NGTCP2_ECN_ECT_0, or :macro:NGTCP2_ECN_CE.
## ```
ngtcp2_tstamp* = uint64 ## ```
## @typedef
##
## :type:ngtcp2_tstamp is a timestamp with nanosecond resolution.
## UINT64_MAX is an invalid value, and it is often used to
## indicate that no value is set.
## ```
ngtcp2_duration* = uint64 ## ```
## @typedef
##
## :type:ngtcp2_duration is a period of time in nanosecond
## resolution. UINT64_MAX is an invalid value, and it is often
## used to indicate that no value is set.
## ```
ngtcp2_cid* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_cid holds a Connection ID.
## ```
datalen*: uint ## ```
## :member:datalen is the length of Connection ID.
## ```
data*: array[20, uint8] ## ```
## :member:data is the buffer to store Connection ID.
## ```
ngtcp2_vec* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_vec is struct iovec compatible structure to
## reference arbitrary array of bytes.
## ```
base*: ptr uint8 ## ```
## :member:base points to the data.
## ```
len*: uint ## ```
## :member:len is the number of bytes which the buffer pointed by
## base contains.
## ```
ngtcp2_pkt_hd* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_pkt_hd represents QUIC packet header.
## ```
dcid*: ngtcp2_cid ## ```
## :member:dcid is Destination Connection ID.
## ```
scid*: ngtcp2_cid ## ```
## :member:scid is Source Connection ID.
## ```
pkt_num*: int64 ## ```
## :member:pkt_num is a packet number.
## ```
token*: ptr uint8 ## ```
## :member:token contains token. Only Initial packet may contain
## token. NULL if no token is present.
## ```
tokenlen*: uint ## ```
## :member:tokenlen is the length of :member:token. 0 if no
## token is present.
## ```
pkt_numlen*: uint ## ```
## :member:pkt_numlen is the number of bytes spent to encode
## :member:pkt_num.
## ```
len*: uint ## ```
## :member:len is the sum of :member:pkt_numlen and the length
## of QUIC packet payload.
## ```
version*: uint32 ## ```
## :member:version is QUIC version.
## ```
`type`*: uint8 ## ```
## :member:type is a type of QUIC packet. This field does not
## have a QUIC packet type defined for a specific QUIC version.
## Instead, it contains version independent packet type defined by
## this library. See :type:ngtcp2_pkt_type.
## ```
flags*: uint8 ## ```
## :member:flags is zero or more of :macro:NGTCP2_PKT_FLAG_*
## <NGTCP2_PKT_FLAG_NONE>.
## ```
ngtcp2_pkt_stateless_reset* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_pkt_stateless_reset represents Stateless Reset.
## ```
stateless_reset_token*: array[16, uint8] ## ```
## :member:stateless_reset_token contains stateless reset token.
## ```
rand*: ptr uint8 ## ```
## :member:rand points a buffer which contains random bytes
## section.
## ```
randlen*: uint ## ```
## :member:randlen is the number of random bytes.
## ```
ngtcp2_SockAddr* = SockAddr ## ```
## @typedef
##
## :type:ngtcp2_sockaddr is typedefed to struct sockaddr. If
## :macro:NGTCP2_USE_GENERIC_SOCKADDR is defined, it is typedefed to
## the generic struct sockaddr defined in ngtcp2.h.
## ```
ngtcp2_SockAddr_in* = SockAddr_in ## ```
## @typedef
##
## :type:ngtcp2_sockaddr_in is typedefed to struct sockaddr_in. If
## :macro:NGTCP2_USE_GENERIC_SOCKADDR is defined, it is typedefed to
## the generic struct sockaddr_in defined in ngtcp2.h.
## ```
ngtcp2_SockAddr_in6* = SockAddr_in6 ## ```
## @typedef
##
## :type:ngtcp2_sockaddr_in6 is typedefed to struct sockaddr_in6.
## If :macro:NGTCP2_USE_GENERIC_SOCKADDR is defined, it is typedefed
## to the generic struct sockaddr_in6 defined in ngtcp2.h.
## ```
ngtcp2_socklen* = SockLen ## ```
## @typedef
##
## :type:ngtcp2_socklen is typedefed to socklen_t. If
## :macro:NGTCP2_USE_GENERIC_SOCKADDR is defined, it is typedefed to
## uint32_t.
## ```
ngtcp2_SockAddr_union* {.union, bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_sockaddr_union conveniently includes all supported
## address types.
## ```
sa*: ngtcp2_SockAddr
`in`*: ngtcp2_SockAddr_in
in6*: ngtcp2_SockAddr_in6
ngtcp2_preferred_addr* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_preferred_addr represents preferred address
## structure.
## ```
cid*: ngtcp2_cid ## ```
## :member:cid is a Connection ID.
## ```
ipv4*: ngtcp2_SockAddr_in ## ```
## :member:ipv4 contains IPv4 address and port.
## ```
ipv6*: ngtcp2_SockAddr_in6 ## ```
## :member:ipv6 contains IPv6 address and port.
## ```
ipv4_present*: uint8 ## ```
## :member:ipv4_present indicates that :member:ipv4 contains
## IPv4 address and port.
## ```
ipv6_present*: uint8 ## ```
## :member:ipv6_present indicates that :member:ipv6 contains
## IPv6 address and port.
## ```
stateless_reset_token*: array[16, uint8] ## ```
## :member:stateless_reset_token contains stateless reset token.
## ```
ngtcp2_version_info* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_version_info represents version_information
## structure. See :rfc:9368.
## ```
chosen_version*: uint32 ## ```
## :member:chosen_version is the version chosen by the sender.
## ```
available_versions*: ptr uint8 ## ```
## :member:available_versions points the wire image of
## available_versions field. The each version is therefore in
## network byte order.
## ```
available_versionslen*: uint ## ```
## :member:available_versionslen is the number of bytes pointed by
## :member:available_versions, not the number of versions
## included.
## ```
ngtcp2_transport_params* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_transport_params represents QUIC transport
## parameters.
## ```
preferred_addr*: ngtcp2_preferred_addr ## ```
## :member:preferred_addr contains preferred address if
## :member:preferred_addr_present is nonzero.
## ```
original_dcid*: ngtcp2_cid ## ```
## :member:original_dcid is the Destination Connection ID field
## from the first Initial packet from client. Server must specify
## this field and set :member:original_dcid_present to nonzero.
## It is expected that application knows the original Destination
## Connection ID even if it sends Retry packet, for example, by
## including it in retry token. Otherwise, application should not
## specify this field.
## ```
initial_scid*: ngtcp2_cid ## ```
## :member:initial_scid is the Source Connection ID field from the
## first Initial packet the local endpoint sends. Application
## should not specify this field. If :member:initial_scid_present
## is set to nonzero, it indicates this field is set.
## ```
retry_scid*: ngtcp2_cid ## ```
## :member:retry_scid is the Source Connection ID field from Retry
## packet. Only server uses this field. If server application
## received Initial packet with retry token from client, and server
## successfully verified its token, server application must set
## Destination Connection ID field from the Initial packet to this
## field, and set :member:retry_scid_present to nonzero. Server
## application must verify that the Destination Connection ID from
## Initial packet was sent in Retry packet by, for example,
## including the Connection ID in a token, or including it in AAD
## when encrypting a token.
## ```
initial_max_stream_data_bidi_local*: uint64 ## ```
## :member:initial_max_stream_data_bidi_local is the size of flow
## control window of locally initiated stream. This is the number
## of bytes that the remote endpoint can send, and the local
## endpoint must ensure that it has enough buffer to receive them.
## ```
initial_max_stream_data_bidi_remote*: uint64 ## ```
## :member:initial_max_stream_data_bidi_remote is the size of flow
## control window of remotely initiated stream. This is the number
## of bytes that the remote endpoint can send, and the local
## endpoint must ensure that it has enough buffer to receive them.
## ```
initial_max_stream_data_uni*: uint64 ## ```
## :member:initial_max_stream_data_uni is the size of flow control
## window of remotely initiated unidirectional stream. This is the
## number of bytes that the remote endpoint can send, and the local
## endpoint must ensure that it has enough buffer to receive them.
## ```
initial_max_data*: uint64 ## ```
## :member:initial_max_data is the connection level flow control
## window.
## ```
initial_max_streams_bidi*: uint64 ## ```
## :member:initial_max_streams_bidi is the number of concurrent
## streams that the remote endpoint can create.
## ```
initial_max_streams_uni*: uint64 ## ```
## :member:initial_max_streams_uni is the number of concurrent
## unidirectional streams that the remote endpoint can create.
## ```
max_idle_timeout*: ngtcp2_duration ## ```
## :member:max_idle_timeout is a duration during which sender
## allows quiescent. 0 means no idle timeout. It must not be
## UINT64_MAX.
## ```
max_udp_payload_size*: uint64 ## ```
## :member:max_udp_payload_size is the maximum UDP payload size
## that the local endpoint can receive.
## ```
active_connection_id_limit*: uint64 ## ```
## :member:active_connection_id_limit is the maximum number of
## Connection ID that sender can store.
## ```
ack_delay_exponent*: uint64 ## ```
## :member:ack_delay_exponent is the exponent used in ACK Delay
## field in ACK frame.
## ```
max_ack_delay*: ngtcp2_duration ## ```
## :member:max_ack_delay is the maximum acknowledgement delay by
## which the local endpoint will delay sending acknowledgements. It
## must be strictly less than (1 << 14) milliseconds.
## Sub-millisecond part is dropped when sending it in a QUIC
## transport parameter.
## ```
max_datagram_frame_size*: uint64 ## ```
## :member:max_datagram_frame_size is the maximum size of DATAGRAM
## frame that the local endpoint willingly receives. Specifying 0
## disables DATAGRAM support. See :rfc:9221.
## ```
stateless_reset_token_present*: uint8 ## ```
## :member:stateless_reset_token_present is nonzero if
## :member:stateless_reset_token field is set.
## ```
disable_active_migration*: uint8 ## ```
## :member:disable_active_migration is nonzero if the local
## endpoint does not support active connection migration.
## ```
original_dcid_present*: uint8 ## ```
## :member:original_dcid_present is nonzero if
## :member:original_dcid field is set.
## ```
initial_scid_present*: uint8 ## ```
## :member:initial_scid_present is nonzero if
## :member:initial_scid field is set.
## ```
retry_scid_present*: uint8 ## ```
## :member:retry_scid_present is nonzero if :member:retry_scid
## field is set.
## ```
preferred_addr_present*: uint8 ## ```
## :member:preferred_addr_present is nonzero if
## :member:preferred_address is set.
## ```
stateless_reset_token*: array[16, uint8] ## ```
## :member:stateless_reset_token contains stateless reset token.
## ```
grease_quic_bit*: uint8 ## ```
## :member:grease_quic_bit is nonzero if sender supports "Greasing
## the QUIC Bit" extension. See :rfc:9287.
## ```
version_info*: ngtcp2_version_info ## ```
## :member:version_info contains version_information field if
## :member:version_info_present is nonzero. Application should
## not specify this field.
## ```
version_info_present*: uint8 ## ```
## :member:version_info_present is nonzero if
## :member:version_info is set. Application should not specify
## this field.
## ```
ngtcp2_conn_info* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_conn_info holds various connection statistics.
## ```
latest_rtt*: ngtcp2_duration ## ```
## :member:latest_rtt is the latest RTT sample which is not
## adjusted by acknowledgement delay.
## ```
min_rtt*: ngtcp2_duration ## ```
## :member:min_rtt is the minimum RTT seen so far. It is not
## adjusted by acknowledgement delay.
## ```
smoothed_rtt*: ngtcp2_duration ## ```
## :member:smoothed_rtt is the smoothed RTT.
## ```
rttvar*: ngtcp2_duration ## ```
## :member:rttvar is a mean deviation of observed RTT.
## ```
cwnd*: uint64 ## ```
## :member:cwnd is the size of congestion window.
## ```
ssthresh*: uint64 ## ```
## :member:ssthresh is slow start threshold.
## ```
bytes_in_flight*: uint64 ## ```
## :member:bytes_in_flight is the number in bytes of all sent
## packets which have not been acknowledged.
## ```
ngtcp2_printf* = proc (user_data: pointer; format: cstring) {.cdecl, varargs.}
ngtcp2_rand_ctx* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_rand_ctx is a wrapper around native random number
## generator. It is opaque to the ngtcp2 library. This might be
## useful if application needs to specify random number generator per
## thread or per connection.
## ```
native_handle*: pointer ## ```
## :member:native_handle is a pointer to an underlying random
## number generator.
## ```
ngtcp2_qlog_write* = proc (user_data: pointer; flags: uint32; data: pointer;
datalen: uint) {.cdecl.}
ngtcp2_settings* {.bycopy.} = object ## ```
## @struct
##
## :type:ngtcp2_settings defines QUIC connection settings.
## ```
qlog_write*: ngtcp2_qlog_write ## ```
## :member:qlog_write is a callback function to write qlog.
## Setting NULL disables qlog.
## ```
cc_algo*: ngtcp2_cc_algo ## ```
## :member:cc_algo specifies congestion control algorithm.
## ```
initial_ts*: ngtcp2_tstamp ## ```
## :member:initial_ts is an initial timestamp given to the
## library.
## ```
initial_rtt*: ngtcp2_duration ## ```
## :member:initial_rtt is an initial RTT.
## ```
log_printf*: ngtcp2_printf ## ```
## :member:log_printf is a function that the library uses to write
## logs. NULL means no logging output. It is nothing to do
## with qlog.
## ```
max_tx_udp_payload_size*: uint ## ```
## :member:max_tx_udp_payload_size is the maximum size of UDP
## datagram payload that the local endpoint transmits.
## ```
token*: ptr uint8 ## ```
## :member:token is a token from Retry packet or NEW_TOKEN frame.
##
## Server sets this field if it received the token in Client Initial
## packet and successfully validated. It should also set
## :member:token_type field.
##
## Client sets this field if it intends to send token in its Initial
## packet.
##
## ngtcp2_conn_server_new and ngtcp2_conn_client_new make a copy
## of token.
##
## Set NULL if there is no token.
## ```
tokenlen*: uint ## ```
## :member:tokenlen is the length of :member:token. Set 0 if
## there is no token.
## ```
token_type*: ngtcp2_token_type ## ```
## :member:token_type is the type of token. Server application
## should set this field.
## ```
rand_ctx*: ngtcp2_rand_ctx ## ```
## :member:rand_ctx is an optional random number generator to be
## passed to :type:ngtcp2_rand callback.
## ```
max_window*: uint64 ## ```
## :member:max_window is the maximum connection-level flow control
## window if connection-level window auto-tuning is enabled. The
## connection-level window auto tuning is enabled if nonzero value
## is specified in this field. The initial value of window size is
## :member:ngtcp2_transport_params.initial_max_data. The window
## size is scaled up to the value specified in this field.
## ```
max_stream_window*: uint64 ## ```
## :member:max_stream_window is the maximum stream-level flow
## control window if stream-level window auto-tuning is enabled.
## The stream-level window auto-tuning is enabled if nonzero value
## is specified in this field. The initial value of window size is
## :member:ngtcp2_transport_params.initial_max_stream_data_bidi_remote,
## :member:ngtcp2_transport_params.initial_max_stream_data_bidi_local,
## or :member:ngtcp2_transport_params.initial_max_stream_data_uni,
## depending on the type of stream. The window size is scaled up to
## the value specified in this field.
## ```
ack_thresh*: uint ## ```
## :member:ack_thresh is the minimum number of the received ACK
## eliciting packets that trigger the immediate acknowledgement from
## the local endpoint.
## ```
no_tx_udp_payload_size_shaping*: uint8 ## ```
## :member:no_tx_udp_payload_size_shaping, if set to nonzero,
## instructs the library not to limit the UDP payload size to
## :macro:NGTCP2_MAX_UDP_PAYLOAD_SIZE (which can be extended by
## Path MTU Discovery), and instead use the minimum size among the
## given buffer size, :member:max_tx_udp_payload_size, and the
## received max_udp_payload_size QUIC transport parameter.
## ```
handshake_timeout*: ngtcp2_duration ## ```
## :member:handshake_timeout is the period of time before giving
## up QUIC connection establishment. If QUIC handshake is not
## complete within this period, ngtcp2_conn_handle_expiry returns
## :macro:NGTCP2_ERR_HANDSHAKE_TIMEOUT error. The deadline is
## :member:initial_ts + :member:handshake_timeout. If this
## field is set to UINT64_MAX, no handshake timeout is set.
## ```
preferred_versions*: ptr uint32 ## ```
## :member:preferred_versions is the array of versions that are
## preferred by the local endpoint. All versions set in this array
## must be supported by the library, and compatible to QUIC v1. The
## reserved versions are not allowed. They are sorted in the order
## of preference.
##
## On compatible version negotiation, server will negotiate one of
## those versions contained in this array if there is some overlap
## between these versions and the versions offered by the client.
## If there is no overlap, but the client chosen version is
## supported by the library, the server chooses the client chosen
## version as the negotiated version. This version set corresponds
## to Offered Versions described in :rfc:9368, and it should be
## included in Version Negotiation packet.
##
## Client uses this field and :member:original_version to prevent
## version downgrade attack if it reacted upon Version Negotiation
## packet. If this field is specified, client must include
## |client_chosen_version| passed to ngtcp2_conn_client_new unless
## |client_chosen_version| is a reserved version.
## ```
preferred_versionslen*: uint ## ```
## :member:preferred_versionslen is the number of versions that
## are contained in the array pointed by
## :member:preferred_versions.
## ```
available_versions*: ptr uint32 ## ```
## :member:available_versions is the array of versions that are
## going to be set in :member:available_versions
## <ngtcp2_version_info.available_versions> field of outgoing
## version_information QUIC transport parameter.
##
## For server, this corresponds to Fully-Deployed Versions described
## in :rfc:9368. If this field is not set, it is set to
## :member:preferred_versions internally if
## :member:preferred_versionslen is not zero. If this field is
## not set, and :member:preferred_versionslen is zero, this field
## is set to :macro:NGTCP2_PROTO_VER_V1 internally.
##
## Client must include |client_chosen_version| passed to
## ngtcp2_conn_client_new in this array if this field is set and
## |client_chosen_version| is not a reserved version. If this field
## is not set, |client_chosen_version| passed to
## ngtcp2_conn_client_new will be set in this field internally
## unless |client_chosen_version| is a reserved version.
## ```
available_versionslen*: uint ## ```
## :member:available_versionslen is the number of versions that
## are contained in the array pointed by
## :member:available_versions.
## ```
original_version*: uint32 ## ```
## :member:original_version is the original version that client
## initially used to make a connection attempt. If it is set, and
## it differs from |client_chosen_version| passed to
## ngtcp2_conn_client_new, the library assumes that client reacted
## upon Version Negotiation packet. Server does not use this field.
## ```
no_pmtud*: uint8 ## ```
## :member:no_pmtud, if set to nonzero, disables Path MTU
## Discovery.