tear the hell out of everything and rip it up into itsy bitsy pieces and put it all back together

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5765 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-09-29 01:06:08 +00:00
parent 834b17948f
commit ffb989e435
42 changed files with 886 additions and 532 deletions
+3 -3
View File
@@ -151,9 +151,7 @@ struct switch_runtime {
FILE *console;
uint8_t running;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
uint32_t no_new_sessions;
uint32_t shutting_down;
uint32_t crash_prot;
uint32_t flags;
};
extern struct switch_runtime runtime;
@@ -161,5 +159,7 @@ extern struct switch_runtime runtime;
void switch_core_sqldb_start(switch_memory_pool_t *pool);
void switch_core_sqldb_stop(void);
void switch_core_session_init(switch_memory_pool_t *pool);
void switch_core_session_uninit(void);
void switch_core_state_machine_init(switch_memory_pool_t *pool);
switch_memory_pool_t *switch_core_memory_init(void);
void switch_core_memory_stop(void);
+2
View File
@@ -43,6 +43,8 @@
#define SWITCH_END_EXTERN_C
#endif
#ifndef WIN32
#include <switch_am_config.h>
#endif
+10 -2
View File
@@ -133,6 +133,7 @@ SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_siz
/** @} */
#if 0
/**
* @defgroup apr_hash Hash Tables
* @ingroup switch_apr
@@ -184,6 +185,15 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht)
*/
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key, switch_ssize_t *klen, void **val);
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht);
/** @} */
#endif
/**
* The default hash function.
* @param key pointer to the key.
@@ -192,9 +202,7 @@ SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key
*/
SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen);
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht);
/** @} */
/**
* @defgroup switch_time Time Routines
* @ingroup switch_apr
+3 -10
View File
@@ -203,15 +203,6 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel);
*/
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value);
/*!
\brief Set a variable on a given channel, without duplicating the value from the session pool.
\param channel channel to set variable on
\param varname the name of the variable
\param value the vaule of the variable (MUST BE ALLOCATED FROM THE SESSION POOL ALREADY)
\returns SWITCH_STATUS_SUCCESS if successful
*/
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_nodup(switch_channel_t *channel, const char *varname, char *value);
/*!
\brief Retrieve a variable from a given channel
\param channel channel to retrieve variable from
@@ -227,7 +218,9 @@ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, co
* pool is NULL, then an internal, non-thread-safe iterator is used.
* @remark Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables
*/
SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel);
SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel);
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
/*!
+9 -8
View File
@@ -43,14 +43,15 @@
SWITCH_BEGIN_EXTERN_C
#define SWITCH_CMD_CHUNK_LEN 1024
#define SWITCH_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); if ((s.data = malloc(SWITCH_CMD_CHUNK_LEN))) { \
memset(s.data, 0, SWITCH_CMD_CHUNK_LEN); \
s.end = s.data;\
s.data_size = SWITCH_CMD_CHUNK_LEN;\
s.write_function = switch_console_stream_write;\
s.alloc_len = SWITCH_CMD_CHUNK_LEN;\
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN;\
}
#define SWITCH_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = malloc(SWITCH_CMD_CHUNK_LEN); \
assert(s.data); \
memset(s.data, 0, SWITCH_CMD_CHUNK_LEN); \
s.end = s.data; \
s.data_size = SWITCH_CMD_CHUNK_LEN; \
s.write_function = switch_console_stream_write; \
s.alloc_len = SWITCH_CMD_CHUNK_LEN; \
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN
/*!
\brief A simple comand loop that reads input from the terminal
*/
+19 -24
View File
@@ -230,18 +230,20 @@ SWITCH_DECLARE(void) switch_core_port_allocator_destroy(switch_core_port_allocat
/*!
\brief Initilize the core
\param console optional FILE stream for output
\param flags core flags
\param err a pointer to set any errors to
\note to be called at application startup
*/
SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, const char **err);
SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_core_flag_t flags, const char **err);
/*!
\brief Initilize the core and load modules
\param console optional FILE stream for output
\param flags core flags
\param err a pointer to set any errors to
\note to be called at application startup instead of switch_core_init. Includes module loading.
*/
SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(const char *console, const char **err);
SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(const char *console, switch_core_flag_t flags, const char **err);
/*!
\brief Set/Get Session Limit
@@ -326,6 +328,7 @@ SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_tab
SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handler(int index);
///\}
SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
///\defgroup memp Memory Pooling/Allocation
///\ingroup core1
@@ -334,13 +337,14 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handl
\brief Create a new sub memory pool from the core's master pool
\return SWITCH_STATUS_SUCCESS on success
*/
SWITCH_DECLARE(switch_status_t) switch_core_new_memory_pool(switch_memory_pool_t **pool);
#define switch_core_new_memory_pool(p) switch_core_perform_new_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
/*!
\brief Returns a subpool back to the main pool
\return SWITCH_STATUS_SUCCESS on success
*/
SWITCH_DECLARE(switch_status_t) switch_core_destroy_memory_pool(switch_memory_pool_t **pool);
#define switch_core_destroy_memory_pool(p) switch_core_perform_destroy_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
/*!
\brief Start the session's state machine
@@ -831,7 +835,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t ** hash, swi
\param hash the hash to destroy
\return SWITCH_STATUS_SUCCESS if the hash is destroyed
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t * hash);
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash);
/*!
\brief Insert data into a hash
@@ -854,25 +858,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t * hash, co
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t * hash, const char *key, const void *data, switch_mutex_t *mutex);
/*!
\brief Insert data into a hash with dynamicly allocated key name
\param hash the hash to add data to
\param key the name of the key to add the data to
\param data the data to add
\return SWITCH_STATUS_SUCCESS if the data is added
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t * hash, const char *key, const void *data);
/*!
\brief Insert data into a hash with dynamicly allocated key name
\param hash the hash to add data to
\param key the name of the key to add the data to
\param data the data to add
\param mutex optional mutex to lock
\return SWITCH_STATUS_SUCCESS if the data is added
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_locked(switch_hash_t * hash, const char *key, const void *data, switch_mutex_t *mutex);
/*!
\brief Delete data from a hash based on desired key
\param hash the hash to delete from
@@ -908,6 +893,10 @@ SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t * hash, const char *k
*/
SWITCH_DECLARE(void *) switch_core_hash_find_locked(switch_hash_t * hash, const char *key, switch_mutex_t *mutex);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, switch_hash_t *hash);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *hi);
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val);
///\}
///\defgroup timer Timer Functions
@@ -1393,6 +1382,12 @@ SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel_t channel);
*/
SWITCH_DECLARE(switch_bool_t) switch_core_ready(void);
/*!
\brief return core flags
\return core flags
*/
SWITCH_DECLARE(switch_core_flag_t) switch_core_flags(void);
/*!
\brief Execute a management operation.
\param relative_oid the relative oid of the operation.
+2
View File
@@ -174,6 +174,8 @@ SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
SWITCH_DECLARE(switch_status_t) switch_event_del_header(switch_event_t *event, const char *header_name);
/*!
\brief Destroy an event
\param event pointer to the pointer to event to destroy
+13 -1
View File
@@ -37,6 +37,7 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C
#define SWITCH_BLANK_STRING ""
#define SWITCH_SEQ_ESC "\033["
/* Ansi Control character suffixes */
#define SWITCH_SEQ_HOME_CHAR 'H'
@@ -123,8 +124,15 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_SPEECH_KEY "speech"
#define SWITCH_UUID_BRIDGE "uuid_bridge"
#define SWITCH_BITS_PER_BYTE 8
typedef uint8_t switch_byte_t;
typedef uint8_t switch_byte_t;
typedef enum {
SCF_NONE = 0,
SCF_USE_SQL = ( 1 << 0),
SCF_NO_NEW_SESSIONS = (1 << 1),
SCF_SHUTTING_DOWN = (1 << 2),
SCF_CRASH_PROT = (1 << 3)
} switch_core_flag_t;
typedef enum {
SWITCH_ENDPOINT_INTERFACE,
@@ -1087,6 +1095,10 @@ typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
const char *tag_name, const char *key_name, const char *key_value, const char *params,
void *user_data);
typedef struct switch_hash switch_hash_t;
struct HashElem;
typedef struct HashElem switch_hash_index_t;
#define SWITCH_API_VERSION 1
#define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)