📄 cli_telnet.c
字号:
/* 被调函数 : */
/*==================================================================*/
_U32 CLI_RecOpt ( PTerm_Data_S pTermStruct, _U8 c )
{
_S8 szFSMInfoEn[][256] = {
"\r\n\r\n The telnet NVT FSM : \r\n \
\r\n the current state : TSIAC \
\r\n the input character : WILL \
\r\n the next state : TSWOPT \
\r\n the action : OptionCmd = WILL ",
"\r\n\r\n The telnet NVT FSM : \r\n \
\r\n the current state : TSIAC \
\r\n the input character : WONT \
\r\n the next state : TSWOPT \
\r\n the action : OptionCmd = WONT ",
"\r\n\r\n The telnet NVT FSM : \r\n \
\r\n the current state : TSIAC \
\r\n the input character : DO \
\r\n the next state : TSWOPT \
\r\n the action : OptionCmd = DO ",
"\r\n\r\n The telnet NVT FSM : \r\n \
\r\n the current state : TSIAC \
\r\n the input character : DONT \
\r\n the next state : TSWOPT \
\r\n the action : OptionCmd = DONT "
};
_S8 szFSMInfoCh[][256] = {
"\r\n\r\n Telnet 网络虚拟终端状态机 : \r\n \
\r\n 当前状态 : TSIAC \
\r\n 输入字符 : WILL \
\r\n 下一状态 : TSWOPT \
\r\n 执行动作 : OptionCmd = WILL ",
"\r\n\r\n Telnet 网络虚拟终端状态机 : \r\n \
\r\n 当前状态 : TSIAC \
\r\n 输入字符 : WONT \
\r\n 下一状态 : TSWOPT \
\r\n 执行动作 : OptionCmd = WONT ",
"\r\n\r\n Telnet 网络虚拟终端状态机 : \r\n \
\r\n 当前状态 : TSIAC \
\r\n 输入字符 : DO \
\r\n 下一状态 : TSWOPT \
\r\n 执行动作 : OptionCmd = DO ",
"\r\n\r\n Telnet 网络虚拟终端状态机 : \r\n \
\r\n 当前状态 : TSIAC \
\r\n 输入字符 : DONT \
\r\n 下一状态 : TSWOPT \
\r\n 执行动作 : OptionCmd = DONT "
};
if(pTermStruct == G_NULL)
{
return 1;
}
/*--------------------------------------------------------------------*/
/* 记录选项命令: */
/* 1. TCWILL */
/* 2. TCWONT */
/* 3. TCDO */
/* 4. TCDONT */
/*--------------------------------------------------------------------*/
pTermStruct->TelnetParam.OptionCmd = c ;
if ( G_TRUE == m_bCliTelnetDebugOn )
{
if ( pTermStruct->iRecvLen == 1 )
{
switch ( c )
{
case TCWILL :
CLI_TelFSMDegOut(szFSMInfoEn[0], szFSMInfoCh[0]);
break ;
case TCWONT:
CLI_TelFSMDegOut(szFSMInfoEn[1], szFSMInfoCh[1]);
break ;
case TCDO :
CLI_TelFSMDegOut(szFSMInfoEn[2], szFSMInfoCh[2]);
break ;
case TCDONT :
CLI_TelFSMDegOut(szFSMInfoEn[3], szFSMInfoCh[3]);
break ;
default :
break ;
}
}
}
return 1 ;
}
/*==================================================================*/
/* 函数名 :CLI_Noop */
/* 函数功能 :空操作 */
/* 输入参数 :PTerm_Data_S pTermStruct 任务数据 */
/* _U8 c 接收到的输入字符 */
/* 输出参数 :PTerm_Data_S pTermStruct 任务数据 */
/* 返回值 :_U32 1:成功 */
/* 调用函数 :CLI_DebugOutString ( ) */
/* 被调函数 : */
/*==================================================================*/
_U32 CLI_Noop ( PTerm_Data_S pTermStruct, _U8 c )
{
_S8 szFSMInfoEn[1024] = "";
_S8 szFSMInfoCh[1024] = "";
if(pTermStruct == G_NULL)
{
return 1;
}
if ( G_TRUE == m_bCliTelnetDebugOn )
{
if ( pTermStruct->iRecvLen == 1 )
{
switch ( pTermStruct->TelnetParam.TTState )
{
case TSDATA :
strcat(szFSMInfoEn, "\r\n The telnet NVT FSM :");
strcat(szFSMInfoCh, "\r\n Telnet 网络虚拟终端状态机 :");
strcat(szFSMInfoEn, "\r\n the current state : TSDATA");
strcat(szFSMInfoCh, "\r\n 当前状态 : TSDATA");
if ( c == TCIAC )
{
strcat(szFSMInfoEn, "\r\n the input character : IAC ( Interrupt As Command )");
strcat(szFSMInfoCh, "\r\n 输入字符 : IAC ( Interrupt As Command )");
strcat(szFSMInfoEn, "\r\n the next state : TSIAC \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSIAC \r\n");
}
else
{
strcat(szFSMInfoEn, "\r\n the input character : 0x");
strcat(szFSMInfoCh, "\r\n 输入字符 : 0x");
EOS_Sprintf ( szInputChar, "%2x", c ) ;
strcat(szFSMInfoEn, szInputChar);
strcat(szFSMInfoCh, szInputChar);
strcat(szFSMInfoEn, "\r\n the next state : TSDATA \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSDATA \r\n");
}
break ;
case TSIAC :
strcat(szFSMInfoEn, "\r\n The telnet NVT FSM :");
strcat(szFSMInfoCh, "\r\n Telnet 网络虚拟终端状态机 :");
strcat(szFSMInfoEn, "\r\n the current state : TSIAC");
strcat(szFSMInfoCh, "\r\n 当前状态 : TSIAC");
switch ( c )
{
case TCIAC :
strcat(szFSMInfoEn, "\r\n the input character : IAC ( Interrupt As Command )");
strcat(szFSMInfoCh, "\r\n 输入字符 : IAC ( Interrupt As Command )");
strcat(szFSMInfoEn, "\r\n the next state : TSDATA \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSDATA \r\n");
break ;
case TCSB :
strcat(szFSMInfoEn, "\r\n the input character : SB ( SuB )");
strcat(szFSMInfoCh, "\r\n 输入字符 : SB ( SuB )");
strcat(szFSMInfoEn, "\r\n the next state : TSSUBNEG \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSSUBNEG \r\n");
break ;
case TCNOP :
strcat(szFSMInfoEn, "\r\n the input character : NOP ( NO OPeration )");
strcat(szFSMInfoCh, "\r\n 输入字符 : NOP ( NO OPeration )");
strcat(szFSMInfoEn, "\r\n the next state : TSDATA \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSDATA \r\n");
break ;
default :
strcat(szFSMInfoEn, "\r\n the input character : 0x");
strcat(szFSMInfoCh, "\r\n 输入字符 : 0x");
EOS_Sprintf ( szInputChar, "%2x", c ) ;
strcat(szFSMInfoEn, szInputChar);
strcat(szFSMInfoCh, szInputChar);
strcat(szFSMInfoEn, "\r\n the next state : TSDATA \r\n");
strcat(szFSMInfoCh, "\r\n 下一状态 : TSDATA \r\n");
break ;
}
break ;
default :
break ;
}
switch ( pTermStruct->TelnetParam.SubState )
{
case SS_START :
strcat(szFSMInfoEn, "\r\n The telnet SubNeg NVT :");
strcat(szFSMInfoCh, "\r\n Telnet 网络虚拟终端子协商状态机 :");
strcat(szFSMInfoEn, "\r\n the current state : SS_START");
strcat(szFSMInfoCh, "\r\n 当前状态 : SS_START");
switch ( c )
{
case TOTERMTYPE :
strcat(szFSMInfoEn, "\r\n the input character : TERMTYPE");
strcat(szFSMInfoCh, "\r\n 输入字符 : TERMTYPE");
strcat(szFSMInfoEn, "\r\n the next state : SS_TERMTYPE ");
strcat(szFSMInfoCh, "\r\n 下一状态 : SS_TERMTYPE ");
break ;
default :
strcat(szFSMInfoEn, "\r\n the input character : 0x");
strcat(szFSMInfoCh, "\r\n 输入字符 : 0x");
EOS_Sprintf ( szInputChar, "%2x", c ) ;
strcat(szFSMInfoEn, szInputChar);
strcat(szFSMInfoCh, szInputChar);
strcat(szFSMInfoEn, "\r\n the next state : SS_END ");
strcat(szFSMInfoCh, "\r\n 下一状态 : SS_END ");
break ;
}
break ;
case SS_TERMTYPE :
strcat(szFSMInfoEn, "\r\n The telnet SubNeg NVT :");
strcat(szFSMInfoCh, "\r\n Telnet 网络虚拟终端子协商状态机 :");
strcat(szFSMInfoEn, "\r\n the current state : SS_TERMTYPE");
strcat(szFSMInfoCh, "\r\n 当前状态 : SS_TERMTYPE");
switch ( c )
{
case TT_IS :
strcat(szFSMInfoEn, "\r\n the input character : IS");
strcat(szFSMInfoCh, "\r\n 输入字符 : IS");
strcat(szFSMInfoEn, "\r\n the next state : SS_IS ");
strcat(szFSMInfoCh, "\r\n 下一状态 : SS_IS ");
break ;
default :
strcat(szFSMInfoEn, "\r\n the input character : 0x");
strcat(szFSMInfoCh, "\r\n 输入字符 : 0x");
EOS_Sprintf ( szInputChar, "%2x", c ) ;
strcat(szFSMInfoEn, szInputChar);
strcat(szFSMInfoCh, szInputChar);
strcat(szFSMInfoEn, "\r\n the next state : SS_END ");
strcat(szFSMInfoCh, "\r\n 下一状态 : SS_END ");
break ;
}
break ;
case SS_END :
strcat(szFSMInfoEn, "\r\n The telnet SubNeg NVT :");
strcat(szFSMInfoCh, "\r\n Telnet 网络虚拟终端子协商状态机 :");
strcat(szFSMInfoEn, "\r\n the current state : SS_END");
strcat(szFSMInfoCh, "\r\n 当前状态 : SS_END");
strcat(szFSMInfoEn, "\r\n the input character : 0x");
strcat(szFSMInfoCh, "\r\n 输入字符 : 0x");
EOS_Sprintf ( szInputChar, "%2x", c ) ;
strcat(szFSMInfoEn, szInputChar);
strcat(szFSMInfoCh, szInputChar);
strcat(szFSMInfoEn, "\r\n the next state : SS_END ");
strcat(szFSMInfoCh, "\r\n 下一状态 : SS_END ");
break ;
default :
break ;
}
}
CLI_TelFSMDegOut(szFSMInfoEn, szFSMInfoCh);
}
return 1 ;
}
/*==================================================================*/
/* 函数名 :CLI_SubOpt */
/* 函数功能 :选项子协商FSM状态装换 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -