RTS API Documentation  1.10.11
switch_core_pvt.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  * Andrey Volk <andywolk@gmail.com>
28  *
29  *
30  * switch_core.h -- Core Library Private Data (not to be installed into the system)
31  * If the last line didn't make sense, stop reading this file, go away!,
32  * this file does not exist!!!!
33  *
34  */
35 #include "switch_profile.h"
36 
37 #ifndef WIN32
38 #include <switch_private.h>
39 #endif
40 
41 #ifdef HAVE_MLOCKALL
42 #include <sys/mman.h>
43 #endif
44 
45 #ifdef HAVE_NETDB_H
46 #include <netdb.h>
47 #endif
48 
49 #ifndef WIN32
50 /* setuid, setgid */
51 #include <unistd.h>
52 
53 /* getgrnam, getpwnam */
54 #include <pwd.h>
55 #include <grp.h>
56 
57 #ifdef HAVE_SYS_RESOURCE_H
58 #include <sys/resource.h>
59 #endif
60 #endif
61 
62 /* #define DEBUG_ALLOC */
63 #define DO_EVENTS
64 
65 #define SWITCH_EVENT_QUEUE_LEN 256
66 #define SWITCH_MESSAGE_QUEUE_LEN 256
67 
68 #define SWITCH_BUFFER_BLOCK_FRAMES 25
69 #define SWITCH_BUFFER_START_FRAMES 50
70 
71 typedef enum {
72  SSF_NONE = 0,
73  SSF_DESTROYED = (1 << 0),
74  SSF_WARN_TRANSCODE = (1 << 1),
75  SSF_HANGUP = (1 << 2),
76  SSF_THREAD_STARTED = (1 << 3),
77  SSF_THREAD_RUNNING = (1 << 4),
78  SSF_READ_TRANSCODE = (1 << 5),
79  SSF_WRITE_TRANSCODE = (1 << 6),
82  SSF_DESTROYABLE = (1 << 9),
85 
94 
102 
108 
111 
120 
123 
126 
137  uint32_t stack_count;
138 
144 
150 
153  uint32_t track_duration;
154  uint32_t track_id;
156  uint32_t soft_lock;
159 
161  uint32_t decoder_errors;
168 
172  const char *external_id;
173 };
174 
188  void *user_data;
189  uint32_t flags;
190  uint8_t ready;
193  time_t stop_time;
195  char *function;
196  char *target;
207  switch_queue_t *spy_video_queue[2];
208  switch_image_t *spy_img[2];
211 
214  uint32_t text_framesize;
217 };
218 
219 typedef enum {
223 
227  int64_t offset;
235  FILE *console;
236  uint8_t running;
238  uint32_t flags;
245  uint32_t sps_total;
246  int32_t sps;
247  int32_t sps_last;
248  int32_t sps_peak;
250  int32_t sessions_peak;
253  char *mailer_app;
259  char dummy_data[5];
261  char *odbc_dsn;
262  char *dbname;
263  uint32_t debug_level;
264  uint32_t runlevel;
265  uint32_t tipping_point;
268  int32_t timer_affinity;
270  double profile_time;
273  char hostname[256];
274  char *switchname;
276  uint32_t max_db_handles;
280  uint32_t time_sync;
290 };
291 
292 extern struct switch_runtime runtime;
293 
294 
298  uint32_t session_count;
299  uint32_t session_limit;
304  int running;
305  int busy;
306 };
307 
309 
310 
311 
312 switch_status_t switch_core_sqldb_init(const char **err);
313 void switch_core_sqldb_destroy(void);
315 void switch_core_sqldb_stop(void);
317 void switch_core_session_uninit(void);
320 void switch_core_memory_stop(void);
switch_mutex_t * codec_init_mutex
switch_frame_t * write_replace_frame_out
switch_memory_pool_t * switch_core_memory_init(void)
#define SWITCH_MAX_STREAMS
Definition: switch_core.h:48
uint32_t min_dtmf_duration
char * core_db_inner_post_trans_execute
switch_audio_resampler_t * write_resampler
switch_frame_t dummy_cng_frame
switch_codec_implementation_t read_impl
Image Descriptor.
Definition: switch_image.h:88
switch_queue_t * event_queue
switch_thread_rwlock_t * bug_rwlock
switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage)
switch_thread_id_t thread_id
switch_frame_t * read_replace_frame_in
switch_time_t initiated
uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
switch_mutex_t * codec_write_mutex
switch_session_flag_t flags
switch_frame_t enc_read_frame
int32_t timer_affinity
switch_queue_t * thread_queue
switch_buffer_t * raw_write_buffer
char * core_db_post_trans_execute
switch_mutex_t * stack_count_mutex
#define SWITCH_RECOMMENDED_BUFFER_SIZE
Definition: switch_types.h:594
void switch_core_memory_stop(void)
uint32_t record_pre_buffer_count
switch_mutex_t * codec_read_mutex
switch_bool_t
Definition: switch_types.h:441
switch_bool_t(* switch_media_bug_callback_t)(switch_media_bug_t *, void *, switch_abc_type_t)
const char * external_id
uint32_t max_audio_channels
switch_codec_t * video_read_codec
switch_codec_t * read_codec
Representation of an event.
Definition: switch_event.h:80
switch_codec_t * real_read_codec
void * streams[SWITCH_MAX_STREAMS]
void switch_core_session_init(switch_memory_pool_t *pool)
switch_queue_t * read_video_queue
switch_thread_rwlock_t * global_var_rwlock
switch_core_session_t * session
switch_codec_implementation_t video_read_impl
switch_codec_t * video_write_codec
switch_event_t * global_vars
switch_buffer_t * raw_write_buffer
switch_codec_implementation_t video_write_impl
switch_codec_implementation_t read_impl
switch_buffer_t * text_buffer
switch_mutex_t * throttle_mutex
switch_call_cause_t shutdown_cause
switch_queue_t * signal_data_queue
A table of i/o routines that an endpoint interface can implement.
#define SWITCH_MAX_STATE_HANDLERS
Definition: switch_types.h:596
switch_plc_state_t * plc
struct switch_runtime runtime
Definition: switch_core.c:86
uint32_t microseconds_per_tick
switch_thread_cond_t * cond
switch_buffer_t * text_buffer
switch_media_bug_callback_t callback
switch_media_handle_t * media_handle
switch_queue_t * write_video_queue
switch_io_event_hooks_t event_hooks
switch_mutex_t * read_mutex
switch_codec_implementation_t write_impl
switch_hash_t * ptimes
switch_queue_t * private_event_queue
switch_dbtype_t odbc_dbtype
int64_t switch_time_t
Definition: switch_apr.h:188
void * private_info[SWITCH_CORE_SESSION_MAX_PRIVATES]
int32_t sessions_peak_fivemin
switch_codec_implementation_t real_read_impl
char * event_channel_key_separator
switch_bool_t colorize_console
switch_channel_t * channel
switch_audio_resampler_t * read_resampler
switch_mutex_t * frame_read_mutex
switch_frame_t * ping_frame
uint8_t enc_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
void switch_core_session_uninit(void)
switch_thread_t * video_bug_thread
switch_dbtype_t
switch_thread_t * thread
switch_codec_t * write_codec
switch_frame_t * write_replace_frame_in
switch_core_video_thread_callback_func_t text_read_callback
switch_media_bug_t * bugs
switch_bool_t manage
switch_mutex_t * resample_mutex
switch_queue_t * message_queue
switch_hash_t * mime_type_exts
uint32_t event_heartbeat_interval
switch_mutex_t * text_mutex
switch_io_routines_t * io_override
An abstraction of a data frame.
Definition: switch_frame.h:54
uintptr_t switch_size_t
switch_thread_cond_t * cond
uint32_t db_handle_timeout
switch_frame_t * video_ping_frame
struct switch_media_bug * next
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_thread_rwlock_t * io_rwlock
pthread_t switch_thread_id_t
Definition: switch_apr.h:51
switch_mutex_t * session_hash_mutex
switch_buffer_t * raw_read_buffer
switch_memory_pool_t * memory_pool
switch_call_cause_t
switch_mutex_t * global_mutex
#define SWITCH_CORE_SESSION_MAX_PRIVATES
Definition: switch_types.h:239
switch_codec_t bug_codec
struct fspr_thread_mutex_t switch_mutex_t
Definition: switch_apr.h:314
switch_frame_t raw_read_frame
switch_codec_implementation_t write_impl
switch_hash_t * mime_types
An audio resampling handle.
switch_core_video_thread_callback_func_t video_read_callback
uint32_t max_dtmf_duration
switch_frame_t * native_write_frame
switch_queue_t * private_event_queue_pri
void * switch_plc_state_t
switch_time_t timestamp
switch_memory_pool_t * pool
switch_status_t
Common return values.
uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
switch_vid_spy_fmt_t
switch_hash_t * session_table
void switch_core_sqldb_stop(void)
uint32_t record_frame_size
switch_log_level_t hard_log_level
uint32_t default_dtmf_duration
struct switch_session_manager session_manager
uint32_t tipping_point
int32_t sps_peak_fivemin
switch_frame_t enc_write_frame
struct fspr_thread_cond_t switch_thread_cond_t
Definition: switch_apr.h:463
uint32_t max_db_handles
switch_status_t(* switch_core_video_thread_callback_func_t)(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
char * core_db_pre_trans_execute
uint32_t port_alloc_flags
switch_mutex_t * mutex
switch_ivr_dmachine_t * dmachine[2]
switch_mutex_t * uuid_mutex
switch_session_flag_t
switch_memory_pool_t * memory_pool
A table of settings and callbacks that define a paticular implementation of a codec.
switch_endpoint_interface_t * endpoint_interface
uint32_t debug_level
struct fspr_pool_t switch_memory_pool_t
switch_codec_t * real_write_codec
switch_log_level_t loglevel
uint8_t raw_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
uint32_t cpu_idle_smoothing_depth
switch_vid_spy_fmt_t spy_fmt
char * core_db_inner_pre_trans_execute
switch_slin_data_t * sdata
switch_thread_id_t thread_id
switch_buffer_t * raw_read_buffer
struct fspr_thread_t switch_thread_t
Definition: switch_apr.h:941
switch_frame_t * read_replace_frame_out
typedefSWITCH_BEGIN_EXTERN_C struct switch_io_event_hooks switch_io_event_hooks_t
switch_mutex_t * mutex
switch_frame_t raw_write_frame
void switch_core_state_machine_init(switch_memory_pool_t *pool)
switch_mutex_t * write_mutex
switch_frame_t * read_demux_frame
struct fspr_thread_rwlock_t switch_thread_rwlock_t
Definition: switch_apr.h:436
switch_thread_rwlock_t * rwlock
switch_status_t switch_core_sqldb_init(const char **err)
Definition: switch_core.c:2428
switch_buffer_t * text_line_buffer
switch_frame_t * native_read_frame
uint32_t record_pre_buffer_max
switch_app_log_t * app_log
switch_log_level_t
Log Level Enumeration.
switch_profile_timer_t * profile_timer
#define SWITCH_UUID_FORMATTED_LENGTH
Definition: switch_apr.h:545
switch_time_t reference
void switch_core_sqldb_destroy(void)
Definition: switch_core.c:3013