NetBurner 3.5.0
PDF Version
 
command.h File Reference

NetBurner Command Processor. More...

#include <basictypes.h>
#include <stdio.h>
#include <ssh/NetBurner/UserAuthManager.h>

Go to the source code of this file.

Macros

#define CMD_OK   (0)
 Function was excecuted properly.
 
#define CMD_CLOSE   (1)
 Connection closed.
 
#define CMD_FAIL   (2)
 General function failed.
 
#define CMD_AUTH_FAIL   (3)
 Authorization failed.
 
#define CMD_TO_MANY_FDS   (4)
 Too many file descriptors currently in use.
 
#define CMD_FAILED_SSH_KEY_GEN   (5)
 Unable to correctly generate key needed for SSH connections.
 
#define CMD_DIS_CAUSE_TIMEOUT   (1)
 Connection timed out.
 
#define CMD_DIS_CAUSE_CLOSED   (2)
 Connection closed.
 
#define CMD_DIS_SOCKET_CLOSED   (3)
 Socket closed. Don't send a response for this case.
 
#define CMD_DIS_AUTH_FAILED   (4)
 Authorization failed. Don't send a response for this case.
 

Enumerations

enum  ListenOn : int8_t { eListenOnTcp = 1 , eListenOnSsh = 2 }
 The various remote channels that the command processor can listen to. More...
 

Functions

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".
 

Variables

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.
 

Detailed Description

NetBurner Command Processor.