-
Notifications
You must be signed in to change notification settings - Fork 0
API Overview
#include <wknet/Wknet.h>
命名空间:wknet::http · wknet::websocket · wknet::sse · wknet::codec · wknet::crypto
| 项 | 说明 |
|---|---|
| IRQL | HTTP / WebSocket / 证书 / 异步入口在 PASSIVE_LEVEL
|
| 返回值 | 多为 NTSTATUS;标 _Must_inspect_result_ 须检查;成功用 NT_SUCCESS
|
| 句柄 | 不透明堆对象;Create 取得,Close / Release 释放 |
| 选项对象 |
SendOptions / AsyncOptions 经 *Create / *Release 管理 |
| 空指针 |
Close / Release 接受 nullptr
|
| 异常 | 不使用 C++ 异常 |
| 类型 | 命名空间 | 创建 / 取得 | 释放 | 头文件 |
|---|---|---|---|---|
Session |
wknet::http |
SessionCreate |
SessionClose |
http/Session.h |
Request |
wknet::http |
RequestCreate |
RequestRelease |
http/Request.h |
Response |
wknet::http |
Send* / AsyncGetResponse
|
ResponseRelease |
http/Response.h |
AsyncOp |
wknet::http |
Async* / ConnectAsync*
|
AsyncRelease |
http/AsyncOp.h |
Headers |
wknet::http |
HeadersCreate |
HeadersRelease |
http/Headers.h |
Body |
wknet::http |
BodyCreate* |
BodyRelease |
http/Body.h |
Cache |
wknet::http |
CacheCreate |
CacheRelease |
http/Cache.h |
CertificateStore |
wknet::http |
CertificateStoreCreate |
CertificateStoreClose |
http/Certificate.h |
WebSocket |
wknet::websocket |
Connect* |
Close / CloseEx
|
websocket/WebSocket.h |
SseClient |
wknet::sse |
Connect* |
Close |
sse/Sse.h |
SendOptions / AsyncOptions 见 同步 HTTP / 异步 HTTP。
| 头文件 | 内容 |
|---|---|
wknet/Wknet.h |
公共 API 总入口 |
wknet/http/Types.h |
枚举、配置结构体、回调、默认常量 |
wknet/http/Session.h |
SessionCreate / SessionClose
|
wknet/http/Request.h |
RequestCreate / RequestRelease
|
wknet/http/Headers.h |
请求头 |
wknet/http/Body.h |
请求体 |
wknet/http/Options.h |
SendOptionsCreate / AsyncOptionsCreate
|
wknet/http/Http.h |
同步 Send / Get / Post … |
wknet/http/HttpAsync.h |
异步 AsyncSend / AsyncGet … |
wknet/http/AsyncOp.h |
等待、取消、取 Response
|
wknet/http/Response.h |
状态码 / body / header / trailer |
wknet/http/Lifecycle.h |
Destroy |
wknet/http/Certificate.h |
CertificateStore、pin、mTLS 相关类型 |
wknet/http/Cache.h |
内存 cache |
wknet/websocket/WebSocket.h |
WebSocket 连接与收发 |
wknet/sse/Sse.h |
Server-Sent Events 客户端 |
wknet/codec/Codec.h |
content-coding / EXI / Pack200 |
wknet/crypto/Aead.h |
AEAD |
wknet/crypto/TlsCredential.h |
TlsClientCredential(经 Certificate.h) |
wknet/Trace.h |
诊断 |
Wknet.h 会包含上表中的公共头(TlsCredential.h 经 Certificate.h 引入)。细分包含时可只取所需头文件。
| 函数 | 返回 |
|---|---|
DefaultSessionConfig() |
SessionConfig |
DefaultTlsConfig() |
TlsConfig |
DefaultSendOptions() |
SendOptions 值 |
DefaultConnectConfig() |
websocket::ConnectConfig 或 sse::DefaultConnectConfig()
|
SendOptions / AsyncOptions 作为 API 参数时使用 SendOptionsCreate / AsyncOptionsCreate(构造函数私有)。
| 页 | 内容 |
|---|---|
| 会话与配置 |
Session、SessionConfig、Http3、代理、池、cache |
| 请求与响应 |
Request、Headers、Body、Response
|
| 同步 HTTP |
Send / 按方法发送、SendOptions
|
| 异步 HTTP |
AsyncSend、AsyncOp、Destroy
|
| WebSocket |
Connect / 收发 / 关闭 |
| SSE |
SseClient Connect / Receive / Close |
| 证书与 TLS |
TlsConfig、CertificateStore、mTLS |
| Codec 与 Crypto | 解码与 AEAD |
#include <wknet/Wknet.h>
Namespaces: wknet::http · wknet::websocket · wknet::sse · wknet::codec · wknet::crypto
| Item | Notes |
|---|---|
| IRQL | HTTP / WebSocket / certificate / async entry points at PASSIVE_LEVEL
|
| Returns | Mostly NTSTATUS; check _Must_inspect_result_; success via NT_SUCCESS
|
| Handles | Opaque heap objects; Create to obtain, Close / Release to free |
| Options |
SendOptions / AsyncOptions via *Create / *Release
|
| Null |
Close / Release accept nullptr
|
| Exceptions | No C++ exceptions |
| Type | Namespace | Create / obtain | Free | Header |
|---|---|---|---|---|
Session |
wknet::http |
SessionCreate |
SessionClose |
http/Session.h |
Request |
wknet::http |
RequestCreate |
RequestRelease |
http/Request.h |
Response |
wknet::http |
Send* / AsyncGetResponse
|
ResponseRelease |
http/Response.h |
AsyncOp |
wknet::http |
Async* / ConnectAsync*
|
AsyncRelease |
http/AsyncOp.h |
Headers |
wknet::http |
HeadersCreate |
HeadersRelease |
http/Headers.h |
Body |
wknet::http |
BodyCreate* |
BodyRelease |
http/Body.h |
Cache |
wknet::http |
CacheCreate |
CacheRelease |
http/Cache.h |
CertificateStore |
wknet::http |
CertificateStoreCreate |
CertificateStoreClose |
http/Certificate.h |
WebSocket |
wknet::websocket |
Connect* |
Close / CloseEx
|
websocket/WebSocket.h |
SseClient |
wknet::sse |
Connect* |
Close |
sse/Sse.h |
SendOptions / AsyncOptions: Sync HTTP / Async HTTP.
| Header | Contents |
|---|---|
wknet/Wknet.h |
Public API umbrella |
wknet/http/Types.h |
Enums, config structs, callbacks, defaults |
wknet/http/Session.h |
SessionCreate / SessionClose
|
wknet/http/Request.h |
RequestCreate / RequestRelease
|
wknet/http/Headers.h |
Request headers |
wknet/http/Body.h |
Request body |
wknet/http/Options.h |
SendOptionsCreate / AsyncOptionsCreate
|
wknet/http/Http.h |
Sync Send / Get / Post … |
wknet/http/HttpAsync.h |
Async AsyncSend / AsyncGet … |
wknet/http/AsyncOp.h |
Wait, cancel, take Response
|
wknet/http/Response.h |
Status / body / headers / trailers |
wknet/http/Lifecycle.h |
Destroy |
wknet/http/Certificate.h |
CertificateStore, pins, mTLS types |
wknet/http/Cache.h |
In-memory cache |
wknet/websocket/WebSocket.h |
WebSocket connect and I/O |
wknet/sse/Sse.h |
Server-Sent Events client |
wknet/codec/Codec.h |
Content-coding / EXI / Pack200 |
wknet/crypto/Aead.h |
AEAD |
wknet/crypto/TlsCredential.h |
TlsClientCredential (via Certificate.h) |
wknet/Trace.h |
Diagnostics |
Wknet.h includes the public headers above (TlsCredential.h via Certificate.h). Fine-grained includes may take only the headers needed.
| Function | Returns |
|---|---|
DefaultSessionConfig() |
SessionConfig |
DefaultTlsConfig() |
TlsConfig |
DefaultSendOptions() |
SendOptions value |
DefaultConnectConfig() |
websocket::ConnectConfig or sse::DefaultConnectConfig()
|
Use SendOptionsCreate / AsyncOptionsCreate when passing SendOptions / AsyncOptions to APIs (constructors are private).
| Page | Contents |
|---|---|
| Session & config |
Session, SessionConfig, Http3, proxy, pool, cache |
| Request & response |
Request, Headers, Body, Response
|
| Sync HTTP |
Send / method-specific send, SendOptions
|
| Async HTTP |
AsyncSend, AsyncOp, Destroy
|
| WebSocket |
Connect / send / receive / close |
| SSE |
SseClient Connect / Receive / Close |
| TLS options |
TlsConfig, CertificateStore, mTLS |
| Codec & crypto | Decode and AEAD |
-
开始使用 / Get Started
-
概念与行为 / Concepts
-
协议指南 / Protocols
-
API 参考 / API Reference
-
贡献与项目 / Contribute