code wiki / (root) / nx_h2_conformance.nx

nx_h2_conformance.nx

buildroot/runtime/nx_h2_conformance.nx

27484 B484 linesdepth 7pulls 11 transitivereach 13 importersview sourcekind tooltopic h2
docsdependenciesstructsconstsfunctions

about

nx_h2_conformance.nx -- TUTOR-BOOTSTRAP SCAFFOLD (Claude, authored under the R4-H2 HTTP/2-transport-ladder workflow), NOT credited as team self-authoring. R4-H2-006 of the sovereign HTTP/2 transport ladder (knowledge/specs/2026-06-13-http2-transport-ladder.md). The CONFORMANCE harness: it composes ALL of the lower GREEN rungs -- HPACK (R4-H2-002), the frame codec (R4-H2-003), the stream state machine (R4-H2-004) and flow control (R4-H2-005) -- into a minimal HTTP/2 CLIENT CONNECTION SEQUENCE asserted over an IN-MEMORY / loopback byte stream (NO live network, NO sockets in the gate): preface -> empty SETTINGS -> HEADERS(GET, END_STREAM|END_HEADERS) -> expect peer SETTINGS + our SETTINGS-ACK exchange + response HEADERS + DATA. The byte sequence is the allowed internet-boundary requirement (RFC 9113 / 7541 dictate the exact octets so we interoperate); the IMPLEMENTATION is pure NishiLang via nx_cc -> nxasm_x86: no gcc, no openssl, no nghttp2. FOUNDED ON (composes, does not reinvent -- anti-orphan law): - nx_h2_flow.nx (R4-H2-005, GREEN): imported EXACTLY ONCE. It transitively splices nx_h2_frame.nx -> nx_hpack.nx -> nx_str.nx -> syscalls.nx, so this ONE import inherits the whole stack: the HPACK encoders (hpack_encode_indexed / hpack_encode_lit_inc_indexed_name), the frame builders (h2_write_preface / h2_frame_write_settings_empty / h2_frame_write_settings_ack / h2_frame_write_headers / h2_frame_write_data / h2_frame_read_header / h2_check_preface), the flow-window arithmetic (h2_flow_init / h2_flow_consume / h2_flow_is_data_frame), plus sys_mmap / sys_write / sys_exit / sys_openat_append / sys_close. Importing nx_h2_frame / nx_hpack / nx_str / nx_syscalls / nx_h2_stream directly TOO would be the RC6 double-import landmine. - nx_h2_stream.nx (R4-H2-004, GREEN): imported EXACTLY ONCE for the stream state machine (h2_stream_new / h2_stream_send_headers / h2_stream_recv_headers / h2_stream_recv_data). nx_h2_stream imports nx_h2_frame, and nx_h2_flow ALSO imports nx_h2_frame -- but each shared module is included at most once by the linker (include-guarded), so importing BOTH nx_h2_flow and nx_h2_stream here pulls nx_h2_frame in once. No floating capability: HPACK founds the codec founds the stream machine founds flow control founds THIS conformance/ALPN rung -- the top of the ladder. BACK-FILL: the team RE-AUTHORS this from the DATA spec via the emitter-of-emitters (X-AUT-006c/e/f) -- this hand-authored scaffold is the sanctioned one-time bootstrap only (meter-integrity, mirror nx_frame_codec.nx:13-16 / nx_h2_frame.nx:31-34 / nx_h2_flow.nx:30-33).

dependencies 4 imports · 2 importers

nx_h2_flow.nx nx_itoa_lib.nx nx_h2_stream.nx nx_tls13_ext.nx nx_h2_conformance.nx nx_h2_client_over_tls.nx nx_h2_server.nx

imports: nx_h2_flow.nxnx_itoa_lib.nxnx_h2_stream.nxnx_tls13_ext.nx

imported by: nx_h2_client_over_tls.nxnx_h2_server.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main cf_puts tls13_ext_emit_alpn_h2_htt tls_write_u16_be cf_check_bytes cf_puts ↻ cf_putn nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap cf_puthex2 tls13_ext_parse_alpn_selec tls_read_u16_be cf_putn ↻ nx_str_cpy h2_build_client_open h2_write_preface h2_frame_write_settings_em h2_frame_write_header tls_write_u24_be h2_write_u32_be h2_build_request_block hpack_encode_indexed hpack_encode_int hpack_encode_lit_noindex_i hpack_encode_int ↻ hpack_encode_str_raw hpack_encode_int ↻ hpack_encode_lit_inc_index hpack_encode_int ↻ hpack_encode_str_raw ↻ h2_frame_write_headers h2_frame_write_header ↻ cf_check cf_puts ↻ cf_putn ↻ h2_check_preface

structs

none

consts

61const K_MAGIC_1024: i64 = 1024
62const K_MAGIC_65535: i64 = 65535
63const K_MAGIC_65533: i64 = 65533

functions

66func cf_puts(s: *u8) -> i64
76func cf_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 3: cf_check_bytescf_checkmain calls 1: nxi_out
77func cf_puthex2(v: i64) -> i64
called by 1: cf_check_bytes
92func cf_fdn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
102func h2_build_request_block(block: *u8, authority: *u8, alen: i64, path: *u8, plen: i64) -> i64
138func h2_build_client_open(out: *u8, off: i64, authority: *u8, alen: i64, path: *u8, plen: i64) -> i64
157func h2_build_request_block_ua(block: *u8, authority: *u8, alen: i64, path: *u8, plen: i64, ua: *u8, ualen: i64) -> i64
164func h2_build_client_open_ua(out: *u8, off: i64, authority: *u8, alen: i64, path: *u8, plen: i64, ua: *u8, ualen: i64) -> i64
194func h2_consume_frames(buf: *u8, off: i64, lim: i64, conn_window: *i64, stream_window: *i64, stream_state: *i64) -> i64
243func cf_check_bytes(name: *u8, got: *u8, glen: i64, exp: *u8, elen: i64) -> i64
called by 1: main calls 3: cf_putscf_putncf_puthex2
265func cf_check(name: *u8, got: i64, exp: i64) -> i64
called by 1: main calls 2: cf_putscf_putn
277func main() -> i64