nx_ice_agent.nx
buildroot/runtime/nx_ice_agent.nx
about
nx_ice_agent.nx -- SOVEREIGN ICE AGENT state machine (RFC 8445 6), NishiLang, composing nx_ice.
The orchestration on top of the check-exchange primitives: an agent holds its LOCAL candidates and the
peer's REMOTE candidates, forms candidate PAIRS (same component), orders them by candidate-pair priority
(RFC 8445 6.1.2.3, via the overflow-safe comparator), schedules connectivity checks highest-priority
first, records each check's result, and NOMINATES the best valid pair as the selected path. Pure logic
over the primitives -- the actual check send/recv is nx_ice's ic_build_check / ic_verify_* over UDP; this
module decides WHICH pair to check next and WHICH becomes the path. Zero third-party code.
license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_8445
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_ice.nx
imported by: nx_ice_agent_gate.nx
structs
| none |
consts
| 12 | const AG_MAGIC_4096: i64 = 4096 |
| 14 | const AG_MAX_LOCAL: i64 = 8 |
| 15 | const AG_MAX_REMOTE: i64 = 8 |
| 16 | const AG_MAX_PAIRS: i64 = 64 |
| 19 | const AG_NLOCAL: i64 = 0 |
| 20 | const AG_NREMOTE: i64 = 1 |
| 21 | const AG_NPAIRS: i64 = 2 |
| 22 | const AG_CONTROLLING: i64 = 3 |
| 23 | const AG_NOMINATED: i64 = 4 // pair index of the SELECTED pair, or -1 |
| 26 | const AG_LOCAL0: i64 = 8 |
| 27 | const AG_REMOTE0: i64 = 40 // AG_LOCAL0 + AG_MAX_LOCAL*4 |
| 28 | const AG_PAIRS0: i64 = 72 // AG_REMOTE0 + AG_MAX_REMOTE*4 |
| 31 | const AG_ST_WAITING: i64 = 0 |
| 32 | const AG_ST_INPROGRESS: i64 = 1 |
| 33 | const AG_ST_SUCCEEDED: i64 = 2 |
| 34 | const AG_ST_FAILED: i64 = 3 |
| 35 | const AG_ST_SELECTED: i64 = 4 |
functions
| 37 | func ag_new(controlling: i64) -> *i64 |
| 43 | func ag_add_local(a: *i64, ip: i64, port: i64, prio: i64, comp: i64) -> i64 called by 1: main |
| 51 | func ag_add_remote(a: *i64, ip: i64, port: i64, prio: i64, comp: i64) -> i64 called by 1: main |
| 59 | func ag_local_prio(a: *i64, i: i64) -> i64 { return a[AG_LOCAL0 + i*4 + 2] } |
| 60 | func ag_local_comp(a: *i64, i: i64) -> i64 { return a[AG_LOCAL0 + i*4 + 3] } called by 1: ag_form_pairs |
| 61 | func ag_remote_prio(a: *i64, i: i64) -> i64 { return a[AG_REMOTE0 + i*4 + 2] } |
| 62 | func ag_remote_comp(a: *i64, i: i64) -> i64 { return a[AG_REMOTE0 + i*4 + 3] } called by 1: ag_form_pairs |
| 63 | func ag_pair_local(a: *i64, p: i64) -> i64 { return a[AG_PAIRS0 + p*4] } |
| 64 | func ag_pair_remote(a: *i64, p: i64) -> i64 { return a[AG_PAIRS0 + p*4 + 1] } |
| 65 | func ag_pair_state(a: *i64, p: i64) -> i64 { return a[AG_PAIRS0 + p*4 + 2] } |
| 68 | func ag_pair_G(a: *i64, p: i64) -> i64 { if a[AG_CONTROLLING]==1 { return ag_local_prio(a, ag_pair_local(a,p)) } return ag_remote_prio(a, ag_pair_remote(a,p)) } |
| 69 | func ag_pair_D(a: *i64, p: i64) -> i64 { if a[AG_CONTROLLING]==1 { return ag_remote_prio(a, ag_pair_remote(a,p)) } return ag_local_prio(a, ag_pair_local(a,p)) } |
| 72 | func ag_swap(a: *i64, p: i64, q: i64) -> i64 called by 1: ag_form_pairs |
| 83 | func ag_form_pairs(a: *i64) -> i64 |
| 116 | func ag_next_check(a: *i64) -> i64 |
| 125 | func ag_result(a: *i64, p: i64, success: i64) -> i64 called by 1: main |
| 133 | func ag_nominate(a: *i64) -> i64 |