Wed Oct 28 11:46:20 2009

Asterisk developer's documentation

strings.h File Reference

String manipulation functions. More...

#include <ctype.h>
#include "asterisk/inline_api.h"
#include "asterisk/utils.h"
#include "asterisk/threadstorage.h"

Include dependency graph for strings.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_str
 The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field to indicate the type of storage. Three special constants indicate malloc, alloca() or static variables, all other values indicate a struct ast_threadstorage pointer. More...


#define _DB1(x)
#define ast_str_alloca(init_len)
#define ast_str_append_va(buf, max_len, fmt, ap)
 Append to a dynamic string using a va_list.
#define ast_str_buffer(a)   ((a)->str)
#define ast_str_set_va(buf, max_len, fmt, ap)
 Set a dynamic string from a va_list.
#define ast_str_size(a)   ((a)->len)
#define ast_str_strlen(a)   ((a)->used)
#define ast_str_update(a)   (a)->used = strlen((a)->str)
#define DS_ALLOCA   ((struct ast_threadstorage *)2)
#define DS_MALLOC   ((struct ast_threadstorage *)1)
#define DS_STATIC   ((struct ast_threadstorage *)3)
#define S_COR(a, b, c)   ((a && !ast_strlen_zero(b)) ? (b) : (c))
 returns the equivalent of logic or for strings, with an additional boolean check: second one if not empty and first one is true, otherwise third one. example: S_COR(usewidget, widget, "<no widget>")
#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.


 Error codes from __ast_str_helper() The undelying processing to manipulate dynamic string is done by __ast_str_helper(), which can return a success, a permanent failure (e.g. no memory), or a temporary one (when the string needs to be reallocated, and we must run va_start() again; XXX this convoluted interface is only here because FreeBSD 4 lacks va_copy, but this will be fixed and the interface simplified). More...


int __ast_str_helper (struct ast_str **buf, size_t max_len, int append, const char *fmt, va_list ap)
 Core functionality of ast_str_(set|append)_va.
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)
 Make sure something is false. 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".
int ast_get_time_t (const char *src, time_t *dst, time_t _default, int *consumed)
 get values from config variables.
int ast_get_timeval (const char *src, struct timeval *tv, struct timeval _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.
int ast_str_append (struct ast_str **buf, size_t max_len, const char *fmt,...)
 Append to a thread local dynamic string.
static force_inline int ast_str_case_hash (const char *str)
 Compute a hash value on a case-insensitive string.
struct ast_str *attribute_malloc ast_str_create (size_t init_len)
 Create a malloc'ed dynamic length string.
static force_inline int ast_str_hash (const char *str)
 Compute a hash value on a string.
int ast_str_make_space (struct ast_str **buf, size_t new_len)
void ast_str_reset (struct ast_str *buf)
 Reset the content of a dynamic string. Useful before a series of ast_str_append.
int ast_str_set (struct ast_str **buf, size_t max_len, const char *fmt,...)
 Set a dynamic string using variable arguments.
struct ast_strast_str_thread_get (struct ast_threadstorage *ts, size_t init_len)
 Retrieve a thread locally stored dynamic 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)
 Make sure something is true. 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".
char * ast_unescape_c (char *s)
 Convert some C escape sequences.
char * ast_unescape_semicolon (char *s)
 Strip backslash for "escaped" semicolons, the string to be stripped (will be modified).

Detailed Description

String manipulation functions.

Definition in file strings.h.

Define Documentation

#define _DB1 (  ) 

Definition at line 412 of file strings.h.

#define ast_str_alloca ( init_len   ) 

#define ast_str_append_va ( buf,
ap   ) 

Append to a dynamic string using a va_list.

Same as ast_str_set_va(), but append to the current content.

Definition at line 604 of file strings.h.

Referenced by __manager_event(), and ast_str_set().

#define ast_str_buffer (  )     ((a)->str)

#define ast_str_set_va ( buf,
ap   ) 

Set a dynamic string from a va_list.

  • buf This is the address of a pointer to a struct ast_str. If it is retrieved using ast_str_thread_get, the struct ast_threadstorage pointer will need to be updated in the case that the buffer has to be reallocated to accommodate a longer string than what it currently has space for.
  • max_len This is the maximum length to allow the string buffer to grow to. If this is set to 0, then there is no maximum length.
  • fmt This is the format string (printf style)
  • ap This is the va_list
The return value of this function is the same as that of the printf family of functions.
Example usage (the first part is only for thread-local storage)
 AST_THREADSTORAGE(my_str, my_str_init);
 #define MY_STR_INIT_SIZE   128
 void my_func(const char *fmt, ...)
      struct ast_str *buf;
      va_list ap;

      if (!(buf = ast_str_thread_get(&my_str, MY_STR_INIT_SIZE)))
      va_start(fmt, ap);
      ast_str_set_va(&buf, 0, fmt, ap);
      printf("This is the string we just built: %s\n", buf->str);

: the following two functions must be implemented as macros because we must do va_end()/va_start() on the original arguments.

Definition at line 588 of file strings.h.

Referenced by ast_agi_send(), ast_cli(), ast_log(), ast_verbose(), and astman_append().

#define ast_str_size (  )     ((a)->len)

Definition at line 354 of file strings.h.

Referenced by ast_str_get_encoded_str().

#define ast_str_strlen (  )     ((a)->used)

Definition at line 355 of file strings.h.

Referenced by build_peer(), and manager_log().

#define ast_str_update (  )     (a)->used = strlen((a)->str)

Definition at line 357 of file strings.h.

Referenced by ast_str_get_encoded_str().

#define DS_ALLOCA   ((struct ast_threadstorage *)2)

Definition at line 349 of file strings.h.

#define DS_MALLOC   ((struct ast_threadstorage *)1)

Definition at line 348 of file strings.h.

#define DS_STATIC   ((struct ast_threadstorage *)3)

Definition at line 350 of file strings.h.

#define S_COR ( a,
 )     ((a && !ast_strlen_zero(b)) ? (b) : (c))

returns the equivalent of logic or for strings, with an additional boolean check: second one if not empty and first one is true, otherwise third one. example: S_COR(usewidget, widget, "<no widget>")

Definition at line 63 of file strings.h.

Referenced by handle_skinny_show_line().

#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 57 of file strings.h.

