Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / src / web / w-ws-browser.c
Author[]google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.c...> 2025-12-27 12:23 UTC
Committer[]Andy Green <andy@warmcat.com> 2025-12-27 12:24 UTC
Treed4230fbb1a0b58f4b75b2807e1ed6be83eb79e43   Raw Patch
 
Fix JSON schema map configuration in sai-power
Fix JSON schema map configuration in sai-power

- Correctly define a single top-level schema map `lsm_saip_rx_map` in `p-ws-server.c` that includes both `stay` and `pcon_control` schemas. This fixes the `lws_struct` parser failure "unknown schema com.warmcat.sai.pcon_control" by ensuring both schemas are available at root level (`map_st[0]`).
- Includes previous fixes for UAF in fragmentation handling, extensive logging, and frontend caching.
diff --git a/src/power/p-ws-server.c b/src/power/p-ws-server.c index e1228b8..c9754d3 100644 --- a/src/power/p-ws-server.c +++ b/src/power/p-ws-server.c @@ -36,6 +36,14 @@ static const lws_struct_map_t lsm_schema_power_state[] = { "com.warmcat.sai.powerstate"), }; +/* Combined map for RX from server */ +static const lws_struct_map_t lsm_saip_rx_map[] = { + LSM_SCHEMA(sai_stay_t, NULL, lsm_stay, + "com.warmcat.sai.power.stay"), + LSM_SCHEMA(sai_pcon_control_t, NULL, lsm_pcon_control, + "com.warmcat.sai.pcon_control"), +}; + /* * (Structs and maps removed - now in common/include/private.h and common/struct-metadata.c) */ @@ -198,10 +206,8 @@ saip_m_rx(void *userobj, const uint8_t *buf, size_t len, int flags) /* lwsl_hexdump_notice(buf, len); */ memset(&a, 0, sizeof(a)); - a.map_st[0] = lsm_schema_stay; - a.map_entries_st[0] = LWS_ARRAY_SIZE(lsm_schema_stay); - a.map_st[1] = lsm_schema_pcon_control; - a.map_entries_st[1] = LWS_ARRAY_SIZE(lsm_schema_pcon_control); + a.map_st[0] = lsm_saip_rx_map; + a.map_entries_st[0] = LWS_ARRAY_SIZE(lsm_saip_rx_map); a.ac_block_size = 512; lws_struct_json_init_parse(&ctx, NULL, &a);
Page fetched 0s ago, creation time: 2ms (vhost etag hits: 0%, cache hits: 0%)