mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
Merge branch 'smgmaster' into releases.3.4
Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c
This commit is contained in:
@@ -240,6 +240,7 @@ struct switch_runtime {
|
||||
uint32_t debug_level;
|
||||
uint32_t runlevel;
|
||||
uint32_t tipping_point;
|
||||
uint32_t microseconds_per_tick;
|
||||
int32_t timer_affinity;
|
||||
switch_profile_timer_t *profile_timer;
|
||||
double profile_time;
|
||||
@@ -248,9 +249,12 @@ struct switch_runtime {
|
||||
int max_sql_buffer_len;
|
||||
switch_dbtype_t odbc_dbtype;
|
||||
char hostname[256];
|
||||
char *switchname;
|
||||
int multiple_registrations;
|
||||
uint32_t max_db_handles;
|
||||
uint32_t db_handle_timeout;
|
||||
int curl_count;
|
||||
int ssl_count;
|
||||
};
|
||||
|
||||
extern struct switch_runtime runtime;
|
||||
|
||||
@@ -725,12 +725,99 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** File types. */
|
||||
typedef enum {
|
||||
SWITCH_NOFILE = 0, /**< no file type determined */
|
||||
SWITCH_REG, /**< a regular file */
|
||||
SWITCH_DIR, /**< a directory */
|
||||
SWITCH_CHR, /**< a character device */
|
||||
SWITCH_BLK, /**< a block device */
|
||||
SWITCH_PIPE, /**< a FIFO / pipe */
|
||||
SWITCH_LNK, /**< a symbolic link */
|
||||
SWITCH_SOCK, /**< a [unix domain] socket */
|
||||
SWITCH_UNKFILE = 127 /**< a file of some other unknown type */
|
||||
} switch_filetype_e;
|
||||
|
||||
|
||||
/** Structure for referencing files. */
|
||||
typedef struct apr_file_t switch_file_t;
|
||||
|
||||
typedef int32_t switch_fileperms_t;
|
||||
typedef int switch_seek_where_t;
|
||||
|
||||
/**
|
||||
* Structure for determining user ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID switch_uid_t;
|
||||
#else
|
||||
typedef uid_t switch_uid_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Structure for determining group ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID switch_gid_t;
|
||||
#else
|
||||
typedef gid_t switch_gid_t;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
typedef uint32_t switch_dev_t;
|
||||
typedef uint64_t switch_ino_t;
|
||||
#else
|
||||
typedef ino_t switch_ino_t;
|
||||
typedef dev_t switch_dev_t;
|
||||
#endif
|
||||
typedef off64_t switch_off_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing file information
|
||||
*/
|
||||
//typedef struct apr_stat_t switch_finfo_t;
|
||||
typedef struct {
|
||||
/** Allocates memory and closes lingering handles in the specified pool */
|
||||
switch_memory_pool_t *pool;
|
||||
/** The bitmask describing valid fields of this switch_finfo_t structure
|
||||
* including all available 'wanted' fields and potentially more */
|
||||
int32_t valid;
|
||||
/** The access permissions of the file. Mimics Unix access rights. */
|
||||
switch_fileperms_t protection;
|
||||
/** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
|
||||
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
|
||||
* If the type cannot be determined, the value is APR_UNKFILE.
|
||||
*/
|
||||
switch_filetype_e filetype;
|
||||
/** The user id that owns the file */
|
||||
switch_uid_t user;
|
||||
/** The group id that owns the file */
|
||||
switch_gid_t group;
|
||||
/** The inode of the file. */
|
||||
switch_ino_t inode;
|
||||
/** The id of the device the file is on. */
|
||||
switch_dev_t device;
|
||||
/** The number of hard links to the file. */
|
||||
int32_t nlink;
|
||||
/** The size of the file */
|
||||
switch_off_t size;
|
||||
/** The storage size consumed by the file */
|
||||
switch_off_t csize;
|
||||
/** The time the file was last accessed */
|
||||
switch_time_t atime;
|
||||
/** The time the file was last modified */
|
||||
switch_time_t mtime;
|
||||
/** The time the file was created, or the inode was last changed */
|
||||
switch_time_t ctime;
|
||||
/** The pathname of the file (possibly unrooted) */
|
||||
const char *fname;
|
||||
/** The file's name (no path) in filesystem case */
|
||||
const char *name;
|
||||
/** The file's handle, if accessed (can be submitted to apr_duphandle) */
|
||||
switch_file_t *filehand;
|
||||
} switch_finfo_t;
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_seek_flags File Seek Flags
|
||||
* @{
|
||||
@@ -817,6 +904,37 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
|
||||
#define SWITCH_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup switch_file_stat flags
|
||||
* @ingroup switch_file_io
|
||||
* @{
|
||||
*/
|
||||
#define SWITCH_FINFO_LINK 0x00000001 /**< Stat the link not the file itself if it is a link */
|
||||
#define SWITCH_FINFO_MTIME 0x00000010 /**< Modification Time */
|
||||
#define SWITCH_FINFO_CTIME 0x00000020 /**< Creation or inode-changed time */
|
||||
#define SWITCH_FINFO_ATIME 0x00000040 /**< Access Time */
|
||||
#define SWITCH_FINFO_SIZE 0x00000100 /**< Size of the file */
|
||||
#define SWITCH_FINFO_CSIZE 0x00000200 /**< Storage size consumed by the file */
|
||||
#define SWITCH_FINFO_DEV 0x00001000 /**< Device */
|
||||
#define SWITCH_FINFO_INODE 0x00002000 /**< Inode */
|
||||
#define SWITCH_FINFO_NLINK 0x00004000 /**< Number of links */
|
||||
#define SWITCH_FINFO_TYPE 0x00008000 /**< Type */
|
||||
#define SWITCH_FINFO_USER 0x00010000 /**< User */
|
||||
#define SWITCH_FINFO_GROUP 0x00020000 /**< Group */
|
||||
#define SWITCH_FINFO_UPROT 0x00100000 /**< User protection bits */
|
||||
#define SWITCH_FINFO_GPROT 0x00200000 /**< Group protection bits */
|
||||
#define SWITCH_FINFO_WPROT 0x00400000 /**< World protection bits */
|
||||
#define SWITCH_FINFO_ICASE 0x01000000 /**< if dev is case insensitive */
|
||||
#define SWITCH_FINFO_NAME 0x02000000 /**< ->name in proper case */
|
||||
|
||||
#define SWITCH_FINFO_MIN 0x00008170 /**< type, mtime, ctime, atime, size */
|
||||
#define SWITCH_FINFO_IDENT 0x00003000 /**< dev and inode */
|
||||
#define SWITCH_FINFO_OWNER 0x00030000 /**< user and group */
|
||||
#define SWITCH_FINFO_PROT 0x00700000 /**< all protections */
|
||||
#define SWITCH_FINFO_NORM 0x0073b170 /**< an atomic unix apr_stat() */
|
||||
#define SWITCH_FINFO_DIRENT 0x02000000 /**< an atomic unix apr_dir_read() */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Open the specified file.
|
||||
* @param newf The opened file descriptor.
|
||||
@@ -861,6 +979,8 @@ SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_stat(switch_finfo_t *finfo, const char *fname, int32_t wanted, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Close the specified file.
|
||||
* @param thefile The file descriptor to close.
|
||||
|
||||
@@ -56,6 +56,15 @@
|
||||
#include <switch.h>
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct profile_node_s {
|
||||
char *var;
|
||||
char *val;
|
||||
struct profile_node_s *next;
|
||||
} profile_node_t;
|
||||
|
||||
|
||||
|
||||
/*! \brief Call Specific Data
|
||||
*/
|
||||
struct switch_caller_profile {
|
||||
@@ -110,6 +119,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
switch_memory_pool_t *pool;
|
||||
struct switch_caller_profile *next;
|
||||
switch_call_direction_t direction;
|
||||
profile_node_t *soft;
|
||||
};
|
||||
|
||||
/*! \brief An Abstract Representation of a dialplan Application */
|
||||
|
||||
@@ -49,6 +49,7 @@ SWITCH_BEGIN_EXTERN_C struct switch_channel_timetable {
|
||||
switch_time_t hungup;
|
||||
switch_time_t transferred;
|
||||
switch_time_t resurrected;
|
||||
switch_time_t bridged;
|
||||
struct switch_channel_timetable *next;
|
||||
};
|
||||
|
||||
@@ -597,7 +598,7 @@ SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_cha
|
||||
#define switch_channel_clear_app_flag(_c, _f) switch_channel_clear_app_flag_key(__FILE__, _c, _f)
|
||||
#define switch_channel_test_app_flag(_c, _f) switch_channel_test_app_flag_key(__FILE__, _c, _f)
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel);
|
||||
|
||||
@@ -57,6 +57,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
struct switch_app_log {
|
||||
char *app;
|
||||
char *arg;
|
||||
switch_time_t stamp;
|
||||
struct switch_app_log *next;
|
||||
};
|
||||
|
||||
@@ -434,6 +435,9 @@ SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *se
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handler_table_t *state_handler);
|
||||
|
||||
SWITCH_DECLARE(int) switch_core_curl_count(int *val);
|
||||
SWITCH_DECLARE(int) switch_core_ssl_count(int *val);
|
||||
|
||||
/*!
|
||||
\brief Remove a global state handler
|
||||
\param state_handler the state handler to remove
|
||||
@@ -762,6 +766,7 @@ SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname);
|
||||
SWITCH_DECLARE(char *) switch_core_get_variable_dup(_In_z_ const char *varname);
|
||||
SWITCH_DECLARE(char *) switch_core_get_variable_pdup(_In_z_ const char *varname, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(const char *) switch_core_get_hostname(void);
|
||||
SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
|
||||
|
||||
/*!
|
||||
\brief Add a global variable to the core
|
||||
@@ -2205,6 +2210,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand
|
||||
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
|
||||
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries);
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_set_signal_handlers(void);
|
||||
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
|
||||
SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
|
||||
SWITCH_DECLARE(const char *) switch_core_banner(void);
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* switch_curl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SWITCH_CURL_H
|
||||
#define __SWITCH_CURL_H
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <switch_ssl.h>
|
||||
|
||||
static inline void switch_curl_init(void)
|
||||
{
|
||||
int curl_count = switch_core_curl_count(NULL);
|
||||
|
||||
if (curl_count == 0) {
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
#if defined(HAVE_OPENSSL)
|
||||
switch_ssl_init_ssl_locks();
|
||||
#endif
|
||||
}
|
||||
|
||||
curl_count++;
|
||||
switch_core_curl_count(&curl_count);
|
||||
}
|
||||
|
||||
static inline void switch_curl_destroy()
|
||||
{
|
||||
int curl_count = switch_core_curl_count(NULL);
|
||||
|
||||
curl_count--;
|
||||
|
||||
if (curl_count == 0) {
|
||||
|
||||
#if defined(HAVE_OPENSSL)
|
||||
switch_ssl_destroy_ssl_locks();
|
||||
#endif
|
||||
curl_global_cleanup();
|
||||
}
|
||||
switch_core_curl_count(&curl_count);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
||||
@@ -285,7 +285,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_json(switch_event_t **event, const char *json);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup);
|
||||
|
||||
#ifndef SWIG
|
||||
/*!
|
||||
|
||||
@@ -223,15 +223,15 @@ typedef intptr_t switch_ssize_t;
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef WIN64
|
||||
#define SWITCH_SSIZE_T_FMT "I64d"
|
||||
#define SWITCH_SIZE_T_FMT "I64d"
|
||||
#define SWITCH_SSIZE_T_FMT "lld"
|
||||
#define SWITCH_SIZE_T_FMT "lld"
|
||||
#else
|
||||
#define SWITCH_SSIZE_T_FMT "d"
|
||||
#define SWITCH_SIZE_T_FMT "d"
|
||||
#endif
|
||||
|
||||
#define SWITCH_INT64_T_FMT "I64d"
|
||||
#define SWITCH_UINT64_T_FMT "I64u"
|
||||
#define SWITCH_INT64_T_FMT "lld"
|
||||
#define SWITCH_UINT64_T_FMT "llu"
|
||||
|
||||
#ifndef TIME_T_FMT
|
||||
#define TIME_T_FMT SWITCH_INT64_T_FMT
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* switch_ssl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SWITCH_SSL_H
|
||||
#define __SWITCH_SSL_H
|
||||
|
||||
#if defined(HAVE_OPENSSL)
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
static switch_mutex_t **ssl_mutexes;
|
||||
static switch_memory_pool_t *ssl_pool = NULL;
|
||||
|
||||
|
||||
static inline void switch_ssl_ssl_lock_callback(int mode, int type, char *file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK) {
|
||||
switch_mutex_lock(ssl_mutexes[type]);
|
||||
}
|
||||
else {
|
||||
switch_mutex_unlock(ssl_mutexes[type]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned long switch_ssl_ssl_thread_id(void)
|
||||
{
|
||||
return (unsigned long) switch_thread_self();
|
||||
}
|
||||
|
||||
static inline void switch_ssl_init_ssl_locks(void)
|
||||
{
|
||||
|
||||
int ssl_count = switch_core_ssl_count(NULL);
|
||||
int i, num;
|
||||
|
||||
if (ssl_count == 0) {
|
||||
num = CRYPTO_num_locks();
|
||||
|
||||
ssl_mutexes = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(switch_mutex_t*));
|
||||
switch_assert(ssl_mutexes != NULL);
|
||||
|
||||
switch_core_new_memory_pool(&ssl_pool);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
switch_mutex_init(&(ssl_mutexes[i]), SWITCH_MUTEX_NESTED, ssl_pool);
|
||||
switch_assert(ssl_mutexes[i] != NULL);
|
||||
}
|
||||
|
||||
CRYPTO_set_id_callback(switch_ssl_ssl_thread_id);
|
||||
CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))switch_ssl_ssl_lock_callback);
|
||||
}
|
||||
|
||||
ssl_count++;
|
||||
switch_core_ssl_count(&ssl_count);
|
||||
}
|
||||
|
||||
static inline void switch_ssl_destroy_ssl_locks()
|
||||
{
|
||||
int i;
|
||||
int ssl_count = switch_core_ssl_count(NULL);
|
||||
|
||||
ssl_count--;
|
||||
|
||||
if (ssl_count == 0) {
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
switch_mutex_destroy(ssl_mutexes[i]);
|
||||
}
|
||||
|
||||
OPENSSL_free(ssl_mutexes);
|
||||
}
|
||||
|
||||
switch_core_ssl_count(&ssl_count);
|
||||
|
||||
}
|
||||
#else
|
||||
static inline void switch_ssl_init_ssl_locks(void) { return; }
|
||||
static inline void switch_ssl_destroy_ssl_locks(void) { return; }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -136,6 +136,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media"
|
||||
#define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
|
||||
#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
|
||||
#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect"
|
||||
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
|
||||
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
|
||||
#define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid"
|
||||
@@ -488,6 +489,7 @@ typedef struct {
|
||||
switch_size_t dtmf_packet_count;
|
||||
switch_size_t cng_packet_count;
|
||||
switch_size_t flush_packet_count;
|
||||
switch_size_t largest_jb_size;
|
||||
} switch_rtp_numbers_t;
|
||||
|
||||
|
||||
|
||||
+39
-17
@@ -239,20 +239,23 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
|
||||
|
||||
/*!
|
||||
\brief Evaluate the truthfullness of a string expression
|
||||
\param expr a string expression
|
||||
\return true or false
|
||||
*/
|
||||
#define switch_true(expr)\
|
||||
((expr && ( !strcasecmp(expr, "yes") ||\
|
||||
!strcasecmp(expr, "on") ||\
|
||||
!strcasecmp(expr, "true") ||\
|
||||
!strcasecmp(expr, "enabled") ||\
|
||||
!strcasecmp(expr, "active") ||\
|
||||
!strcasecmp(expr, "allow") ||\
|
||||
(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
|
||||
static inline int switch_true(const char *expr)
|
||||
{
|
||||
return ((expr && ( !strcasecmp(expr, "yes") ||
|
||||
!strcasecmp(expr, "on") ||
|
||||
!strcasecmp(expr, "true") ||
|
||||
!strcasecmp(expr, "enabled") ||
|
||||
!strcasecmp(expr, "active") ||
|
||||
!strcasecmp(expr, "allow") ||
|
||||
(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE);
|
||||
}
|
||||
|
||||
#define switch_true_buf(expr)\
|
||||
((( !strcasecmp(expr, "yes") ||\
|
||||
@@ -268,14 +271,16 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
|
||||
\param expr a string expression
|
||||
\return true or false
|
||||
*/
|
||||
#define switch_false(expr)\
|
||||
((expr && ( !strcasecmp(expr, "no") ||\
|
||||
!strcasecmp(expr, "off") ||\
|
||||
!strcasecmp(expr, "false") ||\
|
||||
!strcasecmp(expr, "disabled") ||\
|
||||
!strcasecmp(expr, "inactive") ||\
|
||||
!strcasecmp(expr, "disallow") ||\
|
||||
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
|
||||
static inline int switch_false(const char *expr)
|
||||
{
|
||||
return ((expr && ( !strcasecmp(expr, "no") ||
|
||||
!strcasecmp(expr, "off") ||
|
||||
!strcasecmp(expr, "false") ||
|
||||
!strcasecmp(expr, "disabled") ||
|
||||
!strcasecmp(expr, "inactive") ||
|
||||
!strcasecmp(expr, "disallow") ||
|
||||
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf, size_t buflen);
|
||||
@@ -500,6 +505,23 @@ static inline char *switch_clean_string(char *s)
|
||||
}
|
||||
|
||||
|
||||
static inline char *switch_clean_name_string(char *s)
|
||||
{
|
||||
char *p;
|
||||
for (p = s; p && *p; p++) {
|
||||
uint8_t x = (uint8_t) * p;
|
||||
if ((x < 32) || x == '\'' || x == '"' || x == '<' || x == '>' || x == '\\' || x == ':' || x == '@' || x == '/') {
|
||||
*p = ' ';
|
||||
}
|
||||
if ( (p == s) && (*p == ' ') ) {
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\brief Free a pointer and set it to NULL unless it already is NULL
|
||||
@@ -653,7 +675,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
|
||||
SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen);
|
||||
SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
|
||||
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
|
||||
|
||||
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup);
|
||||
SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str);
|
||||
SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len);
|
||||
|
||||
@@ -417,6 +417,8 @@ SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_
|
||||
|
||||
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
///\}
|
||||
#endif // _SWITCH_XML_H
|
||||
|
||||
Reference in New Issue
Block a user