When no command match is found internally, the TELNETs_CmdHandlerExt()
callback function is automatically called. This function needs to be implemented in the user application, and has the following prototype:
Code Block |
---|
CPU_INT16S TELNETs_CmdHandlerExt (CPU_CHAR *pcmd_line, |
...
void *pcwd, CPU_BOOLEAN *psession_active, |
...
void *pout_opt, |
...
TELNET_OUT_FNCT |
...
pout_fnct, |
...
TELNETs_ERR *perr); |
where pcmd_line
is the received complete line; pcwd
, a pointer to the current working directory; and psession_active
, a pointer to a variable indicating whether or not the telnet session is active. As for the pout_fnct
parameter, it is a pointer to a function whose purpose is to provide a way for a command to transmit data to the telnet client, with the help of the pout_opt
parameter.
...
The pseudocode for TELNETs_CmdProcessCmdHandlerExt()
is shown in section Listing 3-3 “Pseudocode following listing.
Code Block | ||||
---|---|---|---|---|
|
...
Listing 3-3 Pseudocode for TELNETs_CmdHandlerExt()
...
| |||
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 | ||
---|---|---|
| ||
|
...
|
...
|
...
|
...
|
...