Data Structures | |
struct | clish_shell_builtin_t |
struct | clish_shell_hooks_t |
Typedefs | |
typedef clish_shell_s | clish_shell_t |
typedef bool_t | clish_shell_init_fn_t (const clish_shell_t *shell) |
typedef void | clish_shell_fini_fn_t (const clish_shell_t *shell) |
typedef void | clish_shell_cmd_line_fn_t (const clish_shell_t *instance, const char *cmd_line) |
typedef bool_t | clish_shell_script_fn_t (const clish_shell_t *instance, const char *script) |
typedef bool_t | clish_shell_access_fn_t (const clish_shell_t *instance, const char *access) |
typedef bool_t | clish_shell_builtin_fn_t (const clish_shell_t *instance, const lub_argv_t *argv) |
Functions | |
int | clish_shell_spawn_and_wait (const clish_shell_hooks_t *hooks, void *cookie) |
bool_t | clish_shell_spawn (pthread_t *pthread, const pthread_attr_t *attr, const clish_shell_hooks_t *hooks, void *cookie) |
bool_t | clish_shell_spawn_from_file (const clish_shell_hooks_t *hooks, void *cookie, const char *filename) |
clish_shell_t * | clish_shell_new (const clish_shell_hooks_t *hooks, void *cookie, FILE *istream) |
bool_t | clish_shell_startup (clish_shell_t *instance) |
void | clish_shell_delete (clish_shell_t *instance) |
clish_view_t * | clish_shell_find_create_view (clish_shell_t *instance, const char *name, const char *prompt) |
clish_ptype_t * | clish_shell_find_create_ptype (clish_shell_t *instance, const char *name, const char *text, const char *pattern, clish_ptype_method_e method, clish_ptype_preprocess_e preprocess) |
int | clish_shell_xml_read (clish_shell_t *instance, const char *filename) |
void | clish_shell_help (clish_shell_t *instance, const char *line) |
bool_t | clish_shell_execute (clish_shell_t *instance, const clish_command_t *cmd, clish_pargv_t **pargv) |
bool_t | clish_shell_readline (clish_shell_t *shell, const char *prompt, const clish_command_t **cmd, clish_pargv_t **pargv) |
void | clish_shell_set_context (clish_shell_t *instance, const char *viewname) |
void | clish_shell_dump (clish_shell_t *instance) |
void | clish_shell_close (clish_shell_t *instance) |
const clish_view_t * | clish_shell__get_view (const clish_shell_t *instance) |
const char * | clish_shell__get_viewid (const clish_shell_t *instance) |
const char * | clish_shell__get_overview (const clish_shell_t *instance) |
tinyrl_t * | clish_shell__get_tinyrl (const clish_shell_t *instance) |
void * | clish_shell__get_client_cookie (const clish_shell_t *instance) |
typedef bool_t clish_shell_access_fn_t(const clish_shell_t *instance,const char *access) |
A hook function used to control access for the current user.
This will be invoked from the context of the spawned shell's thread and will be called during the parsing of the XML files.
The clish component will only insert a command into a view if the access call is sucessfull.
The client may choose to implement invocation of the script in a number of ways, which may include forking a sub-process or thread. It is important that the call doesn't return until the script has been fully evaluated.
typedef bool_t clish_shell_builtin_fn_t(const clish_shell_t *instance,const lub_argv_t *argv) |
A hook function used as a built in command callback
This will be invoked from the context of the spawned shell's thread and will be called during the execution of a builting command.
A client may register any number of these callbacks in its clish_shell_builtin_cmds_t structure.
typedef void clish_shell_cmd_line_fn_t(const clish_shell_t *instance,const char *cmd_line) |
A hook function used to indicate a command line has been executed and the shell is about to prompt for the next command.
This will be invoked from the context of the spawned shell's thread and will be called once an ACTION has been performed.
A client may use this as a periodic indicator of CLI activity, e.g. to manage session timeouts. In addition any required logging of commands may be performed.
typedef void clish_shell_fini_fn_t(const clish_shell_t *shell) |
A hook function used during the shutting down of a spawned shell
This will be invoked from the context of the spawned shell's thread and will be invoked just before the shell is destroyed.
This enables the client-specific finalisation to occur. e.g. releasing any resource held by the cookie, shutting down telnet connections
NB. This function may be called multiple times if a user is spawning new commands (via the "clish_spawn" builtin command), hence should use the reference to the root shell (remembered by the first call to clish_shell_init_fn_t callback) to signal when the cleanup should occur.
typedef bool_t clish_shell_init_fn_t(const clish_shell_t *shell) |
A hook function used during the spawning of a new shell.
This will be invoked from the context of the spawned shell's thread and will be invoked just after the shell instance is created.
This enables the client-specific initialisation of the spawned shell's thread e.g. to map the I/O streams, authenticate a user.
N.B. It is possible for a client to have this invoked multiple times if the user is spawning new shells using a commmand which uses the "clish_spawn" builtin function. Hence the client should remember the shell which first calls this function, and only assign resource (e.g. setting up a script interpreter) for that call.
typedef bool_t clish_shell_script_fn_t(const clish_shell_t *instance,const char *script) |
A hook function used to invoke the script associated with a command
This will be invoked from the context of the spawned shell's thread and will be invoked with the ACTION script which is to be performed.
The clish component will only pass down a call when a command has been correctly input.
The client may choose to implement invocation of the script in a number of ways, which may include forking a sub-process or thread. It is important that the call doesn't return until the script has been fully evaluated.
bool_t clish_shell_spawn | ( | pthread_t * | pthread, | |
const pthread_attr_t * | attr, | |||
const clish_shell_hooks_t * | hooks, | |||
void * | cookie | |||
) |
This operation causes a separate (POSIX) thread of execution to be spawned. This thread becomes responsible for the CLI session.
This will be invoked from the context of the spawned shell's thread and will be called during the execution of a builting command.
A client may register any number of these callbacks in its clish_shell_builtin_cmds_t structure.
pthread | A POSIX thread reference to fill out. This can be used to later control the spawned thread if necessary. |
attr | A POSIX thread attribute reference which will be used to define the thread which will be lanched. A value of NULL will use the system default. |
hooks | A reference to the clients hooks. These are used to communicate back the client when client-specific actions are required. |
cookie | A client specific reference which can be obtained during a callback by invoking clish_shell__get_client_cookie() |