Asterisk - The Open Source Telephony Project
18.5.0
|
IAX Provisioning Protocol. More...
#include "asterisk.h"
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <sys/socket.h>
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/lock.h"
#include "asterisk/frame.h"
#include "asterisk/md5.h"
#include "asterisk/astdb.h"
#include "asterisk/utils.h"
#include "asterisk/acl.h"
#include "asterisk/format_cache.h"
#include "asterisk/format_compatibility.h"
#include "include/iax2.h"
#include "include/provision.h"
#include "include/parser.h"
Go to the source code of this file.
Data Structures | |
struct | iax_flag |
struct | iax_template |
struct | templates |
Functions | |
static int | iax_process_template (struct ast_config *cfg, char *s, char *def) |
char * | iax_prov_complete_template (const char *line, const char *word, int pos, int state) |
char * | iax_provflags2str (char *buf, int buflen, unsigned int flags) |
int | iax_provision_build (struct iax_ie_data *provdata, unsigned int *signature, const char *template, int force) |
static void | iax_provision_free_templates (int dead) |
static int | iax_provision_init (void) |
int | iax_provision_reload (int reload) |
int | iax_provision_unload (void) |
int | iax_provision_version (unsigned int *version, const char *template, int force) |
static const char * | iax_server (unsigned int addr) |
static char * | iax_show_provisioning (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static unsigned int | iax_str2flags (const char *buf) |
static void | iax_template_copy (struct iax_template *dst, struct iax_template *src) |
static struct iax_template * | iax_template_find (const char *s, int allowdead) |
static int | iax_template_parse (struct iax_template *cur, struct ast_config *cfg, const char *s, const char *def) |
static const char * | ifthere (const char *s) |
static unsigned int | prov_ver_calc (struct iax_ie_data *provdata) |
Variables | |
static struct ast_cli_entry | cli_iax2_provision [] |
static struct iax_flag | iax_flags [] |
static int | provinit = 0 |
static ast_mutex_t | provlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static struct templates | templates = { .first = NULL, .last = NULL, } |
IAX Provisioning Protocol.
Definition in file provision.c.
|
static |
Definition at line 387 of file provision.c.
References ast_calloc, ast_copy_string(), AST_LIST_INSERT_HEAD, ast_log, ast_mutex_lock, ast_mutex_unlock, iax_template::dead, iax_template_find(), iax_template_parse(), iax_template::list, LOG_WARNING, iax_template::name, and provlock.
Referenced by iax_provision_reload().
char* iax_prov_complete_template | ( | const char * | line, |
const char * | word, | ||
int | pos, | ||
int | state | ||
) |
Definition at line 179 of file provision.c.
References AST_LIST_TRAVERSE, ast_mutex_lock, ast_mutex_unlock, ast_strdup, c, iax_template::list, iax_template::name, NULL, and provlock.
Referenced by handle_cli_iax2_provision(), and iax_show_provisioning().
char* iax_provflags2str | ( | char * | buf, |
int | buflen, | ||
unsigned int | flags | ||
) |
Definition at line 90 of file provision.c.
References ARRAY_LEN, ast_strlen_zero, buf, iax_flags, iax_template::name, NULL, and value.
Referenced by dump_prov_flags(), and iax_show_provisioning().
int iax_provision_build | ( | struct iax_ie_data * | provdata, |
unsigned int * | signature, | ||
const char * | template, | ||
int | force | ||
) |
Definition at line 209 of file provision.c.
References iax_template::altserver, ast_db_put(), ast_mutex_lock, ast_mutex_unlock, iax_template::flags, iax_template::format, iax_ie_append_byte(), iax_ie_append_int(), iax_ie_append_short(), iax_ie_append_str(), iax_template_find(), iax_template::lang, iax_template::pass, iax_template::port, PROV_IE_ALTSERVER, PROV_IE_FLAGS, PROV_IE_FORMAT, PROV_IE_LANG, PROV_IE_PASS, PROV_IE_PORTNO, PROV_IE_PROVVER, PROV_IE_SERVERIP, PROV_IE_SERVERPORT, PROV_IE_TOS, PROV_IE_USER, prov_ver_calc(), provlock, iax_template::server, iax_template::serverport, tmp(), iax_template::tos, and iax_template::user.
Referenced by iax2_provision(), and iax_provision_version().
|
static |
Definition at line 504 of file provision.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_mutex_lock, ast_mutex_unlock, iax_template::dead, iax_template::list, and provlock.
Referenced by iax_provision_reload(), and iax_provision_unload().
|
static |
Definition at line 497 of file provision.c.
References ast_cli_register_multiple, and provinit.
Referenced by iax_provision_reload().
int iax_provision_reload | ( | int | reload | ) |
Definition at line 529 of file provision.c.
References ast_category_browse(), ast_config_destroy(), ast_config_load2(), ast_db_deltree(), AST_LIST_TRAVERSE, ast_log, ast_verb, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, iax_template::dead, iax_process_template(), iax_provision_free_templates(), iax_provision_init(), iax_template::list, LOG_NOTICE, NULL, and provinit.
Referenced by load_module(), and reload_config().
int iax_provision_unload | ( | void | ) |
Definition at line 520 of file provision.c.
References ast_cli_unregister_multiple(), iax_provision_free_templates(), and provinit.
Referenced by __unload_module().
int iax_provision_version | ( | unsigned int * | version, |
const char * | template, | ||
int | force | ||
) |
Definition at line 258 of file provision.c.
References ast_db_get(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, iax_provision_build(), LOG_ERROR, provlock, and tmp().
Referenced by check_provisioning().
|
static |
Definition at line 425 of file provision.c.
References ast_inet_ntoa().
Referenced by iax_show_provisioning().
|
static |
Definition at line 438 of file provision.c.
References iax_template::altserver, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_copy_string(), AST_LIST_TRAVERSE, ast_mutex_lock, ast_mutex_unlock, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, iax_template::flags, iax_template::format, iax2_getformatname(), iax_prov_complete_template(), iax_provflags2str(), iax_server(), ifthere(), iax_template::lang, ast_cli_args::line, iax_template::list, ast_cli_args::n, iax_template::name, NULL, iax_template::pass, iax_template::port, ast_cli_args::pos, provlock, iax_template::server, iax_template::serverport, iax_template::src, iax_template::tos, ast_cli_entry::usage, iax_template::user, and ast_cli_args::word.
|
static |
Definition at line 114 of file provision.c.
References ARRAY_LEN, buf, iax_template::flags, iax_flags, len(), iax_template::name, and iax_flag::value.
Referenced by iax_template_parse().
|
static |
Definition at line 143 of file provision.c.
References iax_template::altserver, ast_copy_string(), iax_template::dead, iax_template::flags, iax_template::format, iax_template::lang, iax_template::name, iax_template::pass, iax_template::port, iax_template::server, iax_template::src, iax_template::tos, and iax_template::user.
Referenced by iax_template_parse().
|
static |
Definition at line 163 of file provision.c.
References AST_LIST_TRAVERSE, iax_template::dead, iax_template::list, iax_template::name, and NULL.
Referenced by iax_process_template(), iax_provision_build(), and iax_template_parse().
|
static |
Definition at line 282 of file provision.c.
References iax_template::altserver, ao2_ref, ast_copy_string(), ast_format_cache_get, ast_format_compatibility_format2bitfield(), ast_gethostbyname(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_str2tos(), ast_variable_browse(), ast_variable_retrieve(), iax_template::dead, iax_template::flags, iax_template::format, hp, IAX_DEFAULT_PORTNO, iax_str2flags(), iax_template_copy(), iax_template_find(), iax_template::lang, ast_variable::lineno, LOG_WARNING, iax_template::name, ast_variable::name, ast_variable::next, NULL, iax_template::pass, iax_template::port, provlock, iax_template::server, iax_template::serverport, iax_template::src, tmp(), iax_template::tos, iax_template::user, and ast_variable::value.
Referenced by iax_process_template().
|
static |
Definition at line 417 of file provision.c.
Referenced by iax_show_provisioning().
|
static |
Definition at line 199 of file provision.c.
References iax_ie_data::buf, MD5Final(), MD5Init(), MD5Update(), iax_ie_data::pos, and tmp().
Referenced by iax_provision_build().
|
static |
Definition at line 493 of file provision.c.
|
static |
Referenced by iax_provflags2str(), and iax_str2flags().
|
static |
Definition at line 53 of file provision.c.
Referenced by iax_provision_init(), iax_provision_reload(), and iax_provision_unload().
|
static |
Definition at line 74 of file provision.c.
Referenced by iax_process_template(), iax_prov_complete_template(), iax_provision_build(), iax_provision_free_templates(), iax_provision_version(), iax_show_provisioning(), and iax_template_parse().
Referenced by action_getconfig(), and action_getconfigjson().