Referenced by __ast_channel_alloc_ap(), __ast_cli_register(), __ssl_setup(), _sip_show_peer(), acf_if(), action_agents(), action_command(), action_coreshowchannels(), action_meetmelist(), action_reload(), action_setvar(), action_status(), add_peer_mwi_subs(), agent_hangup(), aji_initialize(), aji_test(), app_exec(), ast_async_goto(), ast_bridge_call(), ast_call_forward(), ast_cdr_end(), ast_cdr_init(), ast_cdr_setapp(), ast_cdr_start(), ast_cdr_update(), ast_cli_command(), ast_feature_interpret(), ast_hangup(), ast_play_and_record_full(), ast_setstate(), authenticate(), build_callid_pvt(), build_callid_registry(), build_device(), build_peer(), build_profile(), build_route(), build_rpid(), builtin_automixmonitor(), builtin_automonitor(), callerid_read(), calltoken_required(), check_auth(), check_post(), collect_function_digits(), conf_run(), config_curl(), copy_message(), dahdi_handle_dtmfup(), dahdi_handle_event(), dahdi_hangup(), dahdi_read(), dahdi_show_channel(), dial_exec_full(), do_forward(), do_parking_thread(), do_timelimit(), dundi_exec(), enable_jack_hook(), execif_exec(), fast_originate(), find_conf(), find_queue_by_name_rt(), forward_message(), function_ilink(), get_also_info(), get_cached_mwi(), get_cid_name(), get_destination(), get_refer_info(), handle_chanlist(), handle_cli_iax2_show_channels(), handle_cli_moh_show_classes(), handle_request_do(), handle_request_invite(), handle_response_register(), handle_show_settings(), handle_showchan(), handle_showmancmd(), handle_skinny_show_device(), handle_skinny_show_line(), handle_skinny_show_settings(), hashtab_compare_exten_labels(), hashtab_hash_labels(), help1(), iftime(), init_pvt(), initreqprep(), join_queue(), leave_voicemail(), local_read(), login_exec(), manager_bridge_event(), manager_dbput(), manager_parking_status(), manager_queue_log_custom(), manager_queues_status(), meetme_cmd(), misdn_call(), misdn_cfg_get(), park_call_full(), park_exec(), pbx_builtin_execiftime(), pbx_exec(), pbx_load_config(), peer_mailboxes_to_str(), pgsql_reconnect(), phase_e_handler(), play_mailbox_owner(), play_moh_exec(), post_cdr(), post_manager_event(), process_sdp(), process_text_line(), queue_exec(), realtime_common(), realtime_curl(), realtime_exec(), realtime_multi_curl(), register_exten(), register_group_feature(), register_peer_exten(), reload_config(), report_new_callerid(), return_exec(), search_directory(), send_provisional_keepalive_full(), senddialevent(), serialize_showchan(), set_config(), set_member_paused(), set_one_cid(), setup_env(), shared_write(), show_channels_cb(), sip_show_domains(), sip_show_settings(), sip_uri_cmp(), skinny_answer(), skinny_hold(), skinny_indicate(), sla_show_stations(), sla_show_trunks(), sms_exec(), sms_log(), socket_process(), start_moh_exec(), transmit_notify_with_mwi(), try_suggested_sip_codec(), unregister_exten(), update_realtime_members(), and wait_for_answer().

Enumeration Type Documentation

anonymous enum

Error codes from __ast_str_helper() The undelying processing to manipulate dynamic string is done by __ast_str_helper(), which can return a success, a permanent failure (e.g. no memory), or a temporary one (when the string needs to be reallocated, and we must run va_start() again; XXX this convoluted interface is only here because FreeBSD 4 lacks va_copy, but this will be fixed and the interface simplified).

AST_DYNSTR_BUILD_FAILED  An error has occured and the contents of the dynamic string are undefined
AST_DYNSTR_BUILD_RETRY  The buffer size for the dynamic string had to be increased, and __ast_str_helper() needs to be called again after a va_end() and va_start().

Definition at line 536 of file strings.h.

00536      {
00537    /*! An error has occured and the contents of the dynamic string
00538     *  are undefined */
00540    /*! The buffer size for the dynamic string had to be increased, and
00541     *  __ast_str_helper() needs to be called again after
00542     *  a va_end() and va_start().
00543     */
00545 };

Function Documentation

