xrtSshTransportCoreInit
初始化无缓冲 transport core;零包上限和空策略分别使用默认值。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| xsshrole Role | 本地角色 |
| uint32 iMaxPacketSize | MaxPacketSze 参数 |
| const xsshrekeypolicy* pRekeyPolicy | RekeyPolcy 参数 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
sshtransportcoreinit obj; xrtSshTransportCoreInit(&obj, pCore, Role, iMaxPacketSize, pRekeyPolicy, iNowMs);
xrtSshTransportCoreClear
清除 cipher、序列、协议和预算状态,不处理任何调用方缓冲。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 清除 cipher、序列、协议和预算状态,不处理任何调用方缓冲。 */ result = xrtSshTransportCoreClear(pCore);
xrtSshTransportCoreIdentificationCommit
提交本端 identification 已发送或对端 identification 已验证。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 提交本端 identification 已发送或对端 identification 已验证。 */ result = xrtSshTransportCoreIdentificationCommit(pCore, Direction);
xrtSshTransportCoreCanApplication
判断对应方向当前是否允许应用消息且 NEWKEYS 密钥已经生效。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 判断对应方向当前是否允许应用消息且 NEWKEYS 密钥已经生效。 */ result = xrtSshTransportCoreCanApplication(pCore, Direction);
xrtSshTransportCoreKexReplyNeeded
判断收到对端 KEXINIT 后本端是否必须回复。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 判断收到对端 KEXINIT 后本端是否必须回复。 */ result = xrtSshTransportCoreKexReplyNeeded(pCore);
xrtSshTransportCoreKexConfigure
提交双方 KEXINIT 的协商结果和当前算法消息额度。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| const xsshkexinit* pLocal | 本地地址 |
| const xsshkexinit* pPeer | 对端公钥 |
| const xsshkexnegotiation* pNegotiation | Negotaton 参数 |
| const xsshtransportkexrules* pRules | Rules 参数 |
示例已编译验证
/* 提交双方 KEXINIT 的协商结果和当前算法消息额度。 */ result = xrtSshTransportCoreKexConfigure(pCore, pLocal, pPeer, pNegotiation, pRules);
xrtSshTransportCoreRekeyRequest
请求一次策略阈值之外的主动 rekey。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 请求一次策略阈值之外的主动 rekey。 */ result = xrtSshTransportCoreRekeyRequest(pCore);
xrtSshTransportCoreRekeyCheck
查询当前双向预算和时间产生的 rekey 决策。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
示例已编译验证
/* 查询当前双向预算和时间产生的 rekey 决策。 */ result = xrtSshTransportCoreRekeyCheck(pCore, iNowMs, pDecision);
xrtSshTransportCoreInspect
探测下一包所需完整线路长度和明文工作区。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
| const xsshreader* pReader | 读取器 |
| xsshpacketneed* pNeed | Need 参数 |
示例已编译验证
/* 探测下一包所需完整线路长度和明文工作区。 */ result = xrtSshTransportCoreInspect(pCore, pReader, pNeed);
xrtSshTransportCoreWritePrepareWithPadding
XRT_API xsshcode xrtSshTransportCoreWritePrepareWithPadding( xsshtransportcore* pCore, xsshwriter* pWriter, xbytesview Payload, xsshpaddingproc pPadding, ptr pUserData, uint64 iNowMs );
示例已编译验证
/* XRT_API xsshcode xrtSshTransportCoreWritePrepareWithPadding( xsshtransportcore* pCore, xsshwriter* pWriter, xbytesview Payload, xsshpaddingproc pPadding, ptr pUserData, uint64 iNowMs ); */ result = xrtSshTransportCoreWritePrepareWithPadding();
xrtSshTransportCoreWriteCommit
线路包可靠入队后提交写事务并返回更新后的 rekey 决策。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
示例已编译验证
/* 线路包可靠入队后提交写事务并返回更新后的 rekey 决策。 */ result = xrtSshTransportCoreWriteCommit(pCore, iNowMs, pDecision);
xrtSshTransportCoreWriteAbort
放弃未发送的写事务;调用方负责丢弃 writer 新增的线路字节。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 放弃未发送的写事务;调用方负责丢弃 writer 新增的线路字节。 */ result = xrtSshTransportCoreWriteAbort(pCore);
xrtSshTransportCoreReadPrepare
XRT_API xsshcode xrtSshTransportCoreReadPrepare( xsshtransportcore* pCore, xsshreader* pReader, xsshpacketview* pPacket, void* pPlain, size_t iPlainCapacity, uint64 iNowMs );
示例已编译验证
/* XRT_API xsshcode xrtSshTransportCoreReadPrepare( xsshtransportcore* pCore, xsshreader* pReader, xsshpacketview* pPacket, void* pPlain, size_t iPlainCapacity, uint64 iNowMs ); */ result = xrtSshTransportCoreReadPrepare();
xrtSshTransportCoreReadCommit
接收包完成协议处理后提交状态和 rekey 预算。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
示例已编译验证
/* 接收包完成协议处理后提交状态和 rekey 预算。 */ result = xrtSshTransportCoreReadCommit(pCore, iNowMs, pDecision);
xrtSshTransportCoreReadAbort
放弃已认证但不能接受的接收包,并关闭不可继续推进的 transport。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 放弃已认证但不能接受的接收包,并关闭不可继续推进的 transport。 */ result = xrtSshTransportCoreReadAbort(pCore);
xrtSshTransportCoreWriteKeysPending
判断本端 NEWKEYS 后是否正在等待写方向新密钥。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 判断本端 NEWKEYS 后是否正在等待写方向新密钥。 */ result = xrtSshTransportCoreWriteKeysPending(pCore);
xrtSshTransportCoreReadKeysPending
判断对端 NEWKEYS 后是否正在等待读方向新密钥。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 判断对端 NEWKEYS 后是否正在等待读方向新密钥。 */ result = xrtSshTransportCoreReadKeysPending(pCore);
xrtSshTransportCoreSetWriteAesGcm
在本端 NEWKEYS 可靠入队后激活写方向 AES-GCM 与方向性 rekey 新代。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| xbytesview Key | 键 |
| xbytesview InitialIV | IntalIV 参数 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
/* 在本端 NEWKEYS 可靠入队后激活写方向 AES-GCM 与方向性 rekey 新代。 */ result = xrtSshTransportCoreSetWriteAesGcm(pCore, Key, InitialIV, iNowMs);
xrtSshTransportCoreSetReadAesGcm
在对端 NEWKEYS 已认证后激活读方向 AES-GCM 与方向性 rekey 新代。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
| xbytesview Key | 键 |
| xbytesview InitialIV | IntalIV 参数 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
/* 在对端 NEWKEYS 已认证后激活读方向 AES-GCM 与方向性 rekey 新代。 */ result = xrtSshTransportCoreSetReadAesGcm(pCore, Key, InitialIV, iNowMs);
xrtSshTransportCoreKexComplete
判断至少一代 KEX 已完成且双向 NEWKEYS 密钥均已实际生效。
| 参数 | 说明 |
|---|---|
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 判断至少一代 KEX 已完成且双向 NEWKEYS 密钥均已实际生效。 */ result = xrtSshTransportCoreKexComplete(pCore);
xrtSshTransportCoreClose
关闭 transport;未发送写事务会安全放弃,已准备读事务不会回滚。
| 参数 | 说明 |
|---|---|
| xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 关闭 transport;未发送写事务会安全放弃,已准备读事务不会回滚。 */ result = xrtSshTransportCoreClose(pCore);