Newer
Older
variable->value = malloc(strlen(value)+1);
free(variable->name);
variable->name = NULL;
}
}
}
free(variable);
variable = NULL;
}
return variable;
}
int ast_cust_config_register(struct ast_config_reg *new)
{
ast_config_register(new);
read_ast_cust_config();
return 1;
}
int ast_cust_config_deregister(struct ast_config_reg *new)
{
ast_config_deregister(new);
read_ast_cust_config();
return 1;
}
static void clear_cust_keywords(void)
{
struct ast_config_reg *key;
int x;
ast_mutex_lock(&ast_cust_config_lock);
for (key=get_config_registrations();key;key=key->next) {
for (x=0;x<key->keycount;x++) {
key->keywords[x][0] = '\0';
}
key->keycount=0;
}
ast_mutex_unlock(&ast_cust_config_lock);
}
static int config_command(int fd, int argc, char **argv)
{
struct ast_config_reg *key;
int x;
ast_cli(fd,"\n\n");
ast_mutex_lock(&ast_cust_config_lock);
for (key=get_config_registrations();key;key=key->next) {
ast_cli(fd,"\nConfig Engine: %s\n",key->name);
ast_cli(fd,"===>%s\n",key->keywords[x]);
}
ast_mutex_unlock(&ast_cust_config_lock);
ast_cli(fd,"\n\n");
}
static struct ast_cli_entry config_command_struct = {
{ "show","config","handles", NULL }, config_command,
"Show Config Handles", NULL };
return ast_cli_register(&config_command_struct);
}
char *cfg = config_conf_file;
struct ast_config *config;
struct ast_variable *v;
struct ast_config_reg *ptr;
struct ast_config_reg *test = NULL;
clear_cust_keywords();
config = ast_load(cfg);
if (config) {
for (v = ast_variable_browse(config,"settings");v;v=v->next) {
if (ptr) {
if (ptr->keycount >= CONFIG_KEYWORD_ARRAYLEN) {
ast_log(LOG_WARNING,"Max Number of Bindings exceeded for %s->%s %d/%d\n",v->name,v->value,ptr->keycount,CONFIG_KEYWORD_ARRAYLEN);
} else {
if (strcmp(v->name,config_conf_file) && strcmp(v->name,"asterisk.conf")) {
if (!(test = get_ast_cust_config_keyword(v->name))) {
ast_log(LOG_NOTICE,"Binding: %s to %s\n",v->name,v->value);
strncpy(ptr->keywords[ptr->keycount],v->name,sizeof(ptr->keywords[ptr->keycount]) - 1);
ptr->keywords[ptr->keycount][sizeof(ptr->keywords[ptr->keycount])-1] = '\0';
ast_log(LOG_WARNING,"Cannot bind %s, Permission Denied\n",v->name);
}
}
}
}
ast_destroy(config);
}