xrtSshSessionCoreInit
初始化连接级协议核心;动态内存只用于 KEX transcript。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| xnetbufpool* pPool | 池 |
| xsshrole Role | 本地角色 |
| xsshchannelresolveproc pResolve | Resolve 参数 |
| ptr pUserData | 透传用户数据 |
| xsshreplyqueue* pGlobalReplies | GlobalReles 参数 |
示例已编译验证
sshsessioncoreinit obj; xrtSshSessionCoreInit(&obj, pSession, pPool, Role, pResolve, pUserData, pGlobalReplies);
xrtSshSessionCoreClear
释放 transcript、清除密码材料和全部借用事务,不处理 transport 或外部存储。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 释放 transcript、清除密码材料和全部借用事务,不处理 transport 或外部存储。 */ result = xrtSshSessionCoreClear(pSession);
xrtSshSessionCorePhase
根据连接级对象和 transport 返回当前协议阶段。
| 参数 | 说明 |
|---|---|
| const xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 根据连接级对象和 transport 返回当前协议阶段。 */ result = xrtSshSessionCorePhase(pSession, pCore);
xrtSshSessionCoreAction
返回稳定状态下建议驱动的下一动作;本端 identification 与 KEXINIT 优先于等待对端。
| 参数 | 说明 |
|---|---|
| const xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* 返回稳定状态下建议驱动的下一动作;本端 identification 与 KEXINIT 优先于等待对端。 */ result = xrtSshSessionCoreAction(pSession, pCore);
xrtSshSessionCoreKex
返回可直接使用的 KEX 交换对象。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回可直接使用的 KEX 交换对象。 */ result = xrtSshSessionCoreKex(pSession);
xrtSshSessionCoreKexConst
返回只读 KEX 交换对象。
| 参数 | 说明 |
|---|---|
| const xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回只读 KEX 交换对象。 */ result = xrtSshSessionCoreKexConst(pSession);
xrtSshSessionCoreAuth
返回认证会话;认证方法和凭据策略仍由调用方驱动。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回认证会话;认证方法和凭据策略仍由调用方驱动。 */ result = xrtSshSessionCoreAuth(pSession);
xrtSshSessionCoreAuthConst
返回只读认证会话。
| 参数 | 说明 |
|---|---|
| const xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回只读认证会话。 */ result = xrtSshSessionCoreAuthConst(pSession);
xrtSshSessionCoreConnection
返回 connection 会话;channel 表和 reply FIFO 仍由调用方持有。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回 connection 会话;channel 表和 reply FIFO 仍由调用方持有。 */ result = xrtSshSessionCoreConnection(pSession);
xrtSshSessionCoreConnectionConst
返回只读 connection 会话。
| 参数 | 说明 |
|---|---|
| const xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 返回只读 connection 会话。 */ result = xrtSshSessionCoreConnectionConst(pSession);
xrtSshSessionCoreVersionPrepare
在 transport identification 提交前保存本端或对端版本串。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
| xsshtransportdirection Direction | 半关闭方向 |
| xstrview Version | 版本 |
示例已编译验证
/* 在 transport identification 提交前保存本端或对端版本串。 */ result = xrtSshSessionCoreVersionPrepare(pSession, pCore, Direction, Version);
xrtSshSessionCoreVersionCommit
transport 已提交对应 identification 后发布版本串。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* transport 已提交对应 identification 后发布版本串。 */ result = xrtSshSessionCoreVersionCommit(pSession, pCore);
xrtSshSessionCoreVersionAbort
transport 尚未推进时放弃版本串暂存副本。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* transport 尚未推进时放弃版本串暂存副本。 */ result = xrtSshSessionCoreVersionAbort(pSession, pCore);
xrtSshSessionCoreKexBeginWithPrivate
使用显式 Curve25519 私钥开始当前已经就绪的一代 KEX。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| xsshtransportcore* pCore | 核心对象 |
| xbytesview ServerHostKey | ServerHostKey 参数 |
| xbytesview PrivateKey | PrvateKey 参数 |
示例已编译验证
/* 使用显式 Curve25519 私钥开始当前已经就绪的一代 KEX。 */ result = xrtSshSessionCoreKexBeginWithPrivate(pSession, pCore, ServerHostKey, PrivateKey);
xrtSshSessionCoreAuthBegin
首轮 KEX 完成后开始双端 ssh-userauth 编排。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
| const xsshauthguardpolicy* pPolicy | 策略 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
/* 首轮 KEX 完成后开始双端 ssh-userauth 编排。 */ result = xrtSshSessionCoreAuthBegin(pSession, pCore, pPolicy, iNowMs);
xrtSshSessionCoreWritePrepare
XRT_API xsshcode xrtSshSessionCoreWritePrepare( xsshsessioncore* pSession, const xsshtransportcore* pCore, xbytesview Payload, xsshchannelcore* pChannel, xsshreplyqueue* pReplies, uint64 iReplyToken, uint64 iNowMs, xsshsessionpacketkind* pKind );
示例已编译验证
/* XRT_API xsshcode xrtSshSessionCoreWritePrepare( xsshsessioncore* pSession, const xsshtransportcore* pCore, xbytesview Payload, xsshchannelcore* pChannel, xsshreplyqueue* pReplies, uint64 iReplyToken, uint64 iNowMs, xsshsessionpacketkind* pKind ); */ result = xrtSshSessionCoreWritePrepare();
xrtSshSessionCoreWriteBind
transport 已准备同一 payload 后绑定 packet 类型和序号,尚不推进状态。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
| xbytesview Payload | 负载 |
示例已编译验证
/* transport 已准备同一 payload 后绑定 packet 类型和序号,尚不推进状态。 */ result = xrtSshSessionCoreWriteBind(pSession, pCore, Payload);
xrtSshSessionCoreWriteCommit
transport 已可靠提交输出后提交对应 KEX、认证或 connection 事务。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| xsshtransportcore* pCore | 核心对象 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
/* transport 已可靠提交输出后提交对应 KEX、认证或 connection 事务。 */ result = xrtSshSessionCoreWriteCommit(pSession, pCore, iNowMs);
xrtSshSessionCoreWriteAbort
transport 未推进时放弃上层写事务;transport 自身仍由调用方中止。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| const xsshtransportcore* pCore | 核心对象 |
示例已编译验证
/* transport 未推进时放弃上层写事务;transport 自身仍由调用方中止。 */ result = xrtSshSessionCoreWriteAbort(pSession, pCore);
xrtSshSessionCoreReadPrepare
XRT_API xsshcode xrtSshSessionCoreReadPrepare( xsshsessioncore* pSession, const xsshtransportcore* pCore, xbytesview Payload, void* pHostKeyStorage, size_t iHostKeyCapacity, size_t* pHostKeySize, uint64 iNowMs, xsshsessionpacket* pPacket );
示例已编译验证
/* XRT_API xsshcode xrtSshSessionCoreReadPrepare( xsshsessioncore* pSession, const xsshtransportcore* pCore, xbytesview Payload, void* pHostKeyStorage, size_t iHostKeyCapacity, size_t* pHostKeySize, uint64 iNowMs, xsshsessionpacket* pPacket ); */ result = xrtSshSessionCoreReadPrepare();
xrtSshSessionCoreReadCommit
transport 已提交输入后提交上层事务并按需激活读密钥。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
| xsshtransportcore* pCore | 核心对象 |
| uint64 iNowMs | 当前毫秒时间 |
示例已编译验证
/* transport 已提交输入后提交上层事务并按需激活读密钥。 */ result = xrtSshSessionCoreReadCommit(pSession, pCore, iNowMs);
xrtSshSessionCoreReadAbort
放弃不可回滚的认证输入并终止会话;transport 自身仍由调用方中止。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 放弃不可回滚的认证输入并终止会话;transport 自身仍由调用方中止。 */ result = xrtSshSessionCoreReadAbort(pSession);
xrtSshSessionCoreFail
终止全部协议子状态;transport、网络和外部 channel 由调用方关闭。
| 参数 | 说明 |
|---|---|
| xsshsessioncore* pSession | 会话对象 |
示例已编译验证
/* 终止全部协议子状态;transport、网络和外部 channel 由调用方关闭。 */ result = xrtSshSessionCoreFail(pSession);