mcpp index

compat.ngtcp2

#include

RFC 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

特性

特性声明了
staticlibdefines
defaultimplies
openssldeps, sources, implies

源文件 (1)

  • */lib/*.c

生成的文件

  • mcpp_generated/include/ngtcp2/version.h
  • mcpp_generated/config.h

版本

版本平台 镜像sha256
1.26.0 最新 LinuxWindowsmacOS 源站 85174d674e7f…