WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

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

cli.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef __PJLIB_UTIL_CLI_H__
19#define __PJLIB_UTIL_CLI_H__
20
26#include <pjlib-util/types.h>
27#include <pj/list.h>
28
29
31
75typedef struct pj_cli_t pj_cli_t;
76
80typedef int pj_cli_cmd_id;
81
87typedef struct pj_cli_cfg
88{
94
101
107
108} pj_cli_cfg;
109
113typedef int pj_cli_arg_id;
114
119
123typedef struct pj_cli_sess pj_cli_sess;
124
129
134
138typedef struct pj_cli_cmd_val
139{
142
145
147 int argc;
148
151
153
159typedef struct pj_cli_hint_info
160{
165
170
175
177
184typedef struct pj_cli_exec_info
185{
191
198
204
208 unsigned hint_cnt;
209
218
220
226{
231
237
239
244{
249
254
259
263 unsigned max_cnt;
264
269
273 unsigned cnt;
274
280
286
296
306PJ_DECL(void) pj_cli_write_log(pj_cli_t *cli,
307 int level,
308 const char *buffer,
309 int len);
310
320 pj_cli_t **p_cli);
321
330
339
353PJ_DECL(void) pj_cli_quit(pj_cli_t *cli, pj_cli_sess *req,
354 pj_bool_t restart);
363
373
380PJ_DECL(void) pj_cli_destroy(pj_cli_t *cli);
381
387PJ_DECL(void) pj_cli_cfg_default(pj_cli_cfg *param);
388
396 pj_cli_front_end *fe);
397
420 pj_cli_cmd_spec *group,
421 const pj_str_t *xml,
422 pj_cli_cmd_handler handler,
423 pj_cli_cmd_spec **p_cmd,
424 pj_cli_get_dyn_choice get_choice);
431
440 const char *buffer,
441 pj_size_t len);
442
480 char *cmdline,
481 pj_cli_cmd_val *val,
482 pj_pool_t *pool,
483 pj_cli_exec_info *info);
484
496
520 char *cmdline,
521 pj_pool_t *pool,
522 pj_cli_exec_info *info);
523
529
530#endif /* __PJLIB_UTIL_CLI_H__ */
void pj_cli_destroy(pj_cli_t *cli)
struct pj_cli_cmd_spec pj_cli_cmd_spec
Definition: cli.h:118
pj_status_t pj_cli_create(pj_cli_cfg *cfg, pj_cli_t **p_cli)
pj_bool_t pj_cli_is_restarting(pj_cli_t *cli)
struct pj_cli_arg_spec pj_cli_arg_spec
Definition: cli.h:133
void pj_cli_cfg_default(pj_cli_cfg *param)
void pj_cli_exec_info_default(pj_cli_exec_info *param)
pj_bool_t pj_cli_is_quitting(pj_cli_t *cli)
pj_cli_cmd_id pj_cli_get_cmd_id(const pj_cli_cmd_spec *cmd)
int pj_cli_cmd_id
Definition: cli.h:80
pj_status_t pj_cli_sess_exec(pj_cli_sess *sess, char *cmdline, pj_pool_t *pool, pj_cli_exec_info *info)
int pj_cli_arg_id
Definition: cli.h:113
void pj_cli_quit(pj_cli_t *cli, pj_cli_sess *req, pj_bool_t restart)
pj_cli_cfg * pj_cli_get_param(pj_cli_t *cli)
void pj_cli_sess_end_session(pj_cli_sess *sess)
void pj_cli_register_front_end(pj_cli_t *cli, pj_cli_front_end *fe)
void pj_cli_write_log(pj_cli_t *cli, int level, const char *buffer, int len)
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)
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)
void(* pj_cli_get_dyn_choice)(pj_cli_dyn_choice_param *param)
Definition: cli.h:285
pj_status_t(* pj_cli_cmd_handler)(pj_cli_cmd_val *cval)
Definition: cli.h:295
struct pj_cli_t pj_cli_t
Definition: cli.h:75
void pj_cli_sess_write_msg(pj_cli_sess *sess, const char *buffer, pj_size_t len)
#define PJ_CLI_MAX_HINTS
Definition: config.h:309
#define PJ_CLI_MAX_CHOICE_VAL
Definition: config.h:357
#define PJ_CLI_MAX_ARGS
Definition: config.h:301
int pj_bool_t
size_t pj_size_t
int pj_status_t
#define PJ_BEGIN_DECL
#define PJ_END_DECL
Definition: cli.h:226
pj_str_t value
Definition: cli.h:230
pj_str_t desc
Definition: cli.h:236
Definition: cli.h:88
pj_str_t name
Definition: cli.h:93
pj_str_t title
Definition: cli.h:100
pj_pool_factory * pf
Definition: cli.h:106
Definition: cli.h:139
pj_cli_sess * sess
Definition: cli.h:141
const pj_cli_cmd_spec * cmd
Definition: cli.h:144
int argc
Definition: cli.h:147
pj_str_t argv[PJ_CLI_MAX_ARGS]
Definition: cli.h:150
Definition: cli.h:244
pj_cli_arg_id arg_id
Definition: cli.h:258
unsigned cnt
Definition: cli.h:273
pj_cli_sess * sess
Definition: cli.h:248
pj_cli_arg_choice_val choice[PJ_CLI_MAX_CHOICE_VAL]
Definition: cli.h:278
unsigned max_cnt
Definition: cli.h:263
pj_pool_t * pool
Definition: cli.h:268
pj_cli_cmd_spec * cmd
Definition: cli.h:253
Definition: cli.h:185
unsigned hint_cnt
Definition: cli.h:208
int err_pos
Definition: cli.h:190
pj_cli_cmd_id cmd_id
Definition: cli.h:197
pj_cli_hint_info hint[PJ_CLI_MAX_HINTS]
Definition: cli.h:217
pj_status_t cmd_ret
Definition: cli.h:203
Definition: cli_imp.h:123
Definition: cli.h:160
pj_str_t name
Definition: cli.h:164
pj_str_t desc
Definition: cli.h:174
pj_str_t type
Definition: cli.h:169
Definition: cli_imp.h:171
PJLIB-UTIL types.

 


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.