code wiki / (root) / nx_iot_kasa_probe.nx

nx_iot_kasa_probe.nx

buildroot/runtime/nx_iot_kasa_probe.nx

5169 B154 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind probetopic iot
docsdependenciesstructsconstsfunctions

about

nx_iot_kasa_probe.nx -- SOVEREIGN live Kasa device query. Replaces the non-Nishi shell shim entirely: opens a UDP socket, sends the autokey-encrypted get_sysinfo, reads + decrypts the reply, confirms it is a Kasa sysinfo. The CAPABILITY is this organ; the OS only supplies the socket syscalls -- so the SAME source runs on Linux today (via nx_syscalls_x86_64) and on the optimized NishiOS later (via its syscalls). Nothing PowerShell/netsh on the program path. Composition (DRY, CLAUDE.md #15) -- duplicates nothing: - nx_udp : sovereign UDP socket round-trip - nx_iot_local_kasa : autokey encrypt/decrypt + get_sysinfo builder + looks_like_sysinfo (crypto gate-proven in nx_iot_local_kasa_test) NEVER-BRICK (CLAUDE.md #26): get_sysinfo is READ-ONLY -- it queries device state and writes NOTHING to the device. No firmware path exists here. genealogy_id: NISHI_IOT_HUB_ROADMAP.md Epoch 1/2 + project-iot-discovery-pairing-revival-2026-06-22 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls_x86_64.nx nx_udp.nx nx_iot_local_kasa.nx nx_iot_kasa_probe.nx

imports: nx_syscalls_x86_64.nxnx_udp.nxnx_iot_local_kasa.nx

imported by: nobody (leaf or entry point)

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

main nx_iot_kasa_probe_sysinfo nx_udp_open sys_socket nx_iot_kp_set_rcvtimeo_ms sys_setsockopt nx_iot_kasa_pt_sysinfo nx_iot_kasa_puts_z nx_iot_kasa_encrypt nx_udp_sockaddr_dest nx_udp_send sys_sendto nx_udp_recv sys_recvfrom nx_iot_kasa_decrypt nx_iot_kasa_looks_like_sys nx_iot_kasa_find nx_iot_kasa_strlen

structs

none

consts

25const KP_MAGIC_2048: i64 = 2048
26const KP_MAGIC_9999: i64 = 9999
27const KP_MAGIC_2000: i64 = 2000
30const KP_SO_RCVTIMEO: i64 = 20
33const KP_UNKNOWN: i64 = 0
34const KP_OK: i64 = 1 // got a Kasa sysinfo reply
35const KP_SOCKET_FAIL: i64 = 2
36const KP_SEND_FAIL: i64 = 3
37const KP_NO_REPLY: i64 = 4 // timeout, no datagram
38const KP_NOT_SYSINFO: i64 = 5 // a reply, but not a Kasa sysinfo
39const KP_BUF_SMALL: i64 = 6
40const KP_N: i64 = 7

functions

42func nx_iot_kp_verdict_is_valid(v: i64) -> i64
49func nx_iot_kp_set_rcvtimeo_ms(fd: i64, ms: i64) -> i64
75func nx_iot_kasa_probe_sysinfo(a: i64, b: i64, c: i64, d: i64, port: i64,
126func main() -> i64