Sat Aug 6 00:40:05 2011

Asterisk developer's documentation


strings.h File Reference

String manipulation functions. More...

#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include "asterisk/inline_api.h"
#include "asterisk/compiler.h"
#include "asterisk/compat.h"

Go to the source code of this file.

Data Structures

struct  ast_realloca

Defines

#define ast_restrdupa(ra, s)
#define S_OR(a, b)   (!ast_strlen_zero(a) ? (a) : (b))
 returns the equivalent of logic or for strings: first one if not empty, otherwise second one.

Functions

int ast_build_string (char **buffer, size_t *space, const char *fmt,...)
 Build a string in a buffer, designed to be called repeatedly.
int ast_build_string_va (char **buffer, size_t *space, const char *fmt, va_list ap)
 Build a string in a buffer, designed to be called repeatedly.
void ast_copy_string (char *dst, const char *src, size_t size)
 Size-limited null-terminating string copy.
int ast_false (const char *val)
int ast_get_time_t (const char *src, time_t *dst, time_t _default, int *consumed)
 get values from config variables.
void ast_join (char *s, size_t len, char *const w[])
char * ast_skip_blanks (const char *str)
 Gets a pointer to the first non-whitespace character in a string.
char * ast_skip_nonblanks (char *str)
 Gets a pointer to first whitespace character in a string.
static force_inline int ast_str_case_hash (const char *str)
 Compute a hash value on a case-insensitive string.
static force_inline int ast_str_hash (const char *str)
 Compute a hash value on a string.
char * ast_strip (char *s)
 Strip leading/trailing whitespace from a string.
char * ast_strip_quoted (char *s, const char *beg_quotes, const char *end_quotes)
 Strip leading/trailing whitespace and quotes from a string.
static force_inline int ast_strlen_zero (const char *s)
char * ast_trim_blanks (char *str)
 Trims trailing whitespace characters from a string.
int ast_true (const char *val)
char * ast_unescape_semicolon (char *s)
 Strip backslash for "escaped" semicolons. s The string to be stripped (will be modified).


Detailed Description

String manipulation functions.

Definition in file strings.h.


Define Documentation

#define ast_restrdupa ( ra,
 ) 

Definition at line 257 of file strings.h.

#define S_OR ( a,
 )     (!ast_strlen_zero(a) ? (a) : (b))

returns the equivalent of logic or for strings: first one if not empty, otherwise second one.

Definition at line 43 of file strings.h.

Referenced by __ast_cli_register(), __login_exec(), __sip_show_channels(), _sip_show_peer(), acf_if(), action_agents(), action_command(), action_getvar(), action_setvar(), action_status(), agent_hangup(), aji_client_initialize(), aji_component_initialize(), aji_test(), allow_multiple_login(), app_exec(), ast_async_goto(), ast_backtrace(), ast_bridge_call(), ast_call_forward(), ast_cdr_end(), ast_cdr_free(), ast_cdr_init(), ast_cdr_serialize_variables(), ast_cdr_setapp(), ast_cdr_start(), ast_cdr_update(), ast_play_and_record_full(), ast_setstate(), asyncgoto_exec(), authenticate(), build_callid_pvt(), build_callid_registry(), build_peer(), build_rpid(), builtin_automonitor(), callerid_read(), calltoken_required(), check_auth(), check_post(), copy_message(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_read(), do_parking_thread(), fast_originate(), feature_check(), feature_interpret(), find_conf(), forward_message(), get_also_info(), get_cid_name(), get_destination(), get_refer_info(), handle_call_token(), handle_chanlist(), handle_chanlist_deprecated(), handle_request_invite(), handle_response_register(), handle_showchan(), handle_showchan_deprecated(), help1(), iax2_show_channels(), iftime(), initreqprep(), join_queue(), leave_voicemail(), manager_dbput(), manager_parking_status(), manager_queues_status(), meetme_cmd(), misdn_call(), moh_classes_show(), park_call_full(), park_exec(), pbx_builtin_execiftime(), pbx_builtin_waitexten(), pbx_exec(), pbx_extension_helper(), pbx_load_config(), pgsql_reconnect(), play_mailbox_owner(), post_cdr(), post_manager_event(), process_sdp(), queue_exec(), realtime_common(), realtime_exec(), register_peer_exten(), report_new_callerid(), send_provisional_keepalive_full(), senddialevent(), serialize_showchan(), set_one_cid(), setup_env(), sip_show_domains(), sip_show_settings(), sip_uri_cmp(), sipsock_read(), skinny_answer(), skinny_hold(), skinny_indicate(), sla_show_stations(), sla_show_trunks(), socket_process(), transmit_notify_with_mwi(), update_realtime_members(), and wait_for_answer().


Function Documentation

int ast_build_string ( char **  buffer,
size_t *  space,
const char *  fmt,
  ... 
)

Build a string in a buffer, designed to be called repeatedly.

This is a wrapper for snprintf, that properly handles the buffer pointer and buffer space available.

Parameters:
buffer current position in buffer to place string into (will be updated on return)
space remaining space in buffer (will be updated on return)
fmt printf-style format string
Returns:
0 on success, non-zero on failure.

Definition at line 1047 of file utils.c.

References ast_build_string_va().

Referenced by __queues_show(), add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), ast_cdr_serialize_variables(), ast_http_setcookie(), config_odbc(), config_pgsql(), function_realtime_read(), html_translate(), httpstatus_callback(), initreqprep(), pbx_builtin_serialize_variables(), print_uptimestr(), show_translation(), show_translation_deprecated(), transmit_notify_with_mwi(), transmit_state_notify(), and xml_translate().

