xrtSshTransportKexRulesInit

初始化空 KEX 方法规则。

bool xrtSshTransportKexRulesInit(xsshtransportkexrules* pRules);
参数说明
xsshtransportkexrules* pRulesRules 参数
返回:初始化空 KEX 方法规则。

示例已编译验证

sshtransportkexrulesinit obj;
xrtSshTransportKexRulesInit(&obj, pRules);

xrtSshTransportKexRuleSet

设置一个 30..49 方法消息在本端或对端方向的精确额度。

bool xrtSshTransportKexRuleSet( xsshtransportkexrules* pRules, xsshtransportdirection Direction, uint8 iMessage, uint8 iCount );
参数说明
xsshtransportkexrules* pRulesRules 参数
xsshtransportdirection Direction半关闭方向
uint8 iMessage消息文本
uint8 iCount数量
返回:设置一个 30..49 方法消息在本端或对端方向的精确额度。

示例已编译验证

/* 设置一个 30..49 方法消息在本端或对端方向的精确额度。 */
result = xrtSshTransportKexRuleSet(pRules, Direction, iMessage, iCount);

xrtSshTransportStateInit

初始化一个不拥有外部资源的 client 或 server transport。

bool xrtSshTransportStateInit( xsshtransportstate* pState, xsshrole Role );
参数说明
xsshtransportstate* pState状态对象
xsshrole Role本地角色
返回:初始化一个不拥有外部资源的 client 或 server transport。

示例已编译验证

sshtransportstateinit obj;
xrtSshTransportStateInit(&obj, pState, Role);

xrtSshTransportStateClear

清除状态;不会清理任何调用方密钥或缓冲。

void xrtSshTransportStateClear(xsshtransportstate* pState);
参数说明
xsshtransportstate* pState状态对象
返回:清除状态;不会清理任何调用方密钥或缓冲。

示例已编译验证

/* 清除状态;不会清理任何调用方密钥或缓冲。 */
result = xrtSshTransportStateClear(pState);

xrtSshTransportIdentificationCommit

提交本端 identification 已发送或对端 identification 已验证。

