protocol-quic 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/ext/ngtcp2/AUTHORS +44 -0
- data/ext/ngtcp2/CMakeLists.txt +431 -0
- data/ext/ngtcp2/CMakeOptions.txt +17 -0
- data/ext/ngtcp2/COPYING +22 -0
- data/ext/ngtcp2/ChangeLog +0 -0
- data/ext/ngtcp2/Makefile.am +60 -0
- data/ext/ngtcp2/NEWS +0 -0
- data/ext/ngtcp2/README +1 -0
- data/ext/ngtcp2/README.rst +258 -0
- data/ext/ngtcp2/ci/build_boringssl.sh +10 -0
- data/ext/ngtcp2/ci/build_nghttp3.sh +9 -0
- data/ext/ngtcp2/ci/build_openssl1.sh +8 -0
- data/ext/ngtcp2/ci/build_openssl1_cross.sh +9 -0
- data/ext/ngtcp2/ci/build_openssl3.sh +8 -0
- data/ext/ngtcp2/ci/build_picotls.sh +26 -0
- data/ext/ngtcp2/ci/build_wolfssl.sh +9 -0
- data/ext/ngtcp2/ci/gen-certificate.sh +8 -0
- data/ext/ngtcp2/cmake/ExtractValidFlags.cmake +31 -0
- data/ext/ngtcp2/cmake/FindCUnit.cmake +40 -0
- data/ext/ngtcp2/cmake/FindJemalloc.cmake +40 -0
- data/ext/ngtcp2/cmake/FindLibev.cmake +38 -0
- data/ext/ngtcp2/cmake/FindLibnghttp3.cmake +41 -0
- data/ext/ngtcp2/cmake/Findwolfssl.cmake +41 -0
- data/ext/ngtcp2/cmake/Version.cmake +11 -0
- data/ext/ngtcp2/cmakeconfig.h.in +36 -0
- data/ext/ngtcp2/configure.ac +755 -0
- data/ext/ngtcp2/crypto/CMakeLists.txt +56 -0
- data/ext/ngtcp2/crypto/Makefile.am +49 -0
- data/ext/ngtcp2/crypto/boringssl/CMakeLists.txt +64 -0
- data/ext/ngtcp2/crypto/boringssl/Makefile.am +39 -0
- data/ext/ngtcp2/crypto/boringssl/boringssl.c +630 -0
- data/ext/ngtcp2/crypto/boringssl/libngtcp2_crypto_boringssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/gnutls/CMakeLists.txt +86 -0
- data/ext/ngtcp2/crypto/gnutls/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/gnutls/gnutls.c +644 -0
- data/ext/ngtcp2/crypto/gnutls/libngtcp2_crypto_gnutls.pc.in +33 -0
- data/ext/ngtcp2/crypto/includes/CMakeLists.txt +56 -0
- data/ext/ngtcp2/crypto/includes/Makefile.am +45 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h +893 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_boringssl.h +104 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_gnutls.h +107 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_openssl.h +132 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_picotls.h +246 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_wolfssl.h +106 -0
- data/ext/ngtcp2/crypto/openssl/CMakeLists.txt +86 -0
- data/ext/ngtcp2/crypto/openssl/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/openssl/libngtcp2_crypto_openssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/openssl/openssl.c +807 -0
- data/ext/ngtcp2/crypto/picotls/CMakeLists.txt +65 -0
- data/ext/ngtcp2/crypto/picotls/Makefile.am +39 -0
- data/ext/ngtcp2/crypto/picotls/libngtcp2_crypto_picotls.pc.in +33 -0
- data/ext/ngtcp2/crypto/picotls/picotls.c +707 -0
- data/ext/ngtcp2/crypto/shared.c +1431 -0
- data/ext/ngtcp2/crypto/shared.h +350 -0
- data/ext/ngtcp2/crypto/wolfssl/CMakeLists.txt +84 -0
- data/ext/ngtcp2/crypto/wolfssl/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/wolfssl/libngtcp2_crypto_wolfssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/wolfssl/wolfssl.c +534 -0
- data/ext/ngtcp2/doc/Makefile.am +65 -0
- data/ext/ngtcp2/doc/make.bat +35 -0
- data/ext/ngtcp2/doc/mkapiref.py +356 -0
- data/ext/ngtcp2/doc/source/conf.py.in +94 -0
- data/ext/ngtcp2/doc/source/index.rst +22 -0
- data/ext/ngtcp2/doc/source/programmers-guide.rst +476 -0
- data/ext/ngtcp2/docker/Dockerfile +39 -0
- data/ext/ngtcp2/examples/CMakeLists.txt +361 -0
- data/ext/ngtcp2/examples/Makefile.am +228 -0
- data/ext/ngtcp2/examples/client.cc +3049 -0
- data/ext/ngtcp2/examples/client.h +192 -0
- data/ext/ngtcp2/examples/client_base.cc +202 -0
- data/ext/ngtcp2/examples/client_base.h +213 -0
- data/ext/ngtcp2/examples/debug.cc +298 -0
- data/ext/ngtcp2/examples/debug.h +124 -0
- data/ext/ngtcp2/examples/examplestest.cc +84 -0
- data/ext/ngtcp2/examples/gtlssimpleclient.c +720 -0
- data/ext/ngtcp2/examples/h09client.cc +2601 -0
- data/ext/ngtcp2/examples/h09client.h +196 -0
- data/ext/ngtcp2/examples/h09server.cc +3024 -0
- data/ext/ngtcp2/examples/h09server.h +237 -0
- data/ext/ngtcp2/examples/http.cc +138 -0
- data/ext/ngtcp2/examples/http.h +44 -0
- data/ext/ngtcp2/examples/network.h +80 -0
- data/ext/ngtcp2/examples/server.cc +3731 -0
- data/ext/ngtcp2/examples/server.h +256 -0
- data/ext/ngtcp2/examples/server_base.cc +58 -0
- data/ext/ngtcp2/examples/server_base.h +195 -0
- data/ext/ngtcp2/examples/shared.cc +385 -0
- data/ext/ngtcp2/examples/shared.h +96 -0
- data/ext/ngtcp2/examples/simpleclient.c +683 -0
- data/ext/ngtcp2/examples/template.h +71 -0
- data/ext/ngtcp2/examples/tests/README.rst +60 -0
- data/ext/ngtcp2/examples/tests/__init__.py +0 -0
- data/ext/ngtcp2/examples/tests/config.ini.in +32 -0
- data/ext/ngtcp2/examples/tests/conftest.py +28 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/__init__.py +6 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/certs.py +476 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/client.py +187 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/env.py +191 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/log.py +101 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/server.py +137 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/tls.py +983 -0
- data/ext/ngtcp2/examples/tests/test_01_handshake.py +30 -0
- data/ext/ngtcp2/examples/tests/test_02_resume.py +46 -0
- data/ext/ngtcp2/examples/tests/test_03_earlydata.py +56 -0
- data/ext/ngtcp2/examples/tests/test_04_clientcert.py +57 -0
- data/ext/ngtcp2/examples/tests/test_05_ciphers.py +46 -0
- data/ext/ngtcp2/examples/tls_client_context.h +52 -0
- data/ext/ngtcp2/examples/tls_client_context_boringssl.cc +126 -0
- data/ext/ngtcp2/examples/tls_client_context_boringssl.h +49 -0
- data/ext/ngtcp2/examples/tls_client_context_gnutls.cc +74 -0
- data/ext/ngtcp2/examples/tls_client_context_gnutls.h +50 -0
- data/ext/ngtcp2/examples/tls_client_context_openssl.cc +137 -0
- data/ext/ngtcp2/examples/tls_client_context_openssl.h +49 -0
- data/ext/ngtcp2/examples/tls_client_context_picotls.cc +158 -0
- data/ext/ngtcp2/examples/tls_client_context_picotls.h +53 -0
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.cc +177 -0
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.h +51 -0
- data/ext/ngtcp2/examples/tls_client_session.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_boringssl.cc +110 -0
- data/ext/ngtcp2/examples/tls_client_session_boringssl.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_gnutls.cc +190 -0
- data/ext/ngtcp2/examples/tls_client_session_gnutls.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_openssl.cc +113 -0
- data/ext/ngtcp2/examples/tls_client_session_openssl.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_picotls.cc +147 -0
- data/ext/ngtcp2/examples/tls_client_session_picotls.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.cc +160 -0
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.h +52 -0
- data/ext/ngtcp2/examples/tls_server_context.h +52 -0
- data/ext/ngtcp2/examples/tls_server_context_boringssl.cc +257 -0
- data/ext/ngtcp2/examples/tls_server_context_boringssl.h +54 -0
- data/ext/ngtcp2/examples/tls_server_context_gnutls.cc +99 -0
- data/ext/ngtcp2/examples/tls_server_context_gnutls.h +59 -0
- data/ext/ngtcp2/examples/tls_server_context_openssl.cc +338 -0
- data/ext/ngtcp2/examples/tls_server_context_openssl.h +54 -0
- data/ext/ngtcp2/examples/tls_server_context_picotls.cc +321 -0
- data/ext/ngtcp2/examples/tls_server_context_picotls.h +58 -0
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.cc +284 -0
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.h +55 -0
- data/ext/ngtcp2/examples/tls_server_session.h +52 -0
- data/ext/ngtcp2/examples/tls_server_session_boringssl.cc +84 -0
- data/ext/ngtcp2/examples/tls_server_session_boringssl.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_gnutls.cc +155 -0
- data/ext/ngtcp2/examples/tls_server_session_gnutls.h +46 -0
- data/ext/ngtcp2/examples/tls_server_session_openssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_server_session_openssl.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_picotls.cc +70 -0
- data/ext/ngtcp2/examples/tls_server_session_picotls.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.cc +55 -0
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.h +47 -0
- data/ext/ngtcp2/examples/tls_session_base_gnutls.cc +87 -0
- data/ext/ngtcp2/examples/tls_session_base_gnutls.h +51 -0
- data/ext/ngtcp2/examples/tls_session_base_openssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_session_base_openssl.h +52 -0
- data/ext/ngtcp2/examples/tls_session_base_picotls.cc +56 -0
- data/ext/ngtcp2/examples/tls_session_base_picotls.h +54 -0
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.h +54 -0
- data/ext/ngtcp2/examples/tls_shared_picotls.cc +59 -0
- data/ext/ngtcp2/examples/tls_shared_picotls.h +36 -0
- data/ext/ngtcp2/examples/util.cc +646 -0
- data/ext/ngtcp2/examples/util.h +361 -0
- data/ext/ngtcp2/examples/util_gnutls.cc +136 -0
- data/ext/ngtcp2/examples/util_openssl.cc +131 -0
- data/ext/ngtcp2/examples/util_test.cc +237 -0
- data/ext/ngtcp2/examples/util_test.h +45 -0
- data/ext/ngtcp2/examples/util_wolfssl.cc +130 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack_ecn +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/connection_close +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/crypto +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/data_blocked +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram_len +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_data +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_stream_data +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_streams +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_connection_id +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_token +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_challenge +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_response +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/reset_stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/retire_connection_id +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stop_sending +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_data_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_len +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/streams_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/ksl/random +0 -0
- data/ext/ngtcp2/fuzz/decode_frame.cc +25 -0
- data/ext/ngtcp2/fuzz/ksl.cc +77 -0
- data/ext/ngtcp2/interop/Dockerfile +39 -0
- data/ext/ngtcp2/interop/run_endpoint.sh +93 -0
- data/ext/ngtcp2/lib/CMakeLists.txt +110 -0
- data/ext/ngtcp2/lib/Makefile.am +122 -0
- data/ext/ngtcp2/lib/includes/CMakeLists.txt +4 -0
- data/ext/ngtcp2/lib/includes/Makefile.am +25 -0
- data/ext/ngtcp2/lib/includes/ngtcp2/ngtcp2.h +5843 -0
- data/ext/ngtcp2/lib/includes/ngtcp2/version.h.in +51 -0
- data/ext/ngtcp2/lib/libngtcp2.pc.in +33 -0
- data/ext/ngtcp2/lib/ngtcp2_acktr.c +335 -0
- data/ext/ngtcp2/lib/ngtcp2_acktr.h +221 -0
- data/ext/ngtcp2/lib/ngtcp2_addr.c +117 -0
- data/ext/ngtcp2/lib/ngtcp2_addr.h +69 -0
- data/ext/ngtcp2/lib/ngtcp2_balloc.c +90 -0
- data/ext/ngtcp2/lib/ngtcp2_balloc.h +91 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr.c +693 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr.h +157 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr2.c +1490 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr2.h +149 -0
- data/ext/ngtcp2/lib/ngtcp2_buf.c +56 -0
- data/ext/ngtcp2/lib/ngtcp2_buf.h +108 -0
- data/ext/ngtcp2/lib/ngtcp2_cc.c +616 -0
- data/ext/ngtcp2/lib/ngtcp2_cc.h +422 -0
- data/ext/ngtcp2/lib/ngtcp2_cid.c +147 -0
- data/ext/ngtcp2/lib/ngtcp2_cid.h +175 -0
- data/ext/ngtcp2/lib/ngtcp2_conn.c +13731 -0
- data/ext/ngtcp2/lib/ngtcp2_conn.h +1119 -0
- data/ext/ngtcp2/lib/ngtcp2_conn_stat.h +131 -0
- data/ext/ngtcp2/lib/ngtcp2_conv.c +291 -0
- data/ext/ngtcp2/lib/ngtcp2_conv.h +208 -0
- data/ext/ngtcp2/lib/ngtcp2_crypto.c +895 -0
- data/ext/ngtcp2/lib/ngtcp2_crypto.h +148 -0
- data/ext/ngtcp2/lib/ngtcp2_err.c +154 -0
- data/ext/ngtcp2/lib/ngtcp2_err.h +34 -0
- data/ext/ngtcp2/lib/ngtcp2_gaptr.c +167 -0
- data/ext/ngtcp2/lib/ngtcp2_gaptr.h +98 -0
- data/ext/ngtcp2/lib/ngtcp2_idtr.c +79 -0
- data/ext/ngtcp2/lib/ngtcp2_idtr.h +89 -0
- data/ext/ngtcp2/lib/ngtcp2_ksl.c +819 -0
- data/ext/ngtcp2/lib/ngtcp2_ksl.h +345 -0
- data/ext/ngtcp2/lib/ngtcp2_log.c +822 -0
- data/ext/ngtcp2/lib/ngtcp2_log.h +123 -0
- data/ext/ngtcp2/lib/ngtcp2_macro.h +58 -0
- data/ext/ngtcp2/lib/ngtcp2_map.c +336 -0
- data/ext/ngtcp2/lib/ngtcp2_map.h +136 -0
- data/ext/ngtcp2/lib/ngtcp2_mem.c +113 -0
- data/ext/ngtcp2/lib/ngtcp2_mem.h +72 -0
- data/ext/ngtcp2/lib/ngtcp2_net.h +136 -0
- data/ext/ngtcp2/lib/ngtcp2_objalloc.c +40 -0
- data/ext/ngtcp2/lib/ngtcp2_objalloc.h +140 -0
- data/ext/ngtcp2/lib/ngtcp2_opl.c +46 -0
- data/ext/ngtcp2/lib/ngtcp2_opl.h +65 -0
- data/ext/ngtcp2/lib/ngtcp2_path.c +77 -0
- data/ext/ngtcp2/lib/ngtcp2_path.h +49 -0
- data/ext/ngtcp2/lib/ngtcp2_pkt.c +2527 -0
- data/ext/ngtcp2/lib/ngtcp2_pkt.h +1235 -0
- data/ext/ngtcp2/lib/ngtcp2_pmtud.c +160 -0
- data/ext/ngtcp2/lib/ngtcp2_pmtud.h +123 -0
- data/ext/ngtcp2/lib/ngtcp2_ppe.c +230 -0
- data/ext/ngtcp2/lib/ngtcp2_ppe.h +153 -0
- data/ext/ngtcp2/lib/ngtcp2_pq.c +164 -0
- data/ext/ngtcp2/lib/ngtcp2_pq.h +126 -0
- data/ext/ngtcp2/lib/ngtcp2_pv.c +172 -0
- data/ext/ngtcp2/lib/ngtcp2_pv.h +194 -0
- data/ext/ngtcp2/lib/ngtcp2_qlog.c +1219 -0
- data/ext/ngtcp2/lib/ngtcp2_qlog.h +161 -0
- data/ext/ngtcp2/lib/ngtcp2_range.c +61 -0
- data/ext/ngtcp2/lib/ngtcp2_range.h +80 -0
- data/ext/ngtcp2/lib/ngtcp2_rcvry.h +40 -0
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.c +121 -0
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.h +132 -0
- data/ext/ngtcp2/lib/ngtcp2_rob.c +319 -0
- data/ext/ngtcp2/lib/ngtcp2_rob.h +197 -0
- data/ext/ngtcp2/lib/ngtcp2_rst.c +138 -0
- data/ext/ngtcp2/lib/ngtcp2_rst.h +86 -0
- data/ext/ngtcp2/lib/ngtcp2_rtb.c +1676 -0
- data/ext/ngtcp2/lib/ngtcp2_rtb.h +468 -0
- data/ext/ngtcp2/lib/ngtcp2_str.c +233 -0
- data/ext/ngtcp2/lib/ngtcp2_str.h +94 -0
- data/ext/ngtcp2/lib/ngtcp2_strm.c +698 -0
- data/ext/ngtcp2/lib/ngtcp2_strm.h +310 -0
- data/ext/ngtcp2/lib/ngtcp2_unreachable.c +71 -0
- data/ext/ngtcp2/lib/ngtcp2_unreachable.h +46 -0
- data/ext/ngtcp2/lib/ngtcp2_vec.c +243 -0
- data/ext/ngtcp2/lib/ngtcp2_vec.h +120 -0
- data/ext/ngtcp2/lib/ngtcp2_version.c +39 -0
- data/ext/ngtcp2/lib/ngtcp2_window_filter.c +99 -0
- data/ext/ngtcp2/lib/ngtcp2_window_filter.h +65 -0
- data/ext/ngtcp2/m4/ax_check_compile_flag.m4 +74 -0
- data/ext/ngtcp2/m4/ax_cxx_compile_stdcxx.m4 +1009 -0
- data/ext/ngtcp2/tests/CMakeLists.txt +68 -0
- data/ext/ngtcp2/tests/Makefile.am +94 -0
- data/ext/ngtcp2/tests/main.c +358 -0
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.c +367 -0
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.h +37 -0
- data/ext/ngtcp2/tests/ngtcp2_conn_test.c +9821 -0
- data/ext/ngtcp2/tests/ngtcp2_conn_test.h +104 -0
- data/ext/ngtcp2/tests/ngtcp2_conv_test.c +430 -0
- data/ext/ngtcp2/tests/ngtcp2_conv_test.h +46 -0
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.c +667 -0
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.c +127 -0
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.c +79 -0
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.h +34 -0
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.c +502 -0
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.h +39 -0
- data/ext/ngtcp2/tests/ngtcp2_map_test.c +206 -0
- data/ext/ngtcp2/tests/ngtcp2_map_test.h +38 -0
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.c +1645 -0
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.h +68 -0
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.c +153 -0
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.h +34 -0
- data/ext/ngtcp2/tests/ngtcp2_pv_test.c +129 -0
- data/ext/ngtcp2/tests/ngtcp2_pv_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_range_test.c +105 -0
- data/ext/ngtcp2/tests/ngtcp2_range_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.c +91 -0
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_rob_test.c +552 -0
- data/ext/ngtcp2/tests/ngtcp2_rob_test.h +37 -0
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.c +470 -0
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.h +38 -0
- data/ext/ngtcp2/tests/ngtcp2_str_test.c +96 -0
- data/ext/ngtcp2/tests/ngtcp2_str_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_strm_test.c +575 -0
- data/ext/ngtcp2/tests/ngtcp2_strm_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_test_helper.c +404 -0
- data/ext/ngtcp2/tests/ngtcp2_test_helper.h +191 -0
- data/ext/ngtcp2/tests/ngtcp2_vec_test.c +426 -0
- data/ext/ngtcp2/tests/ngtcp2_vec_test.h +36 -0
- data/ext/ngtcp2/third-party/CMakeLists.txt +34 -0
- data/ext/ngtcp2/third-party/Makefile.am +31 -0
- data/ext/ngtcp2/third-party/http-parser/AUTHORS +68 -0
- data/ext/ngtcp2/third-party/http-parser/LICENSE-MIT +23 -0
- data/ext/ngtcp2/third-party/http-parser/Makefile +157 -0
- data/ext/ngtcp2/third-party/http-parser/README.md +246 -0
- data/ext/ngtcp2/third-party/http-parser/bench.c +111 -0
- data/ext/ngtcp2/third-party/http-parser/contrib/parsertrace.c +160 -0
- data/ext/ngtcp2/third-party/http-parser/contrib/url_parser.c +47 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.c +2419 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.gyp +111 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.h +431 -0
- data/ext/ngtcp2/third-party/http-parser/test.c +4411 -0
- data/lib/protocol/quic/version.rb +10 -0
- data/lib/protocol/quic.rb +9 -0
- data/license.md +21 -0
- data.tar.gz.sig +1 -0
- metadata +424 -0
- metadata.gz.sig +1 -0
@@ -0,0 +1,1119 @@
|
|
1
|
+
/*
|
2
|
+
* ngtcp2
|
3
|
+
*
|
4
|
+
* Copyright (c) 2017 ngtcp2 contributors
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
* a copy of this software and associated documentation files (the
|
8
|
+
* "Software"), to deal in the Software without restriction, including
|
9
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
* the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be
|
15
|
+
* included in all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
#ifndef NGTCP2_CONN_H
|
26
|
+
#define NGTCP2_CONN_H
|
27
|
+
|
28
|
+
#ifdef HAVE_CONFIG_H
|
29
|
+
# include <config.h>
|
30
|
+
#endif /* HAVE_CONFIG_H */
|
31
|
+
|
32
|
+
#include <ngtcp2/ngtcp2.h>
|
33
|
+
|
34
|
+
#include "ngtcp2_mem.h"
|
35
|
+
#include "ngtcp2_crypto.h"
|
36
|
+
#include "ngtcp2_acktr.h"
|
37
|
+
#include "ngtcp2_rtb.h"
|
38
|
+
#include "ngtcp2_strm.h"
|
39
|
+
#include "ngtcp2_idtr.h"
|
40
|
+
#include "ngtcp2_str.h"
|
41
|
+
#include "ngtcp2_pkt.h"
|
42
|
+
#include "ngtcp2_log.h"
|
43
|
+
#include "ngtcp2_pq.h"
|
44
|
+
#include "ngtcp2_cc.h"
|
45
|
+
#include "ngtcp2_bbr.h"
|
46
|
+
#include "ngtcp2_bbr2.h"
|
47
|
+
#include "ngtcp2_pv.h"
|
48
|
+
#include "ngtcp2_pmtud.h"
|
49
|
+
#include "ngtcp2_cid.h"
|
50
|
+
#include "ngtcp2_buf.h"
|
51
|
+
#include "ngtcp2_ppe.h"
|
52
|
+
#include "ngtcp2_qlog.h"
|
53
|
+
#include "ngtcp2_rst.h"
|
54
|
+
#include "ngtcp2_conn_stat.h"
|
55
|
+
|
56
|
+
typedef enum {
|
57
|
+
/* Client specific handshake states */
|
58
|
+
NGTCP2_CS_CLIENT_INITIAL,
|
59
|
+
NGTCP2_CS_CLIENT_WAIT_HANDSHAKE,
|
60
|
+
NGTCP2_CS_CLIENT_TLS_HANDSHAKE_FAILED,
|
61
|
+
/* Server specific handshake states */
|
62
|
+
NGTCP2_CS_SERVER_INITIAL,
|
63
|
+
NGTCP2_CS_SERVER_WAIT_HANDSHAKE,
|
64
|
+
NGTCP2_CS_SERVER_TLS_HANDSHAKE_FAILED,
|
65
|
+
/* Shared by both client and server */
|
66
|
+
NGTCP2_CS_POST_HANDSHAKE,
|
67
|
+
NGTCP2_CS_CLOSING,
|
68
|
+
NGTCP2_CS_DRAINING,
|
69
|
+
} ngtcp2_conn_state;
|
70
|
+
|
71
|
+
/* NGTCP2_MAX_STREAMS is the maximum number of streams. */
|
72
|
+
#define NGTCP2_MAX_STREAMS (1LL << 60)
|
73
|
+
|
74
|
+
/* NGTCP2_MAX_NUM_BUFFED_RX_PKTS is the maximum number of buffered
|
75
|
+
reordered packets. */
|
76
|
+
#define NGTCP2_MAX_NUM_BUFFED_RX_PKTS 4
|
77
|
+
|
78
|
+
/* NGTCP2_MAX_REORDERED_CRYPTO_DATA is the maximum offset of crypto
|
79
|
+
data which is not continuous. In other words, there is a gap of
|
80
|
+
unreceived data. */
|
81
|
+
#define NGTCP2_MAX_REORDERED_CRYPTO_DATA 65536
|
82
|
+
|
83
|
+
/* NGTCP2_MAX_RX_INITIAL_CRYPTO_DATA is the maximum offset of received
|
84
|
+
crypto stream in Initial packet. We set this hard limit here
|
85
|
+
because crypto stream is unbounded. */
|
86
|
+
#define NGTCP2_MAX_RX_INITIAL_CRYPTO_DATA 65536
|
87
|
+
/* NGTCP2_MAX_RX_HANDSHAKE_CRYPTO_DATA is the maximum offset of
|
88
|
+
received crypto stream in Handshake packet. We set this hard limit
|
89
|
+
here because crypto stream is unbounded. */
|
90
|
+
#define NGTCP2_MAX_RX_HANDSHAKE_CRYPTO_DATA 65536
|
91
|
+
|
92
|
+
/* NGTCP2_MAX_RETRIES is the number of Retry packet which client can
|
93
|
+
accept. */
|
94
|
+
#define NGTCP2_MAX_RETRIES 3
|
95
|
+
|
96
|
+
/* NGTCP2_MAX_BOUND_DCID_POOL_SIZE is the maximum number of
|
97
|
+
destination connection ID which have been bound to a particular
|
98
|
+
path, but not yet used as primary path and path validation is not
|
99
|
+
performed from the local endpoint. */
|
100
|
+
#define NGTCP2_MAX_BOUND_DCID_POOL_SIZE 4
|
101
|
+
/* NGTCP2_MAX_DCID_POOL_SIZE is the maximum number of destination
|
102
|
+
connection ID the remote endpoint provides to store. It must be
|
103
|
+
the power of 2. */
|
104
|
+
#define NGTCP2_MAX_DCID_POOL_SIZE 8
|
105
|
+
/* NGTCP2_MAX_DCID_RETIRED_SIZE is the maximum number of retired DCID
|
106
|
+
kept to catch in-flight packet on retired path. */
|
107
|
+
#define NGTCP2_MAX_DCID_RETIRED_SIZE 2
|
108
|
+
/* NGTCP2_MAX_SCID_POOL_SIZE is the maximum number of source
|
109
|
+
connection ID the local endpoint provides to the remote endpoint.
|
110
|
+
The chosen value was described in old draft. Now a remote endpoint
|
111
|
+
tells the maximum value. The value can be quite large, and we have
|
112
|
+
to put the sane limit.*/
|
113
|
+
#define NGTCP2_MAX_SCID_POOL_SIZE 8
|
114
|
+
|
115
|
+
/* NGTCP2_MAX_NON_ACK_TX_PKT is the maximum number of continuous non
|
116
|
+
ACK-eliciting packets. */
|
117
|
+
#define NGTCP2_MAX_NON_ACK_TX_PKT 3
|
118
|
+
|
119
|
+
/* NGTCP2_ECN_MAX_NUM_VALIDATION_PKTS is the maximum number of ECN marked
|
120
|
+
packets sent in NGTCP2_ECN_STATE_TESTING period. */
|
121
|
+
#define NGTCP2_ECN_MAX_NUM_VALIDATION_PKTS 10
|
122
|
+
|
123
|
+
/* NGTCP2_CONNECTION_CLOSE_ERROR_MAX_REASONLEN is the maximum length
|
124
|
+
of reason phrase to remember. If the received reason phrase is
|
125
|
+
longer than this value, it is truncated. */
|
126
|
+
#define NGTCP2_CONNECTION_CLOSE_ERROR_MAX_REASONLEN 1024
|
127
|
+
|
128
|
+
/* NGTCP2_WRITE_PKT_FLAG_NONE indicates that no flag is set. */
|
129
|
+
#define NGTCP2_WRITE_PKT_FLAG_NONE 0x00u
|
130
|
+
/* NGTCP2_WRITE_PKT_FLAG_REQUIRE_PADDING indicates that packet other
|
131
|
+
than Initial packet should be padded. Initial packet might be
|
132
|
+
padded based on QUIC requirement regardless of this flag. */
|
133
|
+
#define NGTCP2_WRITE_PKT_FLAG_REQUIRE_PADDING 0x01u
|
134
|
+
/* NGTCP2_WRITE_PKT_FLAG_MORE indicates that more frames might come
|
135
|
+
and it should be encoded into the current packet. */
|
136
|
+
#define NGTCP2_WRITE_PKT_FLAG_MORE 0x02u
|
137
|
+
|
138
|
+
/*
|
139
|
+
* ngtcp2_max_frame is defined so that it covers the largest ACK
|
140
|
+
* frame.
|
141
|
+
*/
|
142
|
+
typedef union ngtcp2_max_frame {
|
143
|
+
ngtcp2_frame fr;
|
144
|
+
struct {
|
145
|
+
ngtcp2_ack ack;
|
146
|
+
/* ack includes 1 ngtcp2_ack_range. */
|
147
|
+
ngtcp2_ack_range ranges[NGTCP2_MAX_ACK_RANGES - 1];
|
148
|
+
} ackfr;
|
149
|
+
} ngtcp2_max_frame;
|
150
|
+
|
151
|
+
typedef struct ngtcp2_path_challenge_entry {
|
152
|
+
ngtcp2_path_storage ps;
|
153
|
+
uint8_t data[8];
|
154
|
+
} ngtcp2_path_challenge_entry;
|
155
|
+
|
156
|
+
void ngtcp2_path_challenge_entry_init(ngtcp2_path_challenge_entry *pcent,
|
157
|
+
const ngtcp2_path *path,
|
158
|
+
const uint8_t *data);
|
159
|
+
|
160
|
+
/* NGTCP2_CONN_FLAG_NONE indicates that no flag is set. */
|
161
|
+
#define NGTCP2_CONN_FLAG_NONE 0x00u
|
162
|
+
/* NGTCP2_CONN_FLAG_HANDSHAKE_COMPLETED is set when TLS stack declares
|
163
|
+
that TLS handshake has completed. The condition of this
|
164
|
+
declaration varies between TLS implementations and this flag does
|
165
|
+
not indicate the completion of QUIC handshake. Some
|
166
|
+
implementations declare TLS handshake completion as server when
|
167
|
+
they write off Server Finished and before deriving application rx
|
168
|
+
secret. */
|
169
|
+
#define NGTCP2_CONN_FLAG_HANDSHAKE_COMPLETED 0x01u
|
170
|
+
/* NGTCP2_CONN_FLAG_CONN_ID_NEGOTIATED is set if connection ID is
|
171
|
+
negotiated. This is only used for client. */
|
172
|
+
#define NGTCP2_CONN_FLAG_CONN_ID_NEGOTIATED 0x02u
|
173
|
+
/* NGTCP2_CONN_FLAG_TRANSPORT_PARAM_RECVED is set if transport
|
174
|
+
parameters are received. */
|
175
|
+
#define NGTCP2_CONN_FLAG_TRANSPORT_PARAM_RECVED 0x04u
|
176
|
+
/* NGTCP2_CONN_FLAG_LOCAL_TRANSPORT_PARAMS_COMMITTED is set when a
|
177
|
+
local transport parameters are applied. */
|
178
|
+
#define NGTCP2_CONN_FLAG_LOCAL_TRANSPORT_PARAMS_COMMITTED 0x08u
|
179
|
+
/* NGTCP2_CONN_FLAG_RECV_RETRY is set when a client receives Retry
|
180
|
+
packet. */
|
181
|
+
#define NGTCP2_CONN_FLAG_RECV_RETRY 0x10u
|
182
|
+
/* NGTCP2_CONN_FLAG_EARLY_DATA_REJECTED is set when 0-RTT packet is
|
183
|
+
rejected by a peer. */
|
184
|
+
#define NGTCP2_CONN_FLAG_EARLY_DATA_REJECTED 0x20u
|
185
|
+
/* NGTCP2_CONN_FLAG_KEEP_ALIVE_CANCELLED is set when the expired
|
186
|
+
keep-alive timer has been cancelled. */
|
187
|
+
#define NGTCP2_CONN_FLAG_KEEP_ALIVE_CANCELLED 0x40u
|
188
|
+
/* NGTCP2_CONN_FLAG_HANDSHAKE_CONFIRMED is set when an endpoint
|
189
|
+
confirmed completion of handshake. */
|
190
|
+
#define NGTCP2_CONN_FLAG_HANDSHAKE_CONFIRMED 0x80u
|
191
|
+
/* NGTCP2_CONN_FLAG_HANDSHAKE_COMPLETED_HANDLED is set when the
|
192
|
+
library transitions its state to "post handshake". */
|
193
|
+
#define NGTCP2_CONN_FLAG_HANDSHAKE_COMPLETED_HANDLED 0x0100u
|
194
|
+
/* NGTCP2_CONN_FLAG_HANDSHAKE_EARLY_RETRANSMIT is set when the early
|
195
|
+
handshake retransmission has done when server receives overlapping
|
196
|
+
Initial crypto data. */
|
197
|
+
#define NGTCP2_CONN_FLAG_HANDSHAKE_EARLY_RETRANSMIT 0x0200u
|
198
|
+
/* NGTCP2_CONN_FLAG_CLEAR_FIXED_BIT indicates that the local endpoint
|
199
|
+
sends a QUIC packet without Fixed Bit set if a remote endpoint
|
200
|
+
supports Greasing QUIC Bit extension. */
|
201
|
+
#define NGTCP2_CONN_FLAG_CLEAR_FIXED_BIT 0x0400u
|
202
|
+
/* NGTCP2_CONN_FLAG_KEY_UPDATE_NOT_CONFIRMED is set when key update is
|
203
|
+
not confirmed by the local endpoint. That is, it has not received
|
204
|
+
ACK frame which acknowledges packet which is encrypted with new
|
205
|
+
key. */
|
206
|
+
#define NGTCP2_CONN_FLAG_KEY_UPDATE_NOT_CONFIRMED 0x0800u
|
207
|
+
/* NGTCP2_CONN_FLAG_PPE_PENDING is set when
|
208
|
+
NGTCP2_WRITE_STREAM_FLAG_MORE is used and the intermediate state of
|
209
|
+
ngtcp2_ppe is stored in pkt struct of ngtcp2_conn. */
|
210
|
+
#define NGTCP2_CONN_FLAG_PPE_PENDING 0x1000u
|
211
|
+
/* NGTCP2_CONN_FLAG_RESTART_IDLE_TIMER_ON_WRITE is set when idle timer
|
212
|
+
should be restarted on next write. */
|
213
|
+
#define NGTCP2_CONN_FLAG_RESTART_IDLE_TIMER_ON_WRITE 0x2000u
|
214
|
+
/* NGTCP2_CONN_FLAG_SERVER_ADDR_VERIFIED indicates that server as peer
|
215
|
+
verified client address. This flag is only used by client. */
|
216
|
+
#define NGTCP2_CONN_FLAG_SERVER_ADDR_VERIFIED 0x4000u
|
217
|
+
/* NGTCP2_CONN_FLAG_EARLY_KEY_INSTALLED indicates that an early key is
|
218
|
+
installed. conn->early.ckm cannot be used for this purpose because
|
219
|
+
it might be discarded when a certain condition is met. */
|
220
|
+
#define NGTCP2_CONN_FLAG_EARLY_KEY_INSTALLED 0x8000u
|
221
|
+
/* NGTCP2_CONN_FLAG_KEY_UPDATE_INITIATOR is set when the local
|
222
|
+
endpoint has initiated key update. */
|
223
|
+
#define NGTCP2_CONN_FLAG_KEY_UPDATE_INITIATOR 0x10000u
|
224
|
+
|
225
|
+
typedef struct ngtcp2_crypto_data {
|
226
|
+
ngtcp2_buf buf;
|
227
|
+
/* pkt_type is the type of packet to send data in buf. If it is 0,
|
228
|
+
it must be sent in Short packet. Otherwise, it is sent the long
|
229
|
+
packet type denoted by pkt_type. */
|
230
|
+
uint8_t pkt_type;
|
231
|
+
} ngtcp2_crypto_data;
|
232
|
+
|
233
|
+
typedef struct ngtcp2_pktns {
|
234
|
+
struct {
|
235
|
+
/* last_pkt_num is the packet number which the local endpoint sent
|
236
|
+
last time.*/
|
237
|
+
int64_t last_pkt_num;
|
238
|
+
ngtcp2_frame_chain *frq;
|
239
|
+
/* num_non_ack_pkt is the number of continuous non ACK-eliciting
|
240
|
+
packets. */
|
241
|
+
size_t num_non_ack_pkt;
|
242
|
+
|
243
|
+
struct {
|
244
|
+
/* ect0 is the number of QUIC packets, not UDP datagram, which
|
245
|
+
are sent in UDP datagram with ECT0 marking. */
|
246
|
+
size_t ect0;
|
247
|
+
/* start_pkt_num is the lowest packet number that are sent
|
248
|
+
during ECN validation period. */
|
249
|
+
int64_t start_pkt_num;
|
250
|
+
/* validation_pkt_sent is the number of QUIC packets sent during
|
251
|
+
validation period. */
|
252
|
+
size_t validation_pkt_sent;
|
253
|
+
/* validation_pkt_lost is the number of QUIC packets lost during
|
254
|
+
validation period. */
|
255
|
+
size_t validation_pkt_lost;
|
256
|
+
} ecn;
|
257
|
+
} tx;
|
258
|
+
|
259
|
+
struct {
|
260
|
+
/* pngap tracks received packet number in order to suppress
|
261
|
+
duplicated packet number. */
|
262
|
+
ngtcp2_gaptr pngap;
|
263
|
+
/* max_pkt_num is the largest packet number received so far. */
|
264
|
+
int64_t max_pkt_num;
|
265
|
+
/* max_pkt_ts is the timestamp when max_pkt_num packet is
|
266
|
+
received. */
|
267
|
+
ngtcp2_tstamp max_pkt_ts;
|
268
|
+
/* max_ack_eliciting_pkt_num is the largest ack-eliciting packet
|
269
|
+
number received so far. */
|
270
|
+
int64_t max_ack_eliciting_pkt_num;
|
271
|
+
/*
|
272
|
+
* buffed_pkts is buffered packets which cannot be decrypted with
|
273
|
+
* the current encryption level.
|
274
|
+
*
|
275
|
+
* In server Initial encryption level, 0-RTT packet may be buffered.
|
276
|
+
* In server Handshake encryption level, Short packet may be buffered.
|
277
|
+
*
|
278
|
+
* In client Initial encryption level, Handshake or Short packet may
|
279
|
+
* be buffered. In client Handshake encryption level, Short packet
|
280
|
+
* may be buffered.
|
281
|
+
*
|
282
|
+
* - 0-RTT packet is only buffered in server Initial encryption
|
283
|
+
* level ngtcp2_pktns.
|
284
|
+
*
|
285
|
+
* - Handshake packet is only buffered in client Handshake
|
286
|
+
* encryption level ngtcp2_pktns.
|
287
|
+
*
|
288
|
+
* - Short packet is only buffered in Short encryption level
|
289
|
+
* ngtcp2_pktns.
|
290
|
+
*/
|
291
|
+
ngtcp2_pkt_chain *buffed_pkts;
|
292
|
+
|
293
|
+
struct {
|
294
|
+
/* ect0, ect1, and ce are the number of QUIC packets received
|
295
|
+
with those markings. */
|
296
|
+
size_t ect0;
|
297
|
+
size_t ect1;
|
298
|
+
size_t ce;
|
299
|
+
struct {
|
300
|
+
/* ect0, ect1, ce are the ECN counts received in the latest
|
301
|
+
ACK frame. */
|
302
|
+
uint64_t ect0;
|
303
|
+
uint64_t ect1;
|
304
|
+
uint64_t ce;
|
305
|
+
} ack;
|
306
|
+
} ecn;
|
307
|
+
} rx;
|
308
|
+
|
309
|
+
struct {
|
310
|
+
struct {
|
311
|
+
/* frq contains crypto data sorted by their offset. */
|
312
|
+
ngtcp2_ksl frq;
|
313
|
+
/* offset is the offset of crypto stream in this packet number
|
314
|
+
space. */
|
315
|
+
uint64_t offset;
|
316
|
+
/* ckm is a cryptographic key, and iv to encrypt outgoing
|
317
|
+
packets. */
|
318
|
+
ngtcp2_crypto_km *ckm;
|
319
|
+
/* hp_ctx is cipher context for packet header protection. */
|
320
|
+
ngtcp2_crypto_cipher_ctx hp_ctx;
|
321
|
+
/* data is the submitted crypto data. */
|
322
|
+
ngtcp2_buf_chain *data;
|
323
|
+
} tx;
|
324
|
+
|
325
|
+
struct {
|
326
|
+
/* ckm is a cryptographic key, and iv to decrypt incoming
|
327
|
+
packets. */
|
328
|
+
ngtcp2_crypto_km *ckm;
|
329
|
+
/* hp_ctx is cipher context for packet header protection. */
|
330
|
+
ngtcp2_crypto_cipher_ctx hp_ctx;
|
331
|
+
} rx;
|
332
|
+
|
333
|
+
ngtcp2_strm strm;
|
334
|
+
ngtcp2_crypto_ctx ctx;
|
335
|
+
} crypto;
|
336
|
+
|
337
|
+
ngtcp2_acktr acktr;
|
338
|
+
ngtcp2_rtb rtb;
|
339
|
+
} ngtcp2_pktns;
|
340
|
+
|
341
|
+
typedef enum ngtcp2_ecn_state {
|
342
|
+
NGTCP2_ECN_STATE_TESTING,
|
343
|
+
NGTCP2_ECN_STATE_UNKNOWN,
|
344
|
+
NGTCP2_ECN_STATE_FAILED,
|
345
|
+
NGTCP2_ECN_STATE_CAPABLE,
|
346
|
+
} ngtcp2_ecn_state;
|
347
|
+
|
348
|
+
ngtcp2_static_ringbuf_def(dcid_bound, NGTCP2_MAX_BOUND_DCID_POOL_SIZE,
|
349
|
+
sizeof(ngtcp2_dcid));
|
350
|
+
ngtcp2_static_ringbuf_def(dcid_unused, NGTCP2_MAX_DCID_POOL_SIZE,
|
351
|
+
sizeof(ngtcp2_dcid));
|
352
|
+
ngtcp2_static_ringbuf_def(dcid_retired, NGTCP2_MAX_DCID_RETIRED_SIZE,
|
353
|
+
sizeof(ngtcp2_dcid));
|
354
|
+
ngtcp2_static_ringbuf_def(path_challenge, 4,
|
355
|
+
sizeof(ngtcp2_path_challenge_entry));
|
356
|
+
|
357
|
+
ngtcp2_objalloc_def(strm, ngtcp2_strm, oplent);
|
358
|
+
|
359
|
+
struct ngtcp2_conn {
|
360
|
+
ngtcp2_objalloc frc_objalloc;
|
361
|
+
ngtcp2_objalloc rtb_entry_objalloc;
|
362
|
+
ngtcp2_objalloc strm_objalloc;
|
363
|
+
ngtcp2_conn_state state;
|
364
|
+
ngtcp2_callbacks callbacks;
|
365
|
+
/* rcid is a connection ID present in Initial or 0-RTT packet from
|
366
|
+
client as destination connection ID. Server uses this field to
|
367
|
+
check that duplicated Initial or 0-RTT packet are indeed sent to
|
368
|
+
this connection. Client uses this field to validate
|
369
|
+
original_destination_connection_id transport parameter. */
|
370
|
+
ngtcp2_cid rcid;
|
371
|
+
/* oscid is the source connection ID initially used by the local
|
372
|
+
endpoint. */
|
373
|
+
ngtcp2_cid oscid;
|
374
|
+
/* retry_scid is the source connection ID from Retry packet. Client
|
375
|
+
records it in order to verify retry_source_connection_id
|
376
|
+
transport parameter. Server does not use this field. */
|
377
|
+
ngtcp2_cid retry_scid;
|
378
|
+
ngtcp2_pktns *in_pktns;
|
379
|
+
ngtcp2_pktns *hs_pktns;
|
380
|
+
ngtcp2_pktns pktns;
|
381
|
+
|
382
|
+
struct {
|
383
|
+
/* current is the current destination connection ID. */
|
384
|
+
ngtcp2_dcid current;
|
385
|
+
/* bound is a set of destination connection IDs which are bound to
|
386
|
+
particular paths. These paths are not validated yet. */
|
387
|
+
ngtcp2_static_ringbuf_dcid_bound bound;
|
388
|
+
/* unused is a set of unused CID received from peer. */
|
389
|
+
ngtcp2_static_ringbuf_dcid_unused unused;
|
390
|
+
/* retired is a set of CID retired by local endpoint. Keep them
|
391
|
+
in 3*PTO to catch packets in flight along the old path. */
|
392
|
+
ngtcp2_static_ringbuf_dcid_retired retired;
|
393
|
+
/* seqgap tracks received sequence numbers in order to ignore
|
394
|
+
retransmitted duplicated NEW_CONNECTION_ID frame. */
|
395
|
+
ngtcp2_gaptr seqgap;
|
396
|
+
/* retire_prior_to is the largest retire_prior_to received so
|
397
|
+
far. */
|
398
|
+
uint64_t retire_prior_to;
|
399
|
+
struct {
|
400
|
+
/* seqs contains sequence number of Connection ID whose
|
401
|
+
retirement is not acknowledged by the remote endpoint yet. */
|
402
|
+
uint64_t seqs[NGTCP2_MAX_DCID_POOL_SIZE * 2];
|
403
|
+
/* len is the number of sequence numbers that seq contains. */
|
404
|
+
size_t len;
|
405
|
+
} retire_unacked;
|
406
|
+
/* zerolen_seq is a pseudo sequence number of zero-length
|
407
|
+
Destination Connection ID in order to distinguish between
|
408
|
+
them. */
|
409
|
+
uint64_t zerolen_seq;
|
410
|
+
} dcid;
|
411
|
+
|
412
|
+
struct {
|
413
|
+
/* set is a set of CID sent to peer. The peer can use any CIDs in
|
414
|
+
this set. This includes used CID as well as unused ones. */
|
415
|
+
ngtcp2_ksl set;
|
416
|
+
/* used is a set of CID used by peer. The sort function of this
|
417
|
+
priority queue takes timestamp when CID is retired and sorts
|
418
|
+
them in ascending order. */
|
419
|
+
ngtcp2_pq used;
|
420
|
+
/* last_seq is the last sequence number of connection ID. */
|
421
|
+
uint64_t last_seq;
|
422
|
+
/* num_retired is the number of retired Connection ID still
|
423
|
+
included in set. */
|
424
|
+
size_t num_retired;
|
425
|
+
} scid;
|
426
|
+
|
427
|
+
struct {
|
428
|
+
/* strmq contains ngtcp2_strm which has frames to send. */
|
429
|
+
ngtcp2_pq strmq;
|
430
|
+
/* strmq_nretrans is the number of entries in strmq which has
|
431
|
+
stream data to resent. */
|
432
|
+
size_t strmq_nretrans;
|
433
|
+
/* ack is ACK frame. The underlying buffer is reused. */
|
434
|
+
ngtcp2_frame *ack;
|
435
|
+
/* max_ack_ranges is the number of additional ngtcp2_ack_range
|
436
|
+
which ack can contain. */
|
437
|
+
size_t max_ack_ranges;
|
438
|
+
/* offset is the offset the local endpoint has sent to the remote
|
439
|
+
endpoint. */
|
440
|
+
uint64_t offset;
|
441
|
+
/* max_offset is the maximum offset that local endpoint can
|
442
|
+
send. */
|
443
|
+
uint64_t max_offset;
|
444
|
+
/* last_max_data_ts is the timestamp when last MAX_DATA frame is
|
445
|
+
sent. */
|
446
|
+
ngtcp2_tstamp last_max_data_ts;
|
447
|
+
|
448
|
+
struct {
|
449
|
+
/* state is the state of ECN validation */
|
450
|
+
ngtcp2_ecn_state state;
|
451
|
+
/* validation_start_ts is the timestamp when ECN validation is
|
452
|
+
started. It is UINT64_MAX if it has not started yet. */
|
453
|
+
ngtcp2_tstamp validation_start_ts;
|
454
|
+
/* dgram_sent is the number of UDP datagram sent during ECN
|
455
|
+
validation period. */
|
456
|
+
size_t dgram_sent;
|
457
|
+
} ecn;
|
458
|
+
|
459
|
+
struct {
|
460
|
+
/* pktlen is the number of bytes written before calling
|
461
|
+
ngtcp2_conn_update_pkt_tx_time which resets this field to
|
462
|
+
0. */
|
463
|
+
size_t pktlen;
|
464
|
+
/* next_ts is the time to send next packet. It is UINT64_MAX if
|
465
|
+
packet pacing is disabled or expired.*/
|
466
|
+
ngtcp2_tstamp next_ts;
|
467
|
+
/* exceeded_waiting_time is the sum of amount of time the
|
468
|
+
connection waited beyond next_ts. */
|
469
|
+
ngtcp2_duration exceeded_waiting_time;
|
470
|
+
} pacing;
|
471
|
+
} tx;
|
472
|
+
|
473
|
+
struct {
|
474
|
+
/* unsent_max_offset is the maximum offset that remote endpoint
|
475
|
+
can send without extending MAX_DATA. This limit is not yet
|
476
|
+
notified to the remote endpoint. */
|
477
|
+
uint64_t unsent_max_offset;
|
478
|
+
/* offset is the cumulative sum of stream data received for this
|
479
|
+
connection. */
|
480
|
+
uint64_t offset;
|
481
|
+
/* max_offset is the maximum offset that remote endpoint can
|
482
|
+
send. */
|
483
|
+
uint64_t max_offset;
|
484
|
+
/* window is the connection-level flow control window size. */
|
485
|
+
uint64_t window;
|
486
|
+
/* path_challenge stores received PATH_CHALLENGE data. */
|
487
|
+
ngtcp2_static_ringbuf_path_challenge path_challenge;
|
488
|
+
/* ccerr is the received connection close error. */
|
489
|
+
ngtcp2_connection_close_error ccerr;
|
490
|
+
} rx;
|
491
|
+
|
492
|
+
struct {
|
493
|
+
ngtcp2_crypto_km *ckm;
|
494
|
+
ngtcp2_crypto_cipher_ctx hp_ctx;
|
495
|
+
ngtcp2_crypto_ctx ctx;
|
496
|
+
/* discard_started_ts is the timestamp when the timer to discard
|
497
|
+
early key has started. Used by server only. */
|
498
|
+
ngtcp2_tstamp discard_started_ts;
|
499
|
+
/* transport_params is the values remembered by client from the
|
500
|
+
previous session. These are set by
|
501
|
+
ngtcp2_conn_set_early_remote_transport_params(). Server does
|
502
|
+
not use this field. Server must not set values for these
|
503
|
+
parameters that are smaller than the remembered values. */
|
504
|
+
struct {
|
505
|
+
uint64_t initial_max_streams_bidi;
|
506
|
+
uint64_t initial_max_streams_uni;
|
507
|
+
uint64_t initial_max_stream_data_bidi_local;
|
508
|
+
uint64_t initial_max_stream_data_bidi_remote;
|
509
|
+
uint64_t initial_max_stream_data_uni;
|
510
|
+
uint64_t initial_max_data;
|
511
|
+
uint64_t active_connection_id_limit;
|
512
|
+
uint64_t max_datagram_frame_size;
|
513
|
+
} transport_params;
|
514
|
+
} early;
|
515
|
+
|
516
|
+
struct {
|
517
|
+
ngtcp2_settings settings;
|
518
|
+
/* transport_params is the local transport parameters. It is used
|
519
|
+
for Short packet only. */
|
520
|
+
ngtcp2_transport_params transport_params;
|
521
|
+
struct {
|
522
|
+
/* max_streams is the maximum number of bidirectional streams which
|
523
|
+
the local endpoint can open. */
|
524
|
+
uint64_t max_streams;
|
525
|
+
/* next_stream_id is the bidirectional stream ID which the local
|
526
|
+
endpoint opens next. */
|
527
|
+
int64_t next_stream_id;
|
528
|
+
} bidi;
|
529
|
+
|
530
|
+
struct {
|
531
|
+
/* max_streams is the maximum number of unidirectional streams
|
532
|
+
which the local endpoint can open. */
|
533
|
+
uint64_t max_streams;
|
534
|
+
/* next_stream_id is the unidirectional stream ID which the
|
535
|
+
local endpoint opens next. */
|
536
|
+
int64_t next_stream_id;
|
537
|
+
} uni;
|
538
|
+
} local;
|
539
|
+
|
540
|
+
struct {
|
541
|
+
/* transport_params is the received transport parameters during
|
542
|
+
handshake. It is used for Short packet only. */
|
543
|
+
ngtcp2_transport_params *transport_params;
|
544
|
+
/* pending_transport_params is received transport parameters
|
545
|
+
during handshake. It is copied to transport_params when 1RTT
|
546
|
+
key is available. */
|
547
|
+
ngtcp2_transport_params *pending_transport_params;
|
548
|
+
struct {
|
549
|
+
ngtcp2_idtr idtr;
|
550
|
+
/* unsent_max_streams is the maximum number of streams of peer
|
551
|
+
initiated bidirectional stream which the local endpoint can
|
552
|
+
accept. This limit is not yet notified to the remote
|
553
|
+
endpoint. */
|
554
|
+
uint64_t unsent_max_streams;
|
555
|
+
/* max_streams is the maximum number of streams of peer
|
556
|
+
initiated bidirectional stream which the local endpoint can
|
557
|
+
accept. */
|
558
|
+
uint64_t max_streams;
|
559
|
+
} bidi;
|
560
|
+
|
561
|
+
struct {
|
562
|
+
ngtcp2_idtr idtr;
|
563
|
+
/* unsent_max_streams is the maximum number of streams of peer
|
564
|
+
initiated unidirectional stream which the local endpoint can
|
565
|
+
accept. This limit is not yet notified to the remote
|
566
|
+
endpoint. */
|
567
|
+
uint64_t unsent_max_streams;
|
568
|
+
/* max_streams is the maximum number of streams of peer
|
569
|
+
initiated unidirectional stream which the local endpoint can
|
570
|
+
accept. */
|
571
|
+
uint64_t max_streams;
|
572
|
+
} uni;
|
573
|
+
} remote;
|
574
|
+
|
575
|
+
struct {
|
576
|
+
struct {
|
577
|
+
/* new_tx_ckm is a new sender 1RTT key which has not been
|
578
|
+
used. */
|
579
|
+
ngtcp2_crypto_km *new_tx_ckm;
|
580
|
+
/* new_rx_ckm is a new receiver 1RTT key which has not
|
581
|
+
successfully decrypted incoming packet yet. */
|
582
|
+
ngtcp2_crypto_km *new_rx_ckm;
|
583
|
+
/* old_rx_ckm is an old receiver 1RTT key. */
|
584
|
+
ngtcp2_crypto_km *old_rx_ckm;
|
585
|
+
/* confirmed_ts is the time instant when the key update is
|
586
|
+
confirmed by the local endpoint last time. UINT64_MAX means
|
587
|
+
undefined value. */
|
588
|
+
ngtcp2_tstamp confirmed_ts;
|
589
|
+
} key_update;
|
590
|
+
|
591
|
+
/* tls_native_handle is a native handle to TLS session object. */
|
592
|
+
void *tls_native_handle;
|
593
|
+
/* decrypt_hp_buf is a buffer which is used to write unprotected
|
594
|
+
packet header. */
|
595
|
+
ngtcp2_vec decrypt_hp_buf;
|
596
|
+
/* decrypt_buf is a buffer which is used to write decrypted data. */
|
597
|
+
ngtcp2_vec decrypt_buf;
|
598
|
+
/* retry_aead is AEAD to verify Retry packet integrity. It is
|
599
|
+
used by client only. */
|
600
|
+
ngtcp2_crypto_aead retry_aead;
|
601
|
+
/* retry_aead_ctx is AEAD cipher context to verify Retry packet
|
602
|
+
integrity. It is used by client only. */
|
603
|
+
ngtcp2_crypto_aead_ctx retry_aead_ctx;
|
604
|
+
/* tls_error is TLS related error. */
|
605
|
+
int tls_error;
|
606
|
+
/* tls_alert is TLS alert generated by the local endpoint. */
|
607
|
+
uint8_t tls_alert;
|
608
|
+
/* decryption_failure_count is the number of received packets that
|
609
|
+
fail authentication. */
|
610
|
+
uint64_t decryption_failure_count;
|
611
|
+
} crypto;
|
612
|
+
|
613
|
+
/* pkt contains the packet intermediate construction data to support
|
614
|
+
NGTCP2_WRITE_STREAM_FLAG_MORE */
|
615
|
+
struct {
|
616
|
+
ngtcp2_crypto_cc cc;
|
617
|
+
ngtcp2_pkt_hd hd;
|
618
|
+
ngtcp2_ppe ppe;
|
619
|
+
ngtcp2_frame_chain **pfrc;
|
620
|
+
int pkt_empty;
|
621
|
+
int hd_logged;
|
622
|
+
/* flags is bitwise OR of zero or more of
|
623
|
+
NGTCP2_RTB_ENTRY_FLAG_*. */
|
624
|
+
uint16_t rtb_entry_flags;
|
625
|
+
ngtcp2_ssize hs_spktlen;
|
626
|
+
int require_padding;
|
627
|
+
} pkt;
|
628
|
+
|
629
|
+
struct {
|
630
|
+
/* last_ts is a timestamp when a last packet is sent or received
|
631
|
+
on a current path. */
|
632
|
+
ngtcp2_tstamp last_ts;
|
633
|
+
/* timeout is keep-alive timeout. When it expires, a packet
|
634
|
+
should be sent to a current path to keep connection alive. It
|
635
|
+
might be used to keep NAT binding intact. If 0 is set,
|
636
|
+
keep-alive timer is disabled. */
|
637
|
+
ngtcp2_duration timeout;
|
638
|
+
} keep_alive;
|
639
|
+
|
640
|
+
struct {
|
641
|
+
/* Initial keys for negotiated version. If original version ==
|
642
|
+
negotiated version, these fields are not used. */
|
643
|
+
struct {
|
644
|
+
ngtcp2_crypto_km *ckm;
|
645
|
+
ngtcp2_crypto_cipher_ctx hp_ctx;
|
646
|
+
} rx;
|
647
|
+
struct {
|
648
|
+
ngtcp2_crypto_km *ckm;
|
649
|
+
ngtcp2_crypto_cipher_ctx hp_ctx;
|
650
|
+
} tx;
|
651
|
+
/* version is QUIC version that the above Initial keys are created
|
652
|
+
for. */
|
653
|
+
uint32_t version;
|
654
|
+
/* preferred_versions is the array of versions that are preferred
|
655
|
+
by the local endpoint. Server negotiates one of those versions
|
656
|
+
in this array if a client initially selects a less preferred
|
657
|
+
version. Client uses this field and original_version field to
|
658
|
+
prevent version downgrade attack if it reacted upon Version
|
659
|
+
Negotiation packet. */
|
660
|
+
uint32_t *preferred_versions;
|
661
|
+
/* preferred_versionslen is the number of versions stored in the
|
662
|
+
array pointed by preferred_versions. This field is only used
|
663
|
+
by server. */
|
664
|
+
size_t preferred_versionslen;
|
665
|
+
/* available_versions is the versions that the local endpoint
|
666
|
+
sends in version_information transport parameter. This is the
|
667
|
+
wire image of available_versions field of version_information
|
668
|
+
transport parameter. */
|
669
|
+
uint8_t *available_versions;
|
670
|
+
/* available_versionslen is the length of data pointed by
|
671
|
+
available_versions field. */
|
672
|
+
size_t available_versionslen;
|
673
|
+
} vneg;
|
674
|
+
|
675
|
+
ngtcp2_map strms;
|
676
|
+
ngtcp2_conn_stat cstat;
|
677
|
+
ngtcp2_pv *pv;
|
678
|
+
ngtcp2_pmtud *pmtud;
|
679
|
+
ngtcp2_log log;
|
680
|
+
ngtcp2_qlog qlog;
|
681
|
+
ngtcp2_rst rst;
|
682
|
+
ngtcp2_cc_algo cc_algo;
|
683
|
+
ngtcp2_cc cc;
|
684
|
+
const ngtcp2_mem *mem;
|
685
|
+
/* idle_ts is the time instant when idle timer started. */
|
686
|
+
ngtcp2_tstamp idle_ts;
|
687
|
+
void *user_data;
|
688
|
+
uint32_t client_chosen_version;
|
689
|
+
uint32_t negotiated_version;
|
690
|
+
/* flags is bitwise OR of zero or more of NGTCP2_CONN_FLAG_*. */
|
691
|
+
uint32_t flags;
|
692
|
+
int server;
|
693
|
+
};
|
694
|
+
|
695
|
+
typedef enum ngtcp2_vmsg_type {
|
696
|
+
NGTCP2_VMSG_TYPE_STREAM,
|
697
|
+
NGTCP2_VMSG_TYPE_DATAGRAM,
|
698
|
+
} ngtcp2_vmsg_type;
|
699
|
+
|
700
|
+
typedef struct ngtcp2_vmsg_stream {
|
701
|
+
/* strm is a stream that data is sent to. */
|
702
|
+
ngtcp2_strm *strm;
|
703
|
+
/* flags is bitwise OR of zero or more of
|
704
|
+
NGTCP2_WRITE_STREAM_FLAG_*. */
|
705
|
+
uint32_t flags;
|
706
|
+
/* data is the pointer to ngtcp2_vec array which contains the stream
|
707
|
+
data to send. */
|
708
|
+
const ngtcp2_vec *data;
|
709
|
+
/* datacnt is the number of ngtcp2_vec pointed by data. */
|
710
|
+
size_t datacnt;
|
711
|
+
/* pdatalen is the pointer to the variable which the number of bytes
|
712
|
+
written is assigned to if pdatalen is not NULL. */
|
713
|
+
ngtcp2_ssize *pdatalen;
|
714
|
+
} ngtcp2_vmsg_stream;
|
715
|
+
|
716
|
+
typedef struct ngtcp2_vmsg_datagram {
|
717
|
+
/* data is the pointer to ngtcp2_vec array which contains the data
|
718
|
+
to send. */
|
719
|
+
const ngtcp2_vec *data;
|
720
|
+
/* datacnt is the number of ngtcp2_vec pointed by data. */
|
721
|
+
size_t datacnt;
|
722
|
+
/* dgram_id is an opaque identifier chosen by an application. */
|
723
|
+
uint64_t dgram_id;
|
724
|
+
/* flags is bitwise OR of zero or more of
|
725
|
+
NGTCP2_WRITE_DATAGRAM_FLAG_*. */
|
726
|
+
uint32_t flags;
|
727
|
+
/* paccepted is the pointer to the variable which, if it is not
|
728
|
+
NULL, is assigned nonzero if data is written to a packet. */
|
729
|
+
int *paccepted;
|
730
|
+
} ngtcp2_vmsg_datagram;
|
731
|
+
|
732
|
+
typedef struct ngtcp2_vmsg {
|
733
|
+
ngtcp2_vmsg_type type;
|
734
|
+
union {
|
735
|
+
ngtcp2_vmsg_stream stream;
|
736
|
+
ngtcp2_vmsg_datagram datagram;
|
737
|
+
};
|
738
|
+
} ngtcp2_vmsg;
|
739
|
+
|
740
|
+
/*
|
741
|
+
* ngtcp2_conn_sched_ack stores packet number |pkt_num| and its
|
742
|
+
* reception timestamp |ts| in order to send its ACK.
|
743
|
+
*
|
744
|
+
* It returns 0 if it succeeds, or one of the following negative error
|
745
|
+
* codes:
|
746
|
+
*
|
747
|
+
* NGTCP2_ERR_NOMEM
|
748
|
+
* Out of memory
|
749
|
+
* NGTCP2_ERR_PROTO
|
750
|
+
* Same packet number has already been added.
|
751
|
+
*/
|
752
|
+
int ngtcp2_conn_sched_ack(ngtcp2_conn *conn, ngtcp2_acktr *acktr,
|
753
|
+
int64_t pkt_num, int active_ack, ngtcp2_tstamp ts);
|
754
|
+
|
755
|
+
/*
|
756
|
+
* ngtcp2_conn_find_stream returns a stream whose stream ID is
|
757
|
+
* |stream_id|. If no such stream is found, it returns NULL.
|
758
|
+
*/
|
759
|
+
ngtcp2_strm *ngtcp2_conn_find_stream(ngtcp2_conn *conn, int64_t stream_id);
|
760
|
+
|
761
|
+
/*
|
762
|
+
* conn_init_stream initializes |strm|. Its stream ID is |stream_id|.
|
763
|
+
* This function adds |strm| to conn->strms. |strm| must be allocated
|
764
|
+
* by the caller.
|
765
|
+
*
|
766
|
+
* This function returns 0 if it succeeds, or one of the following
|
767
|
+
* negative error codes:
|
768
|
+
*
|
769
|
+
* NGTCP2_ERR_NOMEM
|
770
|
+
* Out of memory
|
771
|
+
* NGTCP2_ERR_CALLBACK_FAILURE
|
772
|
+
* User-callback function failed.
|
773
|
+
*/
|
774
|
+
int ngtcp2_conn_init_stream(ngtcp2_conn *conn, ngtcp2_strm *strm,
|
775
|
+
int64_t stream_id, void *stream_user_data);
|
776
|
+
|
777
|
+
/*
|
778
|
+
* ngtcp2_conn_close_stream closes stream |strm|.
|
779
|
+
*
|
780
|
+
* This function returns 0 if it succeeds, or one of the following
|
781
|
+
* negative error codes:
|
782
|
+
*
|
783
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
784
|
+
* Stream is not found.
|
785
|
+
* NGTCP2_ERR_CALLBACK_FAILURE
|
786
|
+
* User-defined callback function failed.
|
787
|
+
*/
|
788
|
+
int ngtcp2_conn_close_stream(ngtcp2_conn *conn, ngtcp2_strm *strm);
|
789
|
+
|
790
|
+
/*
|
791
|
+
* ngtcp2_conn_close_stream closes stream |strm| if no further
|
792
|
+
* transmission and reception are allowed, and all reordered incoming
|
793
|
+
* data are emitted to the application, and the transmitted data are
|
794
|
+
* acked.
|
795
|
+
*
|
796
|
+
* This function returns 0 if it succeeds, or one of the following
|
797
|
+
* negative error codes:
|
798
|
+
*
|
799
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
800
|
+
* Stream is not found.
|
801
|
+
* NGTCP2_ERR_CALLBACK_FAILURE
|
802
|
+
* User-defined callback function failed.
|
803
|
+
*/
|
804
|
+
int ngtcp2_conn_close_stream_if_shut_rdwr(ngtcp2_conn *conn, ngtcp2_strm *strm);
|
805
|
+
|
806
|
+
/*
|
807
|
+
* ngtcp2_conn_update_rtt updates RTT measurements. |rtt| is a latest
|
808
|
+
* RTT which is not adjusted by ack delay. |ack_delay| is unscaled
|
809
|
+
* ack_delay included in ACK frame. |ack_delay| is actually tainted
|
810
|
+
* (sent by peer), so don't assume that |ack_delay| is always smaller
|
811
|
+
* than, or equals to |rtt|.
|
812
|
+
*
|
813
|
+
* This function returns 0 if it succeeds, or one of the following
|
814
|
+
* negative error codes:
|
815
|
+
*
|
816
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
817
|
+
* RTT sample is ignored.
|
818
|
+
*/
|
819
|
+
int ngtcp2_conn_update_rtt(ngtcp2_conn *conn, ngtcp2_duration rtt,
|
820
|
+
ngtcp2_duration ack_delay, ngtcp2_tstamp ts);
|
821
|
+
|
822
|
+
void ngtcp2_conn_set_loss_detection_timer(ngtcp2_conn *conn, ngtcp2_tstamp ts);
|
823
|
+
|
824
|
+
int ngtcp2_conn_on_loss_detection_timer(ngtcp2_conn *conn, ngtcp2_tstamp ts);
|
825
|
+
|
826
|
+
/*
|
827
|
+
* ngtcp2_conn_detect_lost_pkt detects lost packets.
|
828
|
+
*
|
829
|
+
* This function returns 0 if it succeeds, or one of the following
|
830
|
+
* negative error codes:
|
831
|
+
*
|
832
|
+
* NGTCP2_ERR_NOMEM
|
833
|
+
* Out of memory.
|
834
|
+
*/
|
835
|
+
int ngtcp2_conn_detect_lost_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
|
836
|
+
ngtcp2_conn_stat *cstat, ngtcp2_tstamp ts);
|
837
|
+
|
838
|
+
/*
|
839
|
+
* ngtcp2_conn_tx_strmq_top returns the ngtcp2_strm which sits on the
|
840
|
+
* top of queue. tx_strmq must not be empty.
|
841
|
+
*/
|
842
|
+
ngtcp2_strm *ngtcp2_conn_tx_strmq_top(ngtcp2_conn *conn);
|
843
|
+
|
844
|
+
/*
|
845
|
+
* ngtcp2_conn_tx_strmq_pop pops the ngtcp2_strm from the queue.
|
846
|
+
* tx_strmq must not be empty.
|
847
|
+
*/
|
848
|
+
void ngtcp2_conn_tx_strmq_pop(ngtcp2_conn *conn);
|
849
|
+
|
850
|
+
/*
|
851
|
+
* ngtcp2_conn_tx_strmq_push pushes |strm| into tx_strmq.
|
852
|
+
*
|
853
|
+
* This function returns 0 if it succeeds, or one of the following
|
854
|
+
* negative error codes:
|
855
|
+
*
|
856
|
+
* NGTCP2_ERR_NOMEM
|
857
|
+
* Out of memory.
|
858
|
+
*/
|
859
|
+
int ngtcp2_conn_tx_strmq_push(ngtcp2_conn *conn, ngtcp2_strm *strm);
|
860
|
+
|
861
|
+
/*
|
862
|
+
* ngtcp2_conn_internal_expiry returns the minimum expiry time among
|
863
|
+
* all timers in |conn|.
|
864
|
+
*/
|
865
|
+
ngtcp2_tstamp ngtcp2_conn_internal_expiry(ngtcp2_conn *conn);
|
866
|
+
|
867
|
+
ngtcp2_ssize ngtcp2_conn_write_vmsg(ngtcp2_conn *conn, ngtcp2_path *path,
|
868
|
+
int pkt_info_version, ngtcp2_pkt_info *pi,
|
869
|
+
uint8_t *dest, size_t destlen,
|
870
|
+
ngtcp2_vmsg *vmsg, ngtcp2_tstamp ts);
|
871
|
+
|
872
|
+
/*
|
873
|
+
* ngtcp2_conn_write_single_frame_pkt writes a packet which contains
|
874
|
+
* |fr| frame only in the buffer pointed by |dest| whose length if
|
875
|
+
* |destlen|. |type| is a long packet type to send. If |type| is 0,
|
876
|
+
* Short packet is used. |dcid| is used as a destination connection
|
877
|
+
* ID. |flags| is zero or more of NGTCP2_WRITE_PKT_FLAG_*. Only
|
878
|
+
* NGTCP2_WRITE_PKT_FLAG_REQUIRE_PADDING is recognized.
|
879
|
+
*
|
880
|
+
* The packet written by this function will not be retransmitted.
|
881
|
+
*
|
882
|
+
* This function returns the number of bytes written in |dest| if it
|
883
|
+
* succeeds, or one of the following negative error codes:
|
884
|
+
*
|
885
|
+
* NGTCP2_ERR_CALLBACK_FAILURE
|
886
|
+
* User-defined callback function failed.
|
887
|
+
*/
|
888
|
+
ngtcp2_ssize ngtcp2_conn_write_single_frame_pkt(
|
889
|
+
ngtcp2_conn *conn, ngtcp2_pkt_info *pi, uint8_t *dest, size_t destlen,
|
890
|
+
uint8_t type, uint8_t flags, const ngtcp2_cid *dcid, ngtcp2_frame *fr,
|
891
|
+
uint16_t rtb_entry_flags, const ngtcp2_path *path, ngtcp2_tstamp ts);
|
892
|
+
|
893
|
+
/*
|
894
|
+
* ngtcp2_conn_commit_local_transport_params commits the local
|
895
|
+
* transport parameters, which is currently set to
|
896
|
+
* conn->local.settings.transport_params. This function will do some
|
897
|
+
* amends on transport parameters for adjusting default values.
|
898
|
+
*
|
899
|
+
* This function returns 0 if it succeeds, or one of the following
|
900
|
+
* negative error codes:
|
901
|
+
*
|
902
|
+
* NGTCP2_ERR_NOMEM
|
903
|
+
* Out of memory.
|
904
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
905
|
+
* CID in preferred address equals to the original SCID.
|
906
|
+
*/
|
907
|
+
int ngtcp2_conn_commit_local_transport_params(ngtcp2_conn *conn);
|
908
|
+
|
909
|
+
/*
|
910
|
+
* ngtcp2_conn_lost_pkt_expiry returns the earliest expiry time of
|
911
|
+
* lost packet.
|
912
|
+
*/
|
913
|
+
ngtcp2_tstamp ngtcp2_conn_lost_pkt_expiry(ngtcp2_conn *conn);
|
914
|
+
|
915
|
+
/*
|
916
|
+
* ngtcp2_conn_remove_lost_pkt removes the expired lost packet.
|
917
|
+
*/
|
918
|
+
void ngtcp2_conn_remove_lost_pkt(ngtcp2_conn *conn, ngtcp2_tstamp ts);
|
919
|
+
|
920
|
+
/*
|
921
|
+
* ngtcp2_conn_resched_frames reschedules frames linked from |*pfrc|
|
922
|
+
* for retransmission.
|
923
|
+
*
|
924
|
+
* This function returns 0 if it succeeds, or one of the following
|
925
|
+
* negative error codes:
|
926
|
+
*
|
927
|
+
* NGTCP2_ERR_NOMEM
|
928
|
+
* Out of memory.
|
929
|
+
*/
|
930
|
+
int ngtcp2_conn_resched_frames(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
|
931
|
+
ngtcp2_frame_chain **pfrc);
|
932
|
+
|
933
|
+
uint64_t ngtcp2_conn_tx_strmq_first_cycle(ngtcp2_conn *conn);
|
934
|
+
|
935
|
+
/**
|
936
|
+
* @function
|
937
|
+
*
|
938
|
+
* `ngtcp2_conn_ack_delay_expiry` returns the expiry time point of
|
939
|
+
* delayed protected ACK. One should call
|
940
|
+
* `ngtcp2_conn_cancel_expired_ack_delay_timer` and
|
941
|
+
* `ngtcp2_conn_write_pkt` (or `ngtcp2_conn_writev_stream`) when it
|
942
|
+
* expires. It returns UINT64_MAX if there is no expiry.
|
943
|
+
*/
|
944
|
+
ngtcp2_tstamp ngtcp2_conn_ack_delay_expiry(ngtcp2_conn *conn);
|
945
|
+
|
946
|
+
/**
|
947
|
+
* @function
|
948
|
+
*
|
949
|
+
* `ngtcp2_conn_cancel_expired_ack_delay_timer` stops expired ACK
|
950
|
+
* delay timer. |ts| is the current time. This function must be
|
951
|
+
* called when `ngtcp2_conn_ack_delay_expiry` <= ts.
|
952
|
+
*/
|
953
|
+
void ngtcp2_conn_cancel_expired_ack_delay_timer(ngtcp2_conn *conn,
|
954
|
+
ngtcp2_tstamp ts);
|
955
|
+
|
956
|
+
/**
|
957
|
+
* @function
|
958
|
+
*
|
959
|
+
* `ngtcp2_conn_loss_detection_expiry` returns the expiry time point
|
960
|
+
* of loss detection timer. One should call
|
961
|
+
* `ngtcp2_conn_on_loss_detection_timer` and `ngtcp2_conn_write_pkt`
|
962
|
+
* (or `ngtcp2_conn_writev_stream`) when it expires. It returns
|
963
|
+
* UINT64_MAX if loss detection timer is not armed.
|
964
|
+
*/
|
965
|
+
ngtcp2_tstamp ngtcp2_conn_loss_detection_expiry(ngtcp2_conn *conn);
|
966
|
+
|
967
|
+
/**
|
968
|
+
* @function
|
969
|
+
*
|
970
|
+
* `ngtcp2_conn_get_idle_expiry` returns the time when a connection
|
971
|
+
* should be closed if it continues to be idle. If idle timeout is
|
972
|
+
* disabled, this function returns ``UINT64_MAX``.
|
973
|
+
*/
|
974
|
+
ngtcp2_tstamp ngtcp2_conn_get_idle_expiry(ngtcp2_conn *conn);
|
975
|
+
|
976
|
+
ngtcp2_duration ngtcp2_conn_compute_pto(ngtcp2_conn *conn, ngtcp2_pktns *pktns);
|
977
|
+
|
978
|
+
/*
|
979
|
+
* ngtcp2_conn_track_retired_dcid_seq tracks the sequence number |seq|
|
980
|
+
* of unacknowledged retiring Destination Connection ID.
|
981
|
+
*
|
982
|
+
* This function returns 0 if it succeeds, or one of the following
|
983
|
+
* negative error codes:
|
984
|
+
*
|
985
|
+
* NGTCP2_ERR_CONNECTION_ID_LIMIT
|
986
|
+
* The number of unacknowledged retirement exceeds the limit.
|
987
|
+
*/
|
988
|
+
int ngtcp2_conn_track_retired_dcid_seq(ngtcp2_conn *conn, uint64_t seq);
|
989
|
+
|
990
|
+
/*
|
991
|
+
* ngtcp2_conn_untrack_retired_dcid_seq deletes the sequence number
|
992
|
+
* |seq| of unacknowledged retiring Destination Connection ID. It is
|
993
|
+
* fine if such sequence number is not found.
|
994
|
+
*/
|
995
|
+
void ngtcp2_conn_untrack_retired_dcid_seq(ngtcp2_conn *conn, uint64_t seq);
|
996
|
+
|
997
|
+
/*
|
998
|
+
* ngtcp2_conn_server_negotiate_version negotiates QUIC version. It
|
999
|
+
* is compatible version negotiation. It returns the negotiated QUIC
|
1000
|
+
* version. This function must not be called by client.
|
1001
|
+
*/
|
1002
|
+
uint32_t
|
1003
|
+
ngtcp2_conn_server_negotiate_version(ngtcp2_conn *conn,
|
1004
|
+
const ngtcp2_version_info *version_info);
|
1005
|
+
|
1006
|
+
/**
|
1007
|
+
* @function
|
1008
|
+
*
|
1009
|
+
* `ngtcp2_conn_write_connection_close_pkt` writes a packet which
|
1010
|
+
* contains a CONNECTION_CLOSE frame (type 0x1c) in the buffer pointed
|
1011
|
+
* by |dest| whose capacity is |datalen|.
|
1012
|
+
*
|
1013
|
+
* If |path| is not ``NULL``, this function stores the network path
|
1014
|
+
* with which the packet should be sent. Each addr field must point
|
1015
|
+
* to the buffer which should be at least ``sizeof(struct
|
1016
|
+
* sockaddr_storage)`` bytes long. The assignment might not be done
|
1017
|
+
* if nothing is written to |dest|.
|
1018
|
+
*
|
1019
|
+
* If |pi| is not ``NULL``, this function stores packet metadata in it
|
1020
|
+
* if it succeeds. The metadata includes ECN markings.
|
1021
|
+
*
|
1022
|
+
* This function must not be called from inside the callback
|
1023
|
+
* functions.
|
1024
|
+
*
|
1025
|
+
* At the moment, successful call to this function makes connection
|
1026
|
+
* close. We may change this behaviour in the future to allow
|
1027
|
+
* graceful shutdown.
|
1028
|
+
*
|
1029
|
+
* This function returns the number of bytes written in |dest| if it
|
1030
|
+
* succeeds, or one of the following negative error codes:
|
1031
|
+
*
|
1032
|
+
* :macro:`NGTCP2_ERR_NOMEM`
|
1033
|
+
* Out of memory
|
1034
|
+
* :macro:`NGTCP2_ERR_NOBUF`
|
1035
|
+
* Buffer is too small
|
1036
|
+
* :macro:`NGTCP2_ERR_INVALID_STATE`
|
1037
|
+
* The current state does not allow sending CONNECTION_CLOSE.
|
1038
|
+
* :macro:`NGTCP2_ERR_PKT_NUM_EXHAUSTED`
|
1039
|
+
* Packet number is exhausted, and cannot send any more packet.
|
1040
|
+
* :macro:`NGTCP2_ERR_CALLBACK_FAILURE`
|
1041
|
+
* User callback failed
|
1042
|
+
*/
|
1043
|
+
ngtcp2_ssize ngtcp2_conn_write_connection_close_pkt(
|
1044
|
+
ngtcp2_conn *conn, ngtcp2_path *path, ngtcp2_pkt_info *pi, uint8_t *dest,
|
1045
|
+
size_t destlen, uint64_t error_code, const uint8_t *reason,
|
1046
|
+
size_t reasonlen, ngtcp2_tstamp ts);
|
1047
|
+
|
1048
|
+
/**
|
1049
|
+
* @function
|
1050
|
+
*
|
1051
|
+
* `ngtcp2_conn_write_application_close_pkt` writes a packet which
|
1052
|
+
* contains a CONNECTION_CLOSE frame (type 0x1d) in the buffer pointed
|
1053
|
+
* by |dest| whose capacity is |datalen|.
|
1054
|
+
*
|
1055
|
+
* If |path| is not ``NULL``, this function stores the network path
|
1056
|
+
* with which the packet should be sent. Each addr field must point
|
1057
|
+
* to the buffer which should be at least ``sizeof(struct
|
1058
|
+
* sockaddr_storage)`` bytes long. The assignment might not be done
|
1059
|
+
* if nothing is written to |dest|.
|
1060
|
+
*
|
1061
|
+
* If |pi| is not ``NULL``, this function stores packet metadata in it
|
1062
|
+
* if it succeeds. The metadata includes ECN markings.
|
1063
|
+
*
|
1064
|
+
* If handshake has not been confirmed yet, CONNECTION_CLOSE (type
|
1065
|
+
* 0x1c) with error code :macro:`NGTCP2_APPLICATION_ERROR` is written
|
1066
|
+
* instead.
|
1067
|
+
*
|
1068
|
+
* This function must not be called from inside the callback
|
1069
|
+
* functions.
|
1070
|
+
*
|
1071
|
+
* At the moment, successful call to this function makes connection
|
1072
|
+
* close. We may change this behaviour in the future to allow
|
1073
|
+
* graceful shutdown.
|
1074
|
+
*
|
1075
|
+
* This function returns the number of bytes written in |dest| if it
|
1076
|
+
* succeeds, or one of the following negative error codes:
|
1077
|
+
*
|
1078
|
+
* :macro:`NGTCP2_ERR_NOMEM`
|
1079
|
+
* Out of memory
|
1080
|
+
* :macro:`NGTCP2_ERR_NOBUF`
|
1081
|
+
* Buffer is too small
|
1082
|
+
* :macro:`NGTCP2_ERR_INVALID_STATE`
|
1083
|
+
* The current state does not allow sending CONNECTION_CLOSE.
|
1084
|
+
* :macro:`NGTCP2_ERR_PKT_NUM_EXHAUSTED`
|
1085
|
+
* Packet number is exhausted, and cannot send any more packet.
|
1086
|
+
* :macro:`NGTCP2_ERR_CALLBACK_FAILURE`
|
1087
|
+
* User callback failed
|
1088
|
+
*/
|
1089
|
+
ngtcp2_ssize ngtcp2_conn_write_application_close_pkt(
|
1090
|
+
ngtcp2_conn *conn, ngtcp2_path *path, ngtcp2_pkt_info *pi, uint8_t *dest,
|
1091
|
+
size_t destlen, uint64_t app_error_code, const uint8_t *reason,
|
1092
|
+
size_t reasonlen, ngtcp2_tstamp ts);
|
1093
|
+
|
1094
|
+
int ngtcp2_conn_start_pmtud(ngtcp2_conn *conn);
|
1095
|
+
|
1096
|
+
void ngtcp2_conn_stop_pmtud(ngtcp2_conn *conn);
|
1097
|
+
|
1098
|
+
/**
|
1099
|
+
* @function
|
1100
|
+
*
|
1101
|
+
* `ngtcp2_conn_set_remote_transport_params` sets transport parameter
|
1102
|
+
* |params| from a remote endpoint to |conn|.
|
1103
|
+
*
|
1104
|
+
* This function returns 0 if it succeeds, or one of the following
|
1105
|
+
* negative error codes:
|
1106
|
+
*
|
1107
|
+
* :macro:`NGTCP2_ERR_TRANSPORT_PARAM`
|
1108
|
+
* Failed to validate a remote transport parameters.
|
1109
|
+
* :macro:`NGTCP2_ERR_VERSION_NEGOTIATION_FAILURE`
|
1110
|
+
* Version negotiation failure.
|
1111
|
+
* :macro:`NGTCP2_ERR_CALLBACK_FAILURE`
|
1112
|
+
* User callback failed
|
1113
|
+
* :macro:`NGTCP2_ERR_NOMEM`
|
1114
|
+
* Out of memory.
|
1115
|
+
*/
|
1116
|
+
int ngtcp2_conn_set_remote_transport_params(
|
1117
|
+
ngtcp2_conn *conn, const ngtcp2_transport_params *params);
|
1118
|
+
|
1119
|
+
#endif /* NGTCP2_CONN_H */
|