01048 {
01049    va_list ap;
01050    int result;
01051 
01052    va_start(ap, fmt);
01053    result = ast_build_string_va(buffer, space, fmt, ap);
01054    va_end(ap);
01055 
01056    return result;
01057 }

int ast_build_string_va ( char **  buffer,
size_t *  space,
const char *  fmt,
va_list  ap 
)

Build a string in a buffer, designed to be called repeatedly.

This is a wrapper for snprintf, that properly handles the buffer pointer and buffer space available.

Returns:
0 on success, non-zero on failure.
Parameters:
buffer current position in buffer to place string into (will be updated on return)
space remaining space in buffer (will be updated on return)
fmt printf-style format string
ap varargs list of arguments for format

Definition at line 1028 of file utils.c.

Referenced by ast_build_string().

01029 {
01030    int result;
01031 
01032    if (!buffer || !*buffer || !space || !*space)
01033       return -1;
01034 
01035    result = vsnprintf(*buffer, *space, fmt, ap);
01036 
01037    if (result < 0)
01038       return -1;
01039    else if (result > *space)
01040       result = *space;
01041 
01042    *buffer += result;
01043    *space -= result;
01044    return 0;
01045 }

void ast_copy_string ( char *  dst,
const char *  src,
size_t  size 
) [inline]

Size-limited null-terminating string copy.

Parameters:
ast_copy_string function being used
dst The destination buffer.
src The source string
size The size of the destination buffer
Returns:
Nothing.
This is similar to strncpy, with two important differences:

Definition at line 180 of file strings.h.

