code wiki / _hdl_build / nx_adnet.nx
nx_adnet.nx
buildroot/runtime/_hdl_build/nx_adnet.nx
about
nx_adnet.nx -- LIB: the SOVEREIGN 4chan-style BANNER AD SERVER core (operator: "our ad network ... like how 4chan
has their banners"). First-party, same-origin, PRIVACY-RESPECTING: contextual by SECTION only -- NO cookies, NO
cross-site behavioral tracking, NO 3rd-party. Offsets hosting cost; site-level banners = safe-harbor-compatible
(platform ads, not per-content monetization). Inventory row: id<TAB>advertiser<TAB>img<TAB>clickurl<TAB>section<TAB>weight.
ad_pick(section, rot) -> rotate 1 of N matching the section ad_render_banner -> first-party <a><img> (click via our tracker)
ad_impression/ad_click -> append-only per-AD counters (not per-user) ad_click_target -> the redirect url
Self-contained (own parsing). No TLS. license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_adnet_bill.nxnx_adnet_gate.nxnx_adnet_slot.nx
structs
| none |
consts
| 9 | const K_MAGIC_1024: i64 = 1024 |
functions
| 11 | func ad_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 12 | func ad_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } |
| 13 | func ad_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8) { if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 } |
| 14 | func ad_eol(b: *u8, from: i64, blen: i64) -> i64 { var e: i64=from; while e<blen { if b[e]==10 as u8 { return e } e=e+1 } return blen } |
| 15 | func ad_tab(b: *u8, from: i64, limit: i64) -> i64 { var e: i64=from; while e<limit { if b[e]==9 as u8 { return e } e=e+1 } return limit } |
| 16 | func ad_field(row: *u8, rlen: i64, idx: i64, out: *u8) -> i64 { var fs: i64=0; var f: i64=0; while f<idx { let t: i64=ad_tab(row,fs,rlen); fs=t+1; f=f+1 } let fe: i64=ad_tab(row,fs,rlen); var o: i64=0; var k: i64=fs; while k<fe { out[o]=row[k]; o=o+1; k=k+1 } out[o]=0 as u8; return o } |
| 19 | func ad_section_count(inv: *u8, ilen: i64, section: *u8) -> i64 |
| 25 | func ad_pick(inv: *u8, ilen: i64, section: *u8, rot: i64, out: *u8) -> i64 |
| 40 | func ad_render_banner(ad_row: *u8, rlen: i64, out: *u8) -> i64 |
| 50 | func ad_event(logbuf: *u8, llen: i64, ad_id: *u8) -> i64 { var o: i64=llen; o=ad_cat(logbuf,o,ad_id); logbuf[o]=10 as u8; o=o+1; return o } |
| 51 | func ad_event_count(logbuf: *u8, llen: i64, ad_id: *u8) -> i64 |
| 57 | func ad_click_target(inv: *u8, ilen: i64, ad_id: *u8, out: *u8) -> i64 |