Asterisk - The Open Source Telephony Project GIT-master-67613d1
Macros | Functions
include/asterisk/compat.h File Reference

General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific issues especially those related to header files. More...

#include "asterisk/compiler.h"
#include <inttypes.h>
#include <limits.h>
#include <unistd.h>
#include <stdint.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <poll.h>
#include <errno.h>
#include <glob.h>
Include dependency graph for include/asterisk/compat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __STDC_VERSION__   0
 
#define INFINITY   (1.0/0.0)
 
#define LLONG_MAX   9223372036854775807LL
 
#define MY_GLOB_FLAGS   GLOB_NOCHECK
 
#define NAN   (0.0/0.0)
 
#define strlcat   __use__ast_str__functions_not__strlcat__
 
#define strlcpy   __use__ast_copy_string__not__strlcpy__
 

Functions

int asprintf (char **str, const char *fmt,...)
 
void closefrom (int lowfd)
 
int ffsll (long long n)
 
int getloadavg (double *list, int nelem)
 
uint64_t htonll (uint64_t host64)
 
char * mkdtemp (char *template_s)
 
uint64_t ntohll (uint64_t net64)
 
float roundf (float x)
 
int setenv (const char *name, const char *value, int overwrite)
 
char * strcasestr (const char *, const char *)
 
char * strndup (const char *, size_t)
 
size_t strnlen (const char *, size_t)
 
char * strsep (char **str, const char *delims)
 
uint64_t strtoq (const char *nptr, char **endptr, int base)
 
void timersub (struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff)
 
int unsetenv (const char *name)
 
int vasprintf (char **strp, const char *fmt, va_list ap)
 

Detailed Description

General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific issues especially those related to header files.

Definition in file include/asterisk/compat.h.

Macro Definition Documentation

◆ __STDC_VERSION__

#define __STDC_VERSION__   0

Definition at line 27 of file include/asterisk/compat.h.

◆ INFINITY

#define INFINITY   (1.0/0.0)

Definition at line 210 of file include/asterisk/compat.h.

◆ LLONG_MAX

#define LLONG_MAX   9223372036854775807LL

Definition at line 60 of file include/asterisk/compat.h.

◆ MY_GLOB_FLAGS

#define MY_GLOB_FLAGS   GLOB_NOCHECK

Definition at line 196 of file include/asterisk/compat.h.

◆ NAN

#define NAN   (0.0/0.0)

Definition at line 214 of file include/asterisk/compat.h.

◆ strlcat

#define strlcat   __use__ast_str__functions_not__strlcat__

Definition at line 127 of file include/asterisk/compat.h.

◆ strlcpy

#define strlcpy   __use__ast_copy_string__not__strlcpy__

Definition at line 128 of file include/asterisk/compat.h.

Function Documentation

◆ asprintf()

int asprintf ( char **  str,
const char *  fmt,
  ... 
)

Referenced by to_string(), and yyparse().

◆ closefrom()

void closefrom ( int  lowfd)

Referenced by ast_close_fds_above_n().

◆ ffsll()

int ffsll ( long long  n)

◆ getloadavg()

int getloadavg ( double *  list,
int  nelem 
)

◆ htonll()

uint64_t htonll ( uint64_t  host64)

Definition at line 390 of file strcompat.c.

391{
392#if BYTE_ORDER == BIG_ENDIAN
393 return host64;
394#elif BYTE_ORDER == LITTLE_ENDIAN
395 union {
396 unsigned char c[8];
397 uint64_t u;
398 } number;
399 number.u = host64;
400 return
401 (((uint64_t) number.c[0]) << 56) |
402 (((uint64_t) number.c[1]) << 48) |
403 (((uint64_t) number.c[2]) << 40) |
404 (((uint64_t) number.c[3]) << 32) |
405 (((uint64_t) number.c[4]) << 24) |
406 (((uint64_t) number.c[5]) << 16) |
407 (((uint64_t) number.c[6]) << 8) |
408 (((uint64_t) number.c[7]) << 0);
409#else
410 #error "Unknown byte order"
411#endif
412}
Number structure.
Definition: app_followme.c:154
static struct test_val c

