clicompat.c File Reference

Go to the source code of this file.

Functions

void ast_cli (int fd, const char *fmt,...)
int ast_cli_register_multiple (struct ast_cli_entry *e, int len)
 Register multiple commands.
int ast_cli_unregister_multiple (struct ast_cli_entry *e, int len)
 Unregister multiple commands.
int ast_register_atexit (void(*func)(void))
 Register a function to be executed before Asterisk exits.
int ast_register_cleanup (void(*func)(void))
 Register a function to be executed before Asterisk gracefully exits.


Function Documentation

void ast_cli ( int  fd,
const char *  fmt,
  ... 
)

Definition at line 115 of file main/cli.c.

References ast_carefulwrite(), AST_CLI_INITLEN, AST_DYNSTR_BUILD_FAILED, ast_str_buffer(), ast_str_set_va(), ast_str_strlen(), ast_str_thread_get(), and buf.

00116 {
00117    int res;
00118    struct ast_str *buf;
00119    va_list ap;
00120 
00121    if (!(buf = ast_str_thread_get(&ast_cli_buf, AST_CLI_INITLEN)))
00122       return;
00123 
00124    va_start(ap, fmt);
00125    res = ast_str_set_va(&buf, 0, fmt, ap);
00126    va_end(ap);
00127 
00128    if (res != AST_DYNSTR_BUILD_FAILED) {
00129       ast_carefulwrite(fd, ast_str_buffer(buf), ast_str_strlen(buf), 100);
00130    }
00131 }

int ast_cli_register_multiple ( struct ast_cli_entry e,
int  len 
)

Register multiple commands.

Parameters:
e pointer to first cli entry to register
len number of entries to register

Definition at line 2313 of file main/cli.c.

References ast_cli_register().

02314 {
02315    int i, res = 0;
02316 
02317    for (i = 0; i < len; i++)
02318       res |= ast_cli_register(e + i);
02319 
02320    return res;
02321 }

int ast_cli_unregister_multiple ( struct ast_cli_entry e,
int  len 
)

Unregister multiple commands.

Parameters:
e pointer to first cli entry to unregister
len number of entries to unregister

Definition at line 2323 of file main/cli.c.

References ast_cli_unregister().

02324 {
02325    int i, res = 0;
02326 
02327    for (i = 0; i < len; i++)
02328       res |= ast_cli_unregister(e + i);
02329 
02330    return res;
02331 }

int ast_register_atexit ( void(*)(void)  func  ) 

Register a function to be executed before Asterisk exits.

Parameters:
func The callback function to use.
Return values:
0 on success.
-1 on error.
Note:
This function should be rarely used in situations where something must be shutdown to avoid corruption, excessive data loss, or when external programs must be stopped. All other cleanup in the core should use ast_register_cleanup.

Definition at line 1174 of file asterisk.c.

References ast_atexit::func, and register_atexit().

01175 {
01176    return register_atexit(func, 0);
01177 }

int ast_register_cleanup ( void(*)(void)  func  ) 

Register a function to be executed before Asterisk gracefully exits.

Since:
11.9 If Asterisk is immediately shutdown (core stop now, or sending the TERM signal), the callback is not run. When the callbacks are run, they are run in sequence with ast_register_atexit() callbacks, in the reverse order of registration.
Parameters:
func The callback function to use.
Return values:
0 on success.
-1 on error.

Definition at line 1179 of file asterisk.c.

References ast_atexit::func, and register_atexit().

01180 {
01181    return register_atexit(func, 1);
01182 }


Generated on Thu Apr 16 06:30:13 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6