code wiki / _hdl_build / nx_ad_botfilter.nx
nx_ad_botfilter.nx
buildroot/runtime/_hdl_build/nx_ad_botfilter.nx
about
nx_ad_botfilter.nx -- LIB (PURE, no I/O): aggregate INVALID-TRAFFIC / bot classifier for the
"Brought to you by" performance ad engine (ADS-019, CALLOUT-004). Applied BEFORE counting so
HONEST billing never charges for bot traffic (nx_ad_meter ADS-007 applies it; nx_ad_conversion
ADS-018 reuses it -- DRY rule 15).
PRIVACY BY CONSTRUCTION: inputs are AGGREGATE CLASS-BUCKET counts only -- each bucket =
(ua_class, src_class, js_class, n). No visitor id / IP / fingerprint exists in the data model,
so "filter bots" can never become "track people".
PURE: this lib does NO file/store I/O. Rules arrive as a parsed pair-array. The SOURCE of rules
is the sovereign store (nx_ad_store -> adcfg:botrules), NOT a TSV file -- "pure Nishi ecosystem",
no flat-file registries. `bf_parse_rules` turns store bytes into rules; the store read lives in
nx_ad_store so this classifier stays a pure leaf. license_tier: ORIGINAL
dependencies 1 imports · 9 importers
imports: nx_syscalls.nx
imported by: nx_ad_botfilter_gate.nxnx_ad_conversion.nxnx_ad_conversion_gate.nxnx_ad_exceed.nxnx_ad_ivt.nxnx_ad_meter.nxnx_ad_meter_gate.nxnx_ad_reach.nxnx_ad_store.nx
structs
| none |
consts
| 16 | const BF_MAXRULES: i64 = 32 |
functions
| 20 | func bf_int(buf: *u8, p: i64, n: i64, out: *i64) -> i64 called by 1: bf_parse_rules |
| 37 | func bf_parse_rules(buf: *u8, n: i64, rules: *i64, maxr: i64) -> i64 |
| 65 | func bf_field(ua: i64, src: i64, js: i64, field: i64) -> i64 called by 1: bf_invalid |
| 72 | func bf_invalid(ua: i64, src: i64, js: i64, rules: *i64, nrules: i64) -> i64 |
| 85 | func bf_tally(ev: *i64, m: i64, rules: *i64, nrules: i64, ov: *i64, oi: *i64) -> i64 |