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 __attribute__ ((format (printf, 2, 3)));
00025
00026 #define RESULT_SUCCESS 0
00027 #define RESULT_SHOWUSAGE 1
00028 #define RESULT_FAILURE 2
00029
00030 #define AST_MAX_CMD_LEN 16
00031
00032 #define AST_MAX_ARGS 64
00033
00034
00035 struct ast_cli_entry {
00036
00037 char *cmda[AST_MAX_CMD_LEN];
00038
00039 int (*handler)(int fd, int argc, char *argv[]);
00040
00041 char *summary;
00042
00043 char *usage;
00044
00045 char *(*generator)(char *line, char *word, int pos, int state);
00046
00047 struct ast_cli_entry *next;
00048
00049 int inuse;
00050 };
00051
00052
00053
00054
00055
00056 extern int ast_cli_command(int fd, char *s);
00057
00058
00059
00060
00061
00062
00063
00064
00065 extern int ast_cli_register(struct ast_cli_entry *e);
00066
00067
00068
00069
00070
00071
00072
00073 extern int ast_cli_unregister(struct ast_cli_entry *e);
00074
00075
00076
00077
00078
00079 extern char *ast_cli_generator(char *, char *, int);
00080
00081 extern int ast_cli_generatornummatches(char *, char *);
00082 extern char **ast_cli_completion_matches(char *, char *);
00083
00084 #if defined(__cplusplus) || defined(c_plusplus)
00085 }
00086 #endif
00087
00088 #endif