RTS API Documentation
1.10.11
|
#include <switch.h>
Go to the source code of this file.
Data Structures | |
struct | switch_xml_config_enum_item_t |
struct | switch_xml_config_string_options_t |
struct | switch_xml_config_int_options_t |
struct | switch_xml_config_atomic_options_t |
struct | switch_xml_config_item |
A configuration instruction read by switch_xml_config_parse. More... | |
Macros | |
#define | SWITCH_CONFIG_ITEM(_key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext) { _key, _type, _flags, _ptr, (void*)_defaultvalue, (void*)_data, NULL, _syntax, _helptext } |
#define | SWITCH_CONFIG_ITEM_STRING_STRDUP(_key, _flags, _ptr, _defaultvalue, _syntax, _helptext) { (_key), SWITCH_CONFIG_STRING, (_flags), (_ptr), ((void*)_defaultvalue), (NULL), (NULL), (_syntax), (_helptext) } |
#define | SWITCH_CONFIG_ITEM_CALLBACK(_key, _type, _flags, _ptr, _defaultvalue, _function, _functiondata, _syntax, _helptext) { _key, _type, _flags, _ptr, (void*)_defaultvalue, _functiondata, _function, _syntax, _helptext } |
#define | SWITCH_CONFIG_ITEM_END() { NULL, SWITCH_CONFIG_LAST, 0, NULL, NULL, NULL, NULL, NULL, NULL } |
#define | SWITCH_CONFIG_SET_ITEM(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext) switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, NULL, _syntax, _helptext) |
#define | SWITCH_CONFIG_SET_ITEM_CALLBACK(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _function, _syntax, _helptext) switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, _function, _syntax, _helptext) |
Typedefs | |
typedef struct switch_xml_config_item | switch_xml_config_item_t |
typedef switch_status_t(* | switch_xml_config_callback_t) (switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed) |
Enumerations | |
enum | switch_xml_config_type_t { SWITCH_CONFIG_INT, SWITCH_CONFIG_ATOMIC, SWITCH_CONFIG_STRING, SWITCH_CONFIG_BOOL, SWITCH_CONFIG_CUSTOM, SWITCH_CONFIG_ENUM, SWITCH_CONFIG_FLAG, SWITCH_CONFIG_FLAGARRAY, SWITCH_CONFIG_LAST } |
Type of value to parse. More... | |
enum | switch_config_callback_type_t { CONFIG_LOAD, CONFIG_RELOAD, CONFIG_SHUTDOWN } |
enum | switch_config_flags_t { CONFIG_RELOADABLE = (1 << 0), CONFIG_REQUIRED = (1 << 1) } |
Functions | |
void | switch_config_perform_set_item (switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr, const void *defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext) |
switch_status_t | switch_xml_config_enum_str2int (switch_xml_config_enum_item_t *enum_options, const char *value, int *out) |
Gets the int representation of an enum. More... | |
const char * | switch_xml_config_enum_int2str (switch_xml_config_enum_item_t *enum_options, int value) |
Gets the string representation of an enum. More... | |
void | switch_xml_config_item_print_doc (int level, switch_xml_config_item_t *item) |
Prints out an item's documentation on the console. More... | |
switch_status_t | switch_xml_config_parse (switch_xml_t xml, switch_bool_t reload, switch_xml_config_item_t *instructions) |
Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t. More... | |
switch_status_t | switch_xml_config_parse_module_settings (const char *file, switch_bool_t reload, switch_xml_config_item_t *instructions) |
Parses a module's settings. More... | |
switch_status_t | switch_xml_config_parse_event (switch_event_t *event, int count, switch_bool_t reload, switch_xml_config_item_t *instructions) |
Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t. More... | |
switch_size_t | switch_event_import_xml (switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event) |
Parses a list of xml elements into an event. More... | |
void | switch_xml_config_cleanup (switch_xml_config_item_t *instructions) |
Free any memory allocated by the configuration. More... | |
Variables | |
switch_xml_config_string_options_t | switch_config_string_strdup |
#define SWITCH_CONFIG_ITEM | ( | _key, | |
_type, | |||
_flags, | |||
_ptr, | |||
_defaultvalue, | |||
_data, | |||
_syntax, | |||
_helptext | |||
) | { _key, _type, _flags, _ptr, (void*)_defaultvalue, (void*)_data, NULL, _syntax, _helptext } |
Definition at line 113 of file switch_xml_config.h.
#define SWITCH_CONFIG_ITEM_CALLBACK | ( | _key, | |
_type, | |||
_flags, | |||
_ptr, | |||
_defaultvalue, | |||
_function, | |||
_functiondata, | |||
_syntax, | |||
_helptext | |||
) | { _key, _type, _flags, _ptr, (void*)_defaultvalue, _functiondata, _function, _syntax, _helptext } |
Definition at line 115 of file switch_xml_config.h.
#define SWITCH_CONFIG_ITEM_END | ( | ) | { NULL, SWITCH_CONFIG_LAST, 0, NULL, NULL, NULL, NULL, NULL, NULL } |
Definition at line 116 of file switch_xml_config.h.
#define SWITCH_CONFIG_ITEM_STRING_STRDUP | ( | _key, | |
_flags, | |||
_ptr, | |||
_defaultvalue, | |||
_syntax, | |||
_helptext | |||
) | { (_key), SWITCH_CONFIG_STRING, (_flags), (_ptr), ((void*)_defaultvalue), (NULL), (NULL), (_syntax), (_helptext) } |
Definition at line 114 of file switch_xml_config.h.
#define SWITCH_CONFIG_SET_ITEM | ( | _item, | |
_key, | |||
_type, | |||
_flags, | |||
_ptr, | |||
_defaultvalue, | |||
_data, | |||
_syntax, | |||
_helptext | |||
) | switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, NULL, _syntax, _helptext) |
Definition at line 118 of file switch_xml_config.h.
#define SWITCH_CONFIG_SET_ITEM_CALLBACK | ( | _item, | |
_key, | |||
_type, | |||
_flags, | |||
_ptr, | |||
_defaultvalue, | |||
_data, | |||
_function, | |||
_syntax, | |||
_helptext | |||
) | switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, _function, _syntax, _helptext) |
Definition at line 119 of file switch_xml_config.h.
typedef switch_status_t(* switch_xml_config_callback_t) (switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed) |
Definition at line 95 of file switch_xml_config.h.
typedef struct switch_xml_config_item switch_xml_config_item_t |
Definition at line 82 of file switch_xml_config.h.
Enumerator | |
---|---|
CONFIG_LOAD | |
CONFIG_RELOAD | |
CONFIG_SHUTDOWN |
Definition at line 84 of file switch_xml_config.h.
Enumerator | |
---|---|
CONFIG_RELOADABLE | |
CONFIG_REQUIRED |
Definition at line 90 of file switch_xml_config.h.
Type of value to parse.
Enumerator | |
---|---|
SWITCH_CONFIG_INT | |
SWITCH_CONFIG_ATOMIC | |
SWITCH_CONFIG_STRING | |
SWITCH_CONFIG_BOOL | |
SWITCH_CONFIG_CUSTOM | |
SWITCH_CONFIG_ENUM | |
SWITCH_CONFIG_FLAG | |
SWITCH_CONFIG_FLAGARRAY | |
SWITCH_CONFIG_LAST |
Definition at line 40 of file switch_xml_config.h.
void switch_config_perform_set_item | ( | switch_xml_config_item_t * | item, |
const char * | key, | ||
switch_xml_config_type_t | type, | ||
int | flags, | ||
void * | ptr, | ||
const void * | defaultvalue, | ||
void * | data, | ||
switch_xml_config_callback_t | function, | ||
const char * | syntax, | ||
const char * | helptext | ||
) |
Definition at line 477 of file switch_xml_config.c.
References switch_xml_config_item::data, switch_xml_config_item::defaultvalue, switch_xml_config_item::flags, switch_xml_config_item::function, switch_xml_config_item::helptext, key, switch_xml_config_item::key, switch_xml_config_item::ptr, switch_xml_config_item::syntax, and switch_xml_config_item::type.
switch_size_t switch_event_import_xml | ( | switch_xml_t | xml, |
const char * | keyname, | ||
const char * | valuename, | ||
switch_event_t ** | event | ||
) |
Parses a list of xml elements into an event.
xml | First element of the xml list to parse |
keyname | Name of the key attribute |
keyvalue | Name of the value attribute |
event | [out] event (if *event is NOT NULL, the headers will be appended to the existing event) |
Definition at line 49 of file switch_xml_config.c.
References count, key, switch_xml::next, switch_assert, switch_event_add_header_string(), SWITCH_EVENT_CLONE, switch_event_create, SWITCH_STACK_BOTTOM, switch_xml_attr_soft(), and value.
Referenced by switch_xml_config_parse().
void switch_xml_config_cleanup | ( | switch_xml_config_item_t * | instructions | ) |
Free any memory allocated by the configuration.
instructions | instrutions on how to parse the elements |
Definition at line 447 of file switch_xml_config.c.
References CONFIG_SHUTDOWN, switch_xml_config_item::data, switch_xml_config_item::function, item, switch_xml_config_item::key, switch_xml_config_item::ptr, SWITCH_CONFIG_STRING, SWITCH_FALSE, switch_safe_free, and switch_xml_config_item::type.
const char* switch_xml_config_enum_int2str | ( | switch_xml_config_enum_item_t * | enum_options, |
int | value | ||
) |
Gets the string representation of an enum.
enum_options | the switch_xml_config_enum_item_t array for this enum |
value | int value to search |
Definition at line 127 of file switch_xml_config.c.
References switch_xml_config_enum_item_t::key, and switch_xml_config_enum_item_t::value.
Referenced by switch_xml_config_item_print_doc().
switch_status_t switch_xml_config_enum_str2int | ( | switch_xml_config_enum_item_t * | enum_options, |
const char * | value, | ||
int * | out | ||
) |
Gets the int representation of an enum.
enum_options | the switch_xml_config_enum_item_t array for this enum |
value | string value to search |
Definition at line 115 of file switch_xml_config.c.
References switch_xml_config_enum_item_t::key, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_xml_config_enum_item_t::value.
Referenced by switch_xml_config_parse_event().
void switch_xml_config_item_print_doc | ( | int | level, |
switch_xml_config_item_t * | item | ||
) |
Prints out an item's documentation on the console.
level | loglevel to use |
item | item which the doc should be printed |
Definition at line 91 of file switch_xml_config.c.
References CONFIG_REQUIRED, switch_xml_config_item::helptext, switch_xml_config_item::key, SWITCH_CHANNEL_LOG_CLEAN, switch_log_printf(), switch_test_flag, switch_xml_config_enum_int2str(), switch_xml_config_item::syntax, and switch_xml_config_item::type.
Referenced by switch_xml_config_parse_event().
switch_status_t switch_xml_config_parse | ( | switch_xml_t | xml, |
switch_bool_t | reload, | ||
switch_xml_config_item_t * | instructions | ||
) |
Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t.
xml | The first element of the list to parse |
reload | true to skip all non-reloadable options |
instructions | instrutions on how to parse the elements |
Definition at line 100 of file switch_xml_config.c.
References count, switch_event_destroy(), switch_event_import_xml(), and switch_xml_config_parse_event().
Referenced by switch_xml_config_parse_module_settings().
switch_status_t switch_xml_config_parse_event | ( | switch_event_t * | event, |
int | count, | ||
switch_bool_t | reload, | ||
switch_xml_config_item_t * | instructions | ||
) |
Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t.
event | The event structure containing the key and values to parse |
reload | true to skip all non-reloadable options |
instructions | instrutions on how to parse the elements |
Definition at line 137 of file switch_xml_config.c.
References CONFIG_LOAD, CONFIG_RELOAD, CONFIG_RELOADABLE, CONFIG_REQUIRED, switch_xml_config_item::data, switch_xml_config_item::defaultvalue, switch_xml_config_int_options_t::enforce_max, switch_xml_config_atomic_options_t::enforce_max, switch_xml_config_int_options_t::enforce_min, switch_xml_config_atomic_options_t::enforce_min, switch_xml_config_item::function, switch_event::headers, if(), index, item, switch_xml_config_item::key, switch_xml_config_string_options_t::length, switch_xml_config_int_options_t::max, switch_xml_config_atomic_options_t::max, switch_xml_config_int_options_t::min, switch_xml_config_atomic_options_t::min, switch_event_header::name, switch_event_header::next, switch_xml_config_string_options_t::pool, switch_xml_config_item::ptr, switch_atomic_read(), switch_atomic_set(), SWITCH_CHANNEL_LOG, SWITCH_CONFIG_ATOMIC, SWITCH_CONFIG_BOOL, SWITCH_CONFIG_CUSTOM, SWITCH_CONFIG_ENUM, SWITCH_CONFIG_FLAG, SWITCH_CONFIG_FLAGARRAY, SWITCH_CONFIG_INT, SWITCH_CONFIG_LAST, SWITCH_CONFIG_STRING, switch_copy_string(), switch_core_strdup, switch_event_get_header, SWITCH_FALSE, switch_false(), switch_is_number(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_LOG_WARNING, switch_regex_match(), switch_safe_free, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, switch_test_flag, SWITCH_TRUE, switch_true(), switch_xml_config_enum_str2int(), switch_xml_config_item_print_doc(), switch_xml_config_item::type, switch_xml_config_string_options_t::validation_regex, value, and zstr.
Referenced by switch_xml_config_parse().
switch_status_t switch_xml_config_parse_module_settings | ( | const char * | file, |
switch_bool_t | reload, | ||
switch_xml_config_item_t * | instructions | ||
) |
Parses a module's settings.
reload | true to skip all non-reloadable options |
file | the configuration file to look for |
instructions | the instructions |
Definition at line 72 of file switch_xml_config.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, switch_xml_child(), switch_xml_config_parse(), switch_xml_free(), and switch_xml_open_cfg().
switch_xml_config_string_options_t switch_config_string_strdup |
Definition at line 35 of file switch_xml_config.c.