RTS API Documentation  1.10.11
Macros | Functions
Memory Pooling/Allocation
+ Collaboration diagram for Memory Pooling/Allocation:

Macros

#define switch_core_new_memory_pool(p)   switch_core_perform_new_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
 Create a new sub memory pool from the core's master pool. More...
 
#define switch_core_destroy_memory_pool(p)   switch_core_perform_destroy_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
 Returns a subpool back to the main pool. More...
 
#define switch_core_permanent_alloc(_memory)   switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)
 Allocate memory from the main pool with no intention of returning it. More...
 
#define switch_core_alloc(_pool, _mem)   switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
 Allocate memory directly from a memory pool. More...
 
#define switch_core_session_alloc(_session, _memory)   switch_core_perform_session_alloc(_session, _memory, __FILE__, __SWITCH_FUNC__, __LINE__)
 Allocate memory from a session's pool. More...
 
#define switch_core_permanent_strdup(_todup)   switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)
 Copy a string using permanent memory allocation. More...
 
#define switch_core_session_strdup(_session, _todup)   switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
 Copy a string using memory allocation from a session's pool. More...
 
#define switch_core_strdup(_pool, _todup)   switch_core_perform_strdup(_pool, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
 Copy a string using memory allocation from a given pool. More...
 
#define switch_core_strndup(_pool, _todup, _len)   switch_core_perform_strndup(_pool, _todup, _len, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Functions

int switch_core_session_sync_clock (void)
 