Referenced by __ast_http_load(), __ast_pbx_run(), __ast_play_and_record(), __ast_request_and_dial(), __iax2_show_peers(), __login_exec(), __oh323_new(), __schedule_action(), __set_address_from_contact(), _macro_exec(), _sip_show_peers(), acf_channel_read(), acf_curl_exec(), acf_if(), action_agent_callback_login(), action_originate(), action_userevent(), add_agent(), add_realm_authentication(), add_route(), add_sip_domain(), add_to_interfaces(), adsi_load(), adsi_message(), adsi_process(), agent_devicestate_cb(), agent_new(), agentmonitoroutgoing_exec(), agi_exec_full(), aji_create_buddy(), aji_create_client(), aji_find_version(), aji_handle_message(), aji_handle_presence(), alarmreceiver_exec(), alloc_profile(), alloc_queue(), alsa_new(), announce_thread(), answer_call(), answer_exec_enable(), app_exec(), append_mailbox(), apply_option(), apply_options_full(), apply_outgoing(), ast_app_group_split_group(), ast_app_parse_options(), ast_append_ha(), ast_apply_ha(), ast_bridge_call(), ast_build_timing(), ast_call_forward(), ast_callerid_merge(), ast_callerid_parse(), ast_callerid_split(), ast_category_new(), ast_category_rename(), ast_cdr_appenduserfield(), ast_cdr_getvar(), ast_cdr_init(), ast_cdr_merge(), ast_cdr_register(), ast_cdr_setaccount(), ast_cdr_setapp(), ast_cdr_setdestchan(), ast_cdr_setuserfield(), ast_cdr_update(), ast_channel_free(), ast_cli_completion_matches(), ast_db_get(), ast_devstate_prov_add(), ast_do_masquerade(), ast_explicit_goto(), ast_expr(), ast_frame_dump(), ast_get_enum(), ast_get_hint(), ast_get_srv(), ast_get_txt(), ast_iax2_new(), ast_linear_stream(), ast_lookup_iface(), ast_makesocket(), ast_monitor_change_fname(), ast_monitor_stop(), ast_parse_device_state(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_privacy_check(), ast_privacy_set(), ast_read_image(), ast_readconfig(), ast_say_number_full_nl(), ast_setstate(), ast_tryconnect(), ast_tzset(), ast_var_assign(), async_wait(), authenticate_verify(), authority_to_str(), begin_dial(), build_alias(), build_conf(), build_context(), build_device(), build_gateway(), build_mapping(), build_peer(), build_reply_digest(), build_route(), build_user(), cache_lookup(), cache_lookup_internal(), callerid_feed(), callerid_feed_jp(), callerid_read(), cb_events(), change_password_realtime(), check_auth(), check_availability(), check_password(), check_sip_domain(), check_user_full(), check_via(), checkmd5(), cleanup_stale_contexts(), cli_prompt(), common_exec(), compile_script(), complete_dpreply(), complete_fn_2(), complete_fn_3(), conf_exec(), conf_run(), config_text_file_load(), config_text_file_save(), console_dial(), console_dial_deprecated(), copy_message(), copy_via_headers(), create_addr(), create_followme_number(), create_queue_member(), csv_quote(), dahdi_call(), dahdi_func_read(), dahdi_handle_event(), dahdi_hangup(), dahdi_new(), dahdi_show_channels(), dialout(), dictate_exec(), disa_exec(), dnsmgr_refresh(), do_directory(), do_idle_thread(), dump_byte(), dump_datetime(), dump_int(), dump_ipaddr(), dump_prov_flags(), dump_prov_ies(), dump_samprate(), dump_short(), dundi_answer_entity(), dundi_answer_query(), dundi_do_lookup(), dundi_do_precache(), dundi_do_query(), dundi_lookup_internal(), dundi_lookup_local(), dundi_precache_internal(), dundi_prop_precache(), dundi_query_eid_internal(), dundi_query_thread(), enum_newtoplev(), env_read(), external_rtp_create(), extract_uri(), exts_compare(), features_alloc(), find_cache(), find_conf(), find_engine(), find_line_by_name(), find_or_create(), find_subchannel_and_lock(), find_user_realtime(), findmeexec(), forward_message(), func_channel_read(), func_check_sipdomain(), func_header_read(), function_agent(), function_enum(), function_iaxpeer(), function_realtime_read(), function_sipchaninfo_read(), function_sippeer(), function_txtcidname(), get_also_info(), get_calleridname(), get_date(), get_destination(), get_mohbyname(), get_rdnis(), get_refer_info(), get_rpid_num(), gettag(), global_read(), group_count_function_read(), group_function_read(), group_function_write(), group_list_function_read(), gtalk_add_candidate(), gtalk_alloc(), gtalk_call(), gtalk_create_candidates(), gtalk_create_member(), gtalk_load_config(), gtalk_new(), gtalk_newcall(), gtalk_show_channels(), handle_add_indication(), handle_command_response(), handle_common_options(), handle_debuglevel_deprecated(), handle_enbloc_call_message(), handle_pri_set_debug_file(), handle_request_info(), handle_response(), handle_set_debug(), handle_setcallerid(), handle_setcontext(), handle_setextension(), handle_show_indications(), handle_soft_key_event_message(), handle_speed_dial_stat_req_message(), handle_statechange(), handle_stimulus_message(), handle_version_req_message(), has_voicemail(), iax2_ack_registry(), iax2_call(), iax2_exec(), iax2_getpeername(), iax2_register(), iax2_show_cache(), iax2_show_registry(), iax2_show_users(), iax2_transfer(), iax_frame_subclass2str(), iax_park(), iax_show_provisioning(), ices_exec(), iftime(), import_ch(), inboxcount(), ind_load_module(), init_acf_query(), init_keys(), init_logger_chain(), init_manager(), init_profile(), init_queue(), init_state(), join_queue(), language_read(), leave_voicemail(), load_config(), load_module(), load_moh_classes(), load_password(), local_alloc(), local_new(), log_events(), main(), make_email_file(), masq_park_call(), math(), meetme_cmd(), mgcp_new(), mgcp_request(), mgcp_ss(), misdn_answer(), misdn_call(), misdn_check_l2l1(), misdn_facility_exec(), misdn_hangup(), misdn_new(), misdn_request(), misdn_send_cd(), misdn_send_display(), misdn_send_text(), misdn_set_opt_exec(), mkif(), mkintf(), moh_read(), nbs_alloc(), nbs_new(), netconsole(), oh323_alloc(), oh323_call(), oh323_request(), open_mailbox(), osp_check_destination(), osp_create_provider(), osp_create_transaction(), page_exec(), park_call_exec(), park_call_full(), parkandannounce_exec(), parse_config(), parse_moved_contact(), parse_naptr(), parse_ok_contact(), parse_register_contact(), pbx_builtin_background(), pbx_builtin_saynumber(), pbx_extension_helper(), pbx_load_config(), pbx_load_users(), pbx_retrieve_variable(), pbx_substitute_variables(), pbx_substitute_variables_helper_full(), peer_status(), pgsql_reconnect(), phone_call(), phone_new(), play_mailbox_owner(), play_record_review(), populate_defaults(), pri_dchannel(), process_dahdi(), process_message(), process_precache(), process_sdp(), profile_set_param(), queue_set_param(), quote(), read_agent_config(), read_config(), realtime_switch_common(), realtime_update_peer(), receive_ademco_contact_id(), record_exec(), reg_source_db(), register_peer_exten(), register_verify(), registry_rerequest(), reload_agents(), reload_config(), reload_followme(), reload_logger(), reload_queues(), remap_feature(), remove_from_queue(), reply_digest(), reqprep(), reset_user_pw(), respprep(), ring_entry(), rpt_call(), rt_handle_member_record(), run_externnotify(), sendpage(), set(), set_c_e_p(), set_config(), set_destination(), set_ext_pri(), set_insecure_flags(), set_one_cid(), setup_incoming_call(), sip_new(), sip_park(), sip_poke_peer(), sip_register(), sip_request_call(), sip_show_inuse(), sip_sipredirect(), skinny_answer(), skinny_indicate(), skinny_new(), skinny_newcall(), skinny_register(), skinny_request(), skinny_ss(), smdi_msg_read(), smdi_read(), sms_exec(), sms_handleincoming(), sms_nextoutgoing(), sms_writefile(), socket_read(), softhangup_exec(), spawn_dp_lookup(), spawn_mp3(), speech_grammar(), speech_read(), speech_score(), speech_text(), ss_thread(), stat_read(), store_config(), substring(), temp_peer(), term_color(), term_prompt(), timeout_read(), translate_module_name(), transmit_callinfo(), transmit_dialednumber(), transmit_displaymessage(), transmit_displaynotify(), transmit_displaypromptstatus(), transmit_notify_request(), transmit_notify_request_with_callerid(), transmit_refer(), transmit_state_notify(), try_calling(), try_load_key(), txt_callback(), update_call_counter(), update_common_options(), update_status(), uridecode(), userevent_exec(), vars2manager(), vm_authenticate(), vm_change_password(), vm_change_password_shell(), vm_execmain(), vm_forwardoptions(), vmauthenticate(), wait_for_answer(), and write_metadata().

00252 {

int ast_false ( const char *  val  ) 

Determine if a string containing a boolean value is "false". This function checks to see whether a string passed to it is an indication of an "false" value. It checks to see if the string is "no", "false", "n", "f", "off" or "0".

Returns 0 if val is a NULL pointer, -1 if "false", and 0 otherwise.

Definition at line 1076 of file utils.c.

References ast_strlen_zero().

Referenced by aji_create_client(), aji_load_config(), ast_rtp_reload(), ast_udptl_reload(), build_peer(), build_user(), handle_common_options(), init_acf_query(), load_config(), load_odbc_config(), reload(), run_agi(), set_config(), set_insecure_flags(), and strings_to_mask().

01077 {
01078    if (ast_strlen_zero(s))
01079       return 0;
01080 
01081    /* Determine if this is a false value */
01082    if (!strcasecmp(s, "no") ||
01083        !strcasecmp(s, "false") ||
01084        !strcasecmp(s, "n") ||
01085        !strcasecmp(s, "f") ||
01086        !strcasecmp(s, "0") ||
01087        !strcasecmp(s, "off"))
01088       return -1;
01089 
01090    return 0;
01091 }

int ast_get_time_t ( const char *  src,
time_t *  dst,
time_t  _default,
int *  consumed 
)

get values from config variables.

Definition at line 1340 of file utils.c.

References ast_strlen_zero(), and t.

Referenced by acf_strftime(), build_peer(), cache_lookup_internal(), handle_saydatetime(), load_password(), play_message_datetime(), process_clearcache(), and sayunixtime_exec().

01341 {
01342    long t;
01343    int scanned;
01344 
01345    if (dst == NULL)
01346       return -1;
01347 
01348    *dst = _default;
01349 
01350    if (ast_strlen_zero(src))
01351       return -1;
01352 
01353    /* only integer at the moment, but one day we could accept more formats */
01354    if (sscanf(src, "%30ld%n", &t, &scanned) == 1) {
01355       *dst = t;
01356       if (consumed)
01357          *consumed = scanned;
01358       return 0;
01359    } else
01360       return -1;
01361 }

void ast_join ( char *  s,
size_t  len,
char *const   w[] 
)

Definition at line 1184 of file utils.c.

Referenced by __ast_cli_generator(), __ast_cli_register(), ast_builtins_init(), console_sendtext(), console_sendtext_deprecated(), find_best(), handle_agidumphtml(), handle_help(), handle_showagi(), help1(), and help_workhorse().

01185 {
01186    int x, ofs = 0;
01187    const char *src;
01188 
01189    /* Join words into a string */
01190    if (!s)
01191       return;
01192    for (x = 0; ofs < len && w[x]; x++) {
01193       if (x > 0)
01194          s[ofs++] = ' ';
01195       for (src = w[x]; *src && ofs < len; src++)
01196          s[ofs++] = *src;
01197    }
01198    if (ofs == len)
01199       ofs--;
01200    s[ofs] = '\0';
01201 }

char * ast_skip_blanks ( const char *  str  )  [inline]

Gets a pointer to the first non-whitespace character in a string.

Parameters:
ast_skip_blanks function being used
str the input string
Returns:
a pointer to the first non-whitespace character

Definition at line 58 of file strings.h.

Referenced by __get_header(), ast_callerid_parse(), ast_skip_nonblanks(), check_auth(), check_via(), determine_firstline_parts(), get_body_by_line(), get_calleridname(), get_sdp_line(), handle_request(), handle_request_invite(), handle_request_notify(), handle_response(), next_item(), parse_sip_options(), parse_via(), pbx_load_config(), process_sdp(), reload_queues(), reply_digest(), transmit_fake_auth_response(), and transmit_invite().

00068 {

char * ast_skip_nonblanks ( char *  str  )  [inline]

Gets a pointer to first whitespace character in a string.

Parameters:
ast_skip_noblanks function being used
str the input string
Returns:
a pointer to the first whitespace character

Definition at line 99 of file strings.h.

References ast_skip_blanks(), and ast_trim_blanks().

Referenced by determine_firstline_parts(), and handle_response().

00112 {

static force_inline int ast_str_case_hash ( const char *  str  )  [static]

Compute a hash value on a case-insensitive string.

Uses the same hash algorithm as ast_str_hash, but converts all characters to lowercase prior to computing a hash. This allows for easy case-insensitive lookups in a hash table.

Definition at line 293 of file strings.h.

Referenced by moh_class_hash().

00294 {
00295    int hash = 5381;
00296 
00297    while (*str) {
00298       hash = hash * 33 ^ tolower(*str++);
00299    }
00300 
00301    return abs(hash);
00302 }

static force_inline int ast_str_hash ( const char *  str  )  [static]

Compute a hash value on a string.

This famous hash algorithm was written by Dan Bernstein and is commonly used.

http://www.cse.yorku.ca/~oz/hash.html

Definition at line 276 of file strings.h.

Referenced by peer_hash_cb(), and user_hash_cb().

00277 {
00278    int hash = 5381;
00279 
00280    while (*str)
00281       hash = hash * 33 ^ *str++;
00282 
00283    return abs(hash);
00284 }

char * ast_strip ( char *  s  )  [inline]

Strip leading/trailing whitespace from a string.

Parameters:
s The string to be stripped (will be modified).
Returns:
The stripped string.
This functions strips all leading and trailing whitespace characters from the input string, and returns a pointer to the resulting string. The string is modified in place.

Definition at line 118 of file strings.h.

Referenced by acf_if(), app_exec(), ast_register_file_version(), ast_strip_quoted(), check_blacklist(), config_text_file_load(), make_components(), parse_cookies(), process_text_line(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), and set().

00137 :
  \code

char* ast_strip_quoted ( char *  s,
const char *  beg_quotes,
const char *  end_quotes 
)

Strip leading/trailing whitespace and quotes from a string.

Parameters:
s The string to be stripped (will be modified).
beg_quotes The list of possible beginning quote characters.
end_quotes The list of matching ending quote characters.
Returns:
The stripped string.
This functions strips all leading and trailing whitespace characters from the input string, and returns a pointer to the resulting string. The string is modified in place.

It can also remove beginning and ending quote (or quote-like) characters, in matching pairs. If the first character of the string matches any character in beg_quotes, and the last character of the string is the matching character in end_quotes, then they are removed from the string.

Examples:

  ast_strip_quoted(buf, "\"", "\"");
  ast_strip_quoted(buf, "'", "'");
  ast_strip_quoted(buf, "[{(", "]})");

Definition at line 994 of file utils.c.

References ast_strip().

Referenced by ast_register_file_version(), iftime(), parse_cookies(), and parse_dial_string().

00995 {
00996    char *e;
00997    char *q;
00998 
00999    s = ast_strip(s);
01000    if ((q = strchr(beg_quotes, *s)) && *q != '\0') {
01001       e = s + strlen(s) - 1;
01002       if (*e == *(end_quotes + (q - beg_quotes))) {
01003          s++;
01004          *e = '\0';
01005       }
01006    }
01007 
01008    return s;
01009 }

static force_inline int ast_strlen_zero ( const char *  s  )  [static]

Definition at line 35 of file strings.h.

Referenced by __action_dialoffhook(), __action_dnd(), __action_showchannels(), __action_transfer(), __action_transferhangup(), __ast_callerid_generate(), __ast_cli_generator(), __ast_http_load(), __ast_request_and_dial(), __has_voicemail(), __iax2_show_peers(), __login_exec(), __oh323_new(), __queues_show(), _macro_exec(), _sip_show_peer(), _sip_show_peers(), _while_exec(), acf_channel_read(), acf_curl_exec(), acf_if(), acf_rand_exec(), acf_strptime(), acf_vmcount_exec(), action_agent_callback_login(), action_agent_logoff(), action_agents(), action_command(), action_coresettings(), action_corestatus(), action_extensionstate(), action_getconfig(), action_getvar(), action_hangup(), action_listcommands(), action_mailboxcount(), action_mailboxstatus(), action_originate(), action_redirect(), action_setcdruserfield(), action_setvar(), action_status(), action_timeout(), action_updateconfig(), action_waitevent(), add_agent(), add_calltoken_ignore(), add_realm_authentication(), add_sip_domain(), admin_exec(), adsi_exec(), adsi_message(), advanced_options(), agent_call(), agent_devicestate(), agent_devicestate_cb(), agent_hangup(), agent_logoff_maintenance(), agent_read(), agent_request(), agents_show(), agents_show_online(), agi_exec_full(), alarmreceiver_exec(), alsa_new(), answer_exec_enable(), app_exec(), append_mailbox_mapping(), append_transaction(), apply_options_full(), apply_outgoing(), apply_peer(), apply_plan_to_number(), aqm_exec(), ast_app_group_get_count(), ast_app_group_match_get_count(), ast_app_group_set_channel(), ast_app_group_split_group(), ast_bridge_call(), ast_build_timing(), ast_call_forward(), ast_cdr_copy_vars(), ast_cdr_fork(), ast_cdr_getvar(), ast_cdr_getvar_internal(), ast_cdr_merge(), ast_cdr_noanswer(), ast_channel_datastore_alloc(), ast_cli_complete(), ast_db_gettree(), ast_dnsmgr_get(), ast_dnsmgr_lookup(), ast_explicit_goto(), ast_false(), ast_frame_dump(), ast_get_group(), ast_get_indication_zone(), ast_get_time_t(), ast_httpd_helper_thread(), ast_iax2_new(), ast_is_valid_string(), ast_jb_read_conf(), ast_linear_stream(), ast_log(), ast_makesocket(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_parseable_goto(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_privacy_set(), ast_remotecontrol(), ast_stream_and_wait(), ast_true(), ast_tzset(), ast_variable_delete(), ast_variable_update(), astman_get_variables(), astman_send_error(), astman_send_response(), async_wait(), asyncgoto_exec(), attempt_thread(), auth_exec(), authenticate(), authenticate_reply(), authenticate_verify(), authority_to_str(), autoanswer_complete(), background_detect_exec(), base64_decode(), base64_encode(), begin_dial(), build_contact(), build_device(), build_gateway(), build_mapping(), build_peer(), build_reply_digest(), build_route(), build_rpid(), build_user(), builtin_automonitor(), cache_get_callno_locked(), callerid_feed(), callerid_genmsg(), cb_events(), cdr_read(), cdr_write(), chan_misdn_log(), chanavail_exec(), change_monitor_action(), change_password_realtime(), channel_spy(), chanspy_exec(), check_access(), check_auth(), check_blacklist(), check_day(), check_dow(), check_goto_on_transfer(), check_month(), check_sip_domain(), check_timerange(), check_user_full(), checkmd5(), cli_audio_convert(), cli_audio_convert_deprecated(), compile_script(), conf_exec(), conf_run(), config_text_file_load(), console_dial(), console_dial_deprecated(), console_sendtext(), console_sendtext_deprecated(), controlplayback_exec(), copy_all_header(), copy_header(), copy_via_headers(), count_exec(), create_addr(), create_addr_from_peer(), create_dirpath(), create_queue_member(), csv_log(), csv_quote(), custom_log(), custom_prepare(), dahdi_accept_r2_call_exec(), dahdi_call(), dahdi_handle_event(), dahdi_hangup(), dahdi_new(), dahdi_r2_get_channel_category(), dahdi_show_channel(), database_increment(), deltree_exec(), destroy_endpoint(), destroy_station(), destroy_trans(), destroy_trunk(), dial_trunk(), dialout(), dictate_exec(), directory_exec(), disa_exec(), do_directory(), do_immediate_setup(), do_message(), do_parking_thread(), does_peer_need_mwi(), dump_agents(), dumpchan_exec(), dundi_exec(), dundi_flags2str(), dundi_helper(), dundi_hint2str(), dundi_lookup_local(), dundi_query_thread(), dundi_show_mappings(), dundi_show_peer(), dundifunc_read(), enum_callback(), env_write(), exec(), export_ch(), extenspy_exec(), extract_uri(), fast_originate(), feature_exec_app(), feature_interpret_helper(), feature_request_and_dial(), festival_exec(), fileexists_core(), finalize_content(), find_call(), find_sdp(), find_sip_method(), forward_message(), func_check_sipdomain(), func_header_read(), func_inheritance_write(), function_agent(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_eval(), function_fieldqty(), function_realtime_read(), function_realtime_write(), function_txtcidname(), get_also_info(), get_destination(), get_ip_and_port_from_sdp(), get_range(), get_rdnis(), get_refer_info(), get_sip_pvt_byid_locked(), get_timerange(), gosub_exec(), gosubif_exec(), group_count_function_read(), group_function_read(), group_function_write(), group_list_function_read(), group_match_count_function_read(), group_show_channels(), gtalk_create_candidates(), gtalk_new(), handle_chanlist(), handle_chanlist_deprecated(), handle_command_response(), handle_controlstreamfile(), handle_getvariable(), handle_orig(), handle_pri_set_debug_file(), handle_request(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_options(), handle_request_refer(), handle_request_subscribe(), handle_response(), handle_response_refer(), handle_response_register(), handle_save_dialplan(), handle_saydatetime(), handle_show_dialplan(), handle_stimulus_message(), handle_updates(), handle_uri(), handle_voicemail_show_users(), hasvoicemail_exec(), iax2_call(), iax2_datetime(), iax2_devicestate(), iax2_prov_app(), iax2_request(), iax2_show_cache(), iax2_show_peer(), iax2_show_users(), iax_check_version(), iax_firmware_append(), iax_provflags2str(), ices_exec(), iftime(), inboxcount(), init_acf_query(), initreqprep(), inspect_module(), isAnsweringMachine(), jb_choose_impl(), launch_monitor_thread(), launch_netscript(), leave_voicemail(), load_config(), load_module(), local_ast_moh_start(), log_events(), log_exec(), lookupblacklist_exec(), loopback_parse(), main(), make_components(), make_email_file(), make_filename(), make_logchannel(), manager_add_queue_member(), manager_dbget(), manager_dbput(), manager_iax2_show_peers(), manager_jabber_send(), manager_park(), manager_parking_status(), manager_pause_queue_member(), manager_play_dtmf(), manager_queue_member_count(), manager_queues_status(), manager_remove_queue_member(), manager_sip_show_peer(), manager_sip_show_peers(), matchcid(), math(), md5(), meetmemute(), mgcp_call(), mgcp_hangup(), mgcp_new(), mgcp_request(), mgcp_ss(), mgcpsock_read(), milliwatt_exec(), misdn_answer(), misdn_call(), misdn_cfg_update_ptp(), misdn_check_l2l1(), misdn_facility_exec(), misdn_overlap_dial_task(), misdn_request(), misdn_set_opt_exec(), mixmonitor_exec(), mkintf(), moh2_exec(), morsecode_exec(), mp3_exec(), nbs_alloc(), notify_new_message(), oh323_call(), oh323_request(), onedigit_goto(), orig_app(), orig_exten(), osp_auth(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_new(), page_exec(), park_call_full(), park_exec(), park_space_reserve(), parkandannounce_exec(), parse(), parse_config(), parse_cookies(), parse_dial_string(), parse_register_contact(), parse_request(), parse_sip_options(), parse_via(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_importvar(), pbx_builtin_resetcdr(), pbx_builtin_saydate(), pbx_builtin_saynumber(), pbx_builtin_saytime(), pbx_builtin_setglobalvar(), pbx_builtin_setvar(), pbx_builtin_waitexten(), pbx_checkcondition(), pbx_load_config(), pbx_load_users(), pbx_substitute_variables_helper_full(), pgsql_reconnect(), phone_call(), phone_new(), pickup_exec(), play_file(), play_mailbox_owner(), play_message_callerid(), play_message_category(), play_message_datetime(), playback_exec(), post_cdr(), pqm_exec(), prep_email_sub_vars(), pri_dchannel(), print_ext(), privacy_exec(), process_ast_dsp(), process_dahdi(), process_message(), process_my_load_module(), process_sdp(), process_text_line(), process_token(), ql_exec(), queue_exec(), queue_function_queuemembercount(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_reload_request(), quit_handler(), quote(), random_exec(), read_agent_config(), read_config(), read_exec(), readfile_exec(), real_ctx(), realtime_exec(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), realtime_pgsql_status(), realtime_update_exec(), realtime_update_peer(), receive_ademco_contact_id(), record_exec(), register_peer_exten(), register_verify(), registry_rerequest(), reload_followme(), reload_queue_members(), reload_queues(), reply_digest(), reqprep(), requirecalltoken_mark_auto(), respprep(), retrydial_exec(), return_exec(), ring_entry(), rpt_exec(), rqm_exec(), run_agi(), run_externnotify(), send_keypad_facility_exec(), senddtmf_exec(), sendimage_exec(), sendmail(), sendurl_exec(), set(), set_agentbycallerid(), set_bridge_features_on_config(), set_config(), set_insecure_flags(), set_member_paused(), set_nonce_randdata(), set_one_cid(), setcallerid_exec(), setup_dahdi(), setup_incoming_call(), sha1(), sip_addheader(), sip_hangup(), sip_new(), sip_poke_peer(), sip_register(), sip_request_call(), sip_show_channel(), sip_show_user(), sip_sipredirect(), sip_uri_headers_cmp(), sip_uri_params_cmp(), skel_exec(), skinny_hold(), skinny_new(), skinny_register(), skinny_request(), skinny_ss(), sla_check_device(), sla_queue_event_conf(), sla_ring_station(), sla_station_exec(), smdi_msg_find(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process(), softhangup_exec(), spawn_mp3(), speech_background(), split_ext(), ss_thread(), start_monitor_action(), start_monitor_exec(), static_callback(), stop_monitor_action(), store_config(), strings_to_mask(), system_exec_helper(), testclient_exec(), testserver_exec(), transfer_exec(), transmit_fake_auth_response(), transmit_invite(), transmit_modify_request(), transmit_modify_with_sdp(), transmit_notify_request(), transmit_notify_request_with_callerid(), transmit_notify_with_mwi(), transmit_refer(), transmit_register(), transmit_request_with_auth(), try_calling(), try_firmware(), unalloc_sub(), update_bridgepeer(), update_call_counter(), update_realtime_member_field(), update_registry(), upqm_exec(), uridecode(), uriencode(), userevent_exec(), valid_exit(), vm_authenticate(), vm_box_exists(), vm_exec(), vm_execmain(), vm_forwardoptions(), vm_newuser(), vm_options(), vmauthenticate(), vmu_tm(), wait_for_answer(), wait_for_hangup(), wait_for_winner(), and zapateller_exec().

00036 {
00037    return (!s || (*s == '\0'));
00038 }

char * ast_trim_blanks ( char *  str  )  [inline]

Trims trailing whitespace characters from a string.

Parameters:
ast_trim_blanks function being used
str the input string
Returns:
a pointer to the modified string

Definition at line 84 of file strings.h.

Referenced by ast_callerid_parse(), ast_skip_nonblanks(), determine_firstline_parts(), and pbx_load_config().

00094 {

int ast_true ( const char *  val  ) 

Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".

Returns 0 if val is a NULL pointer, -1 if "true", and 0 otherwise.

Definition at line 1059 of file utils.c.

References ast_strlen_zero().

Referenced by __ast_http_load(), __login_exec(), _parse(), action_agent_callback_login(), action_agent_logoff(), action_originate(), action_setcdruserfield(), action_updateconfig(), aji_create_client(), aji_load_config(), apply_option(), apply_outgoing(), ast_jb_read_conf(), ast_plc_reload(), ast_udptl_reload(), authenticate(), build_device(), build_gateway(), build_peer(), build_user(), connect_link(), dahdi_r2_answer(), do_directory(), do_reload(), festival_exec(), func_inheritance_write(), get_encrypt_methods(), gtalk_load_config(), handle_common_options(), handle_mfcr2_call_files(), handle_save_dialplan(), init_logger_chain(), init_manager(), load_config(), load_module(), load_odbc_config(), load_rpt_vars(), loadconfigurationfile(), manager_add_queue_member(), manager_pause_queue_member(), misdn_answer(), odbc_load_module(), osp_load(), parse_config(), pbx_load_config(), pbx_load_users(), process_dahdi(), queue_set_param(), read_agent_config(), reload(), reload_config(), reload_queues(), set_config(), set_insecure_flags(), sla_load_config(), start_monitor_action(), strings_to_mask(), and update_common_options().

01060 {
01061    if (ast_strlen_zero(s))
01062       return 0;
01063 
01064    /* Determine if this is a true value */
01065    if (!strcasecmp(s, "yes") ||
01066        !strcasecmp(s, "true") ||
01067        !strcasecmp(s, "y") ||
01068        !strcasecmp(s, "t") ||
01069        !strcasecmp(s, "1") ||
01070        !strcasecmp(s, "on"))
01071       return -1;
01072 
01073    return 0;
01074 }

char* ast_unescape_semicolon ( char *  s  ) 

Strip backslash for "escaped" semicolons. s The string to be stripped (will be modified).

Returns:
The stripped string.

Definition at line 1011 of file utils.c.

Referenced by sip_notify().

01012 {
01013    char *e;
01014    char *work = s;
01015 
01016    while ((e = strchr(work, ';'))) {
01017       if ((e > work) && (*(e-1) == '\\')) {
01018          memmove(e - 1, e, strlen(e) + 1);
01019          work = e;
01020       } else {
01021          work = e + 1;
01022       }
01023    }
01024 
01025    return s;
01026 }


Generated on Sat Aug 6 00:40:06 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7