00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _ASTERISK_CLI_H
00015 #define _ASTERISK_CLI_H
00016
00017 #if defined(__cplusplus) || defined(c_plusplus)
00018 extern "C" {
00019 #endif
00020
00021 #include <stdarg.h>
00022
00023 extern void ast_cli(int fd, char *fmt, ...);
00024
00025 #define RESULT_SUCCESS 0
00026 #define RESULT_SHOWUSAGE 1
00027 #define RESULT_FAILURE 2
00028
00029 #define AST_MAX_CMD_LEN 16
00030
00031 #define AST_MAX_ARGS 64
00032
00033
00034 struct ast_cli_entry {
00035
00036 char *cmda[AST_MAX_CMD_LEN];
00037
00038 int (*handler)(int fd, int argc, char *argv[]);
00039
00040 char *summary;
00041
00042 char *usage;
00043
00044 char *(*generator)(char *line, char *word, int pos, int state);
00045
00046 struct ast_cli_entry *next;
00047
00048 int inuse;
00049 };
00050
00051
00052
00053
00054
00055 extern int ast_cli_command(int fd, char *s);
00056
00057
00058
00059
00060
00061
00062
00063
00064 extern int ast_cli_register(struct ast_cli_entry *e);
00065
00066
00067
00068
00069
00070
00071
00072 extern int ast_cli_unregister(struct ast_cli_entry *e);
00073
00074
00075
00076
00077
00078 extern char *ast_cli_generator(char *, char *, int);
00079
00080 extern int ast_cli_generatornummatches(char *, char *);
00081 extern char **ast_cli_completion_matches(char *, char *);
00082
00083 #if defined(__cplusplus) || defined(c_plusplus)
00084 }
00085 #endif
00086
00087 #endif