xsshcode xrtSshTransportIdentificationCommit( xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:提交本端 identification 已发送或对端 identification 已验证。

示例已编译验证

/* 提交本端 identification 已发送或对端 identification 已验证。 */
result = xrtSshTransportIdentificationCommit(pState, Direction);

xrtSshTransportCanApplication

判断对应方向当前是否可以提交应用层消息。

bool xrtSshTransportCanApplication( const xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
const xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:判断对应方向当前是否可以提交应用层消息。

示例已编译验证

/* 判断对应方向当前是否可以提交应用层消息。 */
result = xrtSshTransportCanApplication(pState, Direction);

xrtSshTransportKexReplyNeeded

判断是否已收到对端 KEXINIT,且本端必须回复 KEXINIT。

bool xrtSshTransportKexReplyNeeded( const xsshtransportstate* pState );
参数说明
const xsshtransportstate* pState状态对象
返回:判断是否已收到对端 KEXINIT,且本端必须回复 KEXINIT。

示例已编译验证

/* 判断是否已收到对端 KEXINIT,且本端必须回复 KEXINIT。 */
result = xrtSshTransportKexReplyNeeded(pState);

xrtSshTransportKexInitCheck

检查 KEXINIT 是否可在指定方向可靠提交。

xsshcode xrtSshTransportKexInitCheck( const xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
const xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:检查 KEXINIT 是否可在指定方向可靠提交。

示例已编译验证

sshtransportkexinitcheck obj;
xrtSshTransportKexInitCheck(&obj, pState, Direction);

xrtSshTransportKexInitCommit

提交 KEXINIT,并记录下一包是否为猜测的 KEX 方法消息。

xsshcode xrtSshTransportKexInitCommit( xsshtransportstate* pState, xsshtransportdirection Direction, bool bFirstKexPacketFollows );
参数说明
xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
bool bFirstKexPacketFollowsbFrstKexPacketFollows 参数
返回:提交 KEXINIT,并记录下一包是否为猜测的 KEX 方法消息。

示例已编译验证

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 );

示例已编译验证

/* 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。

xsshcode xrtSshTransportMessageCheck( const xsshtransportstate* pState, xsshtransportdirection Direction, uint8 iMessage );
参数说明
const xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
uint8 iMessage消息文本
返回:检查普通 transport、KEX 方法或应用消息;KEXINIT/NEWKEYS 使用专用 API。

示例已编译验证

/* 检查普通 transport、KEX 方法或应用消息;KEXINIT/NEWKEYS 使用专用 API。 */
result = xrtSshTransportMessageCheck(pState, Direction, iMessage);

xrtSshTransportMessageCommit

在消息已可靠入队或已认证接收后提交普通消息。

xsshcode xrtSshTransportMessageCommit( xsshtransportstate* pState, xsshtransportdirection Direction, uint8 iMessage );
参数说明
xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
uint8 iMessage消息文本
返回:在消息已可靠入队或已认证接收后提交普通消息。

示例已编译验证

/* 在消息已可靠入队或已认证接收后提交普通消息。 */
result = xrtSshTransportMessageCommit(pState, Direction, iMessage);

xrtSshTransportNewKeysCheck

检查对应方向已经完成全部 KEX 方法消息,可以发送或接受 NEWKEYS。

xsshcode xrtSshTransportNewKeysCheck( const xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
const xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:检查对应方向已经完成全部 KEX 方法消息,可以发送或接受 NEWKEYS。

示例已编译验证

/* 检查对应方向已经完成全部 KEX 方法消息,可以发送或接受 NEWKEYS。 */
result = xrtSshTransportNewKeysCheck(pState, Direction);

xrtSshTransportNewKeysCommit

提交 NEWKEYS,并返回密钥切换、序列重置和整代完成动作。

xsshcode xrtSshTransportNewKeysCommit( xsshtransportstate* pState, xsshtransportdirection Direction, uint32* pActions );
参数说明
xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
uint32* pActionsActons 参数
返回:提交 NEWKEYS,并返回密钥切换、序列重置和整代完成动作。

示例已编译验证

/* 提交 NEWKEYS,并返回密钥切换、序列重置和整代完成动作。 */
result = xrtSshTransportNewKeysCommit(pState, Direction, pActions);

xrtSshTransportAuthSuccessCheck

检查 server USERAUTH_SUCCESS;用于约束第二次 EXT_INFO 必须紧邻在前。

xsshcode xrtSshTransportAuthSuccessCheck( const xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
const xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:检查 server USERAUTH_SUCCESS;用于约束第二次 EXT_INFO 必须紧邻在前。

示例已编译验证

/* 检查 server USERAUTH_SUCCESS;用于约束第二次 EXT_INFO 必须紧邻在前。 */
result = xrtSshTransportAuthSuccessCheck(pState, Direction);

xrtSshTransportAuthSuccessCommit

提交 server USERAUTH_SUCCESS;消息格式仍由 ssh_auth_message 处理。

xsshcode xrtSshTransportAuthSuccessCommit( xsshtransportstate* pState, xsshtransportdirection Direction );
参数说明
xsshtransportstate* pState状态对象
xsshtransportdirection Direction半关闭方向
返回:提交 server USERAUTH_SUCCESS;消息格式仍由 ssh_auth_message 处理。

示例已编译验证

/* 提交 server USERAUTH_SUCCESS;消息格式仍由 ssh_auth_message 处理。 */
result = xrtSshTransportAuthSuccessCommit(pState, Direction);

xrtSshTransportClose

网络关闭后终止状态机;重复调用保持关闭状态。

void xrtSshTransportClose(xsshtransportstate* pState);
参数说明
xsshtransportstate* pState状态对象
返回:网络关闭后终止状态机;重复调用保持关闭状态。

示例已编译验证

/* 网络关闭后终止状态机;重复调用保持关闭状态。 */
result = xrtSshTransportClose(pState);