int __ast_str_helper ( struct ast_str **  buf,
size_t  max_len,
int  append,
const char *  fmt,
va_list  ap 

Core functionality of ast_str_(set|append)_va.

The arguments to this function are the same as those described for ast_str_set_va except for an addition argument, append. If append is non-zero, this will append to the current string instead of writing over it.

In the case that this function is called and the buffer was not large enough to hold the result, the partial write will be truncated, and the result AST_DYNSTR_BUILD_RETRY will be returned to indicate that the buffer size was increased, and the function should be called a second time.

A return of AST_DYNSTR_BUILD_FAILED indicates a memory allocation error.

A return value greater than or equal to zero indicates the number of characters that have been written, not including the terminating ''. In the append case, this only includes the number of characters appended.

This function should never need to be called directly. It should through calling one of the other functions or macros defined in this file.
core handler for dynamic strings. This is not meant to be called directly, but rather through the various wrapper macros ast_str_set(...) ast_str_append(...) ast_str_set_va(...) ast_str_append_va(...)

Definition at line 1656 of file utils.c.

References AST_DYNSTR_BUILD_FAILED, AST_DYNSTR_BUILD_RETRY, ast_str_make_space(), and ast_verbose().

01658 {
01659    int res, need;
01660    int offset = (append && (*buf)->len) ? (*buf)->used : 0;
01662    if (max_len < 0)
01663       max_len = (*buf)->len;  /* don't exceed the allocated space */
01664    /*
01665     * Ask vsnprintf how much space we need. Remember that vsnprintf
01666     * does not count the final '\0' so we must add 1.
01667     */
01668    res = vsnprintf((*buf)->str + offset, (*buf)->len - offset, fmt, ap);
01670    need = res + offset + 1;
01671    /*
01672     * If there is not enough space and we are below the max length,
01673     * reallocate the buffer and return a message telling to retry.
01674     */
01675    if (need > (*buf)->len && (max_len == 0 || (*buf)->len < max_len) ) {
01676       if (max_len && max_len < need)   /* truncate as needed */
01677          need = max_len;
01678       else if (max_len == 0)  /* if unbounded, give more room for next time */
01679          need += 16 + need/4;
01680       if (0)   /* debugging */
01681          ast_verbose("extend from %d to %d\n", (int)(*buf)->len, need);
01682       if (ast_str_make_space(buf, need)) {
01683          ast_verbose("failed to extend from %d to %d\n", (int)(*buf)->len, need);
01684          return AST_DYNSTR_BUILD_FAILED;
01685       }
01686       (*buf)->str[offset] = '\0';   /* Truncate the partial write. */
01688       /* va_end() and va_start() must be done before calling
01689        * vsnprintf() again. */
01690       return AST_DYNSTR_BUILD_RETRY;
01691    }
01692    /* update space used, keep in mind the truncation */
01693    (*buf)->used = (res + offset > (*buf)->len) ? (*buf)->len : res + offset;
01695    return res;
01696 }

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

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

This method is not recommended. New code should use ast_str_*() instead.
This is a wrapper for snprintf, that properly handles the buffer pointer and buffer space available.

  • 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
    Return values:
    0 on success
    non-zero on failure.

Definition at line 1190 of file utils.c.

References ast_build_string_va().

Referenced by config_odbc(), config_pgsql(), handle_speechrecognize(), lua_func_read(), lua_pbx_exec(), and pp_each_user_exec().

01191 {
01192    va_list ap;
01193    int result;
01195    va_start(ap, fmt);
01196    result = ast_build_string_va(buffer, space, fmt, ap);
01197    va_end(ap);
01199    return result;
01200 }

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.

0 on success, non-zero on failure.
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 1171 of file utils.c.

Referenced by ast_build_string().

01172 {
01173    int result;
01175    if (!buffer || !*buffer || !space || !*space)
01176       return -1;
01178    result = vsnprintf(*buffer, *space, fmt, ap);
01180    if (result < 0)
01181       return -1;
01182    else if (result > *space)
01183       result = *space;
01185    *buffer += result;
01186    *space -= result;
01187    return 0;
01188 }

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

Size-limited null-terminating string copy.

  • dst The destination buffer.
  • src The source string
  • size The size of the destination buffer
    This is similar to strncpy, with two important differences:
    • the destination buffer will always be null-terminated
    • the destination buffer is not filled with zeros past the copied string length These differences make it slightly more efficient, and safer to use since it will not leave the destination buffer unterminated. There is no need to pass an artificially reduced buffer size to this function (unlike strncpy), and the buffer does not need to be initialized to zeroes prior to calling this function.

Definition at line 207 of file strings.h.

Referenced by __ast_channel_alloc_ap(), __ast_http_load(), __ast_pbx_run(), __ast_play_and_record(), __ast_request_and_dial(), __iax2_show_peers(), __init_manager(), __oh323_new(), __schedule_action(), __set_address_from_contact(), _macro_exec(), _sip_show_peers(), acf_channel_read(), acf_curl_exec(), acf_exception_read(), acf_fetch(), acf_iaxvar_read(), acf_if(), acf_isexten_exec(), acf_mailbox_exists(), acf_odbc_read(), acf_sprintf(), acf_version_exec(), action_originate(), add_agent(), add_blank(), add_line(), add_realm_authentication(), add_route(), add_sdp(), add_sip_domain(), add_to_interfaces(), adsi_load(), adsi_message(), adsi_process(), 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(), alsa_new(), announce_thread(), answer_call(), answer_exec_enable(), app_exec(), append_mailbox(), apply_general_options(), apply_option(), apply_options_full(), apply_outgoing(), ast_app_group_split_group(), 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_context_remove_extension_callerid2(), ast_db_get(), ast_devstate_prov_add(), ast_do_masquerade(), ast_eivr_getvariable(), ast_explicit_goto(), ast_expr(), ast_extension_state2(), ast_frame_dump(), ast_get_enum(), ast_get_hint(), ast_get_srv(), ast_get_txt(), ast_getformatname_multiple(), ast_iax2_new(), ast_linear_stream(), ast_log(), ast_makesocket(), ast_monitor_change_fname(), ast_monitor_start(), 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_rtp_lookup_mime_multiple(), ast_say_date_th(), ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_en(), ast_say_date_with_format_es(), ast_say_date_with_format_fr(), ast_say_date_with_format_gr(), ast_say_date_with_format_it(), ast_say_date_with_format_nl(), ast_say_date_with_format_pl(), ast_say_date_with_format_th(), ast_say_date_with_format_zh(), ast_say_datetime_from_now_pt(), ast_say_datetime_th(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_hu(), ast_say_number_full_it(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_zh(), ast_setstate(), ast_tryconnect(), ast_tzset(), ast_uri_encode(), ast_var_assign(), async_wait(), authenticate(), authenticate_verify(), begin_dial_channel(), 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(), callerpres_read(), CB_ADD_LEN(), cb_events(), change_password_realtime(), check_auth(), check_availability(), check_match(), check_password(), check_sip_domain(), check_user_full(), check_via(), check_via_response(), cleanup_stale_contexts(), cli_prompt(), collect_function_digits(), common_exec(), compile_script(), complete_dpreply(), complete_fn(), conf_exec(), conf_run(), config_text_file_load(), console_dial(), copy_message(), copy_via_headers(), create_addr(), create_followme_number(), create_queue_member(), create_vmaccount(), csv_quote(), cut_internal(), dahdi_call(), dahdi_func_read(), dahdi_handle_event(), dahdi_hangup(), dahdi_new(), dahdi_show_channels(), devstate_read(), dial_exec_full(), dialgroup_read(), dialgroup_write(), dialout(), dictate_exec(), disa_exec(), dnsmgr_refresh(), do_forward(), do_parking_thread(), dump_addr(), 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(), enum_query_read(), enum_result_read(), env_read(), external_rtp_create(), extract_uri(), exts_compare(), extstate_read(), features_alloc(), file_read(), find_account(), find_cache(), find_conf_realtime(), find_context_locked(), find_engine(), find_line_by_name(), find_or_create(), find_queue_by_name_rt(), find_subchannel_and_lock(), find_subchannel_by_name(), find_user_realtime(), findmeexec(), forward_message(), func_channel_read(), func_check_sipdomain(), func_header_read(), function_agent(), function_autopatchup(), function_enum(), function_iaxpeer(), function_ilink(), function_realtime_read(), function_realtime_readdestroy(), function_remote(), function_sipchaninfo_read(), function_sippeer(), function_txtcidname(), gen_header(), get_also_info(), get_calleridname(), get_date(), get_destination(), get_mohbyname(), get_rdnis(), get_refer_info(), get_rpid_num(), getdisplaybyname(), getflagbyname(), getkeybyname(), getstatebyname(), getsubbyname(), gettag(), global_read(), gosub_exec(), 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_cli_iax2_show_cache(), handle_cli_iax2_show_registry(), handle_cli_iax2_show_users(), handle_cli_indication_add(), handle_cli_indication_show(), handle_cli_keys_init(), handle_cli_misdn_send_display(), handle_cli_misdn_send_facility(), handle_cli_rpt_lstats(), handle_cli_ulimit(), handle_command_response(), handle_common_options(), handle_dial_page(), handle_enbloc_call_message(), handle_gosub(), handle_link_data(), handle_link_phone_dtmf(), handle_remote_dtmf_digit(), handle_request_info(), handle_response(), handle_setcallerid(), handle_setcontext(), handle_setextension(), handle_soft_key_event_message(), handle_speed_dial_stat_req_message(), handle_statechange(), handle_stimulus_message(), handle_version_req_message(), has_voicemail(), hash_read(), iax2_ack_registry(), iax2_append_register(), iax2_call(), iax2_exec(), iax2_getpeername(), iax2_register(), iax2_transfer(), iax_frame_subclass2str(), iax_park(), iax_parse_ies(), iax_show_provisioning(), iax_template_copy(), ices_exec(), ifmodule_read(), iftime(), import_ch(), inboxcount(), ind_load_module(), init_acf_query(), init_logger_chain(), init_profile(), init_state(), interface_exists_global(), jingle_add_candidate(), jingle_alloc(), jingle_call(), jingle_create_candidates(), jingle_create_member(), jingle_load_config(), jingle_new(), jingle_newcall(), jingle_show_channels(), jingle_transmit_invite(), join_queue(), key_dial_page(), key_history(), key_main_page(), key_select_extension(), Keyfavorite(), leave_voicemail(), load_config(), load_module(), load_moh_classes(), load_odbc_config(), load_password(), load_rpt_vars(), load_values_config(), local_alloc(), local_ast_moh_start(), local_dtmf_helper(), local_new(), local_read(), lock_read(), log_events(), login_exec(), lookup_iface(), main(), make_email_file(), manager_iax2_show_peer_list(), manager_modulecheck(), math(), meetme_cmd(), message_template_build(), message_template_create(), message_template_parse_filebody(), mgcp_call(), mgcp_new(), mgcp_request(), mgcp_ss(), minivm_accmess_exec(), minivm_account_func_read(), minivm_delete_exec(), minivm_greet_exec(), minivm_notify_exec(), misdn_answer(), misdn_call(), misdn_cfg_get(), misdn_cfg_get_desc(), misdn_cfg_get_name(), misdn_check_l2l1(), misdn_digit_end(), misdn_facility_exec(), misdn_hangup(), misdn_new(), misdn_request(), misdn_send_text(), misdn_set_opt_exec(), mkif(), mkintf(), nbs_alloc(), nbs_new(), netconsole(), notify_new_message(), 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(), parse_config(), parse_moved_contact(), parse_naptr(), parse_ok_contact(), parse_register_contact(), ParseBookmark(), 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_record_review(), populate_defaults(), process_dahdi(), process_message(), process_precache(), process_sdp(), profile_set_param(), proxy_allocate(), queue_set_param(), quote(), rcv_mac_addr(), read_agent_config(), read_config(), read_config_maps(), realtime_odbc(), realtime_peer(), realtime_switch_common(), realtime_update_peer(), receive_ademco_contact_id(), record_exec(), reg_source_db(), register_exten(), register_peer_exten(), register_verify(), registry_rerequest(), reload(), reload_agents(), reload_config(), reload_followme(), reload_queue_rules(), reload_queues(), remap_feature(), remove_from_queue(), reply_digest(), reqprep(), reset_user_pw(), respprep(), ring_entry(), rpt(), rpt_call(), rpt_exec(), rpt_master(), rpt_telemetry(), rt_handle_member_record(), run_externnotify(), search_directory(), select_entry(), sendmail(), sendpage(), serial_remote_io(), set(), set_c_e_p(), set_callforwards(), set_config(), set_destination(), set_ext_pri(), set_fn(), set_insecure_flags(), set_one_cid(), setrbi(), setup_incoming_call(), setup_privacy_args(), shared_read(), show_entry_history(), sip_new(), sip_notify(), sip_park(), sip_poke_peer(), sip_prepare_socket(), 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_load(), smdi_msg_read(), smdi_read(), sms_exec(), sms_handleincoming(), sms_handleincoming_proto2(), 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(), store_odbc(), substring(), temp_peer(), term_color(), term_prompt(), timeout_read(), timezone_add(), transmit_callinfo(), transmit_cfwdstate(), transmit_connect_with_sdp(), transmit_dialednumber(), transmit_displaymessage(), transmit_displaynotify(), transmit_displaypromptstatus(), transmit_modify_with_sdp(), transmit_notify_request(), transmit_notify_request_with_callerid(), transmit_refer(), transmit_state_notify(), try_calling(), try_load_key(), trylock_read(), txt_callback(), unistim_request(), unistim_sp(), unistim_ss(), unlock_read(), unregister_exten(), update_call_counter(), update_common_options(), update_status(), uridecode(), vars2manager(), vm_authenticate(), vm_change_password(), vm_change_password_shell(), vm_execmain(), vmauthenticate(), wait_for_answer(), and write_metadata().

00308 :

int ast_false ( const char *  val  ) 

Make sure something is false. 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".

Return values:
0 if val is a NULL pointer.
-1 if "true".
0 otherwise.

Definition at line 1219 of file utils.c.

References ast_strlen_zero().

Referenced by __ast_rtp_reload(), __ast_udptl_reload(), aji_create_client(), aji_load_config(), build_peer(), build_user(), dahdi_set_dnd(), func_channel_write(), handle_common_options(), init_acf_query(), load_config(), load_odbc_config(), reload(), reload_config(), run_agi(), set_config(), set_insecure_flags(), sla_build_trunk(), and strings_to_mask().

01220 {
01221    if (ast_strlen_zero(s))
01222       return 0;
01224    /* Determine if this is a false value */
01225    if (!strcasecmp(s, "no") ||
01226        !strcasecmp(s, "false") ||
01227        !strcasecmp(s, "n") ||
01228        !strcasecmp(s, "f") ||
01229        !strcasecmp(s, "0") ||
01230        !strcasecmp(s, "off"))
01231       return -1;
01233    return 0;
01234 }

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

get values from config variables.

Definition at line 1623 of file utils.c.

References ast_strlen_zero().

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

01624 {
01625    long t;
01626    int scanned;
01628    if (dst == NULL)
01629       return -1;
01631    *dst = _default;
01633    if (ast_strlen_zero(src))
01634       return -1;
01636    /* only integer at the moment, but one day we could accept more formats */
01637    if (sscanf(src, "%30ld%n", &t, &scanned) == 1) {
01638       *dst = t;
01639       if (consumed)
01640          *consumed = scanned;
01641       return 0;
01642    } else
01643       return -1;
01644 }

int ast_get_timeval ( const char *  src,
struct timeval *  tv,
struct timeval  _default,
int *  consumed 

get values from config variables.

Definition at line 1596 of file utils.c.

References ast_strlen_zero().

Referenced by acf_strftime().

01597 {
01598    long double dtv = 0.0;
01599    int scanned;
01601    if (dst == NULL)
01602       return -1;
01604    *dst = _default;
01606    if (ast_strlen_zero(src))
01607       return -1;
01609    /* only integer at the moment, but one day we could accept more formats */
01610    if (sscanf(src, "%30Lf%n", &dtv, &scanned) > 0) {
01611       dst->tv_sec = dtv;
01612       dst->tv_usec = (dtv - dst->tv_sec) * 1000000.0;
01613       if (consumed)
01614          *consumed = scanned;
01615       return 0;
01616    } else
01617       return -1;
01618 }

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

Definition at line 1342 of file utils.c.

Referenced by __ast_cli_generator(), ast_agi_register(), ast_agi_unregister(), cli_console_sendtext(), console_sendtext(), find_best(), handle_cli_agi_show(), handle_help(), help1(), help_workhorse(), set_full_cmd(), and write_htmldump().

01343 {
01344    int x, ofs = 0;
01345    const char *src;
01347    /* Join words into a string */
01348    if (!s)
01349       return;
01350    for (x = 0; ofs < len && w[x]; x++) {
01351       if (x > 0)
01352          s[ofs++] = ' ';
01353       for (src = w[x]; *src && ofs < len; src++)
01354          s[ofs++] = *src;
01355    }
01356    if (ofs == len)
01357       ofs--;
01358    s[ofs] = '\0';
01359 }

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

char * ast_skip_nonblanks ( char *  str  )  [inline]

Gets a pointer to first whitespace character in a string.

ast_skip_noblanks function being used
  • str the input string
a pointer to the first whitespace character

Definition at line 119 of file strings.h.

References ast_skip_blanks(), and ast_trim_blanks().

Referenced by __ast_cli_register(), determine_firstline_parts(), handle_response(), and httpd_helper_thread().

00133 {

int ast_str_append ( struct ast_str **  buf,
size_t  max_len,
const char *  fmt,
) [inline]

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 719 of file strings.h.

Referenced by moh_class_hash(), and queue_hash_cb().

00720 {
00721    int hash = 5381;
00723    while (*str) {
00724       hash = hash * 33 ^ tolower(*str++);
00725    }
00727    return abs(hash);
00728 }

struct ast_str *attribute_malloc ast_str_create ( size_t  init_len  )  [read]

Create a malloc'ed dynamic length string.

  • init_len This is the initial length of the string buffer
This function returns a pointer to the dynamic string length. The result will be NULL in the case of a memory allocation error.
The result of this function is dynamically allocated memory, and must be free()'d after it is no longer needed.

Definition at line 385 of file strings.h.

References buf.

Referenced by ast_http_error(), config_curl(), config_text_file_load(), destroy_curl(), destroy_pgsql(), generic_http_callback(), handle_dbget(), httpstatus_callback(), iax_parse_ies(), init_queue(), leave_voicemail(), load_column_config(), load_config(), odbc_log(), pgsql_reconnect(), phoneprov_callback(), queue_set_param(), realtime_curl(), realtime_ldap_base_ap(), realtime_multi_curl(), sqlite3_log(), store_curl(), store_pgsql(), substitute_escapes(), update_curl(), update_ldap(), and userevent_exec().

00392 {

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.

Definition at line 702 of file strings.h.

Referenced by entry_hash_fn(), group_hash_fn(), peer_hash_cb(), profile_hash_fn(), pvt_hash_cb(), routes_hash_fn(), and user_hash_cb().

00703 {
00704    int hash = 5381;
00706    while (*str)
00707       hash = hash * 33 ^ *str++;
00709    return abs(hash);
00710 }

int ast_str_make_space ( struct ast_str **  buf,
size_t  new_len 
) [inline]

Make space in a new string (e.g. to read in data from a file)

Definition at line 438 of file strings.h.

Referenced by __ast_str_helper(), ast_str_get_encoded_str(), and handle_dbget().

00441 {                 \

void ast_str_reset ( struct ast_str buf  )  [inline]

Reset the content of a dynamic string. Useful before a series of ast_str_append.

Definition at line 399 of file strings.h.

Referenced by action_userevent(), build_peer(), and detect_disconnect().

00420 {

int ast_str_set ( struct ast_str **  buf,
size_t  max_len,
const char *  fmt,
) [inline]

Set a dynamic string using variable arguments.

  • buf This is the address of a pointer to a struct ast_str which should have been retrieved using ast_str_thread_get. It will need to be updated in the case that the buffer has to be reallocated to accomodate a longer string than what it currently has space for.
  • max_len This is the maximum length to allow the string buffer to grow to. If this is set to 0, then there is no maximum length. If set to -1, we are bound to the current maximum length.
  • fmt This is the format string (printf style)
The return value of this function is the same as that of the printf family of functions.
All the rest is the same as ast_str_set_va()

Definition at line 671 of file strings.h.

References ast_str_append_va.

Referenced by __manager_event(), __queues_show(), action_createconfig(), ast_http_error(), ast_str_get_encoded_str(), build_peer(), check_auth(), cli_match_char_tree(), config_curl(), dahdi_new(), destroy_curl(), destroy_pgsql(), handle_call_token(), handle_cli_core_show_translation(), iax_parse_ies(), init_queue(), leave_voicemail(), load_column_config(), log_jack_status(), log_match_char_tree(), odbc_log(), pgsql_reconnect(), queue_set_param(), realtime_curl(), realtime_multi_curl(), store_curl(), store_pgsql(), transmit_fake_auth_response(), and update_curl().

00682 {

struct ast_str * ast_str_thread_get ( struct ast_threadstorage ts,
size_t  init_len 
) [read]

Retrieve a thread locally stored dynamic string.

  • ts This is a pointer to the thread storage structure declared by using the AST_THREADSTORAGE macro. If declared with AST_THREADSTORAGE(my_buf, my_buf_init), then this argument would be (&my_buf).
  • init_len This is the initial length of the thread's dynamic string. The current length may be bigger if previous operations in this thread have caused it to increase.
This function will return the thread locally stored dynamic string associated with the thread storage management variable passed as the first argument. The result will be NULL in the case of a memory allocation error.
Example usage:
 AST_THREADSTORAGE(my_str, my_str_init);
 #define MY_STR_INIT_SIZE   128
 void my_func(const char *fmt, ...)
      struct ast_str *buf;

      if (!(buf = ast_str_thread_get(&my_str, MY_STR_INIT_SIZE)))

Definition at line 501 of file strings.h.

References ast_str::len, ast_str::ts, and ast_str::used.

Referenced by __manager_event(), action_userevent(), ast_agi_send(), ast_cli(), ast_log(), ast_verbose(), astman_append(), check_auth(), pbx_find_extension(), system_exec_helper(), and transmit_fake_auth_response().

00506 {

char * ast_strip ( char *  s  )  [inline]

Strip leading/trailing whitespace from a string.

ast_strip function ast_strip being used.
  • s The string to be stripped (will be modified).
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 139 of file strings.h.

Referenced by acf_if(), ast_register_file_version(), ast_strip_quoted(), build_profile(), check_blacklist(), config_text_file_load(), eivr_comm(), load_column_config(), load_config(), parse_cookies(), process_text_line(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), reload_config(), and set().

00158 :

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

Strip leading/trailing whitespace and quotes from a string.

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.
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.


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

Definition at line 1100 of file utils.c.

References ast_strip().

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

01101 {
01102    char *e;
01103    char *q;
01105    s = ast_strip(s);
01106    if ((q = strchr(beg_quotes, *s)) && *q != '\0') {
01107       e = s + strlen(s) - 1;
01108       if (*e == *(end_quotes + (q - beg_quotes))) {
01109          s++;
01110          *e = '\0';
01111       }
01112    }
01114    return s;
01115 }

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

Definition at line 48 of file strings.h.

Referenced by __ast_callerid_generate(), __ast_channel_alloc_ap(), __ast_cli_generator(), __ast_cli_register(), __ast_http_load(), __ast_pbx_run(), __ast_request_and_dial(), __has_voicemail(), __iax2_show_peers(), __init_manager(), __oh323_new(), __queues_show(), __ssl_setup(), _macro_exec(), _sip_show_peer(), _sip_show_peers(), _while_exec(), acf_channel_read(), acf_curl_exec(), acf_if(), acf_import(), acf_isexten_exec(), acf_mailbox_exists(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_strptime(), acf_version_exec(), acf_vmcount_exec(), action_add_agi_cmd(), action_agent_logoff(), action_agents(), action_bridge(), action_challenge(), action_command(), action_coresettings(), action_coreshowchannels(), action_corestatus(), action_dahdidialoffhook(), action_dahdidndoff(), action_dahdidndon(), action_dahdishowchannels(), action_extensionstate(), action_getconfig(), action_getconfigjson(), action_getvar(), action_hangup(), action_listcategories(), action_mailboxcount(), action_mailboxstatus(), action_meetmelist(), action_originate(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), action_transfer(), action_transferhangup(), action_updateconfig(), action_waitevent(), add_agent(), add_calltoken_ignore(), add_peer_mailboxes(), add_realm_authentication(), add_sdp(), add_sip_domain(), admin_exec(), adsi_exec(), adsi_message(), advanced_options(), agent_call(), agent_devicestate(), agent_hangup(), agent_logoff_maintenance(), agent_new(), agent_read(), agent_request(), agents_show(), agents_show_online(), agi_exec_full(), aji_log_hook(), aji_send_exec(), alarmreceiver_exec(), alsa_new(), answer_exec_enable(), app_exec(), append_mailbox_mapping(), append_transaction(), apply_general_options(), apply_options_full(), apply_outgoing(), apply_peer(), aqm_exec(), ast_add_extension2_lockopt(), ast_app_getdata(), ast_app_getdata_full(), 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_cdr_serialize_variables(), ast_cdr_setaccount(), ast_cli_complete(), ast_context_remove_extension_callerid2(), ast_db_gettree(), ast_dnsmgr_get(), ast_dnsmgr_lookup(), ast_explicit_goto(), ast_false(), ast_feature_request_and_dial(), ast_frame_dump(), ast_get_encoded_char(), ast_get_group(), ast_get_indication_zone(), ast_get_time_t(), ast_get_timeval(), ast_iax2_new(), ast_include_new(), ast_is_valid_string(), ast_jb_read_conf(), ast_linear_stream(), ast_load_realtime(), ast_makesocket(), ast_module_check(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_odbc_sanity_check(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_privacy_set(), ast_readconfig(), ast_remotecontrol(), ast_speech_unregister(), ast_stream_and_wait(), ast_true(), ast_tzset(), ast_variable_delete(), ast_variable_update(), astman_get_variables(), astman_send_response_full(), async_wait(), asyncgoto_exec(), attempt_thread(), auth_exec(), authenticate(), authenticate_reply(), authenticate_verify(), autoanswer_complete(), background_detect_exec(), base64_decode(), base64_encode(), begin_dial_channel(), bridge_exec(), build_contact(), build_device(), build_gateway(), build_mapping(), build_peer(), build_profile(), build_reply_digest(), build_route(), build_rpid(), build_user(), builtin_atxfer(), builtin_automixmonitor(), 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_admin_exec(), channel_spy(), check_access(), check_auth(), check_blacklist(), check_goto_on_transfer(), check_peer_ok(), check_sip_domain(), check_user_full(), check_user_ok(), cleaned_basedn(), cli_console_dial(), cli_console_sendtext(), close_client(), common_exec(), compare(), compile_script(), conf_exec(), conf_run(), config_curl(), config_ldap(), config_module(), config_text_file_load(), console_dial(), console_new(), console_sendtext(), controlplayback_exec(), copy_all_header(), copy_header(), copy_rules(), copy_via_headers(), count_exec(), create_addr(), create_addr_from_peer(), create_queue_member(), create_vmaccount(), csv_log(), csv_quote(), custom_log(), custom_prepare(), dahdi_call(), dahdi_handle_event(), dahdi_hangup(), dahdi_new(), database_increment(), deltree_exec(), destroy_endpoint(), destroy_pgsql(), destroy_station(), destroy_trans(), destroy_trunk(), device_state_cb(), devstate_write(), dial_exec_full(), dial_trunk(), dialgroup_read(), dialgroup_refreshdb(), dialgroup_write(), dialout(), dictate_exec(), directory_exec(), disa_exec(), do_directory(), do_forward(), do_immediate_setup(), do_message(), do_monitor(), do_parking_thread(), do_pause_or_unpause(), dump_agents(), dump_cause(), dump_hint(), dumpchan_exec(), dundi_exec(), dundi_flags2str(), dundi_helper(), dundi_hint2str(), dundi_lookup_local(), dundi_query_read(), dundi_query_thread(), dundi_result_read(), dundi_show_mappings(), dundi_show_peer(), dundifunc_read(), enable_jack_hook(), enum_callback(), enum_query_read(), enum_result_read(), env_write(), exec_exec(), execif_exec(), export_ch(), extenspy_exec(), extract_uri(), extstate_read(), fast_originate(), feature_exec_app(), feature_interpret_helper(), festival_exec(), fileexists_core(), find_account(), find_call(), find_cli(), find_engine(), find_line_by_name(), find_queue_by_name_rt(), find_sdp(), find_sip_method(), forkcdr_exec(), forward_message(), ftype2mtype(), 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_gosub(), function_macro(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), 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(), get_transport_str2enum(), gosub_exec(), gosubif_exec(), goto_exten(), 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_cli_devstate_change(), handle_cli_dialplan_save(), handle_cli_file_convert(), handle_cli_iax2_show_cache(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_users(), handle_cli_realtime_pgsql_status(), handle_cli_rpt_stats(), handle_command_response(), handle_controlstreamfile(), handle_exec(), handle_getvariable(), handle_incoming(), handle_options(), handle_orig(), handle_queue_pause_member(), handle_queue_rule_show(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_options(), handle_request_refer(), handle_request_subscribe(), handle_response(), handle_response_invite(), handle_response_refer(), handle_response_register(), handle_saydatetime(), handle_show_dialplan(), handle_soft_key_event_message(), handle_speechrecognize(), handle_stimulus_message(), handle_updates(), handle_voicemail_show_users(), has_voicemail(), hint_read(), httpd_helper_thread(), iax2_call(), iax2_datetime(), iax2_devicestate(), iax2_prov_app(), iax2_request(), iax_check_version(), iax_firmware_append(), iax_provflags2str(), ices_exec(), iconv_read(), iftime(), inboxcount(), init_acf_query(), init_jack_data(), initreqprep(), insert_penaltychange(), inspect_module(), is_argument(), is_prefix(), isAnsweringMachine(), isexten_function_read(), jack_exec(), jb_choose_impl(), jingle_create_candidates(), jingle_new(), key_dial_page(), key_main_page(), launch_asyncagi(), launch_monitor_thread(), launch_netscript(), ldap_reconnect(), ldap_table_config_add_attribute(), leave_voicemail(), load_column_config(), load_config(), load_module(), load_moh_classes(), load_odbc_config(), load_rpt_vars(), load_values_config(), local_ast_moh_start(), log_events(), log_exec(), logger_print_normal(), login_exec(), loopback_parse(), lua_get_variable(), lua_get_variable_value(), main(), make_dir(), make_email_file(), make_filename(), make_logchannel(), manager_add_queue_member(), manager_dbdel(), manager_dbdeltree(), manager_dbget(), manager_dbput(), manager_iax2_show_peer_list(), manager_iax2_show_peers(), manager_jabber_send(), manager_list_voicemail_users(), manager_modulecheck(), manager_park(), manager_parking_status(), manager_pause_queue_member(), manager_play_dtmf(), manager_queue_log_custom(), manager_queue_member_penalty(), manager_queue_rule_show(), manager_queues_status(), manager_queues_summary(), manager_remove_queue_member(), manager_show_dialplan(), manager_show_dialplan_helper(), manager_show_registry(), manager_sip_show_peer(), manager_sip_show_peers(), matchcid(), math(), md5(), meetmemute(), message_template_find(), message_template_parse_filebody(), mgcp_call(), mgcp_hangup(), mgcp_new(), mgcp_request(), mgcp_ss(), mgcpsock_read(), milliwatt_exec(), minivm_accmess_exec(), minivm_account_func_read(), minivm_counter_func_read(), minivm_counter_func_write(), minivm_delete_exec(), minivm_greet_exec(), minivm_notify_exec(), minivm_record_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(), monitor_dial(), morsecode_exec(), mp3_exec(), mwi_sub_event_cb(), nbs_alloc(), next_channel(), notify_message(), notify_new_message(), odbc_log(), oh323_call(), oh323_request(), onedigit_goto(), orig_app(), orig_exten(), osp_auth(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_call(), oss_new(), page_exec(), park_call_full(), park_exec(), park_space_reserve(), parkandannounce_exec(), parse(), parse_config(), parse_cookies(), parse_dial_string(), parse_minse(), parse_register_contact(), parse_request(), parse_session_expires(), parse_sip_options(), parse_uri(), ParseBookmark(), 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_saynumber(), pbx_builtin_setvar(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_checkcondition(), pbx_exec(), pbx_load_users(), pbx_parseable_goto(), pbx_substitute_variables_helper_full(), peer_mailboxes_to_str(), pgsql_reconnect(), phone_call(), phone_new(), phoneprov_callback(), pickup_exec(), pickupchan_exec(), play_file(), play_mailbox_owner(), play_message_callerid(), play_message_category(), play_message_datetime(), play_moh_exec(), playback_exec(), poll_subscribed_mailboxes(), port_str2int(), post_cdr(), pp_each_user_exec(), pqm_exec(), prep_email_sub_vars(), print_ext(), privacy_exec(), proc_422_rsp(), process_ast_dsp(), process_dahdi(), process_echocancel(), process_message(), process_sdp(), process_text_line(), process_token(), proxy_allocate(), ql_exec(), queue_exec(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), queue_mwi_event(), queue_reload_request(), quit_handler(), quote(), rcv_mac_addr(), rcvfax_exec(), read_agent_config(), read_config(), read_exec(), readexten_exec(), readfile_exec(), real_ctx(), realtime_curl(), realtime_exec(), realtime_ldap_entry_to_var(), realtime_ldap_result_to_vars(), realtime_ldap_status(), realtime_multi_curl(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), realtime_update_peer(), receive_ademco_contact_id(), record_exec(), register_exten(), register_peer_exten(), register_verify(), registry_rerequest(), reload(), reload_config(), reload_followme(), reload_queue_members(), reload_queues(), replace_cid(), reply_digest(), reqprep(), requirecalltoken_mark_auto(), respprep(), retrydial_exec(), ring_entry(), rotate_file(), rpt_exec(), rqm_exec(), run_agi(), run_externnotify(), say_periodic_announcement(), SendDialTone(), senddtmf_exec(), sendimage_exec(), sendmail(), sendurl_exec(), set(), set_agentbycallerid(), set_bridge_features_on_config(), set_callforwards(), set_config(), set_insecure_flags(), set_local_info(), set_member_paused(), set_member_penalty(), set_moh_exec(), set_nonce_randdata(), set_one_cid(), setup_dahdi(), setup_incoming_call(), setup_privacy_args(), sha1(), shared_read(), shared_write(), shell_helper(), show_main_page(), sip_addheader(), sip_hangup(), sip_new(), sip_poke_peer(), sip_prepare_socket(), sip_register(), sip_request_call(), sip_show_channel(), sip_show_settings(), 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_build_station(), sla_build_trunk(), sla_check_device(), sla_queue_event_conf(), sla_ring_station(), sla_station_exec(), sla_trunk_exec(), smdi_msg_read(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), 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(), substituted(), sysinfo_helper(), system_exec_helper(), telem_lookup(), testclient_exec(), testserver_exec(), transfer_exec(), transmit_cfwdstate(), 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(), try_suggested_sip_codec(), tryexec_exec(), unalloc_sub(), unistim_new(), unistim_request(), unistim_send_mwi_to_peer(), unregister_exten(), update_bridge_vars(), update_call_counter(), update_realtime_member_field(), update_registry(), upqm_exec(), uridecode(), uriencode(), usbradio_new(), userevent_exec(), valid_exit(), verbose_exec(), vm_authenticate(), vm_box_exists(), vm_exec(), vm_execmain(), vm_newuser(), vm_options(), vmauthenticate(), vmu_tm(), wait_for_answer(), wait_for_hangup(), wait_for_winner(), waituntil_exec(), word_match(), xml_translate(), and zapateller_exec().

00049 {
00050    return (!s || (*s == '\0'));
00051 }

char * ast_trim_blanks ( char *  str  )  [inline]

Trims trailing whitespace characters from a string.

ast_skip_blanks function being used
  • str the input string
a pointer to the modified string

Definition at line 104 of file strings.h.

Referenced by ast_callerid_parse(), ast_skip_nonblanks(), determine_firstline_parts(), do_say(), httpd_helper_thread(), pbx_load_config(), and xml_translate().

00114 {

int ast_true ( const char *  val  ) 

Make sure something is true. 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".

Return values:
0 if val is a NULL pointer.
-1 if "true".
0 otherwise.

Definition at line 1202 of file utils.c.

References ast_strlen_zero().

Referenced by __ast_http_load(), __ast_rtp_reload(), __ast_udptl_reload(), __init_manager(), _parse(), action_agent_logoff(), action_bridge(), action_originate(), action_updateconfig(), aji_create_client(), aji_load_config(), apply_general_options(), apply_option(), apply_outgoing(), ast_jb_read_conf(), ast_readconfig(), build_device(), build_gateway(), build_peer(), build_user(), dahdi_set_dnd(), do_reload(), do_timelimit(), festival_exec(), func_channel_write(), func_inheritance_write(), function_ilink(), get_encrypt_methods(), gtalk_load_config(), handle_common_options(), handle_t38_options(), init_logger_chain(), jingle_load_config(), load_config(), load_config_meetme(), load_module(), load_modules(), load_moh_classes(), load_odbc_config(), load_rpt_vars(), local_ast_moh_start(), login_exec(), manager_add_queue_member(), manager_pause_queue_member(), message_template_build(), misdn_answer(), odbc_load_module(), osp_load(), parse_config(), pbx_load_config(), pbx_load_users(), process_dahdi(), process_echocancel(), queue_set_param(), read_agent_config(), reload(), reload_config(), reload_queues(), run_startup_commands(), search_directory(), set_active(), set_config(), sla_load_config(), smdi_load(), start_monitor_action(), strings_to_mask(), and update_common_options().

01203 {
01204    if (ast_strlen_zero(s))
01205       return 0;
01207    /* Determine if this is a true value */
01208    if (!strcasecmp(s, "yes") ||
01209        !strcasecmp(s, "true") ||
01210        !strcasecmp(s, "y") ||
01211        !strcasecmp(s, "t") ||
01212        !strcasecmp(s, "1") ||
01213        !strcasecmp(s, "on"))
01214       return -1;
01216    return 0;
01217 }

char* ast_unescape_c ( char *  s  ) 

Convert some C escape sequences.

into the equivalent characters. The string to be converted (will be modified).
The converted string.

Definition at line 1136 of file utils.c.

01137 {
01138    char c, *ret, *dst;
01140    if (src == NULL)
01141       return NULL;
01142    for (ret = dst = src; (c = *src++); *dst++ = c ) {
01143       if (c != '\\')
01144          continue;   /* copy char at the end of the loop */
01145       switch ((c = *src++)) {
01146       case '\0':  /* special, trailing '\' */
01147          c = '\\';
01148          break;
01149       case 'b':   /* backspace */
01150          c = '\b';
01151          break;
01152       case 'f':   /* form feed */
01153          c = '\f';
01154          break;
01155       case 'n':
01156          c = '\n';
01157          break;
01158       case 'r':
01159          c = '\r';
01160          break;
01161       case 't':
01162          c = '\t';
01163          break;
01164       }
01165       /* default, use the char literally */
01166    }
01167    *dst = '\0';
01168    return ret;
01169 }

char* ast_unescape_semicolon ( char *  s  ) 

Strip backslash for "escaped" semicolons, the string to be stripped (will be modified).

The stripped string.

Definition at line 1117 of file utils.c.

Referenced by sip_notify().

01118 {
01119    char *e;
01120    char *work = s;
01122    while ((e = strchr(work, ';'))) {
01123       if ((e > work) && (*(e-1) == '\\')) {
01124          memmove(e - 1, e, strlen(e) + 1);
01125          work = e;
01126       } else {
01127          work = e + 1;
01128       }
01129    }
01131    return s;
01132 }

Generated on Wed Oct 28 11:46:21 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6