94 个内核参考模块 · 14 个扩展库 · 6,833 条目录参考条目

内核模块(3143 条参考 / 94 个模块)

基础层(487 条参考 / 21 个模块)

core

17
core.h

版本、ABI、模块查询

features

0
features.h

模块编译开关映射(自动生成,无 API)

error

29
error.h

结构化错误对象与原因链

error_format

1
error_format.h

错误格式化输出

memory

15
memory.h

堆分配收口与分配器替换

memory_debug

11
memory_debug.h

分配故障注入与泄漏检测

memory_stats

4
memory_stats.h

进程级内存统计

temp

17
temp.h

零分配 arena 临时内存

string

85
string.h

字符串操作全集

regex

54
regex.h

正则表达式(编译、匹配、替换、集合)

pattern

47
pattern.h

结构化模式匹配({name} 捕获)

charset

72
charset.h

字符集与 Unicode 转换

number

18
number.h

数值解析与格式化

html

3
html.h

HTML 实体编解码

template

32
template.h

类型化模板

codec

20
codec.h

Hex / Base64 / Percent 编解码

compress

18
compress.h

Deflate / Inflate 压缩

math

20
math.h

数学工具

hash

9
hash.h

哈希函数

random

39
random.h

PCG32 与密码安全随机

xid

11
xid.h

分布式唯一标识

容器(434 条参考 / 10 个模块)

array

50
array.h

动态数组与指针数组

list

28
list.h

双向链表

buffer

23
buffer.h

分段缓冲区

slot_map

16
slot_map.h

稳定下标槽映射

avl

43
avl.h

AVL 平衡树

map

62
map.h

哈希映射与整数映射

set

34
set.h

哈希集合与集合运算

stack

74
stack.h

栈族五件套

queue

46
queue.h

SPSC/MPSC/MPMC 无锁队列

pool

58
pool.h

对象池与变长内存池

数据层(233 条参考 / 5 个模块)

value

143
value.h

xvalue 动态值与 COW 容器

json

30
json.h

JSON 解析与序列化

xlon

36
xlon.h

XLang 对象表示格式

jsonl

12
jsonl.h

JSON Lines 逐行读写

xlonl

12
xlonl.h

XLON Lines 逐行读写

并发层(328 条参考 / 13 个模块)

atomic

29
atomic.h

原子操作

spin

7
spin.h

自旋锁

sync

45
sync.h

互斥量/条件/信号量/读写锁/事件

thread

22
thread.h

线程与 TLS

wait

0
wait.h

等待原语

cancel

15
cancel.h

协作取消

coroutine

47
coroutine.h

有栈协程与调度器

channel

34
channel.h

Go 风格通道与 Select

future

72
future.h

Future / Promise 与组合子

future_bridge

10
future_bridge.h

Future 桥接

executor

9
executor.h

执行器抽象

task

39
task.h

任务池与任务组

signal

20
signal.h

跨平台信号处理

文件与系统(442 条参考 / 10 个模块)

file

100
file.h

文件读写、映射、锁、原子写

vfs

31
vfs.h

虚拟文件系统

file_async

34
file_async.h

异步文件 I/O

path

32
path.h

路径解析与操作

io

46
io.h

Reader / Writer 抽象

console

22
console.h

控制台输出

environment

4
environment.h

环境变量

process

36
process.h

进程创建与管理

logger

80
logger.h

日志系统

time

57
time.h

时间与时区

安全层(245 条参考 / 4 个模块)

asn1

27
asn1.h

ASN.1 / DER 编解码

crypto

122
crypto.h

AES-GCM、ChaCha20、SHA、Ed25519、RSA

pem

7
pem.h

PEM 编解码

x509

89
x509.h

证书解析、路径验证、CRL

TLS(268 条参考 / 8 个模块)

tls

140
tls.h

自研 TLS 1.2/1.3 协议栈

tls_client

10
tls_client.h

TLS 客户端配置

tls_server

9
tls_server.h

TLS 服务端配置

tls_session

29
tls_session.h

TLS 会话管理

tls_stream

53
tls_stream.h

TLS 流层

