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,1235 @@
|
|
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_PKT_H
|
26
|
+
#define NGTCP2_PKT_H
|
27
|
+
|
28
|
+
#ifdef HAVE_CONFIG_H
|
29
|
+
# include <config.h>
|
30
|
+
#endif /* HAVE_CONFIG_H */
|
31
|
+
|
32
|
+
#include <ngtcp2/ngtcp2.h>
|
33
|
+
|
34
|
+
/* QUIC header macros */
|
35
|
+
#define NGTCP2_HEADER_FORM_BIT 0x80
|
36
|
+
#define NGTCP2_FIXED_BIT_MASK 0x40
|
37
|
+
#define NGTCP2_PKT_NUMLEN_MASK 0x03
|
38
|
+
|
39
|
+
/* Long header specific macros */
|
40
|
+
#define NGTCP2_LONG_TYPE_MASK 0x30
|
41
|
+
#define NGTCP2_LONG_RESERVED_BIT_MASK 0x0c
|
42
|
+
|
43
|
+
/* Short header specific macros */
|
44
|
+
#define NGTCP2_SHORT_SPIN_BIT_MASK 0x20
|
45
|
+
#define NGTCP2_SHORT_RESERVED_BIT_MASK 0x18
|
46
|
+
#define NGTCP2_SHORT_KEY_PHASE_BIT 0x04
|
47
|
+
|
48
|
+
/* NGTCP2_SR_TYPE is a Type field of Stateless Reset. */
|
49
|
+
#define NGTCP2_SR_TYPE 0x1f
|
50
|
+
|
51
|
+
/* NGTCP2_MIN_LONG_HEADERLEN is the minimum length of long header.
|
52
|
+
That is (1|1|TT|RR|PP)<1> + VERSION<4> + DCIL<1> + SCIL<1> +
|
53
|
+
LENGTH<1> + PKN<1> */
|
54
|
+
#define NGTCP2_MIN_LONG_HEADERLEN (1 + 4 + 1 + 1 + 1 + 1)
|
55
|
+
|
56
|
+
#define NGTCP2_STREAM_FIN_BIT 0x01
|
57
|
+
#define NGTCP2_STREAM_LEN_BIT 0x02
|
58
|
+
#define NGTCP2_STREAM_OFF_BIT 0x04
|
59
|
+
|
60
|
+
/* NGTCP2_STREAM_OVERHEAD is the maximum number of bytes required
|
61
|
+
other than payload for STREAM frame. That is from type field to
|
62
|
+
the beginning of the payload. */
|
63
|
+
#define NGTCP2_STREAM_OVERHEAD (1 + 8 + 8 + 8)
|
64
|
+
|
65
|
+
/* NGTCP2_CRYPTO_OVERHEAD is the maximum number of bytes required
|
66
|
+
other than payload for CRYPTO frame. That is from type field to
|
67
|
+
the beginning of the payload. */
|
68
|
+
#define NGTCP2_CRYPTO_OVERHEAD (1 + 8 + 8)
|
69
|
+
|
70
|
+
/* NGTCP2_DATAGRAM_OVERHEAD is the maximum number of bytes required
|
71
|
+
other than payload for DATAGRAM frame. That is from type field to
|
72
|
+
the beginning of the payload. */
|
73
|
+
#define NGTCP2_DATAGRAM_OVERHEAD (1 + 8)
|
74
|
+
|
75
|
+
/* NGTCP2_MIN_FRAME_PAYLOADLEN is the minimum frame payload length. */
|
76
|
+
#define NGTCP2_MIN_FRAME_PAYLOADLEN 16
|
77
|
+
|
78
|
+
/* NGTCP2_MAX_SERVER_STREAM_ID_BIDI is the maximum bidirectional
|
79
|
+
server stream ID. */
|
80
|
+
#define NGTCP2_MAX_SERVER_STREAM_ID_BIDI ((int64_t)0x3ffffffffffffffdll)
|
81
|
+
/* NGTCP2_MAX_CLIENT_STREAM_ID_BIDI is the maximum bidirectional
|
82
|
+
client stream ID. */
|
83
|
+
#define NGTCP2_MAX_CLIENT_STREAM_ID_BIDI ((int64_t)0x3ffffffffffffffcll)
|
84
|
+
/* NGTCP2_MAX_SERVER_STREAM_ID_UNI is the maximum unidirectional
|
85
|
+
server stream ID. */
|
86
|
+
#define NGTCP2_MAX_SERVER_STREAM_ID_UNI ((int64_t)0x3fffffffffffffffll)
|
87
|
+
/* NGTCP2_MAX_CLIENT_STREAM_ID_UNI is the maximum unidirectional
|
88
|
+
client stream ID. */
|
89
|
+
#define NGTCP2_MAX_CLIENT_STREAM_ID_UNI ((int64_t)0x3ffffffffffffffell)
|
90
|
+
|
91
|
+
/* NGTCP2_MAX_NUM_ACK_RANGES is the maximum number of Additional ACK
|
92
|
+
ranges which this library can create, or decode. */
|
93
|
+
#define NGTCP2_MAX_ACK_RANGES 32
|
94
|
+
|
95
|
+
/* NGTCP2_MAX_PKT_NUM is the maximum packet number. */
|
96
|
+
#define NGTCP2_MAX_PKT_NUM ((int64_t)((1ll << 62) - 1))
|
97
|
+
|
98
|
+
/* NGTCP2_MIN_PKT_EXPANDLEN is the minimum packet size expansion in
|
99
|
+
addition to the minimum DCID length to hide/trigger Stateless
|
100
|
+
Reset. */
|
101
|
+
#define NGTCP2_MIN_PKT_EXPANDLEN 22
|
102
|
+
|
103
|
+
/* NGTCP2_RETRY_TAGLEN is the length of Retry packet integrity tag. */
|
104
|
+
#define NGTCP2_RETRY_TAGLEN 16
|
105
|
+
|
106
|
+
/* NGTCP2_HARD_MAX_UDP_PAYLOAD_SIZE is the maximum UDP payload size
|
107
|
+
that this library can write. */
|
108
|
+
#define NGTCP2_HARD_MAX_UDP_PAYLOAD_SIZE ((1 << 24) - 1)
|
109
|
+
|
110
|
+
/* NGTCP2_PKT_LENGTHLEN is the number of bytes that is occupied by
|
111
|
+
Length field in Long packet header. */
|
112
|
+
#define NGTCP2_PKT_LENGTHLEN 4
|
113
|
+
|
114
|
+
/* NGTCP2_PKT_TYPE_INITIAL_V1 is Initial long header packet type for
|
115
|
+
QUIC v1. */
|
116
|
+
#define NGTCP2_PKT_TYPE_INITIAL_V1 0x0
|
117
|
+
/* NGTCP2_PKT_TYPE_0RTT_V1 is 0RTT long header packet type for QUIC
|
118
|
+
v1. */
|
119
|
+
#define NGTCP2_PKT_TYPE_0RTT_V1 0x1
|
120
|
+
/* NGTCP2_PKT_TYPE_HANDSHAKE_V1 is Handshake long header packet type
|
121
|
+
for QUIC v1. */
|
122
|
+
#define NGTCP2_PKT_TYPE_HANDSHAKE_V1 0x2
|
123
|
+
/* NGTCP2_PKT_TYPE_RETRY_V1 is Retry long header packet type for QUIC
|
124
|
+
v1. */
|
125
|
+
#define NGTCP2_PKT_TYPE_RETRY_V1 0x3
|
126
|
+
|
127
|
+
/* NGTCP2_PKT_TYPE_INITIAL_V2 is Initial long header packet type for
|
128
|
+
QUIC v2. */
|
129
|
+
#define NGTCP2_PKT_TYPE_INITIAL_V2 0x1
|
130
|
+
/* NGTCP2_PKT_TYPE_0RTT_V2 is 0RTT long header packet type for QUIC
|
131
|
+
v2. */
|
132
|
+
#define NGTCP2_PKT_TYPE_0RTT_V2 0x2
|
133
|
+
/* NGTCP2_PKT_TYPE_HANDSHAKE_V2 is Handshake long header packet type
|
134
|
+
for QUIC v2. */
|
135
|
+
#define NGTCP2_PKT_TYPE_HANDSHAKE_V2 0x3
|
136
|
+
/* NGTCP2_PKT_TYPE_RETRY_V2 is Retry long header packet type for QUIC
|
137
|
+
v2. */
|
138
|
+
#define NGTCP2_PKT_TYPE_RETRY_V2 0x0
|
139
|
+
|
140
|
+
typedef struct ngtcp2_pkt_retry {
|
141
|
+
ngtcp2_cid odcid;
|
142
|
+
uint8_t *token;
|
143
|
+
size_t tokenlen;
|
144
|
+
uint8_t tag[NGTCP2_RETRY_TAGLEN];
|
145
|
+
} ngtcp2_pkt_retry;
|
146
|
+
|
147
|
+
typedef enum {
|
148
|
+
NGTCP2_FRAME_PADDING = 0x00,
|
149
|
+
NGTCP2_FRAME_PING = 0x01,
|
150
|
+
NGTCP2_FRAME_ACK = 0x02,
|
151
|
+
NGTCP2_FRAME_ACK_ECN = 0x03,
|
152
|
+
NGTCP2_FRAME_RESET_STREAM = 0x04,
|
153
|
+
NGTCP2_FRAME_STOP_SENDING = 0x05,
|
154
|
+
NGTCP2_FRAME_CRYPTO = 0x06,
|
155
|
+
NGTCP2_FRAME_NEW_TOKEN = 0x07,
|
156
|
+
NGTCP2_FRAME_STREAM = 0x08,
|
157
|
+
NGTCP2_FRAME_MAX_DATA = 0x10,
|
158
|
+
NGTCP2_FRAME_MAX_STREAM_DATA = 0x11,
|
159
|
+
NGTCP2_FRAME_MAX_STREAMS_BIDI = 0x12,
|
160
|
+
NGTCP2_FRAME_MAX_STREAMS_UNI = 0x13,
|
161
|
+
NGTCP2_FRAME_DATA_BLOCKED = 0x14,
|
162
|
+
NGTCP2_FRAME_STREAM_DATA_BLOCKED = 0x15,
|
163
|
+
NGTCP2_FRAME_STREAMS_BLOCKED_BIDI = 0x16,
|
164
|
+
NGTCP2_FRAME_STREAMS_BLOCKED_UNI = 0x17,
|
165
|
+
NGTCP2_FRAME_NEW_CONNECTION_ID = 0x18,
|
166
|
+
NGTCP2_FRAME_RETIRE_CONNECTION_ID = 0x19,
|
167
|
+
NGTCP2_FRAME_PATH_CHALLENGE = 0x1a,
|
168
|
+
NGTCP2_FRAME_PATH_RESPONSE = 0x1b,
|
169
|
+
NGTCP2_FRAME_CONNECTION_CLOSE = 0x1c,
|
170
|
+
NGTCP2_FRAME_CONNECTION_CLOSE_APP = 0x1d,
|
171
|
+
NGTCP2_FRAME_HANDSHAKE_DONE = 0x1e,
|
172
|
+
NGTCP2_FRAME_DATAGRAM = 0x30,
|
173
|
+
NGTCP2_FRAME_DATAGRAM_LEN = 0x31,
|
174
|
+
} ngtcp2_frame_type;
|
175
|
+
|
176
|
+
typedef struct ngtcp2_stream {
|
177
|
+
uint8_t type;
|
178
|
+
/**
|
179
|
+
* flags of decoded STREAM frame. This gets ignored when encoding
|
180
|
+
* STREAM frame.
|
181
|
+
*/
|
182
|
+
uint8_t flags;
|
183
|
+
uint8_t fin;
|
184
|
+
int64_t stream_id;
|
185
|
+
uint64_t offset;
|
186
|
+
/* datacnt is the number of elements that data contains. Although
|
187
|
+
the length of data is 1 in this definition, the library may
|
188
|
+
allocate extra bytes to hold more elements. */
|
189
|
+
size_t datacnt;
|
190
|
+
/* data is the array of ngtcp2_vec which references data. */
|
191
|
+
ngtcp2_vec data[1];
|
192
|
+
} ngtcp2_stream;
|
193
|
+
|
194
|
+
typedef struct ngtcp2_ack_range {
|
195
|
+
uint64_t gap;
|
196
|
+
uint64_t len;
|
197
|
+
} ngtcp2_ack_range;
|
198
|
+
|
199
|
+
typedef struct ngtcp2_ack {
|
200
|
+
uint8_t type;
|
201
|
+
int64_t largest_ack;
|
202
|
+
uint64_t ack_delay;
|
203
|
+
/**
|
204
|
+
* ack_delay_unscaled is an ack_delay multiplied by
|
205
|
+
* 2**ack_delay_component * NGTCP2_MICROSECONDS.
|
206
|
+
*/
|
207
|
+
ngtcp2_duration ack_delay_unscaled;
|
208
|
+
struct {
|
209
|
+
uint64_t ect0;
|
210
|
+
uint64_t ect1;
|
211
|
+
uint64_t ce;
|
212
|
+
} ecn;
|
213
|
+
uint64_t first_ack_range;
|
214
|
+
size_t rangecnt;
|
215
|
+
ngtcp2_ack_range ranges[1];
|
216
|
+
} ngtcp2_ack;
|
217
|
+
|
218
|
+
typedef struct ngtcp2_padding {
|
219
|
+
uint8_t type;
|
220
|
+
/**
|
221
|
+
* The length of contiguous PADDING frames.
|
222
|
+
*/
|
223
|
+
size_t len;
|
224
|
+
} ngtcp2_padding;
|
225
|
+
|
226
|
+
typedef struct ngtcp2_reset_stream {
|
227
|
+
uint8_t type;
|
228
|
+
int64_t stream_id;
|
229
|
+
uint64_t app_error_code;
|
230
|
+
uint64_t final_size;
|
231
|
+
} ngtcp2_reset_stream;
|
232
|
+
|
233
|
+
typedef struct ngtcp2_connection_close {
|
234
|
+
uint8_t type;
|
235
|
+
uint64_t error_code;
|
236
|
+
uint64_t frame_type;
|
237
|
+
size_t reasonlen;
|
238
|
+
uint8_t *reason;
|
239
|
+
} ngtcp2_connection_close;
|
240
|
+
|
241
|
+
typedef struct ngtcp2_max_data {
|
242
|
+
uint8_t type;
|
243
|
+
/**
|
244
|
+
* max_data is Maximum Data.
|
245
|
+
*/
|
246
|
+
uint64_t max_data;
|
247
|
+
} ngtcp2_max_data;
|
248
|
+
|
249
|
+
typedef struct ngtcp2_max_stream_data {
|
250
|
+
uint8_t type;
|
251
|
+
int64_t stream_id;
|
252
|
+
uint64_t max_stream_data;
|
253
|
+
} ngtcp2_max_stream_data;
|
254
|
+
|
255
|
+
typedef struct ngtcp2_max_streams {
|
256
|
+
uint8_t type;
|
257
|
+
uint64_t max_streams;
|
258
|
+
} ngtcp2_max_streams;
|
259
|
+
|
260
|
+
typedef struct ngtcp2_ping {
|
261
|
+
uint8_t type;
|
262
|
+
} ngtcp2_ping;
|
263
|
+
|
264
|
+
typedef struct ngtcp2_data_blocked {
|
265
|
+
uint8_t type;
|
266
|
+
uint64_t offset;
|
267
|
+
} ngtcp2_data_blocked;
|
268
|
+
|
269
|
+
typedef struct ngtcp2_stream_data_blocked {
|
270
|
+
uint8_t type;
|
271
|
+
int64_t stream_id;
|
272
|
+
uint64_t offset;
|
273
|
+
} ngtcp2_stream_data_blocked;
|
274
|
+
|
275
|
+
typedef struct ngtcp2_streams_blocked {
|
276
|
+
uint8_t type;
|
277
|
+
uint64_t max_streams;
|
278
|
+
} ngtcp2_streams_blocked;
|
279
|
+
|
280
|
+
typedef struct ngtcp2_new_connection_id {
|
281
|
+
uint8_t type;
|
282
|
+
uint64_t seq;
|
283
|
+
uint64_t retire_prior_to;
|
284
|
+
ngtcp2_cid cid;
|
285
|
+
uint8_t stateless_reset_token[NGTCP2_STATELESS_RESET_TOKENLEN];
|
286
|
+
} ngtcp2_new_connection_id;
|
287
|
+
|
288
|
+
typedef struct ngtcp2_stop_sending {
|
289
|
+
uint8_t type;
|
290
|
+
int64_t stream_id;
|
291
|
+
uint64_t app_error_code;
|
292
|
+
} ngtcp2_stop_sending;
|
293
|
+
|
294
|
+
typedef struct ngtcp2_path_challenge {
|
295
|
+
uint8_t type;
|
296
|
+
uint8_t data[NGTCP2_PATH_CHALLENGE_DATALEN];
|
297
|
+
} ngtcp2_path_challenge;
|
298
|
+
|
299
|
+
typedef struct ngtcp2_path_response {
|
300
|
+
uint8_t type;
|
301
|
+
uint8_t data[NGTCP2_PATH_CHALLENGE_DATALEN];
|
302
|
+
} ngtcp2_path_response;
|
303
|
+
|
304
|
+
typedef struct ngtcp2_crypto {
|
305
|
+
uint8_t type;
|
306
|
+
uint64_t offset;
|
307
|
+
/* datacnt is the number of elements that data contains. Although
|
308
|
+
the length of data is 1 in this definition, the library may
|
309
|
+
allocate extra bytes to hold more elements. */
|
310
|
+
size_t datacnt;
|
311
|
+
/* data is the array of ngtcp2_vec which references data. */
|
312
|
+
ngtcp2_vec data[1];
|
313
|
+
} ngtcp2_crypto;
|
314
|
+
|
315
|
+
typedef struct ngtcp2_new_token {
|
316
|
+
uint8_t type;
|
317
|
+
uint8_t *token;
|
318
|
+
size_t tokenlen;
|
319
|
+
} ngtcp2_new_token;
|
320
|
+
|
321
|
+
typedef struct ngtcp2_retire_connection_id {
|
322
|
+
uint8_t type;
|
323
|
+
uint64_t seq;
|
324
|
+
} ngtcp2_retire_connection_id;
|
325
|
+
|
326
|
+
typedef struct ngtcp2_handshake_done {
|
327
|
+
uint8_t type;
|
328
|
+
} ngtcp2_handshake_done;
|
329
|
+
|
330
|
+
typedef struct ngtcp2_datagram {
|
331
|
+
uint8_t type;
|
332
|
+
/* dgram_id is an opaque identifier chosen by an application. */
|
333
|
+
uint64_t dgram_id;
|
334
|
+
/* datacnt is the number of elements that data contains. */
|
335
|
+
size_t datacnt;
|
336
|
+
/* data is a pointer to ngtcp2_vec array that stores data. */
|
337
|
+
ngtcp2_vec *data;
|
338
|
+
/* rdata is conveniently embedded to ngtcp2_datagram, so that data
|
339
|
+
field can just point to the address of this field to store a
|
340
|
+
single vector which is the case when DATAGRAM is received from a
|
341
|
+
remote endpoint. */
|
342
|
+
ngtcp2_vec rdata[1];
|
343
|
+
} ngtcp2_datagram;
|
344
|
+
|
345
|
+
typedef union ngtcp2_frame {
|
346
|
+
uint8_t type;
|
347
|
+
ngtcp2_stream stream;
|
348
|
+
ngtcp2_ack ack;
|
349
|
+
ngtcp2_padding padding;
|
350
|
+
ngtcp2_reset_stream reset_stream;
|
351
|
+
ngtcp2_connection_close connection_close;
|
352
|
+
ngtcp2_max_data max_data;
|
353
|
+
ngtcp2_max_stream_data max_stream_data;
|
354
|
+
ngtcp2_max_streams max_streams;
|
355
|
+
ngtcp2_ping ping;
|
356
|
+
ngtcp2_data_blocked data_blocked;
|
357
|
+
ngtcp2_stream_data_blocked stream_data_blocked;
|
358
|
+
ngtcp2_streams_blocked streams_blocked;
|
359
|
+
ngtcp2_new_connection_id new_connection_id;
|
360
|
+
ngtcp2_stop_sending stop_sending;
|
361
|
+
ngtcp2_path_challenge path_challenge;
|
362
|
+
ngtcp2_path_response path_response;
|
363
|
+
ngtcp2_crypto crypto;
|
364
|
+
ngtcp2_new_token new_token;
|
365
|
+
ngtcp2_retire_connection_id retire_connection_id;
|
366
|
+
ngtcp2_handshake_done handshake_done;
|
367
|
+
ngtcp2_datagram datagram;
|
368
|
+
} ngtcp2_frame;
|
369
|
+
|
370
|
+
typedef struct ngtcp2_pkt_chain ngtcp2_pkt_chain;
|
371
|
+
|
372
|
+
/*
|
373
|
+
* ngtcp2_pkt_chain is the chain of incoming packets buffered.
|
374
|
+
*/
|
375
|
+
struct ngtcp2_pkt_chain {
|
376
|
+
ngtcp2_path_storage path;
|
377
|
+
ngtcp2_pkt_info pi;
|
378
|
+
ngtcp2_pkt_chain *next;
|
379
|
+
uint8_t *pkt;
|
380
|
+
/* pktlen is length of a QUIC packet. */
|
381
|
+
size_t pktlen;
|
382
|
+
/* dgramlen is length of UDP datagram that a QUIC packet is
|
383
|
+
included. */
|
384
|
+
size_t dgramlen;
|
385
|
+
ngtcp2_tstamp ts;
|
386
|
+
};
|
387
|
+
|
388
|
+
/*
|
389
|
+
* ngtcp2_pkt_chain_new allocates ngtcp2_pkt_chain objects, and
|
390
|
+
* assigns its pointer to |*ppc|. The content of buffer pointed by
|
391
|
+
* |pkt| of length |pktlen| is copied into |*ppc|. The packet is
|
392
|
+
* obtained via the network |path|. The values of path->local and
|
393
|
+
* path->remote are copied into |*ppc|.
|
394
|
+
*
|
395
|
+
* This function returns 0 if it succeeds, or one of the following
|
396
|
+
* negative error codes:
|
397
|
+
*
|
398
|
+
* NGTCP2_ERR_NOMEM
|
399
|
+
* Out of memory.
|
400
|
+
*/
|
401
|
+
int ngtcp2_pkt_chain_new(ngtcp2_pkt_chain **ppc, const ngtcp2_path *path,
|
402
|
+
const ngtcp2_pkt_info *pi, const uint8_t *pkt,
|
403
|
+
size_t pktlen, size_t dgramlen, ngtcp2_tstamp ts,
|
404
|
+
const ngtcp2_mem *mem);
|
405
|
+
|
406
|
+
/*
|
407
|
+
* ngtcp2_pkt_chain_del deallocates |pc|. It also frees the memory
|
408
|
+
* pointed by |pc|.
|
409
|
+
*/
|
410
|
+
void ngtcp2_pkt_chain_del(ngtcp2_pkt_chain *pc, const ngtcp2_mem *mem);
|
411
|
+
|
412
|
+
/*
|
413
|
+
* ngtcp2_pkt_hd_init initializes |hd| with the given values. If
|
414
|
+
* |dcid| and/or |scid| is NULL, DCID and SCID of |hd| is empty
|
415
|
+
* respectively. |pkt_numlen| is the number of bytes used to encode
|
416
|
+
* |pkt_num| and either 1, 2, or 4. |version| is QUIC version for
|
417
|
+
* long header. |len| is the length field of Initial, 0RTT, and
|
418
|
+
* Handshake packets.
|
419
|
+
*/
|
420
|
+
void ngtcp2_pkt_hd_init(ngtcp2_pkt_hd *hd, uint8_t flags, uint8_t type,
|
421
|
+
const ngtcp2_cid *dcid, const ngtcp2_cid *scid,
|
422
|
+
int64_t pkt_num, size_t pkt_numlen, uint32_t version,
|
423
|
+
size_t len);
|
424
|
+
|
425
|
+
/*
|
426
|
+
* ngtcp2_pkt_encode_hd_long encodes |hd| as QUIC long header into
|
427
|
+
* |out| which has length |outlen|. It returns the number of bytes
|
428
|
+
* written into |outlen| if it succeeds, or one of the following
|
429
|
+
* negative error codes:
|
430
|
+
*
|
431
|
+
* NGTCP2_ERR_NOBUF
|
432
|
+
* Buffer is too short
|
433
|
+
*/
|
434
|
+
ngtcp2_ssize ngtcp2_pkt_encode_hd_long(uint8_t *out, size_t outlen,
|
435
|
+
const ngtcp2_pkt_hd *hd);
|
436
|
+
|
437
|
+
/*
|
438
|
+
* ngtcp2_pkt_encode_hd_short encodes |hd| as QUIC short header into
|
439
|
+
* |out| which has length |outlen|. It returns the number of bytes
|
440
|
+
* written into |outlen| if it succeeds, or one of the following
|
441
|
+
* negative error codes:
|
442
|
+
*
|
443
|
+
* NGTCP2_ERR_NOBUF
|
444
|
+
* Buffer is too short
|
445
|
+
*/
|
446
|
+
ngtcp2_ssize ngtcp2_pkt_encode_hd_short(uint8_t *out, size_t outlen,
|
447
|
+
const ngtcp2_pkt_hd *hd);
|
448
|
+
|
449
|
+
/**
|
450
|
+
* @function
|
451
|
+
*
|
452
|
+
* `ngtcp2_pkt_decode_frame` decodes a QUIC frame from the buffer
|
453
|
+
* pointed by |payload| whose length is |payloadlen|.
|
454
|
+
*
|
455
|
+
* This function returns the number of bytes read to decode a single
|
456
|
+
* frame if it succeeds, or one of the following negative error codes:
|
457
|
+
*
|
458
|
+
* :enum:`NGTCP2_ERR_FRAME_ENCODING`
|
459
|
+
* Frame is badly formatted; or frame type is unknown; or
|
460
|
+
* |payloadlen| is 0.
|
461
|
+
*/
|
462
|
+
ngtcp2_ssize ngtcp2_pkt_decode_frame(ngtcp2_frame *dest, const uint8_t *payload,
|
463
|
+
size_t payloadlen);
|
464
|
+
|
465
|
+
/**
|
466
|
+
* @function
|
467
|
+
*
|
468
|
+
* `ngtcp2_pkt_encode_frame` encodes a frame |fm| into the buffer
|
469
|
+
* pointed by |out| of length |outlen|.
|
470
|
+
*
|
471
|
+
* This function returns the number of bytes written to the buffer, or
|
472
|
+
* one of the following negative error codes:
|
473
|
+
*
|
474
|
+
* :enum:`NGTCP2_ERR_NOBUF`
|
475
|
+
* Buffer does not have enough capacity to write a frame.
|
476
|
+
*/
|
477
|
+
ngtcp2_ssize ngtcp2_pkt_encode_frame(uint8_t *out, size_t outlen,
|
478
|
+
ngtcp2_frame *fr);
|
479
|
+
|
480
|
+
/*
|
481
|
+
* ngtcp2_pkt_decode_version_negotiation decodes Version Negotiation
|
482
|
+
* packet payload |payload| of length |payloadlen|, and stores the
|
483
|
+
* result in |dest|. |dest| must have enough capacity to store the
|
484
|
+
* result. |payloadlen| also must be a multiple of sizeof(uint32_t).
|
485
|
+
*
|
486
|
+
* This function returns the number of versions written in |dest|.
|
487
|
+
*/
|
488
|
+
size_t ngtcp2_pkt_decode_version_negotiation(uint32_t *dest,
|
489
|
+
const uint8_t *payload,
|
490
|
+
size_t payloadlen);
|
491
|
+
|
492
|
+
/*
|
493
|
+
* ngtcp2_pkt_decode_stateless_reset decodes Stateless Reset payload
|
494
|
+
* |payload| of length |payloadlen|. The |payload| must start with
|
495
|
+
* Stateless Reset Token.
|
496
|
+
*
|
497
|
+
* This function returns 0 if it succeeds, or one of the following
|
498
|
+
* negative error codes:
|
499
|
+
*
|
500
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
501
|
+
* Payloadlen is too short.
|
502
|
+
*/
|
503
|
+
int ngtcp2_pkt_decode_stateless_reset(ngtcp2_pkt_stateless_reset *sr,
|
504
|
+
const uint8_t *payload,
|
505
|
+
size_t payloadlen);
|
506
|
+
|
507
|
+
/*
|
508
|
+
* ngtcp2_pkt_decode_retry decodes Retry packet payload |payload| of
|
509
|
+
* length |payloadlen|. The |payload| must start with Retry token
|
510
|
+
* field.
|
511
|
+
*
|
512
|
+
* This function returns 0 if it succeeds, or one of the following
|
513
|
+
* negative error codes:
|
514
|
+
*
|
515
|
+
* NGTCP2_ERR_INVALID_ARGUMENT
|
516
|
+
* Payloadlen is too short.
|
517
|
+
*/
|
518
|
+
int ngtcp2_pkt_decode_retry(ngtcp2_pkt_retry *dest, const uint8_t *payload,
|
519
|
+
size_t payloadlen);
|
520
|
+
|
521
|
+
/*
|
522
|
+
* ngtcp2_pkt_decode_stream_frame decodes STREAM frame from |payload|
|
523
|
+
* of length |payloadlen|. The result is stored in the object pointed
|
524
|
+
* by |dest|. STREAM frame must start at payload[0]. This function
|
525
|
+
* finishes when it decodes one STREAM frame, and returns the exact
|
526
|
+
* number of bytes read to decode a frame if it succeeds, or one of
|
527
|
+
* the following negative error codes:
|
528
|
+
*
|
529
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
530
|
+
* Payload is too short to include STREAM frame.
|
531
|
+
*/
|
532
|
+
ngtcp2_ssize ngtcp2_pkt_decode_stream_frame(ngtcp2_stream *dest,
|
533
|
+
const uint8_t *payload,
|
534
|
+
size_t payloadlen);
|
535
|
+
|
536
|
+
/*
|
537
|
+
* ngtcp2_pkt_decode_ack_frame decodes ACK frame from |payload| of
|
538
|
+
* length |payloadlen|. The result is stored in the object pointed by
|
539
|
+
* |dest|. ACK frame must start at payload[0]. This function
|
540
|
+
* finishes when it decodes one ACK frame, and returns the exact
|
541
|
+
* number of bytes read to decode a frame if it succeeds, or one of
|
542
|
+
* the following negative error codes:
|
543
|
+
*
|
544
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
545
|
+
* Payload is too short to include ACK frame.
|
546
|
+
*/
|
547
|
+
ngtcp2_ssize ngtcp2_pkt_decode_ack_frame(ngtcp2_ack *dest,
|
548
|
+
const uint8_t *payload,
|
549
|
+
size_t payloadlen);
|
550
|
+
|
551
|
+
/*
|
552
|
+
* ngtcp2_pkt_decode_padding_frame decodes contiguous PADDING frames
|
553
|
+
* from |payload| of length |payloadlen|. It continues to parse
|
554
|
+
* frames as long as the frame type is PADDING. This finishes when it
|
555
|
+
* encounters the frame type which is not PADDING, or all input data
|
556
|
+
* is read. The first byte (payload[0]) must be NGTCP2_FRAME_PADDING.
|
557
|
+
* This function returns the exact number of bytes read to decode
|
558
|
+
* PADDING frames.
|
559
|
+
*/
|
560
|
+
ngtcp2_ssize ngtcp2_pkt_decode_padding_frame(ngtcp2_padding *dest,
|
561
|
+
const uint8_t *payload,
|
562
|
+
size_t payloadlen);
|
563
|
+
|
564
|
+
/*
|
565
|
+
* ngtcp2_pkt_decode_reset_stream_frame decodes RESET_STREAM frame
|
566
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
567
|
+
* object pointed by |dest|. RESET_STREAM frame must start at
|
568
|
+
* payload[0]. This function finishes when it decodes one
|
569
|
+
* RESET_STREAM frame, and returns the exact number of bytes read to
|
570
|
+
* decode a frame if it succeeds, or one of the following negative
|
571
|
+
* error codes:
|
572
|
+
*
|
573
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
574
|
+
* Payload is too short to include RESET_STREAM frame.
|
575
|
+
*/
|
576
|
+
ngtcp2_ssize ngtcp2_pkt_decode_reset_stream_frame(ngtcp2_reset_stream *dest,
|
577
|
+
const uint8_t *payload,
|
578
|
+
size_t payloadlen);
|
579
|
+
|
580
|
+
/*
|
581
|
+
* ngtcp2_pkt_decode_connection_close_frame decodes CONNECTION_CLOSE
|
582
|
+
* frame from |payload| of length |payloadlen|. The result is stored
|
583
|
+
* in the object pointed by |dest|. CONNECTION_CLOSE frame must start
|
584
|
+
* at payload[0]. This function finishes it decodes one
|
585
|
+
* CONNECTION_CLOSE frame, and returns the exact number of bytes read
|
586
|
+
* to decode a frame if it succeeds, or one of the following negative
|
587
|
+
* error codes:
|
588
|
+
*
|
589
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
590
|
+
* Payload is too short to include CONNECTION_CLOSE frame.
|
591
|
+
*/
|
592
|
+
ngtcp2_ssize ngtcp2_pkt_decode_connection_close_frame(
|
593
|
+
ngtcp2_connection_close *dest, const uint8_t *payload, size_t payloadlen);
|
594
|
+
|
595
|
+
/*
|
596
|
+
* ngtcp2_pkt_decode_max_data_frame decodes MAX_DATA frame from
|
597
|
+
* |payload| of length |payloadlen|. The result is stored in the
|
598
|
+
* object pointed by |dest|. MAX_DATA frame must start at payload[0].
|
599
|
+
* This function finishes when it decodes one MAX_DATA frame, and
|
600
|
+
* returns the exact number of bytes read to decode a frame if it
|
601
|
+
* succeeds, or one of the following negative error codes:
|
602
|
+
*
|
603
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
604
|
+
* Payload is too short to include MAX_DATA frame.
|
605
|
+
*/
|
606
|
+
ngtcp2_ssize ngtcp2_pkt_decode_max_data_frame(ngtcp2_max_data *dest,
|
607
|
+
const uint8_t *payload,
|
608
|
+
size_t payloadlen);
|
609
|
+
|
610
|
+
/*
|
611
|
+
* ngtcp2_pkt_decode_max_stream_data_frame decodes MAX_STREAM_DATA
|
612
|
+
* frame from |payload| of length |payloadlen|. The result is stored
|
613
|
+
* in the object pointed by |dest|. MAX_STREAM_DATA frame must start
|
614
|
+
* at payload[0]. This function finishes when it decodes one
|
615
|
+
* MAX_STREAM_DATA frame, and returns the exact number of bytes read
|
616
|
+
* to decode a frame if it succeeds, or one of the following negative
|
617
|
+
* error codes:
|
618
|
+
*
|
619
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
620
|
+
* Payload is too short to include MAX_STREAM_DATA frame.
|
621
|
+
*/
|
622
|
+
ngtcp2_ssize ngtcp2_pkt_decode_max_stream_data_frame(
|
623
|
+
ngtcp2_max_stream_data *dest, const uint8_t *payload, size_t payloadlen);
|
624
|
+
|
625
|
+
/*
|
626
|
+
* ngtcp2_pkt_decode_max_streams_frame decodes MAX_STREAMS frame from
|
627
|
+
* |payload| of length |payloadlen|. The result is stored in the
|
628
|
+
* object pointed by |dest|. MAX_STREAMS frame must start at
|
629
|
+
* payload[0]. This function finishes when it decodes one MAX_STREAMS
|
630
|
+
* frame, and returns the exact number of bytes read to decode a frame
|
631
|
+
* if it succeeds, or one of the following negative error codes:
|
632
|
+
*
|
633
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
634
|
+
* Payload is too short to include MAX_STREAMS frame.
|
635
|
+
*/
|
636
|
+
ngtcp2_ssize ngtcp2_pkt_decode_max_streams_frame(ngtcp2_max_streams *dest,
|
637
|
+
const uint8_t *payload,
|
638
|
+
size_t payloadlen);
|
639
|
+
|
640
|
+
/*
|
641
|
+
* ngtcp2_pkt_decode_ping_frame decodes PING frame from |payload| of
|
642
|
+
* length |payloadlen|. The result is stored in the object pointed by
|
643
|
+
* |dest|. PING frame must start at payload[0]. This function
|
644
|
+
* finishes when it decodes one PING frame, and returns the exact
|
645
|
+
* number of bytes read to decode a frame.
|
646
|
+
*/
|
647
|
+
ngtcp2_ssize ngtcp2_pkt_decode_ping_frame(ngtcp2_ping *dest,
|
648
|
+
const uint8_t *payload,
|
649
|
+
size_t payloadlen);
|
650
|
+
|
651
|
+
/*
|
652
|
+
* ngtcp2_pkt_decode_data_blocked_frame decodes DATA_BLOCKED frame
|
653
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
654
|
+
* object pointed by |dest|. DATA_BLOCKED frame must start at
|
655
|
+
* payload[0]. This function finishes when it decodes one
|
656
|
+
* DATA_BLOCKED frame, and returns the exact number of bytes read to
|
657
|
+
* decode a frame if it succeeds, or one of the following negative
|
658
|
+
* error codes:
|
659
|
+
*
|
660
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
661
|
+
* Payload is too short to include DATA_BLOCKED frame.
|
662
|
+
*/
|
663
|
+
ngtcp2_ssize ngtcp2_pkt_decode_data_blocked_frame(ngtcp2_data_blocked *dest,
|
664
|
+
const uint8_t *payload,
|
665
|
+
size_t payloadlen);
|
666
|
+
|
667
|
+
/*
|
668
|
+
* ngtcp2_pkt_decode_stream_data_blocked_frame decodes
|
669
|
+
* STREAM_DATA_BLOCKED frame from |payload| of length |payloadlen|.
|
670
|
+
* The result is stored in the object pointed by |dest|.
|
671
|
+
* STREAM_DATA_BLOCKED frame must start at payload[0]. This function
|
672
|
+
* finishes when it decodes one STREAM_DATA_BLOCKED frame, and returns
|
673
|
+
* the exact number of bytes read to decode a frame if it succeeds, or
|
674
|
+
* one of the following negative error codes:
|
675
|
+
*
|
676
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
677
|
+
* Payload is too short to include STREAM_DATA_BLOCKED frame.
|
678
|
+
*/
|
679
|
+
ngtcp2_ssize
|
680
|
+
ngtcp2_pkt_decode_stream_data_blocked_frame(ngtcp2_stream_data_blocked *dest,
|
681
|
+
const uint8_t *payload,
|
682
|
+
size_t payloadlen);
|
683
|
+
|
684
|
+
/*
|
685
|
+
* ngtcp2_pkt_decode_streams_blocked_frame decodes STREAMS_BLOCKED
|
686
|
+
* frame from |payload| of length |payloadlen|. The result is stored
|
687
|
+
* in the object pointed by |dest|. STREAMS_BLOCKED frame must start
|
688
|
+
* at payload[0]. This function finishes when it decodes one
|
689
|
+
* STREAMS_BLOCKED frame, and returns the exact number of bytes read
|
690
|
+
* to decode a frame if it succeeds, or one of the following negative
|
691
|
+
* error codes:
|
692
|
+
*
|
693
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
694
|
+
* Payload is too short to include STREAMS_BLOCKED frame.
|
695
|
+
*/
|
696
|
+
ngtcp2_ssize ngtcp2_pkt_decode_streams_blocked_frame(
|
697
|
+
ngtcp2_streams_blocked *dest, const uint8_t *payload, size_t payloadlen);
|
698
|
+
|
699
|
+
/*
|
700
|
+
* ngtcp2_pkt_decode_new_connection_id_frame decodes NEW_CONNECTION_ID
|
701
|
+
* frame from |payload| of length |payloadlen|. The result is stored
|
702
|
+
* in the object pointed by |dest|. NEW_CONNECTION_ID frame must
|
703
|
+
* start at payload[0]. This function finishes when it decodes one
|
704
|
+
* NEW_CONNECTION_ID frame, and returns the exact number of bytes read
|
705
|
+
* to decode a frame if it succeeds, or one of the following negative
|
706
|
+
* error codes:
|
707
|
+
*
|
708
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
709
|
+
* Payload is too short to include NEW_CONNECTION_ID frame; or the
|
710
|
+
* length of CID is strictly less than NGTCP2_MIN_CIDLEN or
|
711
|
+
* greater than NGTCP2_MAX_CIDLEN.
|
712
|
+
*/
|
713
|
+
ngtcp2_ssize ngtcp2_pkt_decode_new_connection_id_frame(
|
714
|
+
ngtcp2_new_connection_id *dest, const uint8_t *payload, size_t payloadlen);
|
715
|
+
|
716
|
+
/*
|
717
|
+
* ngtcp2_pkt_decode_stop_sending_frame decodes STOP_SENDING frame
|
718
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
719
|
+
* object pointed by |dest|. STOP_SENDING frame must start at
|
720
|
+
* payload[0]. This function finishes when it decodes one
|
721
|
+
* STOP_SENDING frame, and returns the exact number of bytes read to
|
722
|
+
* decode a frame if it succeeds, or one of the following negative
|
723
|
+
* error codes:
|
724
|
+
*
|
725
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
726
|
+
* Payload is too short to include STOP_SENDING frame.
|
727
|
+
*/
|
728
|
+
ngtcp2_ssize ngtcp2_pkt_decode_stop_sending_frame(ngtcp2_stop_sending *dest,
|
729
|
+
const uint8_t *payload,
|
730
|
+
size_t payloadlen);
|
731
|
+
|
732
|
+
/*
|
733
|
+
* ngtcp2_pkt_decode_path_challenge_frame decodes PATH_CHALLENGE frame
|
734
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
735
|
+
* object pointed by |dest|. PATH_CHALLENGE frame must start at
|
736
|
+
* payload[0]. This function finishes when it decodes one
|
737
|
+
* PATH_CHALLENGE frame, and returns the exact number of bytes read to
|
738
|
+
* decode a frame if it succeeds, or one of the following negative
|
739
|
+
* error codes:
|
740
|
+
*
|
741
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
742
|
+
* Payload is too short to include PATH_CHALLENGE frame.
|
743
|
+
*/
|
744
|
+
ngtcp2_ssize ngtcp2_pkt_decode_path_challenge_frame(ngtcp2_path_challenge *dest,
|
745
|
+
const uint8_t *payload,
|
746
|
+
size_t payloadlen);
|
747
|
+
|
748
|
+
/*
|
749
|
+
* ngtcp2_pkt_decode_path_response_frame decodes PATH_RESPONSE frame
|
750
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
751
|
+
* object pointed by |dest|. PATH_RESPONSE frame must start at
|
752
|
+
* payload[0]. This function finishes when it decodes one
|
753
|
+
* PATH_RESPONSE frame, and returns the exact number of bytes read to
|
754
|
+
* decode a frame if it succeeds, or one of the following negative
|
755
|
+
* error codes:
|
756
|
+
*
|
757
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
758
|
+
* Payload is too short to include PATH_RESPONSE frame.
|
759
|
+
*/
|
760
|
+
ngtcp2_ssize ngtcp2_pkt_decode_path_response_frame(ngtcp2_path_response *dest,
|
761
|
+
const uint8_t *payload,
|
762
|
+
size_t payloadlen);
|
763
|
+
|
764
|
+
/*
|
765
|
+
* ngtcp2_pkt_decode_crypto_frame decodes CRYPTO frame from |payload|
|
766
|
+
* of length |payloadlen|. The result is stored in the object pointed
|
767
|
+
* by |dest|. CRYPTO frame must start at payload[0]. This function
|
768
|
+
* finishes when it decodes one CRYPTO frame, and returns the exact
|
769
|
+
* number of bytes read to decode a frame if it succeeds, or one of
|
770
|
+
* the following negative error codes:
|
771
|
+
*
|
772
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
773
|
+
* Payload is too short to include CRYPTO frame.
|
774
|
+
*/
|
775
|
+
ngtcp2_ssize ngtcp2_pkt_decode_crypto_frame(ngtcp2_crypto *dest,
|
776
|
+
const uint8_t *payload,
|
777
|
+
size_t payloadlen);
|
778
|
+
|
779
|
+
/*
|
780
|
+
* ngtcp2_pkt_decode_new_token_frame decodes NEW_TOKEN frame from
|
781
|
+
* |payload| of length |payloadlen|. The result is stored in the
|
782
|
+
* object pointed by |dest|. NEW_TOKEN frame must start at
|
783
|
+
* payload[0]. This function finishes when it decodes one NEW_TOKEN
|
784
|
+
* frame, and returns the exact number of bytes read to decode a frame
|
785
|
+
* if it succeeds, or one of the following negative error codes:
|
786
|
+
*
|
787
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
788
|
+
* Payload is too short to include NEW_TOKEN frame.
|
789
|
+
*/
|
790
|
+
ngtcp2_ssize ngtcp2_pkt_decode_new_token_frame(ngtcp2_new_token *dest,
|
791
|
+
const uint8_t *payload,
|
792
|
+
size_t payloadlen);
|
793
|
+
|
794
|
+
/*
|
795
|
+
* ngtcp2_pkt_decode_retire_connection_id_frame decodes RETIRE_CONNECTION_ID
|
796
|
+
* frame from |payload| of length |payloadlen|. The result is stored in the
|
797
|
+
* object pointed by |dest|. RETIRE_CONNECTION_ID frame must start at
|
798
|
+
* payload[0]. This function finishes when it decodes one RETIRE_CONNECTION_ID
|
799
|
+
* frame, and returns the exact number of bytes read to decode a frame
|
800
|
+
* if it succeeds, or one of the following negative error codes:
|
801
|
+
*
|
802
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
803
|
+
* Payload is too short to include RETIRE_CONNECTION_ID frame.
|
804
|
+
*/
|
805
|
+
ngtcp2_ssize
|
806
|
+
ngtcp2_pkt_decode_retire_connection_id_frame(ngtcp2_retire_connection_id *dest,
|
807
|
+
const uint8_t *payload,
|
808
|
+
size_t payloadlen);
|
809
|
+
|
810
|
+
/*
|
811
|
+
* ngtcp2_pkt_decode_handshake_done_frame decodes HANDSHAKE_DONE frame
|
812
|
+
* from |payload| of length |payloadlen|. The result is stored in the
|
813
|
+
* object pointed by |dest|. HANDSHAKE_DONE frame must start at
|
814
|
+
* payload[0]. This function finishes when it decodes one
|
815
|
+
* HANDSHAKE_DONE frame, and returns the exact number of bytes read to
|
816
|
+
* decode a frame.
|
817
|
+
*/
|
818
|
+
ngtcp2_ssize ngtcp2_pkt_decode_handshake_done_frame(ngtcp2_handshake_done *dest,
|
819
|
+
const uint8_t *payload,
|
820
|
+
size_t payloadlen);
|
821
|
+
|
822
|
+
/*
|
823
|
+
* ngtcp2_pkt_decode_datagram_frame decodes DATAGRAM frame from
|
824
|
+
* |payload| of length |payloadlen|. The result is stored in the
|
825
|
+
* object pointed by |dest|. DATAGRAM frame must start at payload[0].
|
826
|
+
* This function finishes when it decodes one DATAGRAM frame, and
|
827
|
+
* returns the exact number of bytes read to decode a frame if it
|
828
|
+
* succeeds, or one of the following negative error codes:
|
829
|
+
*
|
830
|
+
* NGTCP2_ERR_FRAME_ENCODING
|
831
|
+
* Payload is too short to include DATAGRAM frame.
|
832
|
+
*/
|
833
|
+
ngtcp2_ssize ngtcp2_pkt_decode_datagram_frame(ngtcp2_datagram *dest,
|
834
|
+
const uint8_t *payload,
|
835
|
+
size_t payloadlen);
|
836
|
+
|
837
|
+
/*
|
838
|
+
* ngtcp2_pkt_encode_stream_frame encodes STREAM frame |fr| into the
|
839
|
+
* buffer pointed by |out| of length |outlen|.
|
840
|
+
*
|
841
|
+
* This function assigns <the serialized frame type> &
|
842
|
+
* ~NGTCP2_FRAME_STREAM to fr->flags.
|
843
|
+
*
|
844
|
+
* This function returns the number of bytes written if it succeeds,
|
845
|
+
* or one of the following negative error codes:
|
846
|
+
*
|
847
|
+
* NGTCP2_ERR_NOBUF
|
848
|
+
* Buffer does not have enough capacity to write a frame.
|
849
|
+
*/
|
850
|
+
ngtcp2_ssize ngtcp2_pkt_encode_stream_frame(uint8_t *out, size_t outlen,
|
851
|
+
ngtcp2_stream *fr);
|
852
|
+
|
853
|
+
/*
|
854
|
+
* ngtcp2_pkt_encode_ack_frame encodes ACK frame |fr| into the buffer
|
855
|
+
* pointed by |out| of length |outlen|.
|
856
|
+
*
|
857
|
+
* This function assigns <the serialized frame type> &
|
858
|
+
* ~NGTCP2_FRAME_ACK to fr->flags.
|
859
|
+
*
|
860
|
+
* This function returns the number of bytes written if it succeeds,
|
861
|
+
* or one of the following negative error codes:
|
862
|
+
*
|
863
|
+
* NGTCP2_ERR_NOBUF
|
864
|
+
* Buffer does not have enough capacity to write a frame.
|
865
|
+
*/
|
866
|
+
ngtcp2_ssize ngtcp2_pkt_encode_ack_frame(uint8_t *out, size_t outlen,
|
867
|
+
ngtcp2_ack *fr);
|
868
|
+
|
869
|
+
/*
|
870
|
+
* ngtcp2_pkt_encode_padding_frame encodes PADDING frame |fr| into the
|
871
|
+
* buffer pointed by |out| of length |outlen|.
|
872
|
+
*
|
873
|
+
* This function encodes consecutive fr->len PADDING frames.
|
874
|
+
*
|
875
|
+
* This function returns the number of bytes written if it succeeds,
|
876
|
+
* or one of the following negative error codes:
|
877
|
+
*
|
878
|
+
* NGTCP2_ERR_NOBUF
|
879
|
+
* Buffer does not have enough capacity to write frame(s).
|
880
|
+
*/
|
881
|
+
ngtcp2_ssize ngtcp2_pkt_encode_padding_frame(uint8_t *out, size_t outlen,
|
882
|
+
const ngtcp2_padding *fr);
|
883
|
+
|
884
|
+
/*
|
885
|
+
* ngtcp2_pkt_encode_reset_stream_frame encodes RESET_STREAM frame
|
886
|
+
* |fr| into the buffer pointed by |out| of length |buflen|.
|
887
|
+
*
|
888
|
+
* This function returns the number of bytes written if it succeeds,
|
889
|
+
* or one of the following negative error codes:
|
890
|
+
*
|
891
|
+
* NGTCP2_ERR_NOBUF
|
892
|
+
* Buffer does not have enough capacity to write a frame.
|
893
|
+
*/
|
894
|
+
ngtcp2_ssize
|
895
|
+
ngtcp2_pkt_encode_reset_stream_frame(uint8_t *out, size_t outlen,
|
896
|
+
const ngtcp2_reset_stream *fr);
|
897
|
+
|
898
|
+
/*
|
899
|
+
* ngtcp2_pkt_encode_connection_close_frame encodes CONNECTION_CLOSE
|
900
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
901
|
+
*
|
902
|
+
* This function returns the number of bytes written if it succeeds,
|
903
|
+
* or one of the following negative error codes:
|
904
|
+
*
|
905
|
+
* NGTCP2_ERR_NOBUF
|
906
|
+
* Buffer does not have enough capacity to write a frame.
|
907
|
+
*/
|
908
|
+
ngtcp2_ssize
|
909
|
+
ngtcp2_pkt_encode_connection_close_frame(uint8_t *out, size_t outlen,
|
910
|
+
const ngtcp2_connection_close *fr);
|
911
|
+
|
912
|
+
/*
|
913
|
+
* ngtcp2_pkt_encode_max_data_frame encodes MAX_DATA frame |fr| into
|
914
|
+
* the buffer pointed by |out| of length |outlen|.
|
915
|
+
*
|
916
|
+
* This function returns the number of bytes written if it succeeds,
|
917
|
+
* or one of the following negative error codes:
|
918
|
+
*
|
919
|
+
* NGTCP2_ERR_NOBUF
|
920
|
+
* Buffer does not have enough capacity to write a frame.
|
921
|
+
*/
|
922
|
+
ngtcp2_ssize ngtcp2_pkt_encode_max_data_frame(uint8_t *out, size_t outlen,
|
923
|
+
const ngtcp2_max_data *fr);
|
924
|
+
|
925
|
+
/*
|
926
|
+
* ngtcp2_pkt_encode_max_stream_data_frame encodes MAX_STREAM_DATA
|
927
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
928
|
+
*
|
929
|
+
* This function returns the number of bytes written if it succeeds,
|
930
|
+
* or one of the following negative error codes:
|
931
|
+
*
|
932
|
+
* NGTCP2_ERR_NOBUF
|
933
|
+
* Buffer does not have enough capacity to write a frame.
|
934
|
+
*/
|
935
|
+
ngtcp2_ssize
|
936
|
+
ngtcp2_pkt_encode_max_stream_data_frame(uint8_t *out, size_t outlen,
|
937
|
+
const ngtcp2_max_stream_data *fr);
|
938
|
+
|
939
|
+
/*
|
940
|
+
* ngtcp2_pkt_encode_max_streams_frame encodes MAX_STREAMS
|
941
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
942
|
+
*
|
943
|
+
* This function returns the number of bytes written if it succeeds,
|
944
|
+
* or one of the following negative error codes:
|
945
|
+
*
|
946
|
+
* NGTCP2_ERR_NOBUF
|
947
|
+
* Buffer does not have enough capacity to write a frame.
|
948
|
+
*/
|
949
|
+
ngtcp2_ssize ngtcp2_pkt_encode_max_streams_frame(uint8_t *out, size_t outlen,
|
950
|
+
const ngtcp2_max_streams *fr);
|
951
|
+
|
952
|
+
/*
|
953
|
+
* ngtcp2_pkt_encode_ping_frame encodes PING frame |fr| into the
|
954
|
+
* buffer pointed by |out| of length |outlen|.
|
955
|
+
*
|
956
|
+
* This function returns the number of bytes written if it succeeds,
|
957
|
+
* or one of the following negative error codes:
|
958
|
+
*
|
959
|
+
* NGTCP2_ERR_NOBUF
|
960
|
+
* Buffer does not have enough capacity to write a frame.
|
961
|
+
*/
|
962
|
+
ngtcp2_ssize ngtcp2_pkt_encode_ping_frame(uint8_t *out, size_t outlen,
|
963
|
+
const ngtcp2_ping *fr);
|
964
|
+
|
965
|
+
/*
|
966
|
+
* ngtcp2_pkt_encode_data_blocked_frame encodes DATA_BLOCKED frame
|
967
|
+
* |fr| into the buffer pointed by |out| of length |outlen|.
|
968
|
+
*
|
969
|
+
* This function returns the number of bytes written if it succeeds,
|
970
|
+
* or one of the following negative error codes:
|
971
|
+
*
|
972
|
+
* NGTCP2_ERR_NOBUF
|
973
|
+
* Buffer does not have enough capacity to write a frame.
|
974
|
+
*/
|
975
|
+
ngtcp2_ssize
|
976
|
+
ngtcp2_pkt_encode_data_blocked_frame(uint8_t *out, size_t outlen,
|
977
|
+
const ngtcp2_data_blocked *fr);
|
978
|
+
|
979
|
+
/*
|
980
|
+
* ngtcp2_pkt_encode_stream_data_blocked_frame encodes
|
981
|
+
* STREAM_DATA_BLOCKED frame |fr| into the buffer pointed by |out| of
|
982
|
+
* length |outlen|.
|
983
|
+
*
|
984
|
+
* This function returns the number of bytes written if it succeeds,
|
985
|
+
* or one of the following negative error codes:
|
986
|
+
*
|
987
|
+
* NGTCP2_ERR_NOBUF
|
988
|
+
* Buffer does not have enough capacity to write a frame.
|
989
|
+
*/
|
990
|
+
ngtcp2_ssize ngtcp2_pkt_encode_stream_data_blocked_frame(
|
991
|
+
uint8_t *out, size_t outlen, const ngtcp2_stream_data_blocked *fr);
|
992
|
+
|
993
|
+
/*
|
994
|
+
* ngtcp2_pkt_encode_streams_blocked_frame encodes STREAMS_BLOCKED
|
995
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
996
|
+
*
|
997
|
+
* This function returns the number of bytes written if it succeeds,
|
998
|
+
* or one of the following negative error codes:
|
999
|
+
*
|
1000
|
+
* NGTCP2_ERR_NOBUF
|
1001
|
+
* Buffer does not have enough capacity to write a frame.
|
1002
|
+
*/
|
1003
|
+
ngtcp2_ssize
|
1004
|
+
ngtcp2_pkt_encode_streams_blocked_frame(uint8_t *out, size_t outlen,
|
1005
|
+
const ngtcp2_streams_blocked *fr);
|
1006
|
+
|
1007
|
+
/*
|
1008
|
+
* ngtcp2_pkt_encode_new_connection_id_frame encodes NEW_CONNECTION_ID
|
1009
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
1010
|
+
*
|
1011
|
+
* This function returns the number of bytes written if it succeeds,
|
1012
|
+
* or one of the following negative error codes:
|
1013
|
+
*
|
1014
|
+
* NGTCP2_ERR_NOBUF
|
1015
|
+
* Buffer does not have enough capacity to write a frame.
|
1016
|
+
*/
|
1017
|
+
ngtcp2_ssize
|
1018
|
+
ngtcp2_pkt_encode_new_connection_id_frame(uint8_t *out, size_t outlen,
|
1019
|
+
const ngtcp2_new_connection_id *fr);
|
1020
|
+
|
1021
|
+
/*
|
1022
|
+
* ngtcp2_pkt_encode_stop_sending_frame encodes STOP_SENDING frame
|
1023
|
+
* |fr| into the buffer pointed by |out| of length |outlen|.
|
1024
|
+
*
|
1025
|
+
* This function returns the number of bytes written if it succeeds,
|
1026
|
+
* or one of the following negative error codes:
|
1027
|
+
*
|
1028
|
+
* NGTCP2_ERR_NOBUF
|
1029
|
+
* Buffer does not have enough capacity to write a frame.
|
1030
|
+
*/
|
1031
|
+
ngtcp2_ssize
|
1032
|
+
ngtcp2_pkt_encode_stop_sending_frame(uint8_t *out, size_t outlen,
|
1033
|
+
const ngtcp2_stop_sending *fr);
|
1034
|
+
|
1035
|
+
/*
|
1036
|
+
* ngtcp2_pkt_encode_path_challenge_frame encodes PATH_CHALLENGE frame
|
1037
|
+
* |fr| into the buffer pointed by |out| of length |outlen|.
|
1038
|
+
*
|
1039
|
+
* This function returns the number of bytes written if it succeeds,
|
1040
|
+
* or one of the following negative error codes:
|
1041
|
+
*
|
1042
|
+
* NGTCP2_ERR_NOBUF
|
1043
|
+
* Buffer does not have enough capacity to write a frame.
|
1044
|
+
*/
|
1045
|
+
ngtcp2_ssize
|
1046
|
+
ngtcp2_pkt_encode_path_challenge_frame(uint8_t *out, size_t outlen,
|
1047
|
+
const ngtcp2_path_challenge *fr);
|
1048
|
+
|
1049
|
+
/*
|
1050
|
+
* ngtcp2_pkt_encode_path_response_frame encodes PATH_RESPONSE frame
|
1051
|
+
* |fr| into the buffer pointed by |out| of length |outlen|.
|
1052
|
+
*
|
1053
|
+
* This function returns the number of bytes written if it succeeds,
|
1054
|
+
* or one of the following negative error codes:
|
1055
|
+
*
|
1056
|
+
* NGTCP2_ERR_NOBUF
|
1057
|
+
* Buffer does not have enough capacity to write a frame.
|
1058
|
+
*/
|
1059
|
+
ngtcp2_ssize
|
1060
|
+
ngtcp2_pkt_encode_path_response_frame(uint8_t *out, size_t outlen,
|
1061
|
+
const ngtcp2_path_response *fr);
|
1062
|
+
|
1063
|
+
/*
|
1064
|
+
* ngtcp2_pkt_encode_crypto_frame encodes CRYPTO frame |fr| into the
|
1065
|
+
* buffer pointed by |out| of length |outlen|.
|
1066
|
+
*
|
1067
|
+
* This function returns the number of bytes written if it succeeds,
|
1068
|
+
* or one of the following negative error codes:
|
1069
|
+
*
|
1070
|
+
* NGTCP2_ERR_NOBUF
|
1071
|
+
* Buffer does not have enough capacity to write a frame.
|
1072
|
+
*/
|
1073
|
+
ngtcp2_ssize ngtcp2_pkt_encode_crypto_frame(uint8_t *out, size_t outlen,
|
1074
|
+
const ngtcp2_crypto *fr);
|
1075
|
+
|
1076
|
+
/*
|
1077
|
+
* ngtcp2_pkt_encode_new_token_frame encodes NEW_TOKEN frame |fr| into
|
1078
|
+
* the buffer pointed by |out| of length |outlen|.
|
1079
|
+
*
|
1080
|
+
* This function returns the number of bytes written if it succeeds,
|
1081
|
+
* or one of the following negative error codes:
|
1082
|
+
*
|
1083
|
+
* NGTCP2_ERR_NOBUF
|
1084
|
+
* Buffer does not have enough capacity to write a frame.
|
1085
|
+
*/
|
1086
|
+
ngtcp2_ssize ngtcp2_pkt_encode_new_token_frame(uint8_t *out, size_t outlen,
|
1087
|
+
const ngtcp2_new_token *fr);
|
1088
|
+
|
1089
|
+
/*
|
1090
|
+
* ngtcp2_pkt_encode_retire_connection_id_frame encodes RETIRE_CONNECTION_ID
|
1091
|
+
* frame |fr| into the buffer pointed by |out| of length |outlen|.
|
1092
|
+
*
|
1093
|
+
* This function returns the number of bytes written if it succeeds,
|
1094
|
+
* or one of the following negative error codes:
|
1095
|
+
*
|
1096
|
+
* NGTCP2_ERR_NOBUF
|
1097
|
+
* Buffer does not have enough capacity to write a frame.
|
1098
|
+
*/
|
1099
|
+
ngtcp2_ssize ngtcp2_pkt_encode_retire_connection_id_frame(
|
1100
|
+
uint8_t *out, size_t outlen, const ngtcp2_retire_connection_id *fr);
|
1101
|
+
|
1102
|
+
/*
|
1103
|
+
* ngtcp2_pkt_encode_handshake_done_frame encodes HANDSHAKE_DONE frame
|
1104
|
+
* |fr| into the buffer pointed by |out| of length |outlen|.
|
1105
|
+
*
|
1106
|
+
* This function returns the number of bytes written if it succeeds,
|
1107
|
+
* or one of the following negative error codes:
|
1108
|
+
*
|
1109
|
+
* NGTCP2_ERR_NOBUF
|
1110
|
+
* Buffer does not have enough capacity to write a frame.
|
1111
|
+
*/
|
1112
|
+
ngtcp2_ssize
|
1113
|
+
ngtcp2_pkt_encode_handshake_done_frame(uint8_t *out, size_t outlen,
|
1114
|
+
const ngtcp2_handshake_done *fr);
|
1115
|
+
|
1116
|
+
/*
|
1117
|
+
* ngtcp2_pkt_encode_datagram_frame encodes DATAGRAM frame |fr| into
|
1118
|
+
* the buffer pointed by |out| of length |outlen|.
|
1119
|
+
*
|
1120
|
+
* This function returns the number of bytes written if it succeeds,
|
1121
|
+
* or one of the following negative error codes:
|
1122
|
+
*
|
1123
|
+
* NGTCP2_ERR_NOBUF
|
1124
|
+
* Buffer does not have enough capacity to write a frame.
|
1125
|
+
*/
|
1126
|
+
ngtcp2_ssize ngtcp2_pkt_encode_datagram_frame(uint8_t *out, size_t outlen,
|
1127
|
+
const ngtcp2_datagram *fr);
|
1128
|
+
|
1129
|
+
/*
|
1130
|
+
* ngtcp2_pkt_adjust_pkt_num find the full 64 bits packet number for
|
1131
|
+
* |pkt_num|, which is expected to be least significant |n| bits. The
|
1132
|
+
* |max_pkt_num| is the highest successfully authenticated packet
|
1133
|
+
* number.
|
1134
|
+
*/
|
1135
|
+
int64_t ngtcp2_pkt_adjust_pkt_num(int64_t max_pkt_num, int64_t pkt_num,
|
1136
|
+
size_t n);
|
1137
|
+
|
1138
|
+
/*
|
1139
|
+
* ngtcp2_pkt_validate_ack checks that ack is malformed or not.
|
1140
|
+
*
|
1141
|
+
* This function returns 0 if it succeeds, or one of the following
|
1142
|
+
* negative error codes:
|
1143
|
+
*
|
1144
|
+
* NGTCP2_ERR_ACK_FRAME
|
1145
|
+
* ACK frame is malformed
|
1146
|
+
*/
|
1147
|
+
int ngtcp2_pkt_validate_ack(ngtcp2_ack *fr);
|
1148
|
+
|
1149
|
+
/*
|
1150
|
+
* ngtcp2_pkt_stream_max_datalen returns the maximum number of bytes
|
1151
|
+
* which can be sent for stream denoted by |stream_id|. |offset| is
|
1152
|
+
* an offset of within the stream. |len| is the estimated number of
|
1153
|
+
* bytes to be sent. |left| is the size of buffer. If |left| is too
|
1154
|
+
* small to write STREAM frame, this function returns (size_t)-1.
|
1155
|
+
*/
|
1156
|
+
size_t ngtcp2_pkt_stream_max_datalen(int64_t stream_id, uint64_t offset,
|
1157
|
+
uint64_t len, size_t left);
|
1158
|
+
|
1159
|
+
/*
|
1160
|
+
* ngtcp2_pkt_crypto_max_datalen returns the maximum number of bytes
|
1161
|
+
* which can be sent for crypto stream. |offset| is an offset of
|
1162
|
+
* within the crypto stream. |len| is the estimated number of bytes
|
1163
|
+
* to be sent. |left| is the size of buffer. If |left| is too small
|
1164
|
+
* to write CRYPTO frame, this function returns (size_t)-1.
|
1165
|
+
*/
|
1166
|
+
size_t ngtcp2_pkt_crypto_max_datalen(uint64_t offset, size_t len, size_t left);
|
1167
|
+
|
1168
|
+
/*
|
1169
|
+
* ngtcp2_pkt_datagram_framelen returns the length of DATAGRAM frame
|
1170
|
+
* to encode |len| bytes of data.
|
1171
|
+
*/
|
1172
|
+
size_t ngtcp2_pkt_datagram_framelen(size_t len);
|
1173
|
+
|
1174
|
+
/*
|
1175
|
+
* ngtcp2_pkt_verify_reserved_bits verifies that the first byte |c| of
|
1176
|
+
* the packet header has the correct reserved bits.
|
1177
|
+
*
|
1178
|
+
* This function returns 0 if it succeeds, or one of the following
|
1179
|
+
* negative error codes:
|
1180
|
+
*
|
1181
|
+
* NGTCP2_ERR_PROTO
|
1182
|
+
* Reserved bits has wrong value.
|
1183
|
+
*/
|
1184
|
+
int ngtcp2_pkt_verify_reserved_bits(uint8_t c);
|
1185
|
+
|
1186
|
+
/*
|
1187
|
+
* ngtcp2_pkt_encode_pseudo_retry encodes Retry pseudo-packet in the
|
1188
|
+
* buffer pointed by |dest| of length |destlen|.
|
1189
|
+
*
|
1190
|
+
* This function returns 0 if it succeeds, or one of the following
|
1191
|
+
* negative error codes:
|
1192
|
+
*
|
1193
|
+
* NGTCP2_ERR_BUF
|
1194
|
+
* Buffer is too short.
|
1195
|
+
*/
|
1196
|
+
ngtcp2_ssize ngtcp2_pkt_encode_pseudo_retry(
|
1197
|
+
uint8_t *dest, size_t destlen, const ngtcp2_pkt_hd *hd, uint8_t unused,
|
1198
|
+
const ngtcp2_cid *odcid, const uint8_t *token, size_t tokenlen);
|
1199
|
+
|
1200
|
+
/*
|
1201
|
+
* ngtcp2_pkt_verify_retry_tag verifies Retry packet. The buffer
|
1202
|
+
* pointed by |pkt| of length |pktlen| must contain Retry packet
|
1203
|
+
* including packet header. The odcid and tag fields of |retry| must
|
1204
|
+
* be specified. |aead| must be AEAD_AES_128_GCM.
|
1205
|
+
*
|
1206
|
+
* This function returns 0 if it succeeds, or one of the following
|
1207
|
+
* negative error codes:
|
1208
|
+
*
|
1209
|
+
* NGTCP2_ERR_PROTO
|
1210
|
+
* Verification failed.
|
1211
|
+
*/
|
1212
|
+
int ngtcp2_pkt_verify_retry_tag(uint32_t version, const ngtcp2_pkt_retry *retry,
|
1213
|
+
const uint8_t *pkt, size_t pktlen,
|
1214
|
+
ngtcp2_encrypt encrypt,
|
1215
|
+
const ngtcp2_crypto_aead *aead,
|
1216
|
+
const ngtcp2_crypto_aead_ctx *aead_ctx);
|
1217
|
+
|
1218
|
+
/*
|
1219
|
+
* ngtcp2_pkt_versioned_type returns versioned packet type for a
|
1220
|
+
* version |version| that corresponds to the version-independent
|
1221
|
+
* |pkt_type|.
|
1222
|
+
*/
|
1223
|
+
uint8_t ngtcp2_pkt_versioned_type(uint32_t version, uint32_t pkt_type);
|
1224
|
+
|
1225
|
+
/**
|
1226
|
+
* @function
|
1227
|
+
*
|
1228
|
+
* `ngtcp2_pkt_get_type_long` returns the version-independent long
|
1229
|
+
* packet type. |version| is the QUIC version. |c| is the first byte
|
1230
|
+
* of Long packet header. If |version| is not supported by the
|
1231
|
+
* library, it returns 0.
|
1232
|
+
*/
|
1233
|
+
uint8_t ngtcp2_pkt_get_type_long(uint32_t version, uint8_t c);
|
1234
|
+
|
1235
|
+
#endif /* NGTCP2_PKT_H */
|