References c.

Referenced by ast_websocket_write(), and iax_ie_append_versioned_uint64().

◆ mkdtemp()

char * mkdtemp ( char *  template_s)

◆ ntohll()

uint64_t ntohll ( uint64_t  net64)

Definition at line 364 of file strcompat.c.

365{
366#if BYTE_ORDER == BIG_ENDIAN
367 return net64;
368#elif BYTE_ORDER == LITTLE_ENDIAN
369 union {
370 unsigned char c[8];
371 uint64_t u;
372 } number;
373 number.u = net64;
374 return
375 (((uint64_t) number.c[0]) << 56) |
376 (((uint64_t) number.c[1]) << 48) |
377 (((uint64_t) number.c[2]) << 40) |
378 (((uint64_t) number.c[3]) << 32) |
379 (((uint64_t) number.c[4]) << 24) |
380 (((uint64_t) number.c[5]) << 16) |
381 (((uint64_t) number.c[6]) << 8) |
382 (((uint64_t) number.c[7]) << 0);
383#else
384 #error "Unknown byte order"
385#endif
386}

References c.

Referenced by ast_websocket_read(), dump_versioned_codec(), and iax_parse_ies().

◆ roundf()

float roundf ( float  x)

◆ setenv()

int setenv ( const char *  name,
const char *  value,
int  overwrite 
)

◆ strcasestr()

char * strcasestr ( const char *  ,
const char *   
)

◆ strndup()

char * strndup ( const char *  ,
size_t   
)

Referenced by __ast_repl_strndup().

◆ strnlen()

size_t strnlen ( const char *  ,
size_t   
)

◆ strsep()

char * strsep ( char **  str,
const char *  delims 
)

