sdk: 同步主仓新增模块 cachegov/lazygrid/select/net 通道

This commit is contained in:
AskaEth committed 2026-09-03 05:09:05 +08:00
1 parent 0af6af7c7e
commit 64cde13c8d
15 files changed
+1326 -10

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/*
* meow_ui_net.h — MeowOS SDK 网络自愿通道(NETMGR_DESIGN §6.3/§4;追加式 API,含入 meow_ui.h)。
*
* 定位:框架 App 联网前的**自愿自治**通道 + **自愿字节上报**,二者都不强制(防君子不防小人)。
* - meow_net_policy_check(host):联网前自查 host 是否被 netmgrd 管控策略放行。
* 返回 0=allow(可联网);1=block(策略拒绝,App 应中止本次联网)。
* netmgrd 不在 / 超时 → 0(乐观放行,绝不因监控不可用而误封业务)。
* - meow_net_report(rx,tx):App 自愿上报本进程累计收发字节。内核无 per-socket/per-uid
* 字节计数器(NETMGR_DESIGN §4 表),§4 的「字节级精确记账走 SDK 自报通道」由此落地;
* netmgrd 记入 per-实体统计(status JSON `entity_bytes`)。best-effort,失败静默不影响业务。
* 用法:App 在发起 HTTP/TLS 前调 meow_net_policy_check(host),若返回 1 则按产品语义处理(如提示被限)。
*/
#ifndef MEOW_UI_NET_H
#define MEOW_UI_NET_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* 检查 host 是否被策略放行。0=allow;1=block;netmgrd 不在/超时 → 0(乐观放行)。
* host 为域名(如 "music.163.com");判定以当前 App(MEOW_LOG_APP)为实体,服务端策略引擎权威执行。 */
int meow_net_policy_check(const char *host);
/* 上报本进程累计收发字节(best-effort,失败静默)。 */
void meow_net_report(uint32_t rx, uint32_t tx);
#ifdef __cplusplus
}
#endif
#endif /* MEOW_UI_NET_H */