23 #ifndef _ASTERISK_CLI_H
24 #define _ASTERISK_CLI_H
26 #if defined(__cplusplus) || defined(c_plusplus)
32 void ast_cli(
int fd,
const char *fmt, ...)
33 __attribute__((
format(printf, 2, 3)));
37 #define CLI_NO_PERMS -1
39 #define RESULT_SUCCESS 0
40 #define RESULT_SHOWUSAGE 1
41 #define RESULT_FAILURE 2
43 #define CLI_SUCCESS (char *)RESULT_SUCCESS
44 #define CLI_SHOWUSAGE (char *)RESULT_SHOWUSAGE
45 #define CLI_FAILURE (char *)RESULT_FAILURE
47 #define AST_MAX_CMD_LEN 16
49 #define AST_MAX_ARGS 64
51 #define AST_CLI_COMPLETE_EOF "_EOF_"
58 #define ESS(x) ((x) == 1 ? "" : "s")
65 #define AST_CLI_YESNO(x) (x) ? "Yes" : "No"
72 #define AST_CLI_ONOFF(x) (x) ? "On" : "Off"
186 #if defined(__cplusplus) || defined(c_plusplus)
187 #define AST_CLI_DEFINE(fn, txt) { { "" }, txt, NULL, 0, NULL, NULL, 0, 0, NULL, fn }
191 #define AST_CLI_DEFINE(fn, txt , ... ) { .handler = fn, .summary = txt, ## __VA_ARGS__ }
226 #define ast_cli_command(fd,s) ast_cli_command_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, s)
242 #define ast_cli_command_multiple(fd,size,s) ast_cli_command_multiple_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, size, s)
307 #if defined(__cplusplus) || defined(c_plusplus)
char ** ast_cli_completion_matches(const char *, const char *)
Generates a NULL-terminated array of strings that 1) begin with the string in the second parameter...
int ast_cli_register(struct ast_cli_entry *e)
Registers a command or an array of commands.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
descriptor for a cli entry.
void ast_cli(int fd, const char *fmt,...)
int args
This gets set in ast_cli_register()
char * ast_cli_complete(const char *word, const char *const choices[], int pos)
int ast_cli_command_full(int uid, int gid, int fd, const char *s)
Interprets a command Interpret a command s, sending output to fd if uid:gid has permissions to run th...
A set of macros to manage forward-linked lists.
ast_cli_command
calling arguments for new-style handlers.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
char * ast_cli_generator(const char *, const char *, int)
Readline madness Useful for readline, that's about it.
int ast_cli_command_multiple_full(int uid, int gid, int fd, size_t size, const char *s)
Executes multiple CLI commands Interpret strings separated by NULL and execute each one...
const char *const summary
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
int ast_cli_generatornummatches(const char *, const char *)
Return the number of unique matches for the generator.
struct ast_cli_entry::@159 list
const char *const cmda[AST_MAX_CMD_LEN]
static snd_pcm_format_t format