TELNETs_CmdHandlerExt()

Callback function processing received external command.

Files

telnet-s.h

Prototype

          CPU_INT16S  TELNETs_CmdHandlerExt (CPU_CHAR         *pcmd_line, 
                                             void             *pcwd,
                                             CPU_BOOLEAN      *psession_active,
                                             void             *pout_opt,
                                             TELNET_OUT_FNCT   pout_fnct,
                                             TELNETs_ERR      *p_err);


Arguments

pcmd_line

Pointer to command line.

pcwd

Pointer to current working directory.

psession_active

Pointer to variable indicating whether the session is active or not.

pout_opt

Pointer to output function optional parameter.

pout_fnct

Pointer to output function.

p_err

Pointer to variable that will receive the return error code from this function.

Returned Values

TELNETs_CMDPROCESS_ERR, if an error occurred;

Command specific return value, otherwise.

Required Configuration

None.

Notes / Warnings

This is a callback function that must be implemented in your application.

Example Template

          #define  TELNET_CMD     "cmd_xyz"
           
          CPU_INT16S  TELNETs_CmdHandlerExt (CPU_CHAR        *pcmd_line,
                                             void            *pcwd,
                                             CPU_BOOLEAN     *psession_active,
                                             void            *pout_opt,
                                             TELNET_OUT_FNCT  pout_fnct,
                                             TELNETs_ERR     *p_err)
          {
              if (Str_Cmp(TELNET_CMD, pcmd_line) == 0) {
                  Cmd_xyz(pcmd_line);
                  ret_val = TELNETs_CMDPROCESS_ERR_NONE;
                 *p_err   = TELNETs_ERR_NONE;
           
              } else {
                  ret_val = TELNETs_CMDPROCESS_ERR;
                 *p_err   = TELNETs_ERR_CMD_PROCESS;
              }
          }