Referenced by __analog_ss_thread(), __ast_play_and_record(), __ast_sorcery_apply_config(), _ast_device_state(), acf_curl_helper(), acf_vmcount_exec(), action_command(), action_messagesend(), actual_load_config(), add_hintdevice(), add_menu_entry(), add_redirect(), adsi_load(), adsi_message(), ami_sip_qualify(), analog_ss_thread(), announce_to_dial(), append_ha_core(), append_mailbox(), append_mailbox_mapping(), apply_options(), apps_handler(), ari_channels_handle_originate_with_id(), ast_append_acl(), ast_ari_channels_create(), ast_ari_invoke(), ast_bridge_timelimit(), ast_build_timing(), ast_eivr_getvariable(), ast_eivr_setvariable(), ast_el_strtoarr(), ast_extension_state3(), ast_format_cap_update_by_allow_disallow(), ast_format_str_reduce(), ast_get_chan_applicationmap(), ast_get_group(), ast_get_namedgroups(), ast_http_get_auth(), ast_http_get_post_vars(), ast_http_header_parse(), ast_msg_send(), ast_parse_arg(), ast_parse_digest(), ast_playtones_start(), ast_presence_state_helper(), ast_read_image(), ast_refer_send(), ast_remotecontrol(), ast_sip_auth_vector_init(), ast_sip_for_each_aor(), ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), ast_sip_validate_uri_length(), ast_strings_match(), ast_utils_which(), ast_vector_string_split(), ast_websocket_uri_cb(), asterisk_publication_mailboxstate(), auth_exec(), authenticate_api_key(), authenticate_verify(), bridge_create_common(), build_calendar(), build_channels(), build_peer(), build_user(), chanavail_exec(), check_blacklist(), check_nonce(), cli_qualify(), cli_reload_qualify_endpoint(), cli_show_qualify_endpoint(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), conf_exec(), conf_run(), config_curl(), create_queue_member(), create_unsolicited_mwi_subscriptions(), cut_internal(), decrypt_frame(), deltree_exec(), dial_exec_full(), dial_trunk(), do_broadcast(), do_say(), dtmf_info_incoming_request(), dundi_exec(), eval_exten_read(), events_handler(), ewscal_write_event(), exec_exec(), expand_gosub_args(), extstate_read(), filehelper(), find_aor_for_resource(), find_aor_name(), find_body_generator_accept(), forward_message(), freq_parser(), function_fieldnum_helper(), function_fieldqty_helper(), function_ooh323_write(), geoloc_gml_list_to_xml(), get_mid_bundle_group(), get_range(), get_timerange(), global_loaded(), gosub_exec(), goto_parser(), h263_parse_sdp_fmtp(), h264_parse_sdp_fmtp(), handle_cli_dialplan_add_extension(), handle_debug_dialplan(), handle_show_dialplan(), handle_uri(), has_voicemail(), hint_read(), http_request_headers_get(), iax2_register(), ident_handler(), iftime(), inboxcount2(), init_logger_chain(), ip_identify_match_handler(), is_prefix(), ivr_dispatch(), jack_handler(), json_array_from_list(), json_decode_read(), leave_voicemail(), list_item_handler(), load_column_config(), load_values_config(), load_zonemessages(), make_components(), make_email_file(), man_do_variable_value(), manager_dialplan_extension_add(), manager_dialplan_extension_remove(), metermaidstate(), msg_send_exec(), mwi_contact_changed(), mwi_has_voicemail(), mwi_inboxcount(), mwi_on_aor(), mwi_to_event(), mwi_validate_for_aor(), notify_endpoint(), notify_new_message(), orig_app(), orig_exten(), origin_allowed(), originate_exec(), page_exec(), parse_cookies(), parse_data(), parse_dial_string(), parse_empty_options(), parse_line(), parse_node(), parse_tone_uri(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_saynumber(), pbx_builtin_sayordinal(), pbx_builtin_setvar(), pbx_find_extension(), pbx_load_config(), pbx_load_users(), pbx_parseable_goto(), permanent_uri_handler(), pickup_exec(), pickupchan_exec(), pjsip_acf_dial_contacts_read(), process_dahdi(), process_description_file(), process_text_line(), publisher_start(), queue_set_param(), realtime_curl(), realtime_multi_curl(), realtime_multi_mysql(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_mysql(), realtime_odbc(), realtime_pgsql(), register_peer_exten(), register_verify(), reload_config(), reload_module(), reload_queue_members(), res_sdp_crypto_parse_offer(), say_filenames(), search_directory_sub(), send_dial_tone(), send_unsolicited_mwi_notify(), sendfax_exec(), sendmail(), separate_mailbox(), set(), set_remote_mslabel_and_stream_group(), sip_options_synchronize_endpoint(), sla_add_trunk_to_station(), sla_check_device(), sla_queue_event_conf(), sla_ring_station(), sla_state(), sla_station_exec(), sorcery_config_open(), sorcery_memory_cache_open(), sorcery_realtime_open(), sort_internal(), spawn_mp3(), stat_read(), store_tone_zone_ring_cadence(), test_cel_peer_strings_match(), timezone_add(), tryexec_exec(), type_in_list(), user_event_hook_cb(), userevent_exec(), vmauthenticate(), write_htmldump(), xml_translate(), xmpp_client_authenticate_sasl(), xmpp_pubsub_handle_event(), and xmpp_send_cb().

◆ strtoq()

uint64_t strtoq ( const char *  nptr,
char **  endptr,
int  base 
)

◆ timersub()

void timersub ( struct timeval *  tvend,
struct timeval *  tvstart,
struct timeval *  tvdiff 
)

◆ unsetenv()

int unsetenv ( const char *  name)

Referenced by env_write(), and rxqcheck().

◆ vasprintf()

int vasprintf ( char **  strp,
const char *  fmt,
va_list  ap 
)