switch_status_t switch_core_perform_destroy_memory_pool (_Inout_ switch_memory_pool_t **pool, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
void switch_core_memory_pool_set_data (switch_memory_pool_t *pool, const char *key, void *data)
 
void * switch_core_memory_pool_get_data (switch_memory_pool_t *pool, const char *key)
 
void switch_core_session_run (_In_ switch_core_session_t *session)
 Start the session's state machine. More...
 
unsigned int switch_core_session_running (_In_ switch_core_session_t *session)
 determine if the session's state machine is running More...
 
unsigned int switch_core_session_started (_In_ switch_core_session_t *session)
 
void * switch_core_perform_permanent_alloc (_In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
void * switch_core_perform_alloc (_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
_Ret_ void * switch_core_perform_session_alloc (_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file, const char *func, int line)
 
char * switch_core_perform_permanent_strdup (_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
char * switch_core_perform_session_strdup (_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
char * switch_core_perform_strdup (_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
char * switch_core_perform_strndup (_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, size_t len, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
 
char * switch_core_session_sprintf (_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt,...)
 printf-style style printing routine. The data is output to a string allocated from the session More...
 
char * switch_core_session_vsprintf (switch_core_session_t *session, const char *fmt, va_list ap)
 printf-style style printing routine. The data is output to a string allocated from the session More...
 
char * switch_core_sprintf (_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt,...)
 printf-style style printing routine. The data is output to a string allocated from the pool More...
 
char * switch_core_vsprintf (switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, va_list ap)
 printf-style style printing routine. The data is output to a string allocated from the pool More...
 
switch_memory_pool_tswitch_core_session_get_pool (_In_ switch_core_session_t *session)
 Retrieve the memory pool from a session. More...
 

Detailed Description

Macro Definition Documentation

◆ switch_core_alloc

#define switch_core_alloc (   _pool,
  _mem 
)    switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)

Allocate memory directly from a memory pool.

Parameters
_poolthe memory pool to allocate from
_memthe number of bytes to allocate
Remarks
the memory returned has been memset to zero
Returns
a void pointer to the allocated memory

Definition at line 684 of file switch_core.h.

Referenced by _switch_cache_db_get_db_handle(), add_uuid(), check_queue(), create_device_record(), create_handle(), dtls_bio_filter_new(), dtls_bio_filter_write(), find_free_frame(), header_callback(), msrp_listener(), new_job(), new_node(), process_device_hup(), record_helper_create(), recording_thread(), rtcp_stats_init(), switch_agc_create(), switch_buffer_create(), switch_buffer_create_partition(), switch_caller_extension_clone(), switch_caller_profile_dup(), switch_caller_profile_new(), switch_channel_alloc(), switch_channel_bind_device_state_handler(), switch_channel_set_originator_caller_profile(), switch_channel_set_profile_var(), switch_core_codec_add_implementation(), switch_core_codec_add_video_implementation(), switch_core_file_handle_dup(), switch_core_launch_thread(), switch_core_media_add_payload_map(), switch_core_perform_file_open(), switch_core_port_allocator_new(), switch_core_session_findall_matching_var(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_vars_ans(), switch_core_session_request_uuid(), switch_core_speech_read_tts(), switch_core_url_encode_opt(), switch_dial_handle_add_leg_list(), switch_dial_handle_create(), switch_dial_handle_list_create(), switch_dial_leg_list_add_leg(), switch_escape_char(), switch_escape_string_pool(), switch_find_parameter(), switch_frame_buffer_create(), switch_img_txt_handle_create(), switch_ivr_bg_media(), switch_ivr_digit_stream_parser_new(), switch_ivr_dmachine_bind(), switch_ivr_dmachine_create(), switch_ivr_menu_bind_action(), switch_ivr_menu_bind_function(), switch_ivr_menu_init(), switch_ivr_menu_stack_xml_add(), switch_ivr_menu_stack_xml_init(), switch_ivr_record_session_event(), switch_jb_create(), switch_live_array_add_alias(), switch_live_array_create(), switch_load_core_config(), switch_loadable_module_build_dynamic(), switch_loadable_module_create_module_interface(), switch_loadable_module_load_file(), switch_loadable_module_load_module_ex(), switch_loadable_module_process(), switch_log_bind_logger(), switch_media_handle_create(), switch_msrp_session_new(), switch_msrp_start_client(), switch_network_list_add_host_port_mask(), switch_network_list_create(), switch_network_list_perform_add_cidr_token(), switch_rtp_add_crypto_key(), switch_rtp_add_dtls(), switch_rtp_create(), switch_rtp_get_stats(), switch_rtp_text_factory_create(), switch_speex_init(), switch_sql_queue_manager_init_name(), switch_system_thread(), switch_util_quote_shell_arg_pool(), switch_xml_bind_search_function_ret(), switch_xml_free_in_thread(), timer_generic_sync(), timer_init(), and xswitch_http_request().

◆ switch_core_destroy_memory_pool

#define switch_core_destroy_memory_pool (   p)    switch_core_perform_destroy_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)

Returns a subpool back to the main pool.

Returns
SWITCH_STATUS_SUCCESS on success

Definition at line 642 of file switch_core.h.

Referenced by check_queue(), EventConsumer::cleanup(), destroy_handle(), destroy_thread(), do_shutdown(), dtls_bio_filter_free(), IVRMenu::IVRMenu(), main(), msrp_listener(), msrp_worker(), preprocess_stun_set(), record_helper_create(), record_helper_destroy(), sql_in_thread(), switch_agc_destroy(), switch_channel_clear_device_record(), switch_console_save_history(), switch_core_asr_close(), switch_core_asr_open(), switch_core_codec_destroy(), switch_core_destroy(), switch_core_directory_close(), switch_core_file_close(), switch_core_file_handle_dup(), switch_core_media_deinit(), switch_core_perform_file_open(), switch_core_port_allocator_destroy(), switch_core_port_allocator_new(), switch_core_session_findall_matching_var(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_vars_ans(), switch_core_session_perform_destroy(), switch_core_session_thread_pool_worker(), switch_core_speech_close(), switch_core_timer_destroy(), switch_dial_handle_destroy(), switch_dial_handle_list_destroy(), switch_directory_exists(), switch_file_exists(), switch_frame_buffer_destroy(), switch_img_txt_handle_create(), switch_img_txt_handle_destroy(), switch_ivr_digit_stream_parser_destroy(), switch_ivr_digit_stream_parser_new(), switch_ivr_dmachine_destroy(), switch_ivr_enterprise_originate(), switch_ivr_menu_init(), switch_ivr_menu_stack_free(), switch_ivr_originate(), switch_jb_destroy(), switch_live_array_destroy(), switch_load_network_lists(), switch_load_timezones(), switch_loadable_module_build_dynamic(), switch_loadable_module_exec(), switch_loadable_module_load_file(), switch_loadable_module_shutdown(), SWITCH_MODULE_SHUTDOWN_FUNCTION(), switch_scheduler_task_thread_stop(), switch_sql_queue_manager_destroy(), switch_ssl_destroy_ssl_locks(), switch_stun_ip_lookup(), switch_system_thread(), system_thread(), task_own_thread(), and test_port().

◆ switch_core_new_memory_pool

#define switch_core_new_memory_pool (   p)    switch_core_perform_new_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)

Create a new sub memory pool from the core's master pool.

Returns
SWITCH_STATUS_SUCCESS on success

Definition at line 633 of file switch_core.h.

Referenced by check_queue(), create_device_record(), create_handle(), dtls_bio_filter_new(), EventConsumer::EventConsumer(), IVRMenu::IVRMenu(), main(), msrp_listener(), new_job(), preprocess_stun_set(), record_helper_create(), switch_agc_create(), switch_console_save_history(), switch_core_asr_open(), switch_core_codec_init_with_bitrate(), switch_core_directory_open(), switch_core_file_handle_dup(), switch_core_launch_thread(), switch_core_media_init(), switch_core_perform_file_open(), switch_core_port_allocator_new(), switch_core_session_findall_matching_var(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_vars_ans(), switch_core_session_request_uuid(), switch_core_speech_open(), switch_core_timer_init(), switch_dial_handle_create(), switch_dial_handle_list_create(), switch_directory_exists(), switch_file_exists(), switch_frame_buffer_create(), switch_img_txt_handle_create(), switch_ivr_bg_media(), switch_ivr_digit_stream_parser_new(), switch_ivr_dmachine_create(), switch_ivr_enterprise_originate(), switch_ivr_menu_init(), switch_ivr_menu_stack_xml_init(), switch_ivr_originate(), switch_jb_create(), switch_live_array_create(), switch_load_network_lists(), switch_load_timezones(), switch_loadable_module_build_dynamic(), switch_loadable_module_init(), switch_loadable_module_load_file(), switch_msrp_init(), switch_network_list_create(), switch_scheduler_task_thread_start(), switch_sql_queue_manager_init_name(), switch_ssl_init_ssl_locks(), switch_stun_ip_lookup(), switch_system_thread(), switch_xml_free_in_thread(), task_thread_loop(), and test_port().

◆ switch_core_permanent_alloc

#define switch_core_permanent_alloc (   _memory)    switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)

Allocate memory from the main pool with no intention of returning it.

Parameters
_memorythe number of bytes to allocate
Returns
a void pointer to the allocated memory
Note
this memory never goes out of scope until the core is destroyed

Definition at line 671 of file switch_core.h.

◆ switch_core_permanent_strdup

#define switch_core_permanent_strdup (   _todup)    switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)

Copy a string using permanent memory allocation.

Parameters
_todupthe string to duplicate
Returns
a pointer to the newly duplicated string

Definition at line 707 of file switch_core.h.

Referenced by console_xml_config(), and switch_core_mime_add_type().

◆ switch_core_session_alloc

#define switch_core_session_alloc (   _session,
  _memory 
)    switch_core_perform_session_alloc(_session, _memory, __FILE__, __SWITCH_FUNC__, __LINE__)

Allocate memory from a session's pool.

Parameters
_sessionthe session to request memory from
_memorythe amount of memory to allocate
Returns
a void pointer to the newly allocated memory
Note
the memory will be in scope as long as the session exists

Definition at line 696 of file switch_core.h.

Referenced by check_channel_status(), check_jitter(), check_stream_changes(), hanguphook(), send_display(), switch_caller_extension_add_application(), switch_caller_extension_new(), switch_channel_perform_audio_sync(), switch_channel_perform_video_sync(), switch_channel_set_app_flag_key(), switch_channel_set_caller_profile(), switch_channel_set_flag_value(), switch_core_media_bug_add(), switch_core_media_copy_t38_options(), switch_core_media_crypto_append_key_material(), switch_core_media_negotiate_sdp(), switch_core_media_patch_sdp(), switch_core_media_process_udptl(), switch_core_session_exec(), switch_core_session_execute_exten(), switch_core_session_raw_read(), switch_core_session_request_xml(), switch_core_session_thread_pool_launch(), switch_ivr_activate_unicast(), switch_ivr_bind_dtmf_meta_session(), switch_ivr_broadcast_in_thread(), switch_ivr_detect_speech_init(), switch_ivr_displace_session(), switch_ivr_eavesdrop_exec_all(), switch_ivr_eavesdrop_session(), switch_ivr_eavesdrop_update_display(), switch_ivr_inband_dtmf_generate_session(), switch_ivr_inband_dtmf_session(), switch_ivr_multi_threaded_bridge(), switch_ivr_play_and_collect_input(), switch_ivr_preprocess_session(), switch_ivr_session_audio(), switch_ivr_set_user_xml(), switch_ivr_speak_text(), switch_ivr_tone_detect_session(), switch_ivr_video_write_overlay_session(), switch_media_handle_create(), video_bug_thread(), video_helper_thread(), and video_write_thread().

◆ switch_core_session_strdup

#define switch_core_session_strdup (   _session,
  _todup 
)    switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)

Copy a string using memory allocation from a session's pool.

Parameters
_sessiona session to use for allocation
_todupthe string to duplicate
Returns
a pointer to the newly duplicated string

Definition at line 719 of file switch_core.h.

Referenced by check_channel_status(), check_ice(), do_api_on(), exec_app(), gen_ice(), play_and_detect_input_callback(), record_helper_post_process(), send_display(), signal_bridge_on_hibernate(), switch_caller_extension_add_application(), switch_caller_extension_new(), switch_channel_caller_extension_masquerade(), switch_channel_execute_on_value(), switch_channel_export_variable_var_check(), switch_channel_get_hold_music(), switch_channel_get_variable_dup(), switch_channel_get_variable_partner(), switch_channel_handle_cause(), switch_channel_process_export(), switch_channel_queue_dtmf_string(), switch_channel_set_caller_profile(), switch_channel_set_device_id(), switch_channel_set_flag_value(), switch_channel_set_name(), switch_core_media_absorb_sdp(), switch_core_media_add_ice_acl(), switch_core_media_bug_add(), switch_core_media_choose_port(), switch_core_media_copy_t38_options(), switch_core_media_crypto_append_key_material(), switch_core_media_ext_address_lookup(), switch_core_media_gen_local_sdp(), switch_core_media_negotiate_sdp(), switch_core_media_prepare_codecs(), switch_core_media_process_sdp_filter(), switch_core_media_process_t38_passthru(), switch_core_media_process_udptl(), switch_core_media_proxy_remote_addr(), switch_core_media_recover_session(), switch_core_media_set_codec(), switch_core_media_set_local_sdp(), switch_core_media_set_video_codec(), switch_core_session_check_incoming_crypto(), switch_core_session_exec(), switch_core_session_execute_application_async(), switch_core_session_execute_exten(), switch_core_session_get_recovery_crypto_key(), switch_core_session_get_text_buffer(), switch_core_session_outgoing_channel(), switch_core_session_perform_receive_message(), switch_core_session_reporting_state(), switch_core_session_request_xml(), switch_core_session_send_dtmf_string(), switch_core_session_set_external_id(), switch_core_session_thread(), switch_core_standard_on_routing(), switch_ivr_activate_unicast(), switch_ivr_bind_dtmf_meta_session(), switch_ivr_displace_session(), switch_ivr_eavesdrop_exec_all(), switch_ivr_eavesdrop_session(), switch_ivr_eavesdrop_update_display(), switch_ivr_enterprise_orig_and_bridge(), switch_ivr_intercept_session(), switch_ivr_menu_execute(), switch_ivr_multi_threaded_bridge(), switch_ivr_orig_and_bridge(), switch_ivr_parse_event(), switch_ivr_phrase_macro_event(), switch_ivr_play_file(), switch_ivr_record_file_event(), switch_ivr_say(), switch_ivr_say_ip(), switch_ivr_set_user_extended(), switch_ivr_tone_detect_session(), switch_play_and_get_digits(), switch_process_import(), and transfer_after_bridge().

◆ switch_core_strdup

#define switch_core_strdup (   _pool,
  _todup 
)    switch_core_perform_strdup(_pool, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)

Copy a string using memory allocation from a given pool.

Parameters
_poolthe pool to use for allocation
_todupthe string to duplicate
Returns
a pointer to the newly duplicated string

Definition at line 733 of file switch_core.h.

Referenced by add_uuid(), check_bridge_export(), create_device_record(), load_config(), msrp_worker(), new_job(), process_device_hup(), read_rtcp_packet(), switch_agc_set_token(), switch_caller_extension_clone(), switch_caller_profile_dup(), switch_caller_profile_new(), switch_channel_caller_extension_masquerade(), switch_channel_flip_cid(), switch_channel_pass_callee_id(), switch_channel_set_profile_var(), switch_core_asr_open(), switch_core_codec_add_implementation(), switch_core_codec_add_video_implementation(), switch_core_codec_init_with_bitrate(), switch_core_get_variable_pdup(), switch_core_media_add_payload_map(), switch_core_perform_file_open(), switch_core_port_allocator_new(), switch_core_session_execute_exten(), switch_core_session_findall_matching_var(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_vars_ans(), switch_core_session_set_uuid(), switch_core_speech_open(), switch_core_url_encode_opt(), switch_dial_leg_list_add_leg(), switch_img_txt_handle_create(), switch_img_txt_handle_render(), switch_ivr_bg_media(), switch_ivr_dmachine_bind(), switch_ivr_dmachine_check_match(), switch_ivr_dmachine_create(), switch_ivr_dmachine_set_terminators(), switch_ivr_enterprise_originate(), switch_ivr_menu_bind_action(), switch_ivr_menu_bind_function(), switch_ivr_menu_init(), switch_ivr_menu_stack_xml_add(), switch_ivr_menu_stack_xml_build(), switch_ivr_originate(), switch_ivr_record_session_event(), switch_ivr_session_transfer(), switch_ivr_uuid_bridge(), switch_live_array_add_alias(), switch_live_array_create(), switch_load_core_config(), switch_load_timezones(), switch_loadable_module_build_dynamic(), switch_loadable_module_create_module_interface(), switch_loadable_module_load_file(), switch_loadable_module_load_module_ex(), switch_loadable_module_process(), switch_msrp_session_new(), switch_network_list_create(), switch_network_list_perform_add_cidr_token(), switch_pool_strip_whitespace(), switch_rtp_activate_ice(), switch_rtp_change_ice_dest(), switch_rtp_create(), switch_rtp_new(), switch_rtp_set_local_address(), switch_rtp_set_remote_address(), switch_sql_queue_manager_init_name(), switch_stun_host_lookup(), switch_stun_ip_lookup(), switch_stun_lookup(), switch_system_thread(), switch_xml_config_parse_event(), and xswitch_http_request().

◆ switch_core_strndup

#define switch_core_strndup (   _pool,
  _todup,
  _len 
)    switch_core_perform_strndup(_pool, _todup, _len, __FILE__, __SWITCH_FUNC__, __LINE__)

Definition at line 735 of file switch_core.h.

Function Documentation

◆ switch_core_memory_pool_get_data()

void* switch_core_memory_pool_get_data ( switch_memory_pool_t pool,
const char *  key 
)

Definition at line 322 of file switch_core_memory.c.

Referenced by handle_rfc2833(), rtcp_generate_report_block(), rtcp_generate_sender_info(), rtcp_stats(), rtcp_stats_init(), switch_core_codec_init_with_bitrate(), and switch_rtp_create().

323 {
324  void *data = NULL;
325 
326  fspr_pool_userdata_get(&data, key, pool);
327 
328  return data;
329 }
switch_memory_pool_t * pool
char * key
Definition: switch_msrp.c:64

◆ switch_core_memory_pool_set_data()

void switch_core_memory_pool_set_data ( switch_memory_pool_t pool,
const char *  key,
void *  data 
)

Definition at line 317 of file switch_core_memory.c.

Referenced by switch_core_session_request_uuid(), and switch_thread_create().

318 {
319  fspr_pool_userdata_set(data, key, NULL, pool);
320 }
switch_memory_pool_t * pool
char * key
Definition: switch_msrp.c:64

◆ switch_core_perform_alloc()

void* switch_core_perform_alloc ( _In_ switch_memory_pool_t pool,
_In_ switch_size_t  memory,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_destroy_memory_pool()

switch_status_t switch_core_perform_destroy_memory_pool ( _Inout_ switch_memory_pool_t **  pool,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_permanent_alloc()

void* switch_core_perform_permanent_alloc ( _In_ switch_size_t  memory,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_permanent_strdup()

char* switch_core_perform_permanent_strdup ( _In_z_ const char *  todup,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_session_alloc()

_Ret_ void* switch_core_perform_session_alloc ( _In_ switch_core_session_t session,
_In_ switch_size_t  memory,
const char *  file,
const char *  func,
int  line 
)

◆ switch_core_perform_session_strdup()

char* switch_core_perform_session_strdup ( _In_ switch_core_session_t session,
_In_z_ const char *  todup,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_strdup()

char* switch_core_perform_strdup ( _In_ switch_memory_pool_t pool,
_In_z_ const char *  todup,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_perform_strndup()

char* switch_core_perform_strndup ( _In_ switch_memory_pool_t pool,
_In_z_ const char *  todup,
size_t  len,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line 
)

◆ switch_core_session_get_pool()

switch_memory_pool_t* switch_core_session_get_pool ( _In_ switch_core_session_t session)

Retrieve the memory pool from a session.

Parameters
sessionthe session to retrieve the pool from
Returns
the session's pool
Note
to be used sparingly

Referenced by audio_bridge_thread(), audio_write_thread(), early_thread_run(), inband_dtmf_generate_callback(), launch_collect_thread(), preprocess_callback(), record_callback(), setup_ringback(), switch_caller_profile_clone(), switch_channel_get_variable_dup(), switch_core_media_activate_rtp(), switch_core_media_bug_add(), switch_core_media_bug_patch_spy_frame(), switch_core_media_ext_address_lookup(), switch_core_media_gen_local_sdp(), switch_core_media_negotiate_sdp(), switch_core_media_set_codec(), switch_core_media_set_video_codec(), switch_core_media_set_video_file(), switch_core_session_read_text_frame(), switch_core_session_request_xml(), switch_core_session_start_audio_write_thread(), switch_core_session_start_text_thread(), switch_core_session_start_video_thread(), switch_core_session_thread(), switch_core_session_url_encode(), switch_core_session_url_encode_opt(), switch_core_session_write_video_frame(), switch_core_standard_on_hangup(), switch_ivr_activate_unicast(), switch_ivr_broadcast_in_thread(), switch_ivr_collect_digits_count(), switch_ivr_delay_echo(), switch_ivr_detect_audio(), switch_ivr_detect_silence(), switch_ivr_detect_speech_init(), switch_ivr_displace_session(), switch_ivr_eavesdrop_session(), switch_ivr_gentones(), switch_ivr_insert_file(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_play_file(), switch_ivr_record_file_event(), switch_ivr_record_session_event(), switch_ivr_sleep(), switch_ivr_sound_test(), switch_ivr_speak_text(), switch_ivr_wait_for_answer(), switch_ivr_wait_for_silence(), switch_media_handle_create(), SWITCH_STANDARD_APP(), unicast_thread_launch(), and video_write_thread().

◆ switch_core_session_run()

void switch_core_session_run ( _In_ switch_core_session_t session)

Start the session's state machine.

Parameters
sessionthe session on which to start the state machine

Referenced by switch_core_session_thread().

◆ switch_core_session_running()

unsigned int switch_core_session_running ( _In_ switch_core_session_t session)

determine if the session's state machine is running

Parameters
sessionthe session on which to check

Referenced by switch_channel_perform_hangup(), and switch_ivr_originate().

◆ switch_core_session_sprintf()

char* switch_core_session_sprintf ( _In_ switch_core_session_t session,
_In_z_ _Printf_format_string_ const char *  fmt,
  ... 
)

◆ switch_core_session_started()

unsigned int switch_core_session_started ( _In_ switch_core_session_t session)

◆ switch_core_session_sync_clock()

int switch_core_session_sync_clock ( void  )

Definition at line 1509 of file switch_core_session.c.

References runtime, SCF_SYNC_CLOCK_REQUESTED, switch_session_manager::session_count, switch_runtime::session_hash_mutex, session_manager, switch_mutex_lock(), switch_mutex_unlock(), switch_set_flag, and switch_time_sync().

Referenced by switch_core_session_ctl().

1510 {
1511  int doit = 0;
1512 
1514  if (session_manager.session_count == 0) {
1515  doit = 1;
1516  } else {
1518  }
1520 
1521  if (doit) {
1522  switch_time_sync();
1523  }
1524 
1525  return doit;
1526 
1527 }
void switch_time_sync(void)
Definition: switch_time.c:609
struct switch_session_manager session_manager
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:700
struct switch_runtime runtime
Definition: switch_core.c:86
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
Definition: switch_apr.c:313
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
Definition: switch_apr.c:308
switch_mutex_t * session_hash_mutex

◆ switch_core_session_vsprintf()

char* switch_core_session_vsprintf ( switch_core_session_t session,
const char *  fmt,
va_list  ap 
)

printf-style style printing routine. The data is output to a string allocated from the session

Parameters
sessiona session to use for allocation
fmtThe format of the string
apThe arguments to use while printing the data
Returns
The new string

Definition at line 192 of file switch_core_memory.c.

References switch_core_session::pool, and switch_core_vsprintf().

193 {
194  return switch_core_vsprintf(session->pool, fmt, ap);
195 }
int cJSON_bool fmt
Definition: switch_cJSON.h:150
switch_memory_pool_t * pool
char * switch_core_vsprintf(switch_memory_pool_t *pool, const char *fmt, va_list ap)

◆ switch_core_sprintf()

char* switch_core_sprintf ( _In_ switch_memory_pool_t pool,
_In_z_ _Printf_format_string_ const char *  fmt,
  ... 
)

◆ switch_core_vsprintf()

char* switch_core_vsprintf ( switch_memory_pool_t pool,
_In_z_ _Printf_format_string_ const char *  fmt,
va_list  ap 
)

printf-style style printing routine. The data is output to a string allocated from the pool

Parameters
poola pool to use for allocation
fmtThe format of the string
apThe arguments to use while printing the data
Returns
The new string