compat.ngtcp2
#includeRFC 9000 QUIC protocol implementation in C (native in-graph static build)
#include <ngtcp2/ngtcp2_crypto_ossl.h>
mcpp add compat.ngtcp2@1.26.0
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
#include <ngtcp2/ngtcp2_crypto_ossl.h>
#include <openssl/ssl.h>
#include <memory>
// 同时建立客户端和服务端 TLS 会话,验证静态库的后端符号和 OpenSSL 传递依赖
int main() {
if (ngtcp2_crypto_ossl_init() != 0) return 1;
std::unique_ptr<SSL_CTX, decltype(&SSL_CTX_free)> factory(SSL_CTX_new(TLS_method()), SSL_CTX_free);
if (!factory) return 2;
for (bool server : {false, true}) {
std::unique_ptr<SSL, decltype(&SSL_free)> tls(SSL_new(factory.get()), SSL_free);
if (!tls) return 3;
ngtcp2_crypto_ossl_ctx* raw = nullptr;
if (ngtcp2_crypto_ossl_ctx_new(&raw, tls.get()) != 0) return 4;
std::unique_ptr<ngtcp2_crypto_ossl_ctx, decltype(&ngtcp2_crypto_ossl_ctx_del)> session(raw, ngtcp2_crypto_ossl_ctx_del);
if (ngtcp2_crypto_ossl_ctx_get_ssl(session.get()) != tls.get()) return 5;
auto status = server ? ngtcp2_crypto_ossl_configure_server_session(tls.get())
: ngtcp2_crypto_ossl_configure_client_session(tls.get());
if (status != 0) return 6;
}
ngtcp2_crypto_ossl_free();
// …
tests/examples/ngtcp2-openssl/tests/tls_backend.cpp · 專案 tests/examples/ngtcp2-openssl
建置
- targets
ngtcp2 (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/lib/includes, */crypto/includes, */lib, */crypto, mcpp_generated/include, mcpp_generated
功能
| 功能 | 宣告了 |
|---|---|
| staticlib | defines |
| default | implies |
| openssl | deps, sources, implies |
原始檔 (1)
*/lib/*.c
產生的檔案
mcpp_generated/include/ngtcp2/version.hmcpp_generated/config.h
版本
| 版本 | 平台 | 鏡像 | sha256 |
|---|---|---|---|
1.26.0 最新 |
LinuxWindowsmacOS | 來源 | 85174d674e7f… |