Asterisk - The Open Source Telephony Project  18.5.0
Functions
cli_functions.h File Reference

PJSIP CLI functions header file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int pjsip_channel_cli_register (void)
 Registers the channel cli commands. More...
 
void pjsip_channel_cli_unregister (void)
 Unregisters the channel cli commands. More...
 

Detailed Description

PJSIP CLI functions header file.

Author
George Joseph <[email protected]> 

Definition in file cli_functions.h.

Function Documentation

◆ pjsip_channel_cli_register()

int pjsip_channel_cli_register ( void  )

Registers the channel cli commands.

Since
13.9.0
Return values
0on success
-1on failure

Definition at line 448 of file cli_commands.c.

References ao2_alloc, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sip_register_cli_formatter(), cli_channel_get_container(), cli_channel_get_id(), cli_channel_iterate(), cli_channel_print_body(), cli_channel_print_header(), cli_channel_retrieve_by_id(), cli_channelstats_get_container(), cli_channelstats_iterate(), cli_channelstats_print_body(), cli_channelstats_print_header(), ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, ast_sip_cli_formatter_entry::name, NULL, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, and ast_sip_cli_formatter_entry::retrieve_by_id.

Referenced by load_module().

449 {
451  if (!channel_formatter) {
452  ast_log(LOG_ERROR, "Unable to allocate memory for channel_formatter\n");
453  return -1;
454  }
455  channel_formatter->name = "channel";
462 
464  if (!channelstats_formatter) {
466  ast_log(LOG_ERROR, "Unable to allocate memory for channelstats_formatter\n");
467  return -1;
468  }
469  channelstats_formatter->name = "channelstat";
476 
480 
481  return 0;
482 }
struct ao2_container *(* get_container)(const char *regex)
Definition: res_pjsip_cli.h:64
static struct ao2_container * cli_channelstats_get_container(const char *regex)
Definition: cli_commands.c:230
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
Definition: res_pjsip_cli.h:52
static int cli_channel_iterate(void *endpoint, ao2_callback_fn callback, void *arg)
Definition: cli_commands.c:45
static int cli_channelstats_print_body(void *obj, void *arg, int flags)
Definition: cli_commands.c:337
static int cli_channel_print_header(void *obj, void *arg, int flags)
Definition: cli_commands.c:247
static void * cli_channel_retrieve_by_id(const char *id)
Definition: cli_commands.c:242
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
Definition: res_pjsip_cli.h:66
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
#define NULL
Definition: resample.c:96
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
Definition: pjsip_cli.c:310
struct ast_sip_cli_formatter_entry * channel_formatter
Definition: cli_commands.c:446
#define ast_log
Definition: astobj2.c:42
static struct ao2_container * cli_channel_get_container(const char *regex)
Definition: cli_commands.c:225
#define ao2_ref(o, delta)
Definition: astobj2.h:464
void *(* retrieve_by_id)(const char *id)
Definition: res_pjsip_cli.h:68
static struct ast_cli_entry cli_commands[]
Definition: cli_commands.c:422
#define LOG_ERROR
Definition: logger.h:285
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
static int cli_channelstats_iterate(void *endpoint, ao2_callback_fn callback, void *arg)
Definition: cli_commands.c:50
const char *(* get_id)(const void *obj)
Definition: res_pjsip_cli.h:70
struct ast_sip_cli_formatter_entry * channelstats_formatter
Definition: cli_commands.c:445
ao2_callback_fn * print_header
Definition: res_pjsip_cli.h:60
static int cli_channel_print_body(void *obj, void *arg, int flags)
Definition: cli_commands.c:271
ao2_callback_fn * print_body
Definition: res_pjsip_cli.h:62
static const char * cli_channel_get_id(const void *obj)
Definition: cli_commands.c:235
const char * name
Definition: res_pjsip_cli.h:58
static int cli_channelstats_print_header(void *obj, void *arg, int flags)
Definition: cli_commands.c:323

◆ pjsip_channel_cli_unregister()

void pjsip_channel_cli_unregister ( void  )

Unregisters the channel cli commands.

Since
13.9.0

Definition at line 484 of file cli_commands.c.

References ARRAY_LEN, ast_cli_unregister_multiple(), and ast_sip_unregister_cli_formatter().

Referenced by unload_module().

485 {
489 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
struct ast_sip_cli_formatter_entry * channel_formatter
Definition: cli_commands.c:446
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
Definition: pjsip_cli.c:326
static struct ast_cli_entry cli_commands[]
Definition: cli_commands.c:422
struct ast_sip_cli_formatter_entry * channelstats_formatter
Definition: cli_commands.c:445