apiref.rst revision 2f2f4363
1API Reference
2=============
3
4.. highlight:: c
5
6Preliminaries
7-------------
8
9All declarations are in :file:`lsquic.h`, so it is enough to
10
11::
12
13    #incluide <lsquic.h>
14
15in each source file.
16
17
18Library Version
19---------------
20
21LSQUIC follows the following versioning model.  The version number
22has the form MAJOR.MINOR.PATCH, where
23
24- MAJOR changes when a large redesign occurs;
25- MINOR changes when an API change or another significant change occurs; and
26- PATCH changes when a bug is fixed or another small, API-compatible change occurs.
27
28QUIC Versions
29-------------
30
31LSQUIC supports two types of QUIC protocol: Google QUIC and IETF QUIC.  The
32former will at some point become obsolete, while the latter is still being
33developed by the IETF.  Both types are included in a single enum:
34
35.. type:: enum lsquic_version
36
37    .. member:: LSQVER_043
38
39        Google QUIC version Q043
40
41    .. member:: LSQVER_046
42
43        Google QUIC version Q046
44
45    .. member:: LSQVER_050
46
47        Google QUIC version Q050
48
49    .. member:: LSQVER_ID27
50
51        IETF QUIC version ID (Internet-Draft) 27
52
53    .. member:: LSQVER_ID28
54
55        IETF QUIC version ID 28
56
57    .. member:: LSQVER_ID29
58
59        IETF QUIC version ID 29
60
61    .. member:: N_LSQVER
62
63        Special value indicating the number of versions in the enum.  It
64        may be used as argument to :func:`lsquic_engine_connect()`.
65
66Several version lists (as bitmasks) are defined in :file:`lsquic.h`:
67
68.. macro:: LSQUIC_SUPPORTED_VERSIONS
69
70List of all supported versions.
71
72.. macro:: LSQUIC_FORCED_TCID0_VERSIONS
73
74List of versions in which the server never includes CID in short packets.
75
76.. macro:: LSQUIC_EXPERIMENTAL_VERSIONS
77
78Experimental versions.
79
80.. macro:: LSQUIC_DEPRECATED_VERSIONS
81
82Deprecated versions.
83
84.. macro:: LSQUIC_GQUIC_HEADER_VERSIONS
85
86Versions that have Google QUIC-like headers.  Only Q043 remains in this
87list.
88
89.. macro:: LSQUIC_IETF_VERSIONS
90
91IETF QUIC versions.
92
93.. macro:: LSQUIC_IETF_DRAFT_VERSIONS
94
95IETF QUIC *draft* versions.  When IETF QUIC v1 is released, it will not
96be included in this list.
97
98LSQUIC Types
99------------
100
101LSQUIC declares several types used by many of its public functions.  They are:
102
103.. type:: lsquic_engine_t
104
105    Instance of LSQUIC engine.
106
107.. type:: lsquic_conn_t
108
109    QUIC connection.
110
111.. type:: lsquic_stream_t
112
113    QUIC stream.
114
115.. type:: lsquic_stream_id_t
116
117    Stream ID.
118
119.. type:: lsquic_conn_ctx_t
120
121    Connection context.  This is the return value of :member:`lsquic_stream_if.on_new_conn`.
122    To LSQUIC, this is just an opaque pointer.  User code is expected to
123    use it for its own purposes.
124
125.. type:: lsquic_stream_ctx_t
126
127    Stream context.  This is the return value of :func:`on_new_stream()`.
128    To LSQUIC, this is just an opaque pointer.  User code is expected to
129    use it for its own purposes.
130
131.. type:: lsquic_http_headers_t
132
133    HTTP headers
134
135Library Initialization
136----------------------
137
138Before using the library, internal structures must be initialized using
139the global initialization function:
140
141::
142
143    if (0 == lsquic_global_init(LSQUIC_GLOBAL_CLIENT|LSQUIC_GLOBAL_SERVER))
144        /* OK, do something useful */
145        ;
146
147This call only needs to be made once.  Afterwards, any number of LSQUIC
148engines may be instantiated.
149
150After a process is done using LSQUIC, it should clean up:
151
152::
153
154    lsquic_global_cleanup();
155
156Logging
157-------
158
159.. type:: struct lsquic_logger_if
160
161    .. member:: int     (*log_buf)(void *logger_ctx, const char *buf, size_t len)
162
163.. function:: void lsquic_logger_init (const struct lsquic_logger_if *logger_if, void *logger_ctx, enum lsquic_logger_timestamp_style)
164
165    Call this if you want to do something with LSQUIC log messages, as they are thrown out by default.
166
167.. function:: int lsquic_set_log_level (const char *log_level)
168
169    Set log level for all LSQUIC modules.
170
171    :param log_level: Acceptable values are debug, info, notice, warning, error, alert, emerg, crit (case-insensitive).
172    :return: 0 on success or -1 on failure (invalid log level).
173
174.. function:: int lsquic_logger_lopt (const char *log_specs)
175
176    Set log level for a particular module or several modules.
177
178    :param log_specs:
179
180        One or more "module=level" specifications serapated by comma.
181        For example, "event=debug,engine=info".  See `List of Log Modules`_
182
183Engine Instantiation and Destruction
184------------------------------------
185
186To use the library, an instance of the ``struct lsquic_engine`` needs to be
187created:
188
189.. function:: lsquic_engine_t *lsquic_engine_new (unsigned flags, const struct lsquic_engine_api *api)
190
191    Create a new engine.
192
193    :param flags: This is is a bitmask of :macro:`LSENG_SERVER` and
194                :macro:`LSENG_HTTP`.
195    :param api: Pointer to an initialized :type:`lsquic_engine_api`.
196
197    The engine can be instantiated either in server mode (when ``LSENG_SERVER``
198    is set) or client mode.  If you need both server and client in your program,
199    create two engines (or as many as you'd like).
200
201    Specifying ``LSENG_HTTP`` flag enables the HTTP functionality: HTTP/2-like
202    for Google QUIC connections and HTTP/3 functionality for IETF QUIC
203    connections.
204
205.. macro:: LSENG_SERVER
206
207    One of possible bitmask values passed as first argument to
208    :type:`lsquic_engine_new`.  When set, the engine instance
209    will be in the server mode.
210
211.. macro:: LSENG_HTTP
212
213    One of possible bitmask values passed as first argument to
214    :type:`lsquic_engine_new`.  When set, the engine instance
215    will enable HTTP functionality.
216
217.. function:: void lsquic_engine_cooldown (lsquic_engine_t *engine)
218
219    This function closes all mini connections and marks all full connections
220    as going away.  In server mode, this also causes the engine to stop
221    creating new connections.
222
223.. function:: void lsquic_engine_destroy (lsquic_engine_t *engine)
224
225    Destroy engine and all its resources.
226
227Engine Callbacks
228----------------
229
230``struct lsquic_engine_api`` contains a few mandatory members and several
231optional members.
232
233.. type:: struct lsquic_engine_api
234
235    .. member:: const struct lsquic_stream_if       *ea_stream_if
236    .. member:: void                                *ea_stream_if_ctx
237
238        ``ea_stream_if`` is mandatory.  This structure contains pointers
239        to callbacks that handle connections and stream events.
240
241    .. member:: lsquic_packets_out_f                 ea_packets_out
242    .. member:: void                                *ea_packets_out_ctx
243
244        ``ea_packets_out`` is used by the engine to send packets.
245
246    .. member:: const struct lsquic_engine_settings *ea_settings
247
248        If ``ea_settings`` is set to NULL, the engine uses default settings
249        (see :func:`lsquic_engine_init_settings()`)
250
251    .. member:: lsquic_lookup_cert_f                 ea_lookup_cert
252    .. member:: void                                *ea_cert_lu_ctx
253
254        Look up certificate.  Mandatory in server mode.
255
256    .. member:: struct ssl_ctx_st *                (*ea_get_ssl_ctx)(void *peer_ctx)
257
258        Get SSL_CTX associated with a peer context.  Mandatory in server
259        mode.  This is use for default values for SSL instantiation.
260
261    .. member:: const struct lsquic_hset_if         *ea_hsi_if
262    .. member:: void                                *ea_hsi_ctx
263
264        Optional header set interface.  If not specified, the incoming headers
265        are converted to HTTP/1.x format and are read from stream and have to
266        be parsed again.
267
268    .. member:: const struct lsquic_shared_hash_if  *ea_shi
269    .. member:: void                                *ea_shi_ctx
270
271        Shared hash interface can be used to share state between several
272        processes of a single QUIC server.
273
274    .. member:: const struct lsquic_packout_mem_if  *ea_pmi
275    .. member:: void                                *ea_pmi_ctx
276
277        Optional set of functions to manage memory allocation for outgoing
278        packets.
279
280    .. member:: lsquic_cids_update_f                 ea_new_scids
281    .. member:: lsquic_cids_update_f                 ea_live_scids
282    .. member:: lsquic_cids_update_f                 ea_old_scids
283    .. member:: void                                *ea_cids_update_ctx
284
285        In a multi-process setup, it may be useful to observe the CID
286        lifecycle.  This optional set of callbacks makes it possible.
287
288    .. member:: const char                          *ea_alpn
289
290        The optional ALPN string is used by the client if :macro:`LSENG_HTTP`
291        is not set.
292
293.. _apiref-engine-settings:
294
295Engine Settings
296---------------
297
298Engine behavior can be controlled by several settings specified in the
299settings structure:
300
301.. type:: struct lsquic_engine_settings
302
303    .. member:: unsigned        es_versions
304
305        This is a bit mask wherein each bit corresponds to a value in
306        :type:`lsquic_version`.  Client starts negotiating with the highest
307        version and goes down.  Server supports either of the versions
308        specified here.  This setting applies to both Google and IETF QUIC.
309
310        The default value is :macro:`LSQUIC_DF_VERSIONS`.
311
312    .. member:: unsigned        es_cfcw
313
314       Initial default connection flow control window.
315
316       In server mode, per-connection values may be set lower than
317       this if resources are scarce.
318
319       Do not set es_cfcw and es_sfcw lower than :macro:`LSQUIC_MIN_FCW`.
320
321    .. member:: unsigned        es_sfcw
322
323       Initial default stream flow control window.
324
325       In server mode, per-connection values may be set lower than
326       this if resources are scarce.
327
328       Do not set es_cfcw and es_sfcw lower than :macro:`LSQUIC_MIN_FCW`.
329
330    .. member:: unsigned        es_max_cfcw
331
332       This value is used to specify maximum allowed value CFCW is allowed
333       to reach due to window auto-tuning.  By default, this value is zero,
334       which means that CFCW is not allowed to increase from its initial
335       value.
336
337       This setting is applicable to both gQUIC and IETF QUIC.
338
339       See :member:`lsquic_engine_settings.es_cfcw`,
340       :member:`lsquic_engine_settings.es_init_max_data`.
341
342    .. member:: unsigned        es_max_sfcw
343
344       This value is used to specify the maximum value stream flow control
345       window is allowed to reach due to auto-tuning.  By default, this
346       value is zero, meaning that auto-tuning is turned off.
347
348       This setting is applicable to both gQUIC and IETF QUIC.
349
350       See :member:`lsquic_engine_settings.es_sfcw`,
351       :member:`lsquic_engine_settings.es_init_max_stream_data_bidi_local`,
352       :member:`lsquic_engine_settings.es_init_max_stream_data_bidi_remote`.
353
354    .. member:: unsigned        es_max_streams_in
355
356        Maximum incoming streams, a.k.a. MIDS.
357
358        Google QUIC only.
359
360    .. member:: unsigned long   es_handshake_to
361
362       Handshake timeout in microseconds.
363
364       For client, this can be set to an arbitrary value (zero turns the
365       timeout off).
366
367       For server, this value is limited to about 16 seconds.  Do not set
368       it to zero.
369
370       Defaults to :macro:`LSQUIC_DF_HANDSHAKE_TO`.
371
372    .. member:: unsigned long   es_idle_conn_to
373
374        Idle connection timeout, a.k.a ICSL, in microseconds; GQUIC only.
375
376        Defaults to :macro:`LSQUIC_DF_IDLE_CONN_TO`
377
378    .. member:: int             es_silent_close
379
380        When true, ``CONNECTION_CLOSE`` is not sent when connection times out.
381        The server will also not send a reply to client's ``CONNECTION_CLOSE``.
382
383        Corresponds to SCLS (silent close) gQUIC option.
384
385    .. member:: unsigned        es_max_header_list_size
386
387       This corresponds to SETTINGS_MAX_HEADER_LIST_SIZE
388       (:rfc:`7540#section-6.5.2`).  0 means no limit.  Defaults
389       to :func:`LSQUIC_DF_MAX_HEADER_LIST_SIZE`.
390
391    .. member:: const char     *es_ua
392
393        UAID -- User-Agent ID.  Defaults to :macro:`LSQUIC_DF_UA`.
394
395        Google QUIC only.
396
397
398       More parameters for server
399
400    .. member:: unsigned        es_max_inchoate
401
402        Maximum number of incoming connections in inchoate state.  (In
403        other words, maximum number of mini connections.)
404
405        This is only applicable in server mode.
406
407        Defaults to :macro:`LSQUIC_DF_MAX_INCHOATE`.
408
409    .. member:: int             es_support_push
410
411       Setting this value to 0 means that
412
413       For client:
414
415       1. we send a SETTINGS frame to indicate that we do not support server
416          push; and
417       2. all incoming pushed streams get reset immediately.
418
419       (For maximum effect, set es_max_streams_in to 0.)
420
421       For server:
422
423       1. :func:`lsquic_conn_push_stream()` will return -1.
424
425    .. member:: int             es_support_tcid0
426
427       If set to true value, the server will not include connection ID in
428       outgoing packets if client's CHLO specifies TCID=0.
429
430       For client, this means including TCID=0 into CHLO message.  Note that
431       in this case, the engine tracks connections by the
432       (source-addr, dest-addr) tuple, thereby making it necessary to create
433       a socket for each connection.
434
435       This option has no effect in Q046 and Q050, as the server never includes
436       CIDs in the short packets.
437
438       This setting is applicable to gQUIC only.
439
440       The default is :func:`LSQUIC_DF_SUPPORT_TCID0`.
441
442    .. member:: int             es_support_nstp
443
444       Q037 and higher support "No STOP_WAITING frame" mode.  When set, the
445       client will send NSTP option in its Client Hello message and will not
446       sent STOP_WAITING frames, while ignoring incoming STOP_WAITING frames,
447       if any.  Note that if the version negotiation happens to downgrade the
448       client below Q037, this mode will *not* be used.
449
450       This option does not affect the server, as it must support NSTP mode
451       if it was specified by the client.
452
453        Defaults to :macro:`LSQUIC_DF_SUPPORT_NSTP`.
454
455    .. member:: int             es_honor_prst
456
457       If set to true value, the library will drop connections when it
458       receives corresponding Public Reset packet.  The default is to
459       ignore these packets.
460
461       The default is :macro:`LSQUIC_DF_HONOR_PRST`.
462
463    .. member:: int             es_send_prst
464
465       If set to true value, the library will send Public Reset packets
466       in response to incoming packets with unknown Connection IDs.
467
468       The default is :macro:`LSQUIC_DF_SEND_PRST`.
469
470    .. member:: unsigned        es_progress_check
471
472       A non-zero value enables internal checks that identify suspected
473       infinite loops in user `on_read` and `on_write` callbacks
474       and break them.  An infinite loop may occur if user code keeps
475       on performing the same operation without checking status, e.g.
476       reading from a closed stream etc.
477
478       The value of this parameter is as follows: should a callback return
479       this number of times in a row without making progress (that is,
480       reading, writing, or changing stream state), loop break will occur.
481
482       The defaut value is :macro:`LSQUIC_DF_PROGRESS_CHECK`.
483
484    .. member:: int             es_rw_once
485
486       A non-zero value make stream dispatch its read-write events once
487       per call.
488
489       When zero, read and write events are dispatched until the stream
490       is no longer readable or writeable, respectively, or until the
491       user signals unwillingness to read or write using
492       :func:`lsquic_stream_wantread()` or :func:`lsquic_stream_wantwrite()`
493       or shuts down the stream.
494
495       The default value is :macro:`LSQUIC_DF_RW_ONCE`.
496
497    .. member:: unsigned        es_proc_time_thresh
498
499       If set, this value specifies the number of microseconds that
500       :func:`lsquic_engine_process_conns()` and
501       :func:`lsquic_engine_send_unsent_packets()` are allowed to spend
502       before returning.
503
504       This is not an exact science and the connections must make
505       progress, so the deadline is checked after all connections get
506       a chance to tick (in the case of :func:`lsquic_engine_process_conns())`
507       and at least one batch of packets is sent out.
508
509       When processing function runs out of its time slice, immediate
510       calls to :func:`lsquic_engine_has_unsent_packets()` return false.
511
512       The default value is :func:`LSQUIC_DF_PROC_TIME_THRESH`.
513
514    .. member:: int             es_pace_packets
515
516       If set to true, packet pacing is implemented per connection.
517
518       The default value is :func:`LSQUIC_DF_PACE_PACKETS`.
519
520    .. member:: unsigned        es_clock_granularity
521
522       Clock granularity information is used by the pacer.  The value
523       is in microseconds; default is :func:`LSQUIC_DF_CLOCK_GRANULARITY`.
524
525    .. member:: unsigned        es_init_max_data
526
527       Initial max data.
528
529       This is a transport parameter.
530
531       Depending on the engine mode, the default value is either
532       :macro:`LSQUIC_DF_INIT_MAX_DATA_CLIENT` or
533       :macro:`LSQUIC_DF_INIT_MAX_DATA_SERVER`.
534
535       IETF QUIC only.
536
537    .. member:: unsigned        es_init_max_stream_data_bidi_remote
538
539       Initial max stream data.
540
541       This is a transport parameter.
542
543       Depending on the engine mode, the default value is either
544       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_REMOTE_CLIENT` or
545       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_REMOTE_SERVER`.
546
547       IETF QUIC only.
548
549    .. member:: unsigned        es_init_max_stream_data_bidi_local
550
551       Initial max stream data.
552
553       This is a transport parameter.
554
555       Depending on the engine mode, the default value is either
556       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_LOCAL_CLIENT` or
557       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_LOCAL_SERVER`.
558
559       IETF QUIC only.
560
561    .. member:: unsigned        es_init_max_stream_data_uni
562
563       Initial max stream data for unidirectional streams initiated
564       by remote endpoint.
565
566       This is a transport parameter.
567
568       Depending on the engine mode, the default value is either
569       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_UNI_CLIENT` or
570       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_UNI_SERVER`.
571
572       IETF QUIC only.
573
574    .. member:: unsigned        es_init_max_streams_bidi
575
576       Maximum initial number of bidirectional stream.
577
578       This is a transport parameter.
579
580       Default value is :macro:`LSQUIC_DF_INIT_MAX_STREAMS_BIDI`.
581
582       IETF QUIC only.
583
584    .. member:: unsigned        es_init_max_streams_uni
585
586       Maximum initial number of unidirectional stream.
587
588       This is a transport parameter.
589
590       Default value is :macro:`LSQUIC_DF_INIT_MAX_STREAMS_UNI_CLIENT` or
591       :macro:`LSQUIC_DF_INIT_MAX_STREAM_DATA_UNI_SERVER`.
592
593       IETF QUIC only.
594
595    .. member:: unsigned        es_idle_timeout
596
597       Idle connection timeout.
598
599       This is a transport parameter.
600
601       (Note: `es_idle_conn_to` is not reused because it is in microseconds,
602       which, I now realize, was not a good choice.  Since it will be
603       obsoleted some time after the switchover to IETF QUIC, we do not
604       have to keep on using strange units.)
605
606       Default value is :macro:`LSQUIC_DF_IDLE_TIMEOUT`.
607
608       Maximum value is 600 seconds.
609
610       IETF QUIC only.
611
612    .. member:: unsigned        es_ping_period
613
614       Ping period.  If set to non-zero value, the connection will generate and
615       send PING frames in the absence of other activity.
616
617       By default, the server does not send PINGs and the period is set to zero.
618       The client's defaut value is :macro:`LSQUIC_DF_PING_PERIOD`.
619
620       IETF QUIC only.
621
622    .. member:: unsigned        es_scid_len
623
624       Source Connection ID length.  Valid values are 0 through 20, inclusive.
625
626       Default value is :macro:`LSQUIC_DF_SCID_LEN`.
627
628       IETF QUIC only.
629
630    .. member:: unsigned        es_scid_iss_rate
631
632       Source Connection ID issuance rate.  This field is measured in CIDs
633       per minute.  Using value 0 indicates that there is no rate limit for
634       CID issuance.
635
636       Default value is :macro:`LSQUIC_DF_SCID_ISS_RATE`.
637
638       IETF QUIC only.
639
640    .. member:: unsigned        es_qpack_dec_max_size
641
642       Maximum size of the QPACK dynamic table that the QPACK decoder will
643       use.
644
645       The default is :macro:`LSQUIC_DF_QPACK_DEC_MAX_SIZE`.
646
647       IETF QUIC only.
648
649    .. member:: unsigned        es_qpack_dec_max_blocked
650
651       Maximum number of blocked streams that the QPACK decoder is willing
652       to tolerate.
653
654       The default is :macro:`LSQUIC_DF_QPACK_DEC_MAX_BLOCKED`.
655
656       IETF QUIC only.
657
658    .. member:: unsigned        es_qpack_enc_max_size
659
660       Maximum size of the dynamic table that the encoder is willing to use.
661       The actual size of the dynamic table will not exceed the minimum of
662       this value and the value advertized by peer.
663
664       The default is :macro:`LSQUIC_DF_QPACK_ENC_MAX_SIZE`.
665
666       IETF QUIC only.
667
668    .. member:: unsigned        es_qpack_enc_max_blocked
669
670       Maximum number of blocked streams that the QPACK encoder is willing
671       to risk.  The actual number of blocked streams will not exceed the
672       minimum of this value and the value advertized by peer.
673
674       The default is :macro:`LSQUIC_DF_QPACK_ENC_MAX_BLOCKED`.
675
676       IETF QUIC only.
677
678    .. member:: int             es_ecn
679
680       Enable ECN support.
681
682       The default is :macro:`LSQUIC_DF_ECN`
683
684       IETF QUIC only.
685
686    .. member:: int             es_allow_migration
687
688       Allow peer to migrate connection.
689
690       The default is :macro:`LSQUIC_DF_ALLOW_MIGRATION`
691
692       IETF QUIC only.
693
694    .. member:: unsigned        es_cc_algo
695
696       Congestion control algorithm to use.
697
698       - 0:  Use default (:macro:`LSQUIC_DF_CC_ALGO)`
699       - 1:  Cubic
700       - 2:  BBR
701
702       IETF QUIC only.
703
704    .. member:: int             es_ql_bits
705
706       Use QL loss bits.  Allowed values are:
707
708       - 0:  Do not use loss bits
709       - 1:  Allow loss bits
710       - 2:  Allow and send loss bits
711
712       Default value is :macro:`LSQUIC_DF_QL_BITS`
713
714    .. member:: int             es_spin
715
716       Enable spin bit.  Allowed values are 0 and 1.
717
718       Default value is :macro:`LSQUIC_DF_SPIN`
719
720    .. member:: int             es_delayed_acks
721
722       Enable delayed ACKs extension.  Allowed values are 0 and 1.
723
724       **Warning**: this is an experimental feature.  Using it will most likely
725       lead to degraded performance.
726
727       Default value is :macro:`LSQUIC_DF_DELAYED_ACKS`
728
729    .. member:: int             es_timestamps
730
731       Enable timestamps extension.  Allowed values are 0 and 1.
732
733       Default value is @ref LSQUIC_DF_TIMESTAMPS
734
735    .. member:: unsigned short  es_max_udp_payload_size_rx
736
737       Maximum packet size we are willing to receive.  This is sent to
738       peer in transport parameters: the library does not enforce this
739       limit for incoming packets.
740
741       If set to zero, limit is not set.
742
743       Default value is :macro:`LSQUIC_DF_MAX_UDP_PAYLOAD_SIZE_RX`
744
745    .. member:: int es_dplpmtud
746
747       If set to true value, enable DPLPMTUD -- Datagram Packetization
748       Layer Path MTU Discovery.
749
750       Default value is :macro:`LSQUIC_DF_DPLPMTUD`
751
752    .. member:: unsigned short  es_base_plpmtu
753
754        PLPMTU size expected to work for most paths.
755
756        If set to zero, this value is calculated based on QUIC and IP versions.
757
758        Default value is :macro:`LSQUIC_DF_BASE_PLPMTU`
759
760    .. member:: unsigned short  es_max_plpmtu
761
762        Largest PLPMTU size the engine will try.
763
764        If set to zero, picking this value is left to the engine.
765
766        Default value is :macro:`LSQUIC_DF_MAX_PLPMTU`
767
768    .. member:: unsigned        es_mtu_probe_timer
769
770        This value specifies how long the DPLPMTUD probe timer is, in
771        milliseconds.  `[draft-ietf-tsvwg-datagram-plpmtud-22] <https://tools.ietf.org/html/draft-ietf-tsvwg-datagram-plpmtud-22>`_ says:
772
773            PROBE_TIMER:  The PROBE_TIMER is configured to expire after a period
774            longer than the maximum time to receive an acknowledgment to a
775            probe packet.  This value MUST NOT be smaller than 1 second, and
776            SHOULD be larger than 15 seconds.  Guidance on selection of the
777            timer value are provided in section 3.1.1 of the UDP Usage
778            Guidelines :rfc:`8085#section-3.1`.
779
780        If set to zero, the default is used.
781
782        Default value is :macro:`LSQUIC_DF_MTU_PROBE_TIMER`
783
784    .. member:: unsigned        es_noprogress_timeout
785
786       No progress timeout.
787
788       If connection does not make progress for this number of seconds, the
789       connection is dropped.  Here, progress is defined as user streams
790       being written to or read from.
791
792       If this value is zero, this timeout is disabled.
793
794       Default value is :macro:`LSQUIC_DF_NOPROGRESS_TIMEOUT_SERVER` in server
795       mode and :macro:`LSQUIC_DF_NOPROGRESS_TIMEOUT_CLIENT` in client mode.
796
797    .. member:: int             es_grease_quic_bit
798
799       Enable the "QUIC bit grease" extension.  When set to a true value,
800       lsquic will grease the QUIC bit on the outgoing QUIC packets if
801       the peer sent the "grease_quic_bit" transport parameter.
802
803       Default value is :macro:`LSQUIC_DF_GREASE_QUIC_BIT`
804
805To initialize the settings structure to library defaults, use the following
806convenience function:
807
808.. function:: lsquic_engine_init_settings (struct lsquic_engine_settings *, unsigned flags)
809
810    ``flags`` is a bitmask of ``LSENG_SERVER`` and ``LSENG_HTTP``
811
812After doing this, change just the settings you'd like.  To check whether
813the values are correct, another convenience function is provided:
814
815.. function:: lsquic_engine_check_settings (const struct lsquic_engine_settings *, unsigned flags, char *err_buf, size_t err_buf_sz)
816
817    Check settings for errors.  Return 0 if settings are OK, -1 otherwise.
818
819    If `err_buf` and `err_buf_sz` are set, an error string is written to the
820    buffers.
821
822The following macros in :file:`lsquic.h` specify default values:
823
824*Note that, despite our best efforts, documentation may accidentally get
825out of date.  Please check your :file:`lsquic.h` for actual values.*
826
827.. macro::      LSQUIC_MIN_FCW
828
829    Minimum flow control window is set to 16 KB for both client and server.
830    This means we can send up to this amount of data before handshake gets
831    completed.
832
833.. macro:: LSQUIC_DF_VERSIONS
834
835    By default, deprecated and experimental versions are not included.
836
837.. macro:: LSQUIC_DF_CFCW_SERVER
838.. macro:: LSQUIC_DF_CFCW_CLIENT
839.. macro:: LSQUIC_DF_SFCW_SERVER
840.. macro:: LSQUIC_DF_SFCW_CLIENT
841.. macro:: LSQUIC_DF_MAX_STREAMS_IN
842
843.. macro:: LSQUIC_DF_INIT_MAX_DATA_SERVER
844.. macro:: LSQUIC_DF_INIT_MAX_DATA_CLIENT
845.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_REMOTE_SERVER
846.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_LOCAL_SERVER
847.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_REMOTE_CLIENT
848.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_BIDI_LOCAL_CLIENT
849.. macro:: LSQUIC_DF_INIT_MAX_STREAMS_BIDI
850.. macro:: LSQUIC_DF_INIT_MAX_STREAMS_UNI_CLIENT
851.. macro:: LSQUIC_DF_INIT_MAX_STREAMS_UNI_SERVER
852.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_UNI_CLIENT
853.. macro:: LSQUIC_DF_INIT_MAX_STREAM_DATA_UNI_SERVER
854
855.. macro:: LSQUIC_DF_IDLE_TIMEOUT
856
857    Default idle connection timeout is 30 seconds.
858
859.. macro:: LSQUIC_DF_PING_PERIOD
860
861    Default ping period is 15 seconds.
862
863.. macro:: LSQUIC_DF_HANDSHAKE_TO
864
865    Default handshake timeout is 10,000,000 microseconds (10 seconds).
866
867.. macro:: LSQUIC_DF_IDLE_CONN_TO
868
869    Default idle connection timeout is 30,000,000 microseconds.
870
871.. macro:: LSQUIC_DF_SILENT_CLOSE
872
873    By default, connections are closed silenty when they time out (no
874    ``CONNECTION_CLOSE`` frame is sent) and the server does not reply with
875    own ``CONNECTION_CLOSE`` after it receives one.
876
877.. macro:: LSQUIC_DF_MAX_HEADER_LIST_SIZE
878
879    Default value of maximum header list size.  If set to non-zero value,
880    SETTINGS_MAX_HEADER_LIST_SIZE will be sent to peer after handshake is
881    completed (assuming the peer supports this setting frame type).
882
883.. macro:: LSQUIC_DF_UA
884
885    Default value of UAID (user-agent ID).
886
887.. macro:: LSQUIC_DF_MAX_INCHOATE
888
889    Default is 1,000,000.
890
891.. macro:: LSQUIC_DF_SUPPORT_NSTP
892
893    NSTP is not used by default.
894
895.. macro:: LSQUIC_DF_SUPPORT_PUSH
896
897    Push promises are supported by default.
898
899.. macro:: LSQUIC_DF_SUPPORT_TCID0
900
901    Support for TCID=0 is enabled by default.
902
903.. macro:: LSQUIC_DF_HONOR_PRST
904
905    By default, LSQUIC ignores Public Reset packets.
906
907.. macro:: LSQUIC_DF_SEND_PRST
908
909    By default, LSQUIC will not send Public Reset packets in response to
910    packets that specify unknown connections.
911
912.. macro:: LSQUIC_DF_PROGRESS_CHECK
913
914    By default, infinite loop checks are turned on.
915
916.. macro:: LSQUIC_DF_RW_ONCE
917
918    By default, read/write events are dispatched in a loop.
919
920.. macro:: LSQUIC_DF_PROC_TIME_THRESH
921
922    By default, the threshold is not enabled.
923
924.. macro:: LSQUIC_DF_PACE_PACKETS
925
926    By default, packets are paced
927
928.. macro:: LSQUIC_DF_CLOCK_GRANULARITY
929
930    Default clock granularity is 1000 microseconds.
931
932.. macro:: LSQUIC_DF_SCID_LEN
933
934    The default value is 8 for simplicity and speed.
935
936.. macro:: LSQUIC_DF_SCID_ISS_RATE
937
938    The default value is 60 CIDs per minute.
939
940.. macro:: LSQUIC_DF_QPACK_DEC_MAX_BLOCKED
941
942    Default value is 100.
943
944.. macro:: LSQUIC_DF_QPACK_DEC_MAX_SIZE
945
946    Default value is 4,096 bytes.
947
948.. macro:: LSQUIC_DF_QPACK_ENC_MAX_BLOCKED
949
950    Default value is 100.
951
952.. macro:: LSQUIC_DF_QPACK_ENC_MAX_SIZE
953
954    Default value is 4,096 bytes.
955
956.. macro:: LSQUIC_DF_ECN
957
958    ECN is disabled by default.
959
960.. macro:: LSQUIC_DF_ALLOW_MIGRATION
961
962    Allow migration by default.
963
964.. macro:: LSQUIC_DF_QL_BITS
965
966    Use QL loss bits by default.
967
968.. macro:: LSQUIC_DF_SPIN
969
970    Turn spin bit on by default.
971
972.. macro:: LSQUIC_DF_CC_ALGO
973
974    Use Cubic by default.
975
976.. macro:: LSQUIC_DF_DELAYED_ACKS
977
978    Delayed ACKs are off by default.
979
980.. macro:: LSQUIC_DF_MAX_UDP_PAYLOAD_SIZE_RX
981
982    By default, incoming packet size is not limited.
983
984.. macro:: LSQUIC_DF_DPLPMTUD
985
986    By default, DPLPMTUD is enabled
987
988.. macro:: LSQUIC_DF_BASE_PLPMTU
989
990    By default, this value is left up to the engine.
991
992.. macro:: LSQUIC_DF_MAX_PLPMTU
993
994    By default, this value is left up to the engine.
995
996.. macro:: LSQUIC_DF_MTU_PROBE_TIMER
997
998    By default, we use the minimum timer of 1000 milliseconds.
999
1000.. macro:: LSQUIC_DF_NOPROGRESS_TIMEOUT_SERVER
1001
1002    By default, drop no-progress connections after 60 seconds on the server.
1003
1004.. macro:: LSQUIC_DF_NOPROGRESS_TIMEOUT_CLIENT
1005
1006    By default, do not use no-progress timeout on the client.
1007
1008.. macro:: LSQUIC_DF_GREASE_QUIC_BIT
1009
1010    By default, greasing the QUIC bit is enabled (if peer sent
1011    the "grease_quic_bit" transport parameter).
1012
1013Receiving Packets
1014-----------------
1015
1016Incoming packets are supplied to the engine using :func:`lsquic_engine_packet_in()`.
1017It is up to the engine to decide what do to with the packet.  It can find an existing
1018connection and dispatch the packet there, create a new connection (in server mode), or
1019schedule a version negotiation or stateless reset packet.
1020
1021.. function:: int lsquic_engine_packet_in (lsquic_engine_t *engine, const unsigned char *data, size_t size, const struct sockaddr *local, const struct sockaddr *peer, void *peer_ctx, int ecn)
1022
1023    Pass incoming packet to the QUIC engine.  This function can be called
1024    more than once in a row.  After you add one or more packets, call
1025    :func:`lsquic_engine_process_conns()` to schedule outgoing packets, if any.
1026
1027    :param engine: Engine instance.
1028    :param data: Pointer to UDP datagram payload.
1029    :param size: Size of UDP datagram.
1030    :param local: Local address.
1031    :param peer: Peer address.
1032    :param peer_ctx: Peer context.
1033    :param ecn: ECN marking associated with this UDP datagram.
1034
1035    :return:
1036
1037        - ``0``: Packet was processed by a real connection.
1038        - ``1``: Packet was handled successfully, but not by a connection.
1039          This may happen with version negotiation and public reset
1040          packets as well as some packets that may be ignored.
1041        - ``-1``: Some error occurred.  Possible reasons are invalid packet
1042          size or failure to allocate memory.
1043
1044.. function:: int lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
1045
1046    Returns true if there are connections to be processed, false otherwise.
1047
1048    :param engine:
1049
1050        Engine instance.
1051
1052    :param diff:
1053
1054        If the function returns a true value, the pointed to integer is set to the
1055        difference between the earliest advisory tick time and now.
1056        If the former is in the past, this difference is negative.
1057
1058    :return:
1059
1060        True if there are connections to be processed, false otherwise.
1061
1062Sending Packets
1063---------------
1064
1065User specifies a callback :type:`lsquic_packets_out_f` in :type:`lsquic_engine_api`
1066that the library uses to send packets.
1067
1068.. type:: struct lsquic_out_spec
1069
1070    This structure describes an outgoing packet.
1071
1072    .. member:: struct iovec          *iov
1073
1074        A vector with payload.
1075
1076    .. member:: size_t                 iovlen
1077
1078        Vector length.
1079
1080    .. member:: const struct sockaddr *local_sa
1081
1082        Local address.
1083
1084    .. member:: const struct sockaddr *dest_sa
1085
1086        Destination address.
1087
1088    .. member:: void                  *peer_ctx
1089
1090        Peer context associated with the local address.
1091
1092    .. member:: int                    ecn
1093
1094        ECN: Valid values are 0 - 3. See :rfc:`3168`.
1095
1096        ECN may be set by IETF QUIC connections if ``es_ecn`` is set.
1097
1098.. type:: typedef int (*lsquic_packets_out_f)(void *packets_out_ctx, const struct lsquic_out_spec  *out_spec, unsigned n_packets_out)
1099
1100    Returns number of packets successfully sent out or -1 on error.  -1 should
1101    only be returned if no packets were sent out.  If -1 is returned or if the
1102    return value is smaller than ``n_packets_out``, this indicates that sending
1103    of packets is not possible.
1104
1105    If not all packets could be sent out, then:
1106
1107        - errno is examined.  If it is not EAGAIN or EWOULDBLOCK, the connection
1108          whose packet caused the error is closed forthwith.
1109        - No packets are attempted to be sent out until :func:`lsquic_engine_send_unsent_packets()`
1110          is called.
1111
1112.. function:: void lsquic_engine_process_conns (lsquic_engine_t *engine)
1113
1114    Process tickable connections.  This function must be called often enough so
1115    that packets and connections do not expire.  The preferred method of doing
1116    so is by using :func:`lsquic_engine_earliest_adv_tick()`.
1117
1118.. function:: int lsquic_engine_has_unsent_packets (lsquic_engine_t *engine)
1119
1120    Returns true if engine has some unsent packets.  This happens if
1121    :member:`lsquic_engine_api.ea_packets_out` could not send everything out
1122    or if processing deadline was exceeded (see
1123    :member:`lsquic_engine_settings.es_proc_time_thresh`).
1124
1125.. function:: void lsquic_engine_send_unsent_packets (lsquic_engine_t *engine)
1126
1127    Send out as many unsent packets as possibe: until we are out of unsent
1128    packets or until ``ea_packets_out()`` fails.
1129
1130    If ``ea_packets_out()`` cannot send all packets, this function must be
1131    called to signify that sending of packets is possible again.
1132
1133Stream Callback Interface
1134-------------------------
1135
1136The stream callback interface structure lists the callbacks used by
1137the engine to communicate with the user code:
1138
1139.. type:: struct lsquic_stream_if
1140
1141    .. member:: lsquic_conn_ctx_t *(*on_new_conn)(void *stream_if_ctx, lsquic_conn_t *)
1142
1143        Called when a new connection has been created.  In server mode,
1144        this means that the handshake has been successful.  In client mode,
1145        on the other hand, this callback is called as soon as connection
1146        object is created inside the engine, but before the handshake is
1147        done.
1148
1149        The return value is the connection context associated with this
1150        connection.  Use :func:`lsquic_conn_get_ctx()` to get back this
1151        context.  It is OK for this function to return NULL.
1152
1153        This callback is mandatory.
1154
1155    .. member:: void (*on_conn_closed)(lsquic_conn_t *)
1156
1157        Connection is closed.
1158
1159        This callback is mandatory.
1160
1161    .. member:: lsquic_stream_ctx_t * (*on_new_stream)(void *stream_if_ctx, lsquic_stream_t *)
1162
1163        If you need to initiate a connection, call lsquic_conn_make_stream().
1164        This will cause `on_new_stream` callback to be called when appropriate
1165        (this operation is delayed when maximum number of outgoing streams is
1166        reached).
1167
1168        If connection is going away, this callback may be called with the
1169        second parameter set to NULL.
1170
1171        The return value is the stream context associated with the stream.
1172        A pointer to it is passed to `on_read()`, `on_write()`, and `on_close()`
1173        callbacks.  It is OK for this function to return NULL.
1174
1175        This callback is mandatory.
1176
1177    .. member:: void (*on_read)     (lsquic_stream_t *s, lsquic_stream_ctx_t *h)
1178
1179        Stream is readable: either there are bytes to be read or an error
1180        is ready to be collected.
1181
1182        This callback is mandatory.
1183
1184    .. member:: void (*on_write)    (lsquic_stream_t *s, lsquic_stream_ctx_t *h)
1185
1186        Stream is writeable.
1187
1188        This callback is mandatory.
1189
1190    .. member:: void (*on_close)    (lsquic_stream_t *s, lsquic_stream_ctx_t *h)
1191
1192        After this callback returns, the stream is no longer accessible.  This is
1193        a good time to clean up the stream context.
1194
1195        This callback is mandatory.
1196
1197    .. member:: void (*on_hsk_done)(lsquic_conn_t *c, enum lsquic_hsk_status s)
1198
1199        When handshake is completed, this callback is called.
1200
1201        This callback is optional.
1202
1203    .. member:: void (*on_goaway_received)(lsquic_conn_t *)
1204
1205        This is called when our side received GOAWAY frame.  After this,
1206        new streams should not be created.
1207
1208        This callback is optional.
1209
1210    .. member:: void (*on_new_token)(lsquic_conn_t *c, const unsigned char *token, size_t token_size)
1211
1212        When client receives a token in NEW_TOKEN frame, this callback is called.
1213
1214        This callback is optional.
1215
1216    .. member:: void (*on_sess_resume_info)(lsquic_conn_t *c, const unsigned char *, size_t)
1217
1218        This callback lets client record information needed to
1219        perform session resumption next time around.
1220
1221        This callback is optional.
1222
1223Creating Connections
1224--------------------
1225
1226In server mode, the connections are created by the library based on incoming
1227packets.  After handshake is completed, the library calls :member:`lsquic_stream_if.on_new_conn`
1228callback.
1229
1230In client mode, a new connection is created by
1231
1232.. function:: lsquic_conn_t * lsquic_engine_connect (lsquic_engine_t *engine, enum lsquic_version version, const struct sockaddr *local_sa, const struct sockaddr *peer_sa, void *peer_ctx, lsquic_conn_ctx_t *conn_ctx, const char *sni, unsigned short base_plpmtu, const unsigned char *sess_resume, size_t sess_resume_len, const unsigned char *token, size_t token_sz)
1233
1234    :param engine: Engine to use.
1235
1236    :param version:
1237
1238        To let the engine specify QUIC version, use N_LSQVER.  If session resumption
1239        information is supplied, version is picked from there instead.
1240
1241    :param local_sa:
1242
1243        Local address.
1244
1245    :param peer_sa:
1246
1247        Address of the server.
1248
1249    :param peer_ctx:
1250
1251        Context associated with the peer.  This is what gets passed to TODO.
1252
1253    :param conn_ctx:
1254
1255        Connection context can be set early using this parameter.  Useful if
1256        you need the connection context to be available in `on_conn_new()`.
1257        Note that that callback's return value replaces the connection
1258        context set here.
1259
1260    :param sni:
1261
1262        The SNI is required for Google QUIC connections; it is optional for
1263        IETF QUIC and may be set to NULL.
1264
1265    :param base_plpmtu:
1266
1267        Base PLPMTU.  If set to zero, it is selected based on the
1268        engine settings (see
1269        :member:`lsquic_engine_settings.es_base_plpmtu`),
1270        QUIC version, and IP version.
1271
1272    :param sess_resume:
1273
1274        Pointer to previously saved session resumption data needed for
1275        TLS resumption.  May be NULL.
1276
1277    :param sess_resume_len:
1278
1279        Size of session resumption data.
1280
1281    :param token:
1282
1283        Pointer to previously received token to include in the Initial
1284        packet.  Tokens are used by IETF QUIC to pre-validate client
1285        connections, potentially avoiding a retry.
1286
1287        See :member:`lsquic_stream_if.on_new_token` callback.
1288
1289        May be NULL.
1290
1291    :param token_sz:
1292
1293        Size of data pointed to by ``token``.
1294
1295Closing Connections
1296-------------------
1297
1298.. function:: void lsquic_conn_going_away (lsquic_conn_t *conn)
1299
1300    Mark connection as going away: send GOAWAY frame and do not accept
1301    any more incoming streams, nor generate streams of our own.
1302
1303    Only applicable to HTTP/3 and GQUIC connections.  Otherwise a no-op.
1304
1305.. function:: void lsquic_conn_close (lsquic_conn_t *conn)
1306
1307    This closes the connection.  :member:`lsquic_stream_if.on_conn_closed`
1308    and :member:`lsquic_stream_if.on_close` callbacks will be called.
1309
1310Creating Streams
1311----------------
1312
1313Similar to connections, streams are created by the library in server mode; they
1314correspond to requests.  In client mode, a new stream is created by
1315
1316.. function:: void lsquic_conn_make_stream (lsquic_conn_t *)
1317
1318    Create a new request stream.  This causes :member:`on_new_stream()` callback
1319    to be called.  If creating more requests is not permitted at the moment
1320    (due to number of concurrent streams limit), stream creation is registered
1321    as "pending" and the stream is created later when number of streams dips
1322    under the limit again.  Any number of pending streams can be created.
1323    Use :func:`lsquic_conn_n_pending_streams()` and
1324    :func:`lsquic_conn_cancel_pending_streams()` to manage pending streams.
1325
1326    If connection is going away, :func:`on_new_stream()` is called with the
1327    stream parameter set to NULL.
1328
1329Stream Events
1330-------------
1331
1332To register or unregister an interest in a read or write event, use the
1333following functions:
1334
1335.. function:: int lsquic_stream_wantread (lsquic_stream_t *stream, int want)
1336
1337    :param stream: Stream to read from.
1338    :param want: Boolean value indicating whether the caller wants to read
1339                 from stream.
1340    :return: Previous value of ``want`` or ``-1`` if the stream has already
1341             been closed for reading.
1342
1343    A stream becomes readable if there is was an error: for example, the
1344    peer may have reset the stream.  In this case, reading from the stream
1345    will return an error.
1346
1347.. function:: int lsquic_stream_wantwrite (lsquic_stream_t *stream, int want)
1348
1349    :param stream: Stream to write to.
1350    :param want: Boolean value indicating whether the caller wants to write
1351                 to stream.
1352    :return: Previous value of ``want`` or ``-1`` if the stream has already
1353             been closed for writing.
1354
1355Reading From Streams
1356--------------------
1357
1358.. function:: ssize_t lsquic_stream_read (lsquic_stream_t *stream, unsigned char *buf, size_t sz)
1359
1360    :param stream: Stream to read from.
1361    :param buf: Buffer to copy data to.
1362    :param sz: Size of the buffer.
1363    :return: Number of bytes read, zero if EOS has been reached, or -1 on error.
1364
1365    Read up to ``sz`` bytes from ``stream`` into buffer ``buf``.
1366
1367    ``-1`` is returned on error, in which case ``errno`` is set:
1368
1369    - ``EBADF``: The stream is closed.
1370    - ``ECONNRESET``: The stream has been reset.
1371    - ``EWOULDBLOCK``: There is no data to be read.
1372
1373.. function:: ssize_t lsquic_stream_readv (lsquic_stream_t *stream, const struct iovec *vec, int iovcnt)
1374
1375    :param stream: Stream to read from.
1376    :param vec: Array of ``iovec`` structures.
1377    :param iovcnt: Number of elements in ``vec``.
1378    :return: Number of bytes read, zero if EOS has been reached, or -1 on error.
1379
1380    Similar to :func:`lsquic_stream_read()`, but reads data into a vector.
1381
1382.. function:: ssize_t lsquic_stream_readf (lsquic_stream_t *stream, size_t (*readf)(void *ctx, const unsigned char *buf, size_t len, int fin), void *ctx)
1383
1384    :param stream: Stream to read from.
1385
1386    :param readf:
1387
1388        The callback takes four parameters:
1389
1390        - Pointer to user-supplied context;
1391        - Pointer to the data;
1392        - Data size (can be zero); and
1393        - Indicator whether the FIN follows the data.
1394
1395        The callback returns number of bytes processed.  If this number is zero
1396        or is smaller than ``len``, reading from stream stops.
1397
1398    :param ctx: Context pointer passed to ``readf``.
1399
1400    This function allows user-supplied callback to read the stream contents.
1401    It is meant to be used for zero-copy stream processing.
1402
1403    Return value and errors are same as in :func:`lsquic_stream_read()`.
1404
1405Writing To Streams
1406------------------
1407
1408.. function:: ssize_t lsquic_stream_write (lsquic_stream_t *stream, const void *buf, size_t len)
1409
1410    :param stream: Stream to write to.
1411    :param buf: Buffer to copy data from.
1412    :param len: Number of bytes to copy.
1413    :return: Number of bytes written -- which may be smaller than ``len`` -- or a negative
1414             value when an error occurs.
1415
1416    Write ``len`` bytes to the stream.  Returns number of bytes written, which
1417    may be smaller that ``len``.
1418
1419    A negative return value indicates a serious error (the library is likely
1420    to have aborted the connection because of it).
1421
1422.. function:: ssize_t lsquic_stream_writev (lsquic_stream_t *s, const struct iovec *vec, int count)
1423
1424    Like :func:`lsquic_stream_write()`, but read data from a vector.
1425
1426.. type:: struct lsquic_reader
1427
1428    Used as argument to :func:`lsquic_stream_writef()`.
1429
1430    .. member:: size_t (*lsqr_read) (void *lsqr_ctx, void *buf, size_t count)
1431
1432        :param lsqr_ctx: Pointer to user-specified context.
1433        :param buf: Memory location to write to.
1434        :param count: Size of available memory pointed to by ``buf``.
1435        :return:
1436
1437            Number of bytes written.  This is not a ``ssize_t`` because
1438            the read function is not supposed to return an error.  If an error
1439            occurs in the read function (for example, when reading from a file
1440            fails), it is supposed to deal with the error itself.
1441
1442    .. member:: size_t (*lsqr_size) (void *lsqr_ctx)
1443
1444        Return number of bytes remaining in the reader.
1445
1446    .. member:: void    *lsqr_ctx
1447
1448        Context pointer passed both to ``lsqr_read()`` and to ``lsqr_size()``.
1449
1450.. function:: ssize_t lsquic_stream_writef (lsquic_stream_t *stream, struct lsquic_reader *reader)
1451
1452    :param stream: Stream to write to.
1453    :param reader: Reader to read from.
1454    :return: Number of bytes written or -1 on error.
1455
1456    Write to stream using :type:`lsquic_reader`.  This is the most generic of
1457    the write functions -- :func:`lsquic_stream_write()` and
1458    :func:`lsquic_stream_writev()` utilize the same mechanism.
1459
1460.. function:: ssize_t lsquic_stream_pwritev (struct lsquic_stream *stream, ssize_t (*preadv)(void *user_data, const struct iovec *iov, int iovcnt), void *user_data, size_t n_to_write)
1461
1462    :param stream: Stream to write to.
1463    :param preadv: Pointer to a custom ``preadv(2)``-like function.
1464    :param user_data: Data to pass to ``preadv`` function.
1465    :param n_to_write: Number of bytes to write.
1466    :return: Number of bytes written or -1 on error.
1467
1468    Write to stream using user-supplied ``preadv()`` function.
1469    The stream allocates one or more packets and calls ``preadv()``,
1470    which then fills the array of buffers.  This is a good way to
1471    minimize the number of ``read(2)`` system calls; the user can call
1472    ``preadv(2)`` instead.
1473
1474    The number of bytes available in the ``iov`` vector passed back to
1475    the user callback may be smaller than ``n_to_write``.  The expected
1476    use pattern is to pass the number of bytes remaining in the file
1477    and keep on calling ``preadv(2)``.
1478
1479    Note that, unlike other stream-writing functions above,
1480    ``lsquic_stream_pwritev()`` does *not* buffer bytes inside the
1481    stream; it only writes to packets.  That means the caller must be
1482    prepared for this function to return 0 even inside the "on write"
1483    stream callback.  In that case, the caller should fall back to using
1484    another write function.
1485
1486    It is OK for the ``preadv`` callback to write fewer bytes that
1487    ``n_to_write``.  (This can happen if the underlying data source
1488    is truncated.)
1489
1490::
1491
1492    /*
1493     * For example, the return value of zero can be handled as follows:
1494     */
1495    nw = lsquic_stream_pwritev(stream, my_readv, some_ctx, n_to_write);
1496    if (nw == 0)
1497        nw = lsquic_stream_write(stream, rem_bytes_buf, rem_bytes_len);
1498
1499.. function:: int lsquic_stream_flush (lsquic_stream_t *stream)
1500
1501    :param stream: Stream to flush.
1502    :return: 0 on success and -1 on failure.
1503
1504    Flush any buffered data.  This triggers packetizing even a single byte
1505    into a separate frame.  Flushing a closed stream is an error.
1506
1507Closing Streams
1508---------------
1509
1510Streams can be closed for reading, writing, or both.
1511``on_close()`` callback is called at some point after a stream is closed
1512for both reading and writing,
1513
1514.. function:: int lsquic_stream_shutdown (lsquic_stream_t *stream, int how)
1515
1516    :param stream: Stream to shut down.
1517    :param how:
1518
1519        This parameter specifies what do to.  Allowed values are:
1520
1521        - 0: Stop reading.
1522        - 1: Stop writing.
1523        - 2: Stop both reading and writing.
1524
1525    :return: 0 on success or -1 on failure.
1526
1527.. function:: int lsquic_stream_close (lsquic_stream_t *stream)
1528
1529    :param stream: Stream to close.
1530    :return: 0 on success or -1 on failure.
1531
1532Sending HTTP Headers
1533--------------------
1534
1535.. type:: struct lsxpack_header
1536
1537This type is defined in _lsxpack_header.h_.  See that header file for
1538more information.
1539
1540    .. member:: char             *buf
1541
1542        the buffer for headers
1543
1544    .. member:: uint32_t          name_hash
1545
1546        hash value for name
1547
1548    .. member:: uint32_t          nameval_hash
1549
1550        hash value for name + value
1551
1552    .. member:: lsxpack_strlen_t  name_offset
1553
1554        the offset for name in the buffer
1555
1556    .. member:: lsxpack_strlen_t  name_len
1557
1558        the length of name
1559
1560    .. member:: lsxpack_strlen_t  val_offset
1561
1562        the offset for value in the buffer
1563
1564    .. member:: lsxpack_strlen_t  val_len
1565
1566        the length of value
1567
1568    .. member:: uint16_t          chain_next_idx
1569
1570        mainly for cookie value chain
1571
1572    .. member:: uint8_t           hpack_index
1573
1574        HPACK static table index
1575
1576    .. member:: uint8_t           qpack_index
1577
1578        QPACK static table index
1579
1580    .. member:: uint8_t           app_index
1581
1582        APP header index
1583
1584    .. member:: enum lsxpack_flag flags:8
1585
1586        combination of lsxpack_flag
1587
1588    .. member:: uint8_t           indexed_type
1589
1590        control to disable index or not
1591
1592    .. member:: uint8_t           dec_overhead
1593
1594        num of extra bytes written to decoded buffer
1595
1596.. type:: lsquic_http_headers_t
1597
1598    .. member::     int   count
1599
1600        Number of headers in ``headers``.
1601
1602    .. member::     struct lsxpack_header   *headers
1603
1604        Pointer to an array of HTTP headers.
1605
1606    HTTP header list structure.  Contains a list of HTTP headers.
1607
1608.. function:: int lsquic_stream_send_headers (lsquic_stream_t *stream, const lsquic_http_headers_t *headers, int eos)
1609
1610    :param stream:
1611
1612        Stream to send headers on.
1613
1614    :param headers:
1615
1616        Headers to send.
1617
1618    :param eos:
1619
1620        Boolean value to indicate whether these headers constitute the whole
1621        HTTP message.
1622
1623    :return:
1624
1625        0 on success or -1 on error.
1626
1627Receiving HTTP Headers
1628----------------------
1629
1630If ``ea_hsi_if`` is not set in :type:`lsquic_engine_api`, the library will translate
1631HPACK- and QPACK-encoded headers into HTTP/1.x-like headers and prepend them to the
1632stream.  To the stream-reading function, it will look as if a standard HTTP/1.x
1633message.
1634
1635Alternatively, you can specify header-processing set of functions and manage header
1636fields yourself.  In that case, the header set must be "read" from the stream via
1637:func:`lsquic_stream_get_hset()`.
1638
1639.. type:: struct lsquic_hset_if
1640
1641    .. member::  void * (*hsi_create_header_set)(void *hsi_ctx, lsquic_stream_t *stream, int is_push_promise)
1642
1643        :param hsi_ctx: User context.  This is the pointer specifed in ``ea_hsi_ctx``.
1644        :param stream: Stream with which the header set is associated.  May be set
1645                       to NULL in server mode.
1646        :param is_push_promise: Boolean value indicating whether this header set is
1647                                for a push promise.
1648        :return: Pointer to user-defined header set object.
1649
1650        Create a new header set.  This object is (and must be) fetched from a
1651        stream by calling :func:`lsquic_stream_get_hset()` before the stream can
1652        be read.
1653
1654    .. member:: struct lsxpack_header * (*hsi_prepare_decode)(void *hdr_set, struct lsxpack_header *hdr, size_t space)
1655
1656        Return a header set prepared for decoding.  If ``hdr`` is NULL, this
1657        means return a new structure with at least ``space`` bytes available
1658        in the decoder buffer.  On success, a newly prepared header is
1659        returned.
1660
1661        If ``hdr`` is not NULL, it means there was not enough decoder buffer
1662        and it must be increased to at least ``space`` bytes.  ``buf``, ``val_len``,
1663        and ``name_offset`` member of the ``hdr`` structure may change.  On
1664        success, the return value is the same as ``hdr``.
1665
1666        If NULL is returned, the space cannot be allocated.
1667
1668    .. member:: int (*hsi_process_header)(void *hdr_set, struct lsxpack_header *hdr)
1669
1670        Process new header.
1671
1672        :param hdr_set:
1673
1674            Header set to add the new header field to.  This is the object
1675            returned by ``hsi_create_header_set()``.
1676
1677        :param hdr:
1678
1679            The header returned by @ref ``hsi_prepare_decode()``.
1680
1681        :return:
1682
1683            Return 0 on success, a positive value if a header error occured,
1684            or a negative value on any other error.  A positive return value
1685            will result in cancellation of associated stream. A negative return
1686            value will result in connection being aborted.
1687
1688    .. member:: void                (*hsi_discard_header_set)(void *hdr_set)
1689
1690        :param hdr_set: Header set to discard.
1691
1692        Discard header set.  This is called for unclaimed header sets and
1693        header sets that had an error.
1694
1695    .. member:: enum lsquic_hsi_flag hsi_flags
1696
1697        These flags specify properties of decoded headers passed to
1698        ``hsi_process_header()``.  This is only applicable to QPACK headers;
1699        HPACK library header properties are based on compilation, not
1700        run-time, options.
1701
1702.. function:: void * lsquic_stream_get_hset (lsquic_stream_t *stream)
1703
1704    :param stream: Stream to fetch header set from.
1705
1706    :return: Header set associated with the stream.
1707
1708    Get header set associated with the stream.  The header set is created by
1709    ``hsi_create_header_set()`` callback.  After this call, the ownership of
1710    the header set is transferred to the caller.
1711
1712    This call must precede calls to :func:`lsquic_stream_read()`,
1713    :func:`lsquic_stream_readv()`, and :func:`lsquic_stream_readf()`.
1714
1715    If the optional header set interface is not specified,
1716    this function returns NULL.
1717
1718Push Promises
1719-------------
1720
1721.. function:: int lsquic_conn_push_stream (lsquic_conn_t *conn, void *hdr_set, lsquic_stream_t *stream, const lsquic_http_headers_t *headers)
1722
1723    :return:
1724
1725        - 0: Stream pushed successfully.
1726        - 1: Stream push failed because it is disabled or because we hit
1727             stream limit or connection is going away.
1728        - -1: Stream push failed because of an internal error.
1729
1730    A server may push a stream.  This call creates a new stream in reference
1731    to stream ``stream``.  It will behave as if the client made a request: it will
1732    trigger ``on_new_stream()`` event and it can be used as a regular client-initiated stream.
1733
1734    ``hdr_set`` must be set.  It is passed as-is to :func:`lsquic_stream_get_hset()`.
1735
1736.. function:: int lsquic_conn_is_push_enabled (lsquic_conn_t *conn)
1737
1738    :return: Boolean value indicating whether push promises are enabled.
1739
1740    Only makes sense in server mode: the client cannot push a stream and this
1741    function always returns false in client mode.
1742
1743.. function:: int lsquic_stream_is_pushed (const lsquic_stream_t *stream)
1744
1745    :return: Boolean value indicating whether this is a pushed stream.
1746
1747.. function:: int lsquic_stream_refuse_push (lsquic_stream_t *stream)
1748
1749    Refuse pushed stream.  Call it from ``on_new_stream()``.  No need to
1750    call :func:`lsquic_stream_close()` after this.  ``on_close()`` will be called.
1751
1752.. function:: int lsquic_stream_push_info (const lsquic_stream_t *stream, lsquic_stream_id_t *ref_stream_id, void **hdr_set)
1753
1754    Get information associated with pushed stream
1755
1756    :param ref_stream_id: Stream ID in response to which push promise was sent.
1757    :param hdr_set: Header set. This object was passed to or generated by :func:`lsquic_conn_push_stream()`.
1758
1759    :return: 0 on success and -1 if this is not a pushed stream.
1760
1761Stream Priorities
1762-----------------
1763
1764.. function:: unsigned lsquic_stream_priority (const lsquic_stream_t *stream)
1765
1766    Return current priority of the stream.
1767
1768.. function:: int lsquic_stream_set_priority (lsquic_stream_t *stream, unsigned priority)
1769
1770    Set stream priority.  Valid priority values are 1 through 256, inclusive.
1771    Lower value means higher priority.
1772
1773    :return: 0 on success of -1 on failure (this happens if priority value is invalid).
1774
1775Miscellaneous Engine Functions
1776------------------------------
1777
1778.. function:: unsigned lsquic_engine_quic_versions (const lsquic_engine_t *engine)
1779
1780    Return the list of QUIC versions (as bitmask) this engine instance supports.
1781
1782.. function:: unsigned lsquic_engine_count_attq (lsquic_engine_t *engine, int from_now)
1783
1784    Return number of connections whose advisory tick time is before current
1785    time plus ``from_now`` microseconds from now.  ``from_now`` can be negative.
1786
1787Miscellaneous Connection Functions
1788----------------------------------
1789
1790.. function:: enum lsquic_version lsquic_conn_quic_version (const lsquic_conn_t *conn)
1791
1792    Get QUIC version used by the connection.
1793
1794    If version has not yet been negotiated (can happen in client mode), ``-1`` is
1795    returned.
1796
1797.. function:: const lsquic_cid_t * lsquic_conn_id (const lsquic_conn_t *conn)
1798
1799    Get connection ID.
1800
1801.. function:: lsquic_engine_t * lsquic_conn_get_engine (lsquic_conn_t *conn)
1802
1803    Get pointer to the engine.
1804
1805.. function:: int lsquic_conn_get_sockaddr (lsquic_conn_t *conn, const struct sockaddr **local, const struct sockaddr **peer)
1806
1807    Get current (last used) addresses associated with the current path
1808    used by the connection.
1809
1810.. function:: struct stack_st_X509 * lsquic_conn_get_server_cert_chain (lsquic_conn_t *conn)
1811
1812    Get certificate chain returned by the server.  This can be used for
1813    server certificate verification.
1814
1815    The caller releases the stack using sk_X509_free().
1816
1817.. function:: lsquic_conn_ctx_t * lsquic_conn_get_ctx (const lsquic_conn_t *conn)
1818
1819    Get user-supplied context associated with the connection.
1820
1821.. function:: void lsquic_conn_set_ctx (lsquic_conn_t *conn, lsquic_conn_ctx_t *ctx)
1822
1823    Set user-supplied context associated with the connection.
1824
1825.. function:: void * lsquic_conn_get_peer_ctx (lsquic_conn_t *conn, const struct sockaddr *local_sa)
1826
1827    Get peer context associated with the connection and local address.
1828
1829.. function:: enum LSQUIC_CONN_STATUS lsquic_conn_status (lsquic_conn_t *conn, char *errbuf, size_t bufsz)
1830
1831    Get connection status.
1832
1833Miscellaneous Stream Functions
1834------------------------------
1835
1836.. function:: unsigned lsquic_conn_n_avail_streams (const lsquic_conn_t *conn)
1837
1838    Return max allowed outbound streams less current outbound streams.
1839
1840.. function:: unsigned lsquic_conn_n_pending_streams (const lsquic_conn_t *conn)
1841
1842    Return number of delayed streams currently pending.
1843
1844.. function:: unsigned lsquic_conn_cancel_pending_streams (lsquic_conn_t *, unsigned n)
1845
1846    Cancel ``n`` pending streams.  Returns new number of pending streams.
1847
1848.. function:: lsquic_conn_t * lsquic_stream_conn (const lsquic_stream_t *stream)
1849
1850    Get a pointer to the connection object.  Use it with connection functions.
1851
1852.. function:: int lsquic_stream_is_rejected (const lsquic_stream_t *stream)
1853
1854    Returns true if this stream was rejected, false otherwise.  Use this as
1855    an aid to distinguish between errors.
1856
1857Other Functions
1858---------------
1859
1860.. function:: enum lsquic_version lsquic_str2ver (const char *str, size_t len)
1861
1862    Translate string QUIC version to LSQUIC QUIC version representation.
1863
1864.. function:: enum lsquic_version lsquic_alpn2ver (const char *alpn, size_t len)
1865
1866    Translate ALPN (e.g. "h3", "h3-23", "h3-Q046") to LSQUIC enum.
1867
1868Miscellaneous Types
1869-------------------
1870
1871.. type:: struct lsquic_shared_hash_if
1872
1873    The shared hash interface is used to share data between multiple LSQUIC instances.
1874
1875    .. member:: int (*shi_insert)(void *shi_ctx, void *key, unsigned key_sz, void *data, unsigned data_sz, time_t expiry)
1876
1877        :param shi_ctx:
1878
1879            Shared memory context pointer
1880
1881        :param key:
1882
1883            Key data.
1884
1885        :param key_sz:
1886
1887            Key size.
1888
1889        :param data:
1890
1891            Pointer to the data to store.
1892
1893        :param data_sz:
1894
1895            Data size.
1896
1897        :param expiry: When this item expires.  If you want your item to never expire, set this to zero.
1898
1899        :return: 0 on success, -1 on failure.
1900
1901        If inserted successfully, ``free()`` will be called on ``data`` and ``key``
1902        pointer when the element is deleted, whether due to expiration
1903        or explicit deletion.
1904
1905    .. member:: int (*shi_delete)(void *shi_ctx, const void *key, unsigned key_sz)
1906
1907        Delete item from shared hash
1908
1909        :return: 0 on success, -1 on failure.
1910
1911    .. member:: int (*shi_lookup)(void *shi_ctx, const void *key, unsigned key_sz, void **data, unsigned *data_sz)
1912
1913        :param shi_ctx:
1914
1915            Shared memory context pointer
1916
1917        :param key:
1918
1919            Key data.
1920
1921        :param key_sz:
1922
1923            Key size.
1924
1925        :param data:
1926
1927            Pointer to set to the result.
1928
1929        :param data_sz:
1930
1931            Pointer to the data size.
1932
1933        :return:
1934
1935            - ``1``: found.
1936            - ``0``: not found.
1937            - ``-1``:  error (perhaps not enough room in ``data`` if copy was attempted).
1938
1939         The implementation may choose to copy the object into buffer pointed
1940         to by ``data``, so you should have it ready.
1941
1942.. type:: struct lsquic_packout_mem_if
1943
1944    The packet out memory interface is used by LSQUIC to get buffers to
1945    which outgoing packets will be written before they are passed to
1946    :member:`lsquic_engine_api.ea_packets_out` callback.
1947
1948    If not specified, malloc() and free() are used.
1949
1950    .. member:: void *  (*pmi_allocate) (void *pmi_ctx, void *peer_ctx, unsigned short sz, char is_ipv6)
1951
1952        Allocate buffer for sending.
1953
1954    .. member:: void    (*pmi_release)  (void *pmi_ctx, void *peer_ctx, void *buf, char is_ipv6)
1955
1956        This function is used to release the allocated buffer after it is
1957        sent via ``ea_packets_out()``.
1958
1959    .. member:: void    (*pmi_return)  (void *pmi_ctx, void *peer_ctx, void *buf, char is_ipv6)
1960
1961        If allocated buffer is not going to be sent, return it to the
1962        caller using this function.
1963
1964.. type:: typedef void (*lsquic_cids_update_f)(void *ctx, void **peer_ctx, const lsquic_cid_t *cids, unsigned n_cids)
1965
1966    :param ctx:
1967
1968        Context associated with the CID lifecycle callbacks (ea_cids_update_ctx).
1969
1970    :param peer_ctx:
1971
1972        Array of peer context pointers.
1973
1974    :param cids:
1975
1976        Array of connection IDs.
1977
1978    :param n_cids:
1979
1980        Number of elements in the peer context pointer and connection ID arrays.
1981
1982.. type:: struct lsquic_keylog_if
1983
1984    SSL keylog interface.
1985
1986    .. member:: void *    (*kli_open) (void *keylog_ctx, lsquic_conn_t *conn)
1987
1988        Return keylog handle or NULL if no key logging is desired.
1989
1990    .. member:: void      (*kli_log_line) (void *handle, const char *line)
1991
1992        Log line.  The first argument is the pointer returned by ``kli_open()``.
1993
1994    .. member:: void      (*kli_close) (void *handle)
1995
1996        Close handle.
1997
1998.. type:: enum lsquic_logger_timestamp_style
1999
2000    Enumerate timestamp styles supported by LSQUIC logger mechanism.
2001
2002    .. member:: LLTS_NONE
2003
2004        No timestamp is generated.
2005
2006    .. member:: LLTS_HHMMSSMS
2007
2008        The timestamp consists of 24 hours, minutes, seconds, and milliseconds.  Example: 13:43:46.671
2009
2010    .. member:: LLTS_YYYYMMDD_HHMMSSMS
2011
2012        Like above, plus date, e.g: 2017-03-21 13:43:46.671
2013
2014    .. member:: LLTS_CHROMELIKE
2015
2016        This is Chrome-like timestamp used by proto-quic.  The timestamp
2017        includes month, date, hours, minutes, seconds, and microseconds.
2018
2019        Example: 1223/104613.946956 (instead of 12/23 10:46:13.946956).
2020
2021        This is to facilitate reading two logs side-by-side.
2022
2023    .. member:: LLTS_HHMMSSUS
2024
2025        The timestamp consists of 24 hours, minutes, seconds, and microseconds.  Example: 13:43:46.671123
2026
2027    .. member:: LLTS_YYYYMMDD_HHMMSSUS
2028
2029        Date and time using microsecond resolution, e.g: 2017-03-21 13:43:46.671123
2030
2031.. type:: enum LSQUIC_CONN_STATUS
2032
2033    .. member:: LSCONN_ST_HSK_IN_PROGRESS
2034    .. member:: LSCONN_ST_CONNECTED
2035    .. member:: LSCONN_ST_HSK_FAILURE
2036    .. member:: LSCONN_ST_GOING_AWAY
2037    .. member:: LSCONN_ST_TIMED_OUT
2038    .. member:: LSCONN_ST_RESET
2039
2040        If es_honor_prst is not set, the connection will never get public
2041        reset packets and this flag will not be set.
2042
2043    .. member:: LSCONN_ST_USER_ABORTED
2044    .. member:: LSCONN_ST_ERROR
2045    .. member:: LSCONN_ST_CLOSED
2046    .. member:: LSCONN_ST_PEER_GOING_AWAY
2047
2048.. type:: enum lsquic_hsi_flag
2049
2050    These flags are ORed together to specify properties of
2051    :type:`lsxpack_header` passed to :member:`lsquic_hset_if.hsi_process_header`.
2052
2053    .. member:: LSQUIC_HSI_HTTP1X
2054
2055        Turn HTTP/1.x mode on or off.  In this mode, decoded name and value
2056        pair are separated by ``": "`` and ``"\r\n"`` is appended to the end
2057        of the string.  By default, this mode is off.
2058
2059    .. member:: LSQUIC_HSI_HASH_NAME
2060
2061        Include name hash into lsxpack_header.
2062
2063    .. member:: LSQUIC_HSI_HASH_NAMEVAL
2064
2065        Include nameval hash into lsxpack_header.
2066
2067Global Variables
2068----------------
2069
2070.. var:: const char *const lsquic_ver2str[N_LSQVER]
2071
2072    Convert LSQUIC version to human-readable string
2073
2074List of Log Modules
2075-------------------
2076
2077The following log modules are defined:
2078
2079- *alarmset*: Alarm processing.
2080- *bbr*: BBR congestion controller.
2081- *bw-sampler*: Bandwidth sampler (used by BBR).
2082- *cfcw*: Connection flow control window.
2083- *conn*: Connection.
2084- *crypto*: Low-level Google QUIC cryptography tracing.
2085- *cubic*: Cubic congestion controller.
2086- *di*: "Data In" handler (storing incoming data before it is read).
2087- *eng-hist*: Engine history.
2088- *engine*: Engine.
2089- *event*: Cross-module significant events.
2090- *frame-reader*: Reader of the HEADERS stream in Google QUIC.
2091- *frame-writer*: Writer of the HEADERS stream in Google QUIC.
2092- *handshake*: Handshake and packet encryption and decryption.
2093- *hcsi-reader*: Reader of the HTTP/3 control stream.
2094- *hcso-writer*: Writer of the HTTP/3 control stream.
2095- *headers*: HEADERS stream (Google QUIC).
2096- *hsk-adapter*: 
2097- *http1x*: Header conversion to HTTP/1.x.
2098- *logger*: Logger.
2099- *mini-conn*: Mini connection.
2100- *pacer*: Pacer.
2101- *parse*: Parsing.
2102- *prq*: PRQ stands for Packet Request Queue.  This logs scheduling
2103  and sending packets not associated with a connection: version
2104  negotiation and stateless resets.
2105- *purga*: CID purgatory.
2106- *qdec-hdl*: QPACK decoder stream handler.
2107- *qenc-hdl*: QPACK encoder stream handler.
2108- *qlog*: QLOG output.  At the moment, it is out of date.
2109- *qpack-dec*: QPACK decoder.
2110- *qpack-enc*: QPACK encoder.
2111- *rechist*: Receive history.
2112- *sendctl*: Send controller.
2113- *sfcw*: Stream flow control window.
2114- *spi*: Stream priority iterator.
2115- *stream*: Stream operation.
2116- *tokgen*: Token generation and validation.
2117- *trapa*: Transport parameter processing.
2118