RealTime CLI.
More...
Go to the source code of this file.
|
static void | __reg_module (void) |
|
static void | __unreg_module (void) |
|
struct ast_module * | AST_MODULE_SELF_SYM (void) |
|
static char * | cli_realtime_destroy (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
|
static char * | cli_realtime_load (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
|
static char * | cli_realtime_store (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
|
static char * | cli_realtime_update (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
|
static char * | cli_realtime_update2 (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
|
static int | load_module (void) |
|
static int | unload_module (void) |
|
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Realtime Data Lookup/Rewrite" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_cli_entry | cli_realtime [] |
|
◆ CRL_HEADER_FORMAT
#define CRL_HEADER_FORMAT "%30s %-30s\n" |
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ cli_realtime_destroy()
Definition at line 226 of file res_realtime.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_destroy_realtime(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ESS, ast_cli_args::fd, NULL, SENTINEL, and ast_cli_entry::usage.
232 e->
command =
"realtime destroy";
234 "Usage: realtime destroy <family> <colmatch1> <valuematch1> [<colmatch2> <valuematch2> [... <colmatch5> <valuematch5>]]\n" 235 " Remove a stored row using the RealTime driver.\n" 236 " You must supply a family name and name/value pairs (up to 5).\n";
244 }
else if (a->
argc == 5) {
246 }
else if (a->
argc == 7) {
248 }
else if (a->
argc == 9) {
250 }
else if (a->
argc == 11) {
252 }
else if (a->
argc == 13) {
253 res =
ast_destroy_realtime(a->
argv[2], a->
argv[3], a->
argv[4], a->
argv[5], a->
argv[6], a->
argv[7], a->
argv[8], a->
argv[9], a->
argv[10], a->
argv[11], a->
argv[12],
SENTINEL);
259 ast_cli(a->
fd,
"Failed to remove record. Check the debug log for possible SQL related entries.\n");
263 ast_cli(a->
fd,
"Removed %d RealTime record%s.\n", res,
ESS(res));
void ast_cli(int fd, const char *fmt,...)
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
◆ cli_realtime_load()
Definition at line 45 of file res_realtime.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_load_realtime_all(), ast_variables_destroy(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, CRL_HEADER_FORMAT, ast_cli_args::fd, ast_variable::name, ast_variable::next, NULL, SENTINEL, ast_cli_entry::usage, ast_variable::value, and var.
47 #define CRL_HEADER_FORMAT "%30s %-30s\n" 54 "Usage: realtime load <family> <colmatch> <value>\n" 55 " Prints out a list of variables using the RealTime driver.\n" 56 " You must supply a family name, a column to match on, and a value to match to.\n";
77 ast_cli(a->
fd,
"No rows found matching search criteria.\n");
struct ast_variable * next
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Structure for variables, used for configurations and for channel variables.
void ast_cli(int fd, const char *fmt,...)
#define CRL_HEADER_FORMAT
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
◆ cli_realtime_store()
Definition at line 181 of file res_realtime.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_store_realtime(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, SENTINEL, and ast_cli_entry::usage.
189 "Usage: realtime store <family> <colname1> <value1> [<colname2> <value2> [... <colname5> <value5>]]\n" 190 " Create a stored row using the RealTime driver.\n" 191 " You must supply a family name and name/value pairs (up to 5). If\n" 192 " you need to store more than 5 key/value pairs, start with the first\n" 193 " five, then use 'realtime update' or 'realtime update2' to add\n" 194 " additional columns.\n";
202 }
else if (a->
argc == 5) {
204 }
else if (a->
argc == 7) {
206 }
else if (a->
argc == 9) {
208 }
else if (a->
argc == 11) {
210 }
else if (a->
argc == 13) {
211 res =
ast_store_realtime(a->
argv[2], a->
argv[3], a->
argv[4], a->
argv[5], a->
argv[6], a->
argv[7], a->
argv[8], a->
argv[9], a->
argv[10], a->
argv[11], a->
argv[12],
SENTINEL);
217 ast_cli(a->
fd,
"Failed to store record. Check the debug log for possible SQL related entries.\n");
221 ast_cli(a->
fd,
"Stored RealTime record.\n");
void ast_cli(int fd, const char *fmt,...)
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
◆ cli_realtime_update()
Definition at line 83 of file res_realtime.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_update_realtime(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ESS, ast_cli_args::fd, NULL, SENTINEL, and ast_cli_entry::usage.
91 "Usage: realtime update <family> <colmatch> <valuematch> <colupdate> <newvalue>\n" 92 " Update a single variable using the RealTime driver.\n" 93 " You must supply a family name, a column to update on, a new value, column to match, and value to match.\n" 94 " Ex: realtime update sippeers name bobsphone port 4343\n" 95 " will execute SQL as UPDATE sippeers SET port = 4343 WHERE name = bobsphone\n";
107 ast_cli(a->
fd,
"Failed to update. Check the debug log for possible SQL related entries.\n");
111 ast_cli(a->
fd,
"Updated %d RealTime record%s.\n", res,
ESS(res));
void ast_cli(int fd, const char *fmt,...)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
◆ cli_realtime_update2()
Definition at line 116 of file res_realtime.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_update2_realtime(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ESS, ast_cli_args::fd, NULL, SENTINEL, and ast_cli_entry::usage.
122 e->
command =
"realtime update2";
124 "Usage: realtime update2 <family> <colmatch> <valuematch> [... <colmatch5> <valuematch5>] NULL <colupdate> <newvalue>\n" 125 " Update a single variable, requiring one or more fields to match using the\n" 126 " RealTime driver. You must supply a family name, a column to update, a new\n" 127 " value, and at least one column and value to match.\n" 128 " Ex: realtime update2 sippeers name bobsphone ipaddr 127.0.0.1 NULL port 4343\n" 129 " will execute SQL as\n" 130 " UPDATE sippeers SET port='4343' WHERE name='bobsphone' and ipaddr='127.0.0.1'\n";
139 || strcmp(a->
argv[a->
argc - 3],
"NULL")) {
147 }
else if (a->
argc == 10) {
152 }
else if (a->
argc == 12) {
157 }
else if (a->
argc == 14) {
163 }
else if (a->
argc == 16) {
172 ast_cli(a->
fd,
"Failed to update. Check the debug log for possible SQL related entries.\n");
176 ast_cli(a->
fd,
"Updated %d RealTime record%s.\n", res,
ESS(res));
void ast_cli(int fd, const char *fmt,...)
int ast_update2_realtime(const char *family,...) attribute_sentinel
Update realtime configuration.
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Realtime Data Lookup/Rewrite" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static |
◆ ast_module_info
◆ cli_realtime