|
int | CmdStartCommandProcessor (int priority) |
| Start the command processor.
|
|
int | CmdAddCommandFd (int fd, bool require_auth, bool time_out_conn, bool local_echo=true) |
| Add an established FD connection to the list of fd's managed by the command processor.
|
|
int | CmdRemoveCommandFd (int fd) |
| Remove an established FD (either a TCP session, a serial connection, or an SSH session).
|
|
int | CmdListenOnTcpPort (uint16_t port, int do_telnet_processing, int max_connections) |
| Start listening for a connection over TCP.
|
|
int | CmdListenQuietOnTcpPort (uint16_t port, int do_telnet_processing, int max_connections) |
| Start listening for a connection over TCP, but without the siggnon or password.
|
|
int | CmdListenOnSshPort (uint16_t port, int max_connections) |
| Start listening for a connection over SSH.
|
|
int | CmdListenQuietOnSshPort (uint16_t port, int max_connections) |
| Start listening for a connection over SSH, but without the siggnon or password.
|
|
int | CmdStopListeningOnTcpPort (uint16_t port) |
| Stop Listening for connections on the specified port. Also closes all open connections that were based on that port.
|
|
int | CmdStopListeningOnSshPort (uint16_t port) |
| Stop Listening for connections on the specified port. Also closes all open connections that were based on that port.
|
|
void | SendToAll (const char *buffer, int len, bool include_serial_ports) |
| Send a message to all connected sockets, excluding "Listening sockets".
|
|
|
int(* | CmdAuthenticateFunc )(const char *name, const char *passwd) |
| External Authentication function CALLBACK for TCP connections, used to verify username and password. If this function pointer is not NULL then each new Telnet session will be asked to authenticate.
|
|
int(* | CmdAuthenticateSshFunc )(const char *name, const char *authVal, AuthType authType) |
| External Authentication function CALLBACK for SSH connections, used to verify username and password. If this function pointer is not NULL then each new SSH session will be asked to authenticate. If this function pointer is NULL, it tries to use CmdAuthenticateFunc instead.
|
|
int(* | CmdCmd_func )(const char *command, FILE *fRespondto, void *pData) |
| The command processing callback function for handling string commands.
|
|
int(* | CmdChar_func )(char command, FILE *fRespondto, void *pData) |
| The command processing callback function for handling single character commands. If this is implemented does not do echo or line editing this is the responsibility of the application programmer.
|
|
void *(* | CmdConnect_func )(FILE *fRespondto) |
| Connect callback function. If this function is not NULL, then the system will call this function every time a new session is started.
|
|
void(* | CmdPrompt_func )(FILE *fRespondto, void *pData) |
| Prompt callback function. If this function is not NULL, then the system will call this function every time a new prompt line needs to be displayed.
|
|
void(* | CmdDisConnect_func )(FILE *fRespondto, int cause, void *pData) |
| Dis-Connect callback function, if this function is not NULL then the system will call this function every time a session is terminated.
|
|
int | CmdIdleTimeout |
|
const char * | Cmdlogin_prompt |
| If this is defined, then it will be sent to the socket on connection before Authentication is tried.
|
|
#include< command.h >
This is is NetBurner's Command Processor Library. It operates as a task and reads input one line at a time from multiple sources. When it has gathered a whole line, it sends it to a command processor that is defined by the user.
◆ CmdAddCommandFd()
int CmdAddCommandFd |
( |
int | fd, |
|
|
bool | require_auth, |
|
|
bool | time_out_conn, |
|
|
bool | local_echo = true ) |
#include <command.h>
Add an established FD connection to the list of fd's managed by the command processor.
- Parameters
-
fd | The file descriptor. |
require_auth | Do we Authenticate the connection on this FD? |
time_out_conn | Do we time out the connection on this FD? |
local_echo | Do we provide a local echo for this FD (default is true)? |
- Return values
-
CMD_OK | Command processor task started properly. |
CMD_FAIL | Command processor task failed to start. |
CMD_TO_MANY_FDS | Too many file descriptors are currently in use. |
◆ CmdListenOnSshPort()
int CmdListenOnSshPort |
( |
uint16_t | port, |
|
|
int | max_connections ) |
#include <command.h>
Start listening for a connection over SSH.
- Parameters
-
port | The port number to listen on. |
max_connections | What are the max number of connections we should allow on this port? |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_TO_MANY_FDS | Too many file descriptors are currently in use. |
CMD_FAILED_SSH_KEY_GEN | Unable to generate the key needed for SSH communication. |
◆ CmdListenOnTcpPort()
int CmdListenOnTcpPort |
( |
uint16_t | port, |
|
|
int | do_telnet_processing, |
|
|
int | max_connections ) |
#include <command.h>
Start listening for a connection over TCP.
- Parameters
-
port | The port number to listen on. |
do_telnet_processing | Should we treat the port as telnet and process telnet negotiations? |
max_connections | What are the max number of connections we should allow on this port? |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_TO_MANY_FDS | Too many file descriptors are currently in use. |
◆ CmdListenQuietOnSshPort()
int CmdListenQuietOnSshPort |
( |
uint16_t | port, |
|
|
int | max_connections ) |
#include <command.h>
Start listening for a connection over SSH, but without the siggnon or password.
- Parameters
-
port | The port number to listen on. |
max_connections | What are the max number of connections we should allow on this port? |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_TO_MANY_FDS | Too many file descriptors are currently in use. |
CMD_FAILED_SSH_KEY_GEN | Unable to generate the key needed for SSH communication. |
◆ CmdListenQuietOnTcpPort()
int CmdListenQuietOnTcpPort |
( |
uint16_t | port, |
|
|
int | do_telnet_processing, |
|
|
int | max_connections ) |
#include <command.h>
Start listening for a connection over TCP, but without the siggnon or password.
- Parameters
-
port | The port number to listen on. |
do_telnet_processing | Should we treat the port as telnet and process telnet negotiations? |
max_connections | What are the max number of connections we should allow on this port? |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_TO_MANY_FDS | Too many file descriptors are currently in use. |
◆ CmdRemoveCommandFd()
int CmdRemoveCommandFd |
( |
int | fd | ) |
|
#include <command.h>
Remove an established FD (either a TCP session, a serial connection, or an SSH session).
- Parameters
-
fd | The file descriptor to remove. |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_FAIL | Failed to remove the file descriptor. |
◆ CmdStartCommandProcessor()
int CmdStartCommandProcessor |
( |
int | priority | ) |
|
#include <command.h>
Start the command processor.
- Parameters
-
priority | The NBRTOS task priority to run at. |
- Return values
-
CMD_OK | Command processor task started properly. |
CMD_FAIL | Command processor task failed to start. |
◆ CmdStopListeningOnSshPort()
int CmdStopListeningOnSshPort |
( |
uint16_t | port | ) |
|
#include <command.h>
Stop Listening for connections on the specified port. Also closes all open connections that were based on that port.
- Parameters
-
port | The port number to listen on. |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_FAIL | Port requested wasn't listening for a connection. |
◆ CmdStopListeningOnTcpPort()
int CmdStopListeningOnTcpPort |
( |
uint16_t | port | ) |
|
#include <command.h>
Stop Listening for connections on the specified port. Also closes all open connections that were based on that port.
- Parameters
-
port | The port number to listen on. |
- Return values
-
CMD_OK | Successfully removed the file descriptor. |
CMD_FAIL | Port requested wasn't listening for a connection. |
◆ SendToAll()
void SendToAll |
( |
const char * | buffer, |
|
|
int | len, |
|
|
bool | include_serial_ports ) |
#include <command.h>
Send a message to all connected sockets, excluding "Listening sockets".
- Parameters
-
buffer | A buffer holding the message to send. |
len | The length of the buffer to send. |
include_serial_ports | Also send to serial ports? |
◆ CmdAuthenticateFunc
int(* CmdAuthenticateFunc) (const char *name, const char *passwd) |
( |
const char * | name, |
|
|
const char * | passwd ) |
|
extern |
#include <command.h>
External Authentication function CALLBACK for TCP connections, used to verify username and password. If this function pointer is not NULL then each new Telnet session will be asked to authenticate.
- Parameters
-
name | The user name trying to authenticate. |
passwd | The password provided for the user. |
- Return values
-
CMD_OK | If the authentication was successful. |
CMD_CLOSE | If the authentication was not successful. |
◆ CmdAuthenticateSshFunc
int(* CmdAuthenticateSshFunc) (const char *name, const char *authVal, AuthType authType) |
( |
const char * | name, |
|
|
const char * | authVal, |
|
|
AuthType | authType ) |
|
extern |
#include <command.h>
External Authentication function CALLBACK for SSH connections, used to verify username and password. If this function pointer is not NULL then each new SSH session will be asked to authenticate. If this function pointer is NULL, it tries to use CmdAuthenticateFunc instead.
- Parameters
-
name | The user name trying to authenticate. |
authVal | The authorization value provided for the user. |
authType | The type of authorization value passed in. |
- Return values
-
CMD_OK | If the authentication was successful. |
CMD_CLOSE | If the authentication was not successful. |
◆ CmdChar_func
int(* CmdChar_func) (char command, FILE *fRespondto, void *pData) |
( |
char | command, |
|
|
FILE * | fRespondto, |
|
|
void * | pData ) |
|
extern |
#include <command.h>
The command processing callback function for handling single character commands. If this is implemented does not do echo or line editing this is the responsibility of the application programmer.
- Parameters
-
command | The single command character. |
fRespondto | The FILE * all responses should be set to (use fprintf). |
pData | Any data that is associated from the session. This is returned by CmdConnect_func. |
- Return values
-
CMD_OK | If the command was okay. |
CMD_CLOSE | If the command causes the session to terminate (Close). |
- See also
- CmdCmd_func
-
CmdConnect_func
◆ CmdCmd_func
int(* CmdCmd_func) (const char *command, FILE *fRespondto, void *pData) |
( |
const char * | command, |
|
|
FILE * | fRespondto, |
|
|
void * | pData ) |
|
extern |
#include <command.h>
The command processing callback function for handling string commands.
- Parameters
-
command | A pointer to the null terminated ASCII text of the command. |
fRespondto | The FILE * all responses should be set to (use fprintf). |
pData | Any data that is associated from the session and is returned by CmdConnect_func. |
- Return values
-
CMD_OK | If the command was okay. |
CMD_CLOSE | If the command causes the session to terminate (Close). |
- See also
- CmdChar_func
-
CmdConnect_func
◆ CmdConnect_func
void *(* CmdConnect_func) (FILE *fRespondto) |
( |
FILE * | fRespondto | ) |
|
|
extern |
#include <command.h>
Connect callback function. If this function is not NULL, then the system will call this function every time a new session is started.
- Parameters
-
fRespondto | The FILE * all responses should be set to (use fprintf). |
- Return values
-
Returns | an arbitrary void* data item to be associated with the session. This data item is the same pData item used in other callback functions such as CmdPrompt_func. |
- See also
- CmdCmd_func
-
CmdChar_func
◆ CmdDisConnect_func
void(* CmdDisConnect_func) (FILE *fRespondto, int cause, void *pData) |
( |
FILE * | fRespondto, |
|
|
int | cause, |
|
|
void * | pData ) |
|
extern |
#include <command.h>
Dis-Connect callback function, if this function is not NULL then the system will call this function every time a session is terminated.
- Parameters
-
fRespondto | The FILE * all responses should be set to (use fprintf). |
cause | Why it disconnected. Can be any value from Command Processor Disconnect Causes. |
pData | Any data that is associated from the session. This is returned by CmdConnect_func. |
- See also
- CmdConnect_func
◆ CmdIdleTimeout
#include <command.h>
User defined value that specifies the number of seconds a connection is idle before it is terminated due to inactivity.
◆ CmdPrompt_func
void(* CmdPrompt_func) (FILE *fRespondto, void *pData) |
( |
FILE * | fRespondto, |
|
|
void * | pData ) |
|
extern |
#include <command.h>
Prompt callback function. If this function is not NULL, then the system will call this function every time a new prompt line needs to be displayed.
- Parameters
-
fRespondto | The FILE * all responses should be set to (use fprintf). |
pData | Any data that is associated from the session. This is returned by CmdConnect_func. |
- See also
- CmdConnect_func