xrtSshTransportKexRulesInit
初始化空 KEX 方法规则。
| 参数 | 说明 |
|---|---|
| xsshtransportkexrules* pRules | Rules 参数 |
示例已编译验证
sshtransportkexrulesinit obj; xrtSshTransportKexRulesInit(&obj, pRules);
xrtSshTransportKexRuleSet
设置一个 30..49 方法消息在本端或对端方向的精确额度。
| 参数 | 说明 |
|---|---|
| xsshtransportkexrules* pRules | Rules 参数 |
| xsshtransportdirection Direction | 半关闭方向 |
| uint8 iMessage | 消息文本 |
| uint8 iCount | 数量 |
示例已编译验证
/* 设置一个 30..49 方法消息在本端或对端方向的精确额度。 */ result = xrtSshTransportKexRuleSet(pRules, Direction, iMessage, iCount);
xrtSshTransportStateInit
初始化一个不拥有外部资源的 client 或 server transport。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshrole Role | 本地角色 |
示例已编译验证
sshtransportstateinit obj; xrtSshTransportStateInit(&obj, pState, Role);
xrtSshTransportStateClear
清除状态;不会清理任何调用方密钥或缓冲。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
示例已编译验证
/* 清除状态;不会清理任何调用方密钥或缓冲。 */ result = xrtSshTransportStateClear(pState);
xrtSshTransportIdentificationCommit
提交本端 identification 已发送或对端 identification 已验证。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 提交本端 identification 已发送或对端 identification 已验证。 */ result = xrtSshTransportIdentificationCommit(pState, Direction);
xrtSshTransportCanApplication
判断对应方向当前是否可以提交应用层消息。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 判断对应方向当前是否可以提交应用层消息。 */ result = xrtSshTransportCanApplication(pState, Direction);
xrtSshTransportKexReplyNeeded
判断是否已收到对端 KEXINIT,且本端必须回复 KEXINIT。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
示例已编译验证
/* 判断是否已收到对端 KEXINIT,且本端必须回复 KEXINIT。 */ result = xrtSshTransportKexReplyNeeded(pState);
xrtSshTransportKexInitCheck
检查 KEXINIT 是否可在指定方向可靠提交。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
sshtransportkexinitcheck obj; xrtSshTransportKexInitCheck(&obj, pState, Direction);
xrtSshTransportKexInitCommit
提交 KEXINIT,并记录下一包是否为猜测的 KEX 方法消息。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
| bool bFirstKexPacketFollows | bFrstKexPacketFollows 参数 |
示例已编译验证
sshtransportkexinitcommit obj; xrtSshTransportKexInitCommit(&obj, pState, Direction, bFirstKexPacketFollows);
xrtSshTransportKexConfigure
XRT_API xsshcode xrtSshTransportKexConfigure( xsshtransportstate* pState, const xsshkexinit* pLocal, const xsshkexinit* pPeer, const xsshkexnegotiation* pNegotiation, const xsshtransportkexrules* pRules );
示例已编译验证
/* XRT_API xsshcode xrtSshTransportKexConfigure( xsshtransportstate* pState, const xsshkexinit* pLocal, const xsshkexinit* pPeer, const xsshkexnegotiation* pNegotiation, const xsshtransportkexrules* pRules ); */ result = xrtSshTransportKexConfigure();
xrtSshTransportMessageCheck
检查普通 transport、KEX 方法或应用消息;KEXINIT/NEWKEYS 使用专用 API。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
| uint8 iMessage | 消息文本 |
示例已编译验证
/* 检查普通 transport、KEX 方法或应用消息;KEXINIT/NEWKEYS 使用专用 API。 */ result = xrtSshTransportMessageCheck(pState, Direction, iMessage);
xrtSshTransportMessageCommit
在消息已可靠入队或已认证接收后提交普通消息。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
| uint8 iMessage | 消息文本 |
示例已编译验证
/* 在消息已可靠入队或已认证接收后提交普通消息。 */ result = xrtSshTransportMessageCommit(pState, Direction, iMessage);
xrtSshTransportNewKeysCheck
检查对应方向已经完成全部 KEX 方法消息,可以发送或接受 NEWKEYS。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 检查对应方向已经完成全部 KEX 方法消息,可以发送或接受 NEWKEYS。 */ result = xrtSshTransportNewKeysCheck(pState, Direction);
xrtSshTransportNewKeysCommit
提交 NEWKEYS,并返回密钥切换、序列重置和整代完成动作。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
| uint32* pActions | Actons 参数 |
示例已编译验证
/* 提交 NEWKEYS,并返回密钥切换、序列重置和整代完成动作。 */ result = xrtSshTransportNewKeysCommit(pState, Direction, pActions);
xrtSshTransportAuthSuccessCheck
检查 server USERAUTH_SUCCESS;用于约束第二次 EXT_INFO 必须紧邻在前。
| 参数 | 说明 |
|---|---|
| const xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 检查 server USERAUTH_SUCCESS;用于约束第二次 EXT_INFO 必须紧邻在前。 */ result = xrtSshTransportAuthSuccessCheck(pState, Direction);
xrtSshTransportAuthSuccessCommit
提交 server USERAUTH_SUCCESS;消息格式仍由 ssh_auth_message 处理。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
| xsshtransportdirection Direction | 半关闭方向 |
示例已编译验证
/* 提交 server USERAUTH_SUCCESS;消息格式仍由 ssh_auth_message 处理。 */ result = xrtSshTransportAuthSuccessCommit(pState, Direction);
xrtSshTransportClose
网络关闭后终止状态机;重复调用保持关闭状态。
| 参数 | 说明 |
|---|---|
| xsshtransportstate* pState | 状态对象 |
示例已编译验证
/* 网络关闭后终止状态机;重复调用保持关闭状态。 */ result = xrtSshTransportClose(pState);