Asterisk - The Open Source Telephony Project
21.4.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
include
asterisk
res_pjsip_cli.h
1
/*
2
* Asterisk -- An open source telephony toolkit.
3
*
4
* Copyright (C) 2013, Fairview 5 Engineering, LLC.
5
*
6
* George Joseph <george.joseph@fairview5.com>
7
*
8
* See http://www.asterisk.org for more information about
9
* the Asterisk project. Please do not directly contact
10
* any of the maintainers of this project for assistance;
11
* the project provides a web site, mailing lists and IRC
12
* channels for your use.
13
*
14
* This program is free software, distributed under the terms of
15
* the GNU General Public License Version 2. See the LICENSE file
16
* at the top of the source tree.
17
*/
18
19
#ifndef RES_PJSIP_CLI_H_
20
#define RES_PJSIP_CLI_H_
21
22
#include "
asterisk/cli.h
"
23
24
#define CLI_HEADER_FILLER ".........................................................................................."
25
#define CLI_DETAIL_FILLER " "
26
#define CLI_MAX_WIDTH 90
27
#define CLI_LAST_TABSTOP 62
28
#define CLI_MAX_TITLE_NAME 8
29
#define CLI_INDENT_TO_SPACES(x) ((x * 2) + 1 + CLI_MAX_TITLE_NAME)
30
31
/*!
32
* \brief CLI Formatter Context passed to all formatters.
33
*/
34
struct
ast_sip_cli_context
{
35
/*! Buffer used to accumulate cli output. */
36
struct
ast_str
*
output_buffer
;
37
/*! Used to indicate which direction an auth is used for. "I" or "O" */
38
char
*
auth_direction
;
39
/*! Allows formatters to know how far to indent their output. */
40
int
indent_level
;
41
/*! Tells a formatter to dump its object_set. */
42
unsigned
show_details
: 1;
43
/*! Tells a formatter to descend into child objects. */
44
unsigned
recurse
: 1;
45
/*! Tells a formatter to dump it's object_set only if it's the root object. */
46
unsigned
show_details_only_level_0
: 1;
47
};
48
49
/*!
50
* \brief CLI Formatter Registry Entry
51
*/
52
struct
ast_sip_cli_formatter_entry
{
53
/*! A globally unique name for this formatter. If this formatter entry
54
* is for an existing sorcery object type, then this name must match
55
* the sorcery object type. Otherwise it can be any string as long as
56
* it's globally unique.
57
*/
58
const
char
*
name
;
59
/*! The callback used to print the object's column headers. */
60
ao2_callback_fn
*
print_header
;
61
/*! The callback used to print the details of the object. */
62
ao2_callback_fn
*
print_body
;
63
/*! The function used to retrieve a container of all objects of this type. */
64
struct
ao2_container
*(* get_container)(
const
char
*regex);
65
/*! The function used to iterate over a container of objects. */
66
int (*
iterate
)(
void
*
container
,
ao2_callback_fn
callback,
void
*args);
67
/*! The function used to retrieve a specific object from it's container. */
68
void
*(* retrieve_by_id)(
const
char
*id);
69
/*! The function used to retrieve an id string from an object. */
70
const
char
*(* get_id)(
const
void
*obj);
71
};
72
73
/*!
74
* \brief Registers a CLI formatter.
75
*
76
* \param formatter An ao2_callback_fn that outputs the formatted data.
77
* \retval 0 Success, non-zero on failure
78
*/
79
int
ast_sip_register_cli_formatter(
struct
ast_sip_cli_formatter_entry
*formatter);
80
81
/*!
82
* \brief Unregisters a CLI formatter.
83
*
84
* \param formatter The name of the formatter, usually the sorcery object type.
85
* \retval 0 Success, non-zero on failure
86
*/
87
int
ast_sip_unregister_cli_formatter(
struct
ast_sip_cli_formatter_entry
*formatter);
88
89
/*!
90
* \brief Looks up a CLI formatter by type.
91
*
92
* \param name The name of the formatter, usually the sorcery object type.
93
* \retval Pointer to formatter entry structure
94
*/
95
struct
ast_sip_cli_formatter_entry
*ast_sip_lookup_cli_formatter(
const
char
*
name
);
96
97
/*!
98
* \brief Prints a sorcery object's ast_variable list
99
*
100
* \param obj The sorcery object
101
* \param arg The ast_sip_cli_context
102
* \param flags
103
* \retval 0 Success, non-zero on failure
104
*/
105
int
ast_sip_cli_print_sorcery_objectset(
void
*obj,
void
*arg,
int
flags);
106
107
char
*ast_sip_cli_traverse_objects(
struct
ast_cli_entry
*e,
int
cmd,
struct
ast_cli_args
*a);
108
109
110
#endif
/* RES_PJSIP_CLI_H_ */
ast_sip_cli_context::output_buffer
struct ast_str * output_buffer
Definition:
res_pjsip_cli.h:36
ast_sip_cli_formatter_entry
CLI Formatter Registry Entry.
Definition:
res_pjsip_cli.h:52
ao2_callback_fn
int( ao2_callback_fn)(void *obj, void *arg, int flags)
Type of a generic callback function.
Definition:
astobj2.h:1226
ast_cli_entry
descriptor for a cli entry.
Definition:
cli.h:171
ast_sip_cli_formatter_entry::iterate
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
Definition:
res_pjsip_cli.h:66
ast_sip_cli_context::show_details
unsigned show_details
Definition:
res_pjsip_cli.h:42
ast_sip_cli_context
CLI Formatter Context passed to all formatters.
Definition:
res_pjsip_cli.h:34
container
struct ao2_container * container
Definition:
res_fax.c:501
ast_sip_cli_context::indent_level
int indent_level
Definition:
res_pjsip_cli.h:40
ast_str
Support for dynamic strings.
Definition:
strings.h:623
ast_sip_cli_context::recurse
unsigned recurse
Definition:
res_pjsip_cli.h:44
cli.h
Standard Command Line Interface.
ast_sip_cli_context::auth_direction
char * auth_direction
Definition:
res_pjsip_cli.h:38
ast_cli_args
Definition:
cli.h:158
ast_sip_cli_formatter_entry::print_header
ao2_callback_fn * print_header
Definition:
res_pjsip_cli.h:60
ao2_container
Generic container type.
Definition:
astobj2_container_private.h:270
ast_sip_cli_formatter_entry::print_body
ao2_callback_fn * print_body
Definition:
res_pjsip_cli.h:62
ast_sip_cli_formatter_entry::name
const char * name
Definition:
res_pjsip_cli.h:58
ast_sip_cli_context::show_details_only_level_0
unsigned show_details_only_level_0
Definition:
res_pjsip_cli.h:46
Generated on Tue Jul 15 2025 11:50:45 for Asterisk - The Open Source Telephony Project by
1.8.10