|
static void | __init_result_buf (void) |
|
static void | __init_tmp_buf (void) |
|
static void | __reg_module (void) |
|
static void | __unreg_module (void) |
|
static int | acf_strftime (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t buflen) |
|
static int | acf_strptime (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | array (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
|
struct ast_module * | AST_MODULE_SELF_SYM (void) |
|
static void | clearvar_prefix (struct ast_channel *chan, const char *prefix) |
|
static int | csv_quote (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | exec_clearhash (struct ast_channel *chan, const char *data) |
|
static int | filter (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_eval (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | function_eval2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | function_fieldnum (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_fieldnum_helper (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **sbuf, ssize_t len) |
|
static int | function_fieldnum_str (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static int | function_fieldqty (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_fieldqty_helper (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **sbuf, ssize_t len) |
|
static int | function_fieldqty_str (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static const char * | get_key (const struct ast_str *prefix, const struct ast_var_t *var) |
|
static int | hash_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | hash_write (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
|
static int | hashkeys_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | hashkeys_read2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | keypadhash (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | len (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | listfilter (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **bufstr, ssize_t len) |
|
static int | listfilter_read (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | listfilter_read2 (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static int | load_module (void) |
|
static int | passthru (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | quote (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | regex (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | replace (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | shift_pop (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | strbetween (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | string_tolower (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | string_tolower2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | string_toupper (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | string_toupper2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | strreplace (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | unload_module (void) |
|
static int | unshift_push (struct ast_channel *chan, const char *cmd, char *data, const char *new_value) |
|
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "String handling dialplan functions" , .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 char * | app_clearhash = "ClearHash" |
|
static struct ast_custom_function | array_function |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_custom_function | csv_quote_function |
|
static struct ast_custom_function | eval_function |
|
static struct ast_custom_function | fieldnum_function |
|
static struct ast_custom_function | fieldqty_function |
|
static struct ast_custom_function | filter_function |
|
static struct ast_custom_function | hash_function |
|
static struct ast_custom_function | hashkeys_function |
|
static struct ast_custom_function | keypadhash_function |
|
static struct ast_custom_function | len_function |
|
static struct ast_custom_function | listfilter_function |
|
static struct ast_custom_function | passthru_function |
|
static struct ast_custom_function | pop_function |
|
static struct ast_custom_function | push_function |
|
static struct ast_custom_function | quote_function |
|
static struct ast_custom_function | regex_function |
|
static struct ast_custom_function | replace_function |
|
static struct ast_threadstorage | result_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_result_buf , .custom_init = NULL , } |
|
static struct ast_custom_function | shift_function |
|
static struct ast_custom_function | strbetween_function |
|
static struct ast_custom_function | strftime_function |
|
static struct ast_custom_function | strptime_function |
|
static struct ast_custom_function | strreplace_function |
|
static struct ast_threadstorage | tmp_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_tmp_buf , .custom_init = NULL , } |
|
static struct ast_custom_function | tolower_function |
|
static struct ast_custom_function | toupper_function |
|
static struct ast_custom_function | unshift_function |
|
String manipulation dialplan functions.
- Author
- Tilghman Lesher
-
Anthony Minessale II
-
Naveen Albert
Definition in file func_strings.c.
static int filter |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
parse, |
|
|
char * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
static |
- Note
- Looks a little strange, until you realize that we can overflow the size of a char.
Definition at line 734 of file func_strings.c.
743 char allowed[256] =
"";
744 size_t allowedlen = 0;
755 ast_log(
LOG_WARNING,
"FILTER allowed characters includes the quote (\") character. This may not be what you want.\n");
759 for (; *(
args.allowed);) {
765 args.allowed += consumed;
767 if (*(
args.allowed) ==
'-') {
770 args.allowed += consumed + 1;
780 for (ac = (
unsigned char) c1; ac != (
unsigned char) c2; ac++) {
781 bitfield[ac / 32] |= 1 << (ac % 32);
783 bitfield[ac / 32] |= 1 << (ac % 32);
787 ac = (
unsigned char) c1;
788 ast_debug(4,
"c1=%d, consumed=%d, args.allowed=%s\n", c1, (
int) consumed,
args.allowed - consumed);
789 bitfield[ac / 32] |= 1 << (ac % 32);
793 for (ac = 1; ac != 0; ac++) {
794 if (bitfield[ac / 32] & (1 << (ac % 32))) {
795 allowed[allowedlen++] = ac;
801 for (; *(
args.string) && (
buf +
len - 1 > outbuf); (
args.string)++) {
802 if (strchr(allowed, *(
args.string)))
803 *outbuf++ = *(
args.string);
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed)
Decode an encoded control or extended ASCII character.
#define AST_STANDARD_RAW_ARGS(args, parse)
#define ast_opt_dont_warn
References args, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_get_encoded_char(), ast_log, ast_opt_dont_warn, AST_STANDARD_RAW_ARGS, buf, len(), LOG_ERROR, LOG_WARNING, and parse().
Referenced by action_filter(), action_getconfig(), action_getconfigjson(), app_event_filter_set(), app_events_allowed_set(), app_events_disallowed_set(), append_var_and_value_to_filter(), ast_category_browse_filtered(), ast_category_exist(), ast_category_get(), ast_variable_retrieve_filtered(), category_get_sep(), create_lookup_filter(), iax_firmware_traverse(), kqueue_timer_ack(), next_available_category(), process_text_line(), realtime_ldap_base_ap(), stasis_app_event_filter_set(), stasis_caching_set_filter(), stasis_cp_single_set_filter(), stasis_subscription_set_filter(), and update2_ldap().
static int len |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
data, |
|
|
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
|
static |
Definition at line 1416 of file func_strings.c.
1421 length = strlen(data);
1423 snprintf(
buf, buflen,
"%d", length);
References buf.
Referenced by __analog_ss_thread(), __ast_cli_register(), __ast_cli_register_multiple(), __ast_dsp_call_progress(), __ast_dsp_silence_noise(), __ast_frdup(), __big_return(), __bt_defcmp(), __bt_defpfx(), __call_hash(), OrderedDict::__eq__(), __get_header(), OrderedDict::__init__(), __mgcp_xmit(), __rec_fmap(), __rec_fpipe(), __rec_vpipe(), __rtp_recvfrom(), __rtp_sendto(), MultiOrderedDict::__setitem__(), AbsQuantW(), acf_curl_exec(), acf_curlopt_helper(), acf_curlopt_read(), acf_curlopt_read2(), acf_cut_exec(), acf_escape(), acf_escape_backslashes(), acf_escape_ticks(), acf_faxopt_read(), acf_fetch(), acf_iaxvar_read(), acf_if(), acf_meetme_info(), acf_odbc_read(), acf_sort_exec(), acf_sprintf(), acf_transaction_read(), acf_vm_info(), action_command(), FaxPcap::add(), add_sdp(), adsi_careful_send(), ael_token_subst(), alsa_write(), amdf_pitch(), anaFilter(), analog_ss_thread(), anti_injection(), aoc_parse_ie(), append_attr_address(), append_attr_string(), append_interface(), append_var_and_value_to_filter(), apply_outgoing(), ast_agi_register_multiple(), ast_agi_unregister_multiple(), ast_app_group_set_channel(), ast_app_options2str64(), ast_audiosocket_receive_frame(), ast_beep_start(), ast_bucket_alloc(), ast_bucket_file_alloc(), ast_callerid_vmwi_generate(), ast_carefulwrite(), ast_channel_get_cc_agent_type(), ast_channel_get_device_name(), ast_cli_complete(), ast_cli_unregister_multiple(), ast_dsp_process(), ast_dsp_silence_noise_with_energy(), ast_format_str_reduce(), ast_frame_type2str(), ast_func_read(), ast_gen_cas(), ast_get_builtin_feature(), ast_get_feature(), ast_get_namedgroups(), ast_http_prefix(), ast_http_send(), ast_http_uri_link(), ast_iostream_gets(), ast_iostream_printf(), ast_join_delim(), ast_json_utf8_check_len(), ast_media_cache_retrieve(), ast_media_cache_retrieve_metadata(), ast_mkdir(), ast_msg_data_alloc(), ast_read_image(), ast_readstring(), ast_readstring_full(), ast_recvfrom(), ast_rtcp_generate_report(), ast_rtcp_generate_sdes(), ast_rtcp_interpret(), ast_rtp_interpret(), ast_say_number_full_ka(), ast_sendto(), ast_sip_sanitize_xml(), ast_smoother_read(), ast_sockaddr_copy_sockaddr(), ast_speech_get_setting(), ast_speech_write(), ast_srtp_get_random(), ast_srtp_protect(), ast_srtp_unprotect(), ast_statsd_log_string(), ast_str_buffer(), ast_str_substitute_variables_full(), ast_strftime(), ast_strftime_locale(), ast_stun_handle_packet(), ast_tdd_gen_ecdisa(), AST_TEST_DEFINE(), ast_translate(), ast_udptl_write(), ast_websocket_write_string(), ast_xml_escape(), ast_xmldoc_printable(), auth_exec(), authenticate(), base64_buf_helper(), base64_helper(), blacklist_read(), bridge_p2p_rtp_write(), bucket_copy(), bucket_file_wizard_retrieve(), bucket_wizard_retrieve(), buf_hash(), buf_hash_add(), build_device(), build_ha(), build_rand_pad(), build_regex(), build_route(), builtin_feature_get_exten(), calc_energy(), calendar_join_attendees(), calendar_query_exec(), calendar_query_result_exec(), callerid_feed(), callerid_feed_jp(), callerid_generate(), callerid_read(), careful_write(), category_set_sublevels(), CB_ADD_LEN(), cdata(), cdr_read(), channel_do_masquerade(), chararray_handler_fn(), check_dirpath(), check_sip_domain(), chunked_atoh(), cleaned_basedn(), clearvar_prefix(), cli_complete(), cli_console_sendtext(), sip_to_pjsip::cli_options(), sip_to_pjsql::cli_options(), collect_data(), collect_key(), complete_confno(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_meetmecmd_list(), complete_meetmecmd_mute_kick(), complete_peer_helper(), complete_userno(), conf_get_pin(), conf_play(), connectedline_read(), cops_getmsg(), copy(), create_dirpath(), create_video_frame(), crement_function_read(), csv_quote(), custom_devstate_callback(), custom_level_still_exists(), custom_presence_callback(), dahdi_func_read(), dahdi_sendtext(), dahdi_setoption(), dbl_list_expect_reverse(), dbm_open(), dcbias_(), decode_length(), decode_open_type(), decrypt_memcpy(), DEFINE_SQL_STATEMENT(), devstate_read(), devstate_write(), dialgroup_read(), dialgroup_refreshdb(), dictate_exec(), dns_parse_answer(), do_pktccops(), dtmf_store_framehook(), dump_addr(), dump_answer(), dump_byte(), dump_cause(), dump_datetime(), dump_eid(), dump_encrypted(), dump_hint(), dump_ies(), dump_int(), dump_ipaddr(), dump_prefs(), dump_prov(), dump_prov_flags(), dump_prov_ies(), dump_raw(), dump_samprate(), dump_short(), dump_string(), dump_string_hex(), dump_versioned_codec(), dundi_encrypt(), dundi_parse_ies(), dundi_send(), ebl_callback(), encode_length(), encode_open_type(), encrypt_memcpy(), energy_(), enum_callback(), enum_query_read(), env_read(), expand_gosub_args(), expr2_token_subst(), ext_cmp_exten_strlen(), ext_strncpy(), fbuf_append(), feature_read(), featuremap_get(), featuremap_read(), fetch_response_reader(), ffmpeg_decode(), file2display(), file2format(), file_basename(), file_dirname(), file_format(), file_read(), filename_parse(), filter(), frame_set_var(), fsk_serial(), func_channel_read(), func_confbridge_info(), func_get_parkingslot_channel(), func_header_read(), func_mchan_read(), func_read_header(), func_read_headers(), function_amiclient(), function_db_delete(), function_db_read(), function_enum(), function_fieldnum(), function_fieldnum_helper(), function_fieldqty(), function_fieldqty_helper(), function_iaxpeer(), function_ooh323_read(), function_realtime_read(), function_realtime_readdestroy(), function_sippeer(), function_txtcidname(), g722_decode(), g722_encode(), gen_tone(), gen_tones(), general_get(), PathSegment::get_child(), get_csv(), get_date(), get_domain(), get_name_from_resource(), get_sdp(), get_sdp_iterate(), global_read(), group_function_read(), gsm_write(), gsmtolin_framein(), h261_encap(), h263_encap(), h263_read(), h263_write(), h263p_decap(), h263p_encap(), h264_read(), h264_write(), handle_characters(), handle_cli_mobile_search(), handle_cli_moh_unregister_class(), handle_commandmatchesarray(), handle_incoming(), handle_keypad_button_message(), handle_output(), handle_response(), handle_show_sysinfo(), handle_soft_key_event_message(), hangupcause_keys_read(), hangupcause_read(), Model::has_properties(), Model::has_subtypes(), hashfunc(), hashkeys_read(), hashkeys_read2(), header_identify_match_check(), help1(), hepv3_create_capture_info(), hook_read(), hpInput(), hpOutput(), http_request_headers_get(), httpd_process_request(), iax2_getpeername(), iax_frame_subclass2str(), iax_parse_ies(), iax_str2flags(), iftime(), import_helper(), import_read(), init_stmt(), inner_product_single(), internal_feature_read(), internal_featuremap_read(), interpolate_product_single(), ip_identify_apply(), isodate(), ivfilt_(), json_utf8_check_full(), linear_generator(), listener(), listfilter(), listfilter_read(), load_file(), lock_read(), lpc10_decode(), lpc10tolin_framein(), lpfilt_(), lws2sws(), make_ari_stubs::main(), refcounter::main(), main(), spandspflow2pcap::main(), make_dir(), make_file(), make_filename(), manager_login(), math(), MD5Update(), media_offer_read_av(), memcpy_decrypt(), memcpy_encrypt(), message_template_parse_emailbody(), method_match(), mgcp_postrequest(), mgcp_ss(), mgcpsock_read(), milliwatt_generate(), minivm_account_func_read(), minivm_counter_func_read(), moh_generate(), monmp3thread(), mpeg4_decap(), mpeg4_encap(), msg_data_func_read(), msg_func_read(), msg_to_endpoint(), my_dahdi_write(), newpvt(), PathSegment::num_children(), parse_bookmark(), parse_cdata(), parse_ie(), refcounter::parse_line(), get_documentation::parse_manager_event_instance(), parse_naptr(), parse_srv(), partial_match(), passthru(), pbx_substitute_variables_helper_full(), pbx_substitute_variables_helper_full_location(), phoneprov_callback(), pickup_get(), pjsip_acf_channel_read(), pjsip_acf_dial_contacts_read(), pjsip_acf_dtmf_mode_read(), pjsip_acf_media_offer_read(), pjsip_acf_moh_passthrough_read(), playtone(), plc_fillin(), plc_rx(), pp_each_extension_helper(), pp_each_extension_read(), pp_each_user_helper(), pp_each_user_read(), presence_read(), print_body(), process_cn_rfc3389(), process_dtmf_cisco(), process_dtmf_rfc2833(), reflocks::process_file(), refstats::process_file(), process_sdp(), queue_function_exists(), queue_function_mem_read(), queue_function_memberpenalty_read(), queue_function_qac_dep(), queue_function_queuegetchannel(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), quote(), read_credentials(), read_header(), read_headers(), realtimefield_read(), receive_message(), red_t140_to_red(), redirecting_read(), refer_blind_callback(), regex(), remove_header(), replace(), reschedule_precache(), resource_name_baselen(), rtp_instance_parse_extmap_extensions(), save_history(), sayfile_exec(), scan_thread(), schedule_delivery(), sco_accept(), sco_write(), send_string(), set(), set2(), set_bridge_peer_vars_multiparty(), sha1(), shared_read(), sip_addheader(), sip_route_add(), sip_route_process_header(), sip_show_channel(), sip_show_history(), sip_tcptls_write(), skip_name(), smdi_msg_retrieve_read(), sms_generate(), sms_messagetx(), socket_process_meta(), speech_aeap_engine_get_setting(), speech_aeap_engine_write(), speech_grammar(), speech_score(), speech_text(), speex_get_wb_sz_at(), speex_samples(), sprint_list_entry(), srv_callback(), start_automixmonitor(), start_automonitor(), stat_read(), StateConstructW(), StateSearchW(), static_callback(), strbetween(), strreplace(), syntFilter(), t38_tx_packet_handler(), tdd_feed(), term_filter_escapes(), timeout_read(), transfer_exec(), transmit_response_bysession(), try_firmware(), trylock_read(), txt_callback(), udptl_build_packet(), udptl_rx_packet(), unistim_sp(), unlock_read(), unquote(), OrderedDict::update(), uri_parse_and_default(), uridecode(), uriencode(), vm_check_password_shell(), wav_write(), ws_safe_read(), ws_send_msg(), xfer_get(), xmldoc_get_syntax_fun(), xmldoc_reverse_helper(), xmldoc_setpostbr(), xmpp_client_authenticate_sasl(), xmpp_client_receive(), xmpp_client_send_raw_message(), and xmpp_io_recv().
static int replace |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
data, |
|
|
struct ast_str ** |
buf, |
|
|
ssize_t |
len |
|
) |
| |
|
static |
Definition at line 815 of file func_strings.c.
822 char *strptr, *varsubst;
835 ast_log(
LOG_ERROR,
"Usage: %s(<varname>,<search-chars>[,<replace-char>])\n", cmd);
844 ast_log(
LOG_ERROR,
"The characters to search for and the variable name must not be empty.\n");
849 sprintf(varsubst,
"${%s}",
args.varname);
858 ast_debug(3,
"Characters to find: (%s)\n", find);
864 if (strchr(find, *strptr)) {
866 memmove(strptr, strptr + 1, strlen(strptr + 1) + 1);
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
References args, ast_alloca, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_free, ast_get_encoded_char(), ast_get_encoded_str(), ast_log, AST_STANDARD_APP_ARGS, ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_strlen(), ast_str_substitute_variables(), ast_strlen_zero(), buf, len(), LOG_ERROR, RAII_VAR, and str.
Referenced by FaxPcap::add(), add_header(), add_pri(), app_get_replace_channel_app(), app_set_replace_channel_app(), app_set_replace_channel_snapshot(), ast_add_extension2(), ast_sip_add_global_request_header(), ast_sip_add_global_response_header(), bridge_features_ds_set_full(), channel_feature_hooks_set_full(), get_replace_channel_snapshot(), ResourceApi::load(), ApiDeclaration::load_file(), localized_add_extension2(), manager_dialplan_extension_add(), spandspflow2pcap::n2b(), parking_add_extension(), get_documentation::parse_manager_event_instance(), process_text_line(), replace_channel_destroy(), and astconfigparser::try_section().