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 #define AST_CLI_COMPLETE_EOF "_EOF_"
00035
00036
00037 struct
ast_cli_entry {
00038
00039 char *cmda[
AST_MAX_CMD_LEN];
00040
00041 int (*handler)(
int fd,
int argc,
char *argv[]);
00042
00043 char *summary;
00044
00045 char *usage;
00046
00047
char *(*generator)(
char *line,
char *word,
int pos,
int state);
00048
00049 struct ast_cli_entry *next;
00050
00051 int inuse;
00052 };
00053
00054
00055
00056
00057
00058
extern int ast_cli_command(
int fd,
char *s);
00059
00060
00061
00062
00063
00064
00065
00066
00067
extern int ast_cli_register(
struct ast_cli_entry *e);
00068
00069
00070
00071
00072
00073
00074
00075
extern int ast_cli_unregister(
struct ast_cli_entry *e);
00076
00077
00078
00079
00080
00081
extern char *
ast_cli_generator(
char *,
char *,
int);
00082
00083
extern int ast_cli_generatornummatches(
char *,
char *);
00084
extern char **
ast_cli_completion_matches(
char *,
char *);
00085
00086
#if defined(__cplusplus) || defined(c_plusplus)
00087
}
00088
#endif
00089
00090
#endif