Robust Distributed System Nucleus (rDSN)  ver 1.0.0
Classes | Typedefs | Functions
Command-Line Interface (cli)

Overview

Classes

struct  dsn_cli_reply
 

Typedefs

typedef struct dsn_cli_reply dsn_cli_reply
 
typedef void(* dsn_cli_handler) (void *context, int argc, const char **argv, dsn_cli_reply *reply)
 
typedef void(* dsn_cli_free_handler) (dsn_cli_reply reply)
 

Functions

DSN_API const char * dsn_cli_run (const char *command_line)
 
DSN_API void dsn_cli_free (const char *command_output)
 
DSN_API dsn_handle_t dsn_cli_register (const char *command, const char *help_one_line, const char *help_long, void *context, dsn_cli_handler cmd_handler, dsn_cli_free_handler output_freer)
 
DSN_API dsn_handle_t dsn_cli_app_register (const char *command, const char *help_one_line, const char *help_long, void *context, dsn_cli_handler cmd_handler, dsn_cli_free_handler output_freer)
 
DSN_API void dsn_cli_deregister (dsn_handle_t cli_handle)
 

Function Documentation

DSN_API const char* dsn_cli_run ( const char *  command_line)

run a given cli command

Parameters
command_linegiven command line.
Returns
null if it fails, else execution response
DSN_API void dsn_cli_free ( const char *  command_output)

free memory occupied by cli response

Parameters
command_outputresult from dsn_cli_run
DSN_API dsn_handle_t dsn_cli_register ( const char *  command,
const char *  help_one_line,
const char *  help_long,
void *  context,
dsn_cli_handler  cmd_handler,
dsn_cli_free_handler  output_freer 
)

register a customized cli command handler

Parameters
commandcommand name
help_one_lineone line help information
help_longlong help information
contextcontext used by cmd_handler
cmd_handlercommand handler
output_freercommand result resource free handler
Returns
the handle of this registered command
DSN_API dsn_handle_t dsn_cli_app_register ( const char *  command,
const char *  help_one_line,
const char *  help_long,
void *  context,
dsn_cli_handler  cmd_handler,
dsn_cli_free_handler  output_freer 
)

same as dsn_cli_register, except that the command name is auto-augmented by rDSN as $app_full_name.

$command

DSN_API void dsn_cli_deregister ( dsn_handle_t  cli_handle)

remove a cli handler

Parameters
cli_handlehandle of the cli returned from dsn_cli_register or dsn_cli_app_register