構成
build.zig
c
src/main.zig
実行
| #include <php.h> | |
| #include <Zend/zend_smart_str.h> | |
| #include <sapi/embed/php_embed.h> | |
| #include <main/php_streams.h> | |
| static int run_min_client(void); | |
| int main(int argc, char **argv) | |
| { | |
| PHP_EMBED_START_BLOCK(argc, argv) |
| #include <php.h> | |
| #include <Zend/zend_smart_str.h> | |
| #include <sapi/embed/php_embed.h> | |
| #define SERVER_ADDR "tls://127.0.0.1:8443" | |
| #define SERVER_CERT_PEM "localhost.pem" | |
| #define SERVER_KEY_PEM "localhost-key.pem" | |
| static int run_min_server(void); | |
| static php_stream_context *create_tls_server_context(void); |
| #include <php.h> | |
| #include <Zend/zend_smart_str.h> | |
| #include <sapi/embed/php_embed.h> | |
| static int run_min_server(void); | |
| int main(int argc, char **argv) | |
| { | |
| PHP_EMBED_START_BLOCK(argc, argv) |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <netdb.h> | |
| #include <sys/socket.h> | |
| #include <openssl/ssl.h> | |
| #include <openssl/err.h> | |
| #include <openssl/x509_vfy.h> |
| /* | |
| Minimal TLS Client in C (Architecture Exercise for QUIC Preparation) | |
| This program implements a small TLS + TCP client using OpenSSL. | |
| The goal of this code is not merely to demonstrate how to perform | |
| a TLS request, but to illustrate a connection-oriented design that | |
| resembles modern network protocol libraries. | |
| Instead of writing everything inside main(), the implementation | |
| intentionally separates responsibilities into multiple functions: |
| <?php | |
| /* | |
| Minimal ReactPHP example for querying HTTPS DNS Resource Records (type 65). | |
| This script demonstrates how to: | |
| 1. Query HTTPS DNS records using ReactPHP DNS | |
| 2. Retrieve raw RDATA from the DNS response | |
| 3. Parse SVCB/HTTPS wire format | |
| 4. Extract ALPN values such as "h2" and "h3" |
| <?php | |
| /* | |
| Minimal HTTPS RR (DNS type 65) parser for PHP. | |
| Demonstrates how to parse HTTPS/SVCB records returned by: | |
| dns_get_record($host, 65, ..., true) | |
| Extracts ALPN values such as "h2" and "h3". |