Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
titleListing - Pseudocode for TELNETs_CmdHandlerExt()
linenumberstrue
CPU_INT16S  TELNETs_CmdHandlerExt (CPU_CHAR         *pcmd_line, 
                                   void             *pcwd, 
                                   CPU_BOOLEAN      *psession_active, 
                                   void             *pout_opt, 
                                   TELNETs_SESSION  *psession, 
                                   TELNET_OUT_FNCT  *pout_fnct, 
                                   TELNETs_ERR      *perr) 
          { 
         
    Parse the command line (pcmd_line).                                                       (1)
         
    Search corresponding command.                                                             (2)
      
       Execute command.                                                                          (3)
         
    Transmit error message if needed.                                                         (4)
         
}


Panel
bgColor#f0f0f0
  1. The command line received by the telnet server and passed in parameter has to be parsed in order to extract the command name, as well as its eventual arguments.
  2. Once the command name has been read from the command line, TELNETs_CmdHandlerExt() has to locate the corresponding function. The storage and search mechanism taking place here is implementation specific.
  3. Finally, the function corresponding to the one passed in the command line is invoked, and output to the telnet client is possibly transmitted.
  4. If an error occurred while processing (i.e., searching for) the command, the function simply returns with the error variable set accordingly. However, if the error occurred inside the function, it is that function responsibility to transmit an appropriate message to the telnet client.

...