tls_resume

7
tls_resume.h

会话恢复

tls_identity

13
tls_identity.h

TLS 身份

tls_verify

8
tls_verify.h

TLS 验证

网络层(377 条参考 / 9 个模块)

net

191
net.h

地址、引擎、Worker、缓冲池、端口

tcp

63
tcp.h

TCP 流

tcp_server

15
tcp_server.h

TCP 服务端

udp

73
udp.h

UDP 数据报

net_file

4
net_file.h

网络文件传输

net_frame

9
net_frame.h

帧层

net_interface

12
net_interface.h

网络接口查询

proxy

23
proxy.h

代理配置

task_net

6
task_net.h

网络任务

Web 协议层(253 条参考 / 14 个模块)

http

59
http.h

HTTP 语义原语

http1

25
http1.h

HTTP/1.1 解析与编码

http1_net

2
http1_net.h

HTTP/1.1 网络绑定

http1_tls

2
http1_tls.h

HTTP/1.1 TLS 绑定

http_connection

5
http_connection.h

HTTP 连接管理

http_decode

10
http_decode.h

HTTP 解码器

http_encoding

12
http_encoding.h

HTTP 编码

http_expect

8
http_expect.h

Expect 头

http_te

10
http_te.h

Transfer-Encoding

http_trailer

6
http_trailer.h

HTTP Trailer

http_upgrade

10
http_upgrade.h

HTTP Upgrade

websocket

57
websocket.h

WebSocket 帧协议

websocket_stream

38
websocket_stream.h

WebSocket 流

websocket_upgrade

9
websocket_upgrade.h

WebSocket 升级

扩展库(2,846 条参考 / 14 库)

xhttp

1036
70 个参考模块

HTTP 客户端与服务端

xssh

586
65 个参考模块

SSH2 协议原语与客户端运行时

xacme

61
14 个参考模块

ACME 证书申请与管理。五家云 DNS provider、EAB、传播确认与一站式 Obtain,自动化 Let's Encrypt 签发。

xjwt

28
xjwt.h

JWT/JWS 签发与验证。HS/RS/ES 三族算法与 JWKS 公钥集,按 kid 自动选钥。

xoauth2

32
xoauth2.h

OAuth2 客户端与 OIDC 应用组合。授权码、PKCE、令牌刷新与 introspection。

xllm

100
xllm.h

单次模型调用、流式响应与提供方适配。OpenAI 兼容/Anthropic/Responses 三方言,传输重试与用量统计。

xllm-session

77
xllm-session.h

会话账本、预算、压缩与持久化。上下文预算、轮次滑窗与 JSONL 存档恢复。

xwork

71
xwork.h

Agent 循环、工具执行与审批。有界工具循环、子代理委派与统一任务系统。

xruntime

442
17 个参考模块

动态类型与对象系统

xmail

89
16 个参考模块

邮件 MIME 与传输基座

xsmtp

43
4 个参考模块

SMTP 邮件客户端

xpop3

47
4 个参考模块

POP3 邮件客户端

ximap

101
9 个参考模块

IMAP 邮件客户端

xws

133
5 个参考模块

WebSocket 运行时

命名约定与错误模型

全库统一约定:函数 xrt + 模块前缀 + PascalCase(如 xrtHttp1RequestParse); 类型小写 x 前缀(xnetstream、xhttpcall);常量全大写。 头文件按 XRT_MODULE_* / XHTTP_MODULE_* 宏裁剪,依赖断言以 #error 强制。

错误处理是四层模型:解析层返回带偏移的错误结构(xhttp1errorinfo);网络层用结果码 xnetresult 区分错误与控制流(AGAIN / CLOSED / TIMEOUT / CANCELLED); 运行时层走线程级结构化错误 xrtGetError / xrtSetError(带域、操作名与原因链 xrtErrorWrap); 异步层用 xwaitresult。

最权威的参考永远是头文件本身(全中文注释、按模块裁剪、依赖断言齐全):

当前参考面向 XRT 2.0.0-dev。按模块组织接口,结合头文件注释与仓库示例阅读,可以更快建立完整的调用流程。