code wiki / (root) / nx_printer_health.nx

nx_printer_health.nx

buildroot/runtime/nx_printer_health.nx

7973 B166 linesdepth 1pulls 1 transitivereach 11 importersview sourcekind librarytopic printer
docsdependenciesstructsconstsfunctions

about

nx_printer_health.nx -- honest-status / anti-silent-failure model layer (R1) over nx_ipp_codec. THE operator complaint this targets: printers "silently fail". A real IPP printer always tells you WHY it is stuck via printer-state + printer-state-reasons; Brother's UI swallows it. This layer reads a parsed Get-Printer-Attributes response and answers, honestly and mechanically, the only question a user cares about: "can this thing actually print right now, and if not, exactly why?" Grounded in RFC 8011 sec 5.4.11/5.4.12 (fetched by the sovereign researcher -> ipp_rfc8011.raw): - printer-state: idle=3 processing=4 stopped=5 - printer-state-reasons (1setOf keyword): each value MAY carry a severity suffix '-report' (least severe; MUST NOT affect output) '-warning' (won't stop the Job; output may be lower quality) '-error' (most severe; if ANY error reason is present the printer MUST be 'stopped') If a value has NO suffix and is not 'none': it is an ERROR when the printer is 'stopped', otherwise a WARNING. 'none' means there are no reasons. - printer-is-accepting-jobs (boolean, sec 5.4.23) NEVER-BRICK (#26): pure model logic; no syscalls, no hardware writes. Safe by construction. no_silent_failure: a malformed response yields NX_PR_UNKNOWN, never a false "ready". Sovereign: imports only nx_ipp_codec.nx; nx_cc -> nxasm, no gcc. genealogy_id: project-printer-management-ipp-sclass-2026-06-20 license_tier: ORIGINAL nx_capability_claims: provides: [printer_reason_severity, printer_worst_severity, printer_accepting, printer_can_print, printer_diagnose] safety: [no_unchecked_deref, no_floating_point, no_syscall, bounded_iteration, never_brick_pure_model, defensive_bounds_checked] verdict: [sealed_enum_severity, sealed_enum_can_print, no_silent_failure] sss: [S6, S7]

dependencies 1 imports · 6 importers

nx_ipp_codec.nx nx_printer_health.nx nx_ipp_transport_test.nx nx_printer_exceed.nx nx_printer_health_test.nx nx_printer_query.nx nx_printers_render.nx nx_toner_liberate.nx

imports: nx_ipp_codec.nx

imported by: nx_ipp_transport_test.nxnx_printer_exceed.nxnx_printer_health_test.nxnx_printer_query.nxnx_printers_render.nxnx_toner_liberate.nx

structs

none

consts

36const NX_SEV_NONE: i64 = 0
37const NX_SEV_REPORT: i64 = 1
38const NX_SEV_WARNING: i64 = 2
39const NX_SEV_ERROR: i64 = 3
42const NX_PR_CAN_PRINT: i64 = 1 // ready
43const NX_PR_DEGRADED: i64 = 2 // will print, but needs attention (a warning is active)
44const NX_PR_BLOCKED: i64 = 3 // will NOT print until a human acts (stopped / not accepting / error)
45const NX_PR_UNKNOWN: i64 = 4 // could not be determined (malformed/absent) -- never a false "ready"
46const NX_PR_VERDICT_N: i64 = 5

functions

48func nx_pr_verdict_is_valid(v: i64) -> i64
55func nx_ph_ends_with(buf: *u8, off: i64, len: i64, suf: *u8) -> i64
63func nx_ph_reason_severity(buf: *u8, off: i64, len: i64, pstate: i64) -> i64
78func nx_ph_worst_reason_severity(buf: *u8, n: i64, pstate: i64, out_count: *i64) -> i64
130func nx_ph_accepting(buf: *u8, n: i64, scratch3: *i64) -> i64
called by 1: nx_printer_diagnose calls 1: nx_ipp_find
142func nx_printer_can_print(pstate: i64, accepting: i64, worst_sev: i64) -> i64
called by 1: nx_printer_diagnose
155func nx_printer_diagnose(buf: *u8, n: i64, scratch3: *i64,