nx_h2_conformance.nx
buildroot/runtime/nx_h2_conformance.nx
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
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
structs
| none |
consts
| 61 | const K_MAGIC_1024: i64 = 1024 |
| 62 | const K_MAGIC_65535: i64 = 65535 |
| 63 | const K_MAGIC_65533: i64 = 65533 |
functions
| 66 | func cf_puts(s: *u8) -> i64 |
| 76 | func cf_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 77 | func cf_puthex2(v: i64) -> i64 called by 1: cf_check_bytes |
| 92 | func cf_fdn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 102 | func h2_build_request_block(block: *u8, authority: *u8, alen: i64, path: *u8, plen: i64) -> i64 |
| 138 | func h2_build_client_open(out: *u8, off: i64, authority: *u8, alen: i64, path: *u8, plen: i64) -> i64 |
| 157 | func h2_build_request_block_ua(block: *u8, authority: *u8, alen: i64, path: *u8, plen: i64, ua: *u8, ualen: i64) -> i64 called by 1: h2_build_client_open_ua calls 2: h2_build_request_blockhpack_encode_lit_noindex_indexed_name |
| 164 | func h2_build_client_open_ua(out: *u8, off: i64, authority: *u8, alen: i64, path: *u8, plen: i64, ua: *u8, ualen: i64) -> i64 |
| 194 | func h2_consume_frames(buf: *u8, off: i64, lim: i64, conn_window: *i64, stream_window: *i64, stream_state: *i64) -> i64 |
| 243 | func cf_check_bytes(name: *u8, got: *u8, glen: i64, exp: *u8, elen: i64) -> i64 |
| 265 | func cf_check(name: *u8, got: i64, exp: i64) -> i64 |
| 277 | func main() -> i64 |