Home --> Documentations --> PJLIB-UTIL Reference

cli.h
Go to the documentation of this file.
1 /* $Id$ */
2 /*
3  * Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 #ifndef __PJLIB_UTIL_CLI_H__
20 #define __PJLIB_UTIL_CLI_H__
21 
27 #include <pjlib-util/types.h>
28 #include <pj/list.h>
29 
30 
32 
76 typedef struct pj_cli_t pj_cli_t;
77 
81 typedef int pj_cli_cmd_id;
82 
88 typedef struct pj_cli_cfg
89 {
95 
102 
108 
109 } pj_cli_cfg;
110 
114 typedef int pj_cli_arg_id;
115 
120 
124 typedef struct pj_cli_sess pj_cli_sess;
125 
129 typedef struct pj_cli_front_end pj_cli_front_end;
130 
135 
139 typedef struct pj_cli_cmd_val
140 {
143 
146 
148  int argc;
149 
152 
154 
160 typedef struct pj_cli_hint_info
161 {
166 
171 
176 
178 
185 typedef struct pj_cli_exec_info
186 {
191  int err_pos;
192 
199 
205 
209  unsigned hint_cnt;
210 
219 
221 
226 typedef struct pj_cli_arg_choice_val
227 {
232 
238 
240 
245 {
250 
255 
260 
264  unsigned max_cnt;
265 
270 
274  unsigned cnt;
275 
281 
287 
297 
307 PJ_DECL(void) pj_cli_write_log(pj_cli_t *cli,
308  int level,
309  const char *buffer,
310  int len);
311 
320 PJ_DECL(pj_status_t) pj_cli_create(pj_cli_cfg *cfg,
321  pj_cli_t **p_cli);
322 
330 PJ_DECL(pj_cli_cmd_id) pj_cli_get_cmd_id(const pj_cli_cmd_spec *cmd);
331 
339 PJ_DECL(pj_cli_cfg*) pj_cli_get_param(pj_cli_t *cli);
340 
354 PJ_DECL(void) pj_cli_quit(pj_cli_t *cli, pj_cli_sess *req,
355  pj_bool_t restart);
363 PJ_DECL(pj_bool_t) pj_cli_is_quitting(pj_cli_t *cli);
364 
374 
381 PJ_DECL(void) pj_cli_destroy(pj_cli_t *cli);
382 
388 PJ_DECL(void) pj_cli_cfg_default(pj_cli_cfg *param);
389 
396 PJ_DECL(void) pj_cli_register_front_end(pj_cli_t *cli,
397  pj_cli_front_end *fe);
398 
419  pj_cli_cmd_spec *group,
420  const pj_str_t *xml,
421  pj_cli_cmd_handler handler,
422  pj_cli_cmd_spec **p_cmd,
423  pj_cli_get_dyn_choice get_choice);
429 PJ_DECL(void) pj_cli_exec_info_default(pj_cli_exec_info *param);
430 
438 PJ_DECL(void) pj_cli_sess_write_msg(pj_cli_sess *sess,
439  const char *buffer,
440  pj_size_t len);
441 
479  char *cmdline,
480  pj_cli_cmd_val *val,
481  pj_pool_t *pool,
483 
494 PJ_DECL(void) pj_cli_sess_end_session(pj_cli_sess *sess);
495 
519  char *cmdline,
520  pj_pool_t *pool,
521  pj_cli_exec_info *info);
522 
527 PJ_END_DECL
528 
529 #endif /* __PJLIB_UTIL_CLI_H__ */
pj_cli_cmd_id cmd_id
Definition: cli.h:198
pj_status_t(* pj_cli_cmd_handler)(pj_cli_cmd_val *cval)
Definition: cli.h:296
unsigned max_cnt
Definition: cli.h:264
pj_str_t desc
Definition: cli.h:237
unsigned cnt
Definition: cli.h:274
int pj_bool_t
pj_bool_t pj_cli_is_restarting(pj_cli_t *cli)
#define PJ_CLI_MAX_ARGS
Definition: config.h:302
#define PJ_CLI_MAX_CHOICE_VAL
Definition: config.h:358
pj_cli_cfg * pj_cli_get_param(pj_cli_t *cli)
Definition: cli_imp.h:171
pj_pool_t * pool
Definition: cli.h:269
Definition: cli.h:244
pj_str_t name
Definition: cli.h:165
pj_str_t type
Definition: cli.h:170
Definition: cli.h:160
void pj_cli_quit(pj_cli_t *cli, pj_cli_sess *req, pj_bool_t restart)
pj_cli_sess * sess
Definition: cli.h:249
Definition: cli.h:185
pj_bool_t pj_cli_is_quitting(pj_cli_t *cli)
pj_status_t pj_cli_sess_parse(pj_cli_sess *sess, char *cmdline, pj_cli_cmd_val *val, pj_pool_t *pool, pj_cli_exec_info *info)
int pj_status_t
pj_cli_cmd_id pj_cli_get_cmd_id(const pj_cli_cmd_spec *cmd)
pj_pool_factory * pf
Definition: cli.h:107
unsigned hint_cnt
Definition: cli.h:209
void pj_cli_sess_end_session(pj_cli_sess *sess)
const pj_cli_cmd_spec * cmd
Definition: cli.h:145
struct pj_cli_t pj_cli_t
Definition: cli.h:76
pj_status_t pj_cli_add_cmd_from_xml(pj_cli_t *cli, pj_cli_cmd_spec *group, const pj_str_t *xml, pj_cli_cmd_handler handler, pj_cli_cmd_spec **p_cmd, pj_cli_get_dyn_choice get_choice)
struct pj_cli_cmd_spec pj_cli_cmd_spec
Definition: cli.h:119
int pj_cli_arg_id
Definition: cli.h:114
Definition: cli.h:226
pj_str_t info
void pj_cli_exec_info_default(pj_cli_exec_info *param)
pj_cli_sess * sess
Definition: cli.h:142
pj_cli_cmd_spec * cmd
Definition: cli.h:254
pj_str_t desc
Definition: cli.h:175
int pj_cli_cmd_id
Definition: cli.h:81
int err_pos
Definition: cli.h:191
void pj_cli_destroy(pj_cli_t *cli)
pj_str_t name
Definition: cli.h:94
Definition: cli.h:88
pj_str_t argv[PJ_CLI_MAX_ARGS]
Definition: cli.h:151
Definition: cli_imp.h:123
#define PJ_BEGIN_DECL
pj_cli_arg_choice_val choice[PJ_CLI_MAX_CHOICE_VAL]
Definition: cli.h:279
#define PJ_CLI_MAX_HINTS
Definition: config.h:310
void pj_cli_register_front_end(pj_cli_t *cli, pj_cli_front_end *fe)
pj_str_t value
Definition: cli.h:231
Definition: cli.h:139
void pj_cli_write_log(pj_cli_t *cli, int level, const char *buffer, int len)
pj_str_t title
Definition: cli.h:101
pj_status_t cmd_ret
Definition: cli.h:204
pj_status_t pj_cli_sess_exec(pj_cli_sess *sess, char *cmdline, pj_pool_t *pool, pj_cli_exec_info *info)
pj_status_t pj_cli_create(pj_cli_cfg *cfg, pj_cli_t **p_cli)
pj_cli_arg_id arg_id
Definition: cli.h:259
struct pj_cli_arg_spec pj_cli_arg_spec
Definition: cli.h:134
pj_cli_hint_info hint[PJ_CLI_MAX_HINTS]
Definition: cli.h:218
int argc
Definition: cli.h:148
void(* pj_cli_get_dyn_choice)(pj_cli_dyn_choice_param *param)
Definition: cli.h:286
void pj_cli_cfg_default(pj_cli_cfg *param)
size_t pj_size_t
void pj_cli_sess_write_msg(pj_cli_sess *sess, const char *buffer, pj_size_t len)

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.