mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 04:31:50 +00:00
add wrapper code to fully encapsulate apr, apr-utils, pcre, and sqlite. fully use switch_ namespace in modules, create our own format and type defines. follow up commit for unix autotools coming soon after this. PLEASE NOTE: you will NEED to do a make megaclean and run configure again after this update (and the following commit) or it will not build.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4494 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+20
-4
@@ -51,12 +51,29 @@
|
||||
#define FREESWITCH_MIB ".1.3.6.1.4.1." FREESWITCH_PEN
|
||||
#define FREESWITCH_ITAD "543"
|
||||
|
||||
#include <switch_platform.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <setjmp.h>
|
||||
#include <switch_apr.h>
|
||||
#include <switch_sqlite.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <switch_platform.h>
|
||||
#include <switch_types.h>
|
||||
#include <switch_apr.h>
|
||||
|
||||
#include <switch_core_db.h>
|
||||
#include <switch_regex.h>
|
||||
#include <switch_core.h>
|
||||
#include <switch_loadable_module.h>
|
||||
#include <switch_console.h>
|
||||
@@ -74,7 +91,6 @@
|
||||
#include <switch_stun.h>
|
||||
#include <switch_log.h>
|
||||
#include <switch_xml.h>
|
||||
#include <pcre.h>
|
||||
|
||||
|
||||
/** \mainpage FreeSWITCH
|
||||
|
||||
@@ -1,131 +1,18 @@
|
||||
/* src/include/switch_am_config.h.in. Generated from configure.in by autoheader. */
|
||||
#ifndef SWITCH_AM_CONFIG_H
|
||||
#define SWITCH_AM_CONFIG_H
|
||||
|
||||
/* Enable extra debugging. */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
#define SWITCH_INT_16 @short_value@
|
||||
#define SWITCH_INT_32 @int_value@
|
||||
#define SWITCH_INT_64 @long_value@
|
||||
#define SWITCH_SIZE_T @size_t_value@
|
||||
#define SWITCH_SSIZE_T @ssize_t_value@
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
#define SWITCH_SIZEOF_VOIDP @voidp_size@
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
@ssize_t_fmt@
|
||||
@size_t_fmt@
|
||||
@int64_t_fmt@
|
||||
@uint64_t_fmt@
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mlock' function. */
|
||||
#undef HAVE_MLOCK
|
||||
|
||||
/* Define to 1 if you have the `mlockall' function. */
|
||||
#undef HAVE_MLOCKALL
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#undef HAVE_VASPRINTF
|
||||
|
||||
/* Enable Optimization. */
|
||||
#undef OPTIMZER
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Little Endian */
|
||||
#undef SWITCH_BYTE_ORDER
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* sunpro is bad at inline */
|
||||
#undef __inline__
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
+698
-1012
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* 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 <anthmct@yahoo.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
*
|
||||
* switch_core_db.h -- Sqlite wrapper and extensions Header
|
||||
*
|
||||
*/
|
||||
/*! \file switch_core_db.h
|
||||
\brief Core DB Header
|
||||
*/
|
||||
#ifndef SWITCH_CORE_DB_H
|
||||
#define SWITCH_CORE_DB_H
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
/**
|
||||
* @defgroup switch_sqlite_top Brought To You By SQLite
|
||||
* @ingroup FREESWITCH
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup switch_core_db Database Routines
|
||||
* @ingroup switch_sqlite_top
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Each open database is represented by an instance of the
|
||||
* following opaque structure.
|
||||
*/
|
||||
|
||||
typedef struct sqlite3 switch_core_db_t;
|
||||
typedef struct sqlite3_stmt switch_core_db_stmt_t;
|
||||
|
||||
typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames);
|
||||
|
||||
/**
|
||||
* A function to close the database.
|
||||
*
|
||||
* Call this function with a pointer to a structure that was previously
|
||||
* returned from switch_core_db_open() and the corresponding database will by closed.
|
||||
*
|
||||
* All SQL statements prepared using switch_core_db_prepare()
|
||||
* must be deallocated using switch_core_db_finalize() before
|
||||
* this routine is called. Otherwise, SWITCH_CORE_DB_BUSY is returned and the
|
||||
* database connection remains open.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db);
|
||||
|
||||
/**
|
||||
* Open the database file "filename". The "filename" is UTF-8
|
||||
* encoded. A switch_core_db_t* handle is returned in *Db, even
|
||||
* if an error occurs. If the database is opened (or created) successfully,
|
||||
* then SWITCH_CORE_DB_OK is returned. Otherwise an error code is returned. The
|
||||
* switch_core_db_errmsg() routine can be used to obtain
|
||||
* an English language description of the error.
|
||||
*
|
||||
* If the database file does not exist, then a new database is created.
|
||||
* The encoding for the database is UTF-8.
|
||||
*
|
||||
* Whether or not an error occurs when it is opened, resources associated
|
||||
* with the switch_core_db_t* handle should be released by passing it to
|
||||
* switch_core_db_close() when it is no longer required.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb);
|
||||
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
* in a single column of the current result row of a query. In every
|
||||
* case the first parameter is a pointer to the SQL statement that is being
|
||||
* executed (the switch_core_db_stmt_t* that was returned from switch_core_db_prepare()) and
|
||||
* the second argument is the index of the column for which information
|
||||
* should be returned. iCol is zero-indexed. The left-most column as an
|
||||
* index of 0.
|
||||
*
|
||||
* If the SQL statement is not currently point to a valid row, or if the
|
||||
* the colulmn index is out of range, the result is undefined.
|
||||
*
|
||||
* These routines attempt to convert the value where appropriate. For
|
||||
* example, if the internal representation is FLOAT and a text result
|
||||
* is requested, sprintf() is used internally to do the conversion
|
||||
* automatically. The following table details the conversions that
|
||||
* are applied:
|
||||
*
|
||||
* Internal Type Requested Type Conversion
|
||||
* ------------- -------------- --------------------------
|
||||
* NULL INTEGER Result is 0
|
||||
* NULL FLOAT Result is 0.0
|
||||
* NULL TEXT Result is an empty string
|
||||
* NULL BLOB Result is a zero-length BLOB
|
||||
* INTEGER FLOAT Convert from integer to float
|
||||
* INTEGER TEXT ASCII rendering of the integer
|
||||
* INTEGER BLOB Same as for INTEGER->TEXT
|
||||
* FLOAT INTEGER Convert from float to integer
|
||||
* FLOAT TEXT ASCII rendering of the float
|
||||
* FLOAT BLOB Same as FLOAT->TEXT
|
||||
* TEXT INTEGER Use atoi()
|
||||
* TEXT FLOAT Use atof()
|
||||
* TEXT BLOB No change
|
||||
* BLOB INTEGER Convert to TEXT then use atoi()
|
||||
* BLOB FLOAT Convert to TEXT then use atof()
|
||||
* BLOB TEXT Add a "\000" terminator if needed
|
||||
*
|
||||
* Return the value as UTF-8 text.
|
||||
*/
|
||||
SWITCH_DECLARE(const unsigned char *)switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol);
|
||||
|
||||
/**
|
||||
* The first parameter is a compiled SQL statement. This function returns
|
||||
* the column heading for the Nth column of that statement, where N is the
|
||||
* second function parameter. The string returned is UTF-8.
|
||||
*/
|
||||
SWITCH_DECLARE(const char *)switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N);
|
||||
|
||||
/**
|
||||
* Return the number of columns in the result set returned by the compiled
|
||||
* SQL statement. This routine returns 0 if pStmt is an SQL statement
|
||||
* that does not return data (for example an UPDATE).
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_column_count(switch_core_db_stmt_t *pStmt);
|
||||
|
||||
/**
|
||||
* Return a pointer to a UTF-8 encoded string describing in english the
|
||||
* error condition for the most recent switch_core_db_* API call. The returned
|
||||
* string is always terminated by an 0x00 byte.
|
||||
*
|
||||
* The string "not an error" is returned when the most recent API call was
|
||||
* successful.
|
||||
*/
|
||||
SWITCH_DECLARE(const char *)switch_core_db_errmsg(switch_core_db_t *db);
|
||||
|
||||
/**
|
||||
* A function to executes one or more statements of SQL.
|
||||
*
|
||||
* If one or more of the SQL statements are queries, then
|
||||
* the callback function specified by the 3rd parameter is
|
||||
* invoked once for each row of the query result. This callback
|
||||
* should normally return 0. If the callback returns a non-zero
|
||||
* value then the query is aborted, all subsequent SQL statements
|
||||
* are skipped and the switch_core_db_exec() function returns the SWITCH_CORE_DB_ABORT.
|
||||
*
|
||||
* The 4th parameter is an arbitrary pointer that is passed
|
||||
* to the callback function as its first parameter.
|
||||
*
|
||||
* The 2nd parameter to the callback function is the number of
|
||||
* columns in the query result. The 3rd parameter to the callback
|
||||
* is an array of strings holding the values for each column.
|
||||
* The 4th parameter to the callback is an array of strings holding
|
||||
* the names of each column.
|
||||
*
|
||||
* The callback function may be NULL, even for queries. A NULL
|
||||
* callback is not an error. It just means that no callback
|
||||
* will be invoked.
|
||||
*
|
||||
* If an error occurs while parsing or evaluating the SQL (but
|
||||
* not while executing the callback) then an appropriate error
|
||||
* message is written into memory obtained from malloc() and
|
||||
* *errmsg is made to point to that message. The calling function
|
||||
* is responsible for freeing the memory that holds the error
|
||||
* message. Use switch_core_db_free() for this. If errmsg==NULL,
|
||||
* then no error message is ever written.
|
||||
*
|
||||
* The return value is is SWITCH_CORE_DB_OK if there are no errors and
|
||||
* some other return code if there is an error. The particular
|
||||
* return value depends on the type of error.
|
||||
*
|
||||
* If the query could not be executed because a database file is
|
||||
* locked or busy, then this function returns SWITCH_CORE_DB_BUSY. (This
|
||||
* behavior can be modified somewhat using the sswitch_core_db_busy_handler()
|
||||
* and switch_core_db_busy_timeout() functions below.)
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db,
|
||||
const char *sql,
|
||||
switch_core_db_callback_func_t callback,
|
||||
void *data,
|
||||
char **errmsg);
|
||||
|
||||
/**
|
||||
* This function is called to delete a compiled
|
||||
* SQL statement obtained by a previous call to switch_core_db_prepare().
|
||||
* If the statement was executed successfully, or
|
||||
* not executed at all, then SWITCH_CORE_DB_OK is returned. If execution of the
|
||||
* statement failed then an error code is returned.
|
||||
*
|
||||
* This routine can be called at any point during the execution of the
|
||||
* virtual machine. If the virtual machine has not completed execution
|
||||
* when this routine is called, that is like encountering an error or
|
||||
* an interrupt. (See switch_core_db_interrupt().) Incomplete updates may be
|
||||
* rolled back and transactions cancelled, depending on the circumstances,
|
||||
* and the result code returned will be SWITCH_CORE_DB_ABORT.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt);
|
||||
|
||||
/**
|
||||
* To execute an SQL query, it must first be compiled into a byte-code
|
||||
* program using the following routine.
|
||||
*
|
||||
* The first parameter "db" is an SQLite database handle. The second
|
||||
* parameter "zSql" is the statement to be compiled, encoded as
|
||||
* UTF-8. If the next parameter, "nBytes", is less
|
||||
* than zero, then zSql is read up to the first nul terminator. If
|
||||
* "nBytes" is not less than zero, then it is the length of the string zSql
|
||||
* in bytes (not characters).
|
||||
*
|
||||
* *pzTail is made to point to the first byte past the end of the first
|
||||
* SQL statement in zSql. This routine only compiles the first statement
|
||||
* in zSql, so *pzTail is left pointing to what remains uncompiled.
|
||||
*
|
||||
* *ppStmt is left pointing to a compiled SQL statement that can be
|
||||
* executed using switch_core_db_step(). Or if there is an error, *ppStmt may be
|
||||
* set to NULL. If the input text contained no SQL (if the input is and
|
||||
* empty string or a comment) then *ppStmt is set to NULL.
|
||||
*
|
||||
* On success, SWITCH_CORE_DB_OK is returned. Otherwise an error code is returned.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db,
|
||||
const char *zSql,
|
||||
int nBytes,
|
||||
switch_core_db_stmt_t **ppStmt,
|
||||
const char **pzTail);
|
||||
|
||||
/**
|
||||
* After an SQL query has been compiled with a call to either
|
||||
* switch_core_db_prepare(), then this function must be
|
||||
* called one or more times to execute the statement.
|
||||
*
|
||||
* The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE,
|
||||
* SWITCH_CORE_DB_ROW, SWITCH_CORE_DB_ERROR, or SWITCH_CORE_DB_MISUSE.
|
||||
*
|
||||
* SWITCH_CORE_DB_BUSY means that the database engine attempted to open
|
||||
* a locked database and there is no busy callback registered.
|
||||
* Call switch_core_db_step() again to retry the open.
|
||||
*
|
||||
* SWITCH_CORE_DB_DONE means that the statement has finished executing
|
||||
* successfully. switch_core_db_step() should not be called again on this virtual
|
||||
* machine.
|
||||
*
|
||||
* If the SQL statement being executed returns any data, then
|
||||
* SWITCH_CORE_DB_ROW is returned each time a new row of data is ready
|
||||
* for processing by the caller. The values may be accessed using
|
||||
* the switch_core_db_column_*() functions described below. switch_core_db_step()
|
||||
* is called again to retrieve the next row of data.
|
||||
*
|
||||
* SWITCH_CORE_DB_ERROR means that a run-time error (such as a constraint
|
||||
* violation) has occurred. switch_core_db_step() should not be called again on
|
||||
* the VM. More information may be found by calling switch_core_db_errmsg().
|
||||
*
|
||||
* SWITCH_CORE_DB_MISUSE means that the this routine was called inappropriately.
|
||||
* Perhaps it was called on a virtual machine that had already been
|
||||
* finalized or on one that had previously returned SWITCH_CORE_DB_ERROR or
|
||||
* SWITCH_CORE_DB_DONE. Or it could be the case the the same database connection
|
||||
* is being used simulataneously by two or more threads.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_step(switch_core_db_stmt_t *stmt);
|
||||
|
||||
/**
|
||||
* Call this routine to free the memory that switch_core_db_get_table() allocated.
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_db_free(char *z);
|
||||
|
||||
/** Return values for switch_core_db_exec() and switch_core_db_step()*/
|
||||
#define SWITCH_CORE_DB_OK 0 /* Successful result */
|
||||
/* beginning-of-error-codes */
|
||||
#define SWITCH_CORE_DB_ERROR 1 /* SQL error or missing database */
|
||||
#define SWITCH_CORE_DB_INTERNAL 2 /* NOT USED. Internal logic error in SQLite */
|
||||
#define SWITCH_CORE_DB_PERM 3 /* Access permission denied */
|
||||
#define SWITCH_CORE_DB_ABORT 4 /* Callback routine requested an abort */
|
||||
#define SWITCH_CORE_DB_BUSY 5 /* The database file is locked */
|
||||
#define SWITCH_CORE_DB_LOCKED 6 /* A table in the database is locked */
|
||||
#define SWITCH_CORE_DB_NOMEM 7 /* A malloc() failed */
|
||||
#define SWITCH_CORE_DB_READONLY 8 /* Attempt to write a readonly database */
|
||||
#define SWITCH_CORE_DB_INTERRUPT 9 /* Operation terminated by switch_core_db_interrupt()*/
|
||||
#define SWITCH_CORE_DB_IOERR 10 /* Some kind of disk I/O error occurred */
|
||||
#define SWITCH_CORE_DB_CORRUPT 11 /* The database disk image is malformed */
|
||||
#define SWITCH_CORE_DB_NOTFOUND 12 /* NOT USED. Table or record not found */
|
||||
#define SWITCH_CORE_DB_FULL 13 /* Insertion failed because database is full */
|
||||
#define SWITCH_CORE_DB_CANTOPEN 14 /* Unable to open the database file */
|
||||
#define SWITCH_CORE_DB_PROTOCOL 15 /* Database lock protocol error */
|
||||
#define SWITCH_CORE_DB_EMPTY 16 /* Database is empty */
|
||||
#define SWITCH_CORE_DB_SCHEMA 17 /* The database schema changed */
|
||||
#define SWITCH_CORE_DB_TOOBIG 18 /* NOT USED. Too much data for one row */
|
||||
#define SWITCH_CORE_DB_CONSTRAINT 19 /* Abort due to contraint violation */
|
||||
#define SWITCH_CORE_DB_MISMATCH 20 /* Data type mismatch */
|
||||
#define SWITCH_CORE_DB_MISUSE 21 /* Library used incorrectly */
|
||||
#define SWITCH_CORE_DB_NOLFS 22 /* Uses OS features not supported on host */
|
||||
#define SWITCH_CORE_DB_AUTH 23 /* Authorization denied */
|
||||
#define SWITCH_CORE_DB_FORMAT 24 /* Auxiliary database format error */
|
||||
#define SWITCH_CORE_DB_RANGE 25 /* 2nd parameter to switch_core_db_bind out of range */
|
||||
#define SWITCH_CORE_DB_NOTADB 26 /* File opened that is not a database file */
|
||||
#define SWITCH_CORE_DB_ROW 100 /* switch_core_db_step() has another row ready */
|
||||
#define SWITCH_CORE_DB_DONE 101 /* switch_core_db_step() has finished executing */
|
||||
/* end-of-error-codes */
|
||||
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
/**
|
||||
* This routine is a variant of the "sprintf()" from the
|
||||
* standard C library. The resulting string is written into memory
|
||||
* obtained from malloc() so that there is never a possiblity of buffer
|
||||
* overflow. This routine also implement some additional formatting
|
||||
* options that are useful for constructing SQL statements.
|
||||
*
|
||||
* The strings returned by this routine should be freed by calling
|
||||
* switch_core_db_free().
|
||||
*
|
||||
* All of the usual printf formatting options apply. In addition, there
|
||||
* is a "%q" option. %q works like %s in that it substitutes a null-terminated
|
||||
* string from the argument list. But %q also doubles every '\'' character.
|
||||
* %q is designed for use inside a string literal. By doubling each '\''
|
||||
* character it escapes that character and allows it to be inserted into
|
||||
* the string.
|
||||
*
|
||||
* For example, so some string variable contains text as follows:
|
||||
*
|
||||
* char *zText = "It's a happy day!";
|
||||
*
|
||||
* We can use this text in an SQL statement as follows:
|
||||
*
|
||||
* char *z = switch_core_db_mprintf("INSERT INTO TABLES('%q')", zText);
|
||||
* switch_core_db_exec(db, z, callback1, 0, 0);
|
||||
* switch_core_db_free(z);
|
||||
*
|
||||
* Because the %q format string is used, the '\'' character in zText
|
||||
* is escaped and the SQL generated is as follows:
|
||||
*
|
||||
* INSERT INTO table1 VALUES('It''s a happy day!')
|
||||
*
|
||||
* This is correct. Had we used %s instead of %q, the generated SQL
|
||||
* would have looked like this:
|
||||
*
|
||||
* INSERT INTO table1 VALUES('It's a happy day!');
|
||||
*
|
||||
* This second example is an SQL syntax error. As a general rule you
|
||||
* should always use %q instead of %s when inserting text into a string
|
||||
* literal.
|
||||
*/
|
||||
SWITCH_DECLARE(char *)switch_mprintf(const char *zFormat,...);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
#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 expandtab:
|
||||
*/
|
||||
@@ -221,13 +221,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
||||
switch_input_args_t *args,
|
||||
uint32_t limit);
|
||||
|
||||
/*!
|
||||
\brief Function to evaluate an expression against a string
|
||||
\param target The string to find a match in
|
||||
\param expression The regular expression to run against the string
|
||||
\return Boolean if a match was found or not
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression);
|
||||
|
||||
/*!
|
||||
\brief Play a sound and gather digits with the number of retries specified if the user doesn't give digits in the set time
|
||||
|
||||
@@ -48,6 +48,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define __SWITCH_FUNC__ (const char *)__func__
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
|
||||
@@ -62,7 +63,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* C4512: assignment operator could not be generated
|
||||
* C4610: struct can never be instantiated - user defined constructor required
|
||||
*/
|
||||
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610)
|
||||
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
|
||||
|
||||
#if (_MSC_VER >= 1400) // VC8+
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
@@ -93,20 +94,21 @@ typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned long in_addr_t;
|
||||
#endif
|
||||
typedef int pid_t;
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
#define PACKED
|
||||
#include <io.h>
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#else
|
||||
/* packed attribute */
|
||||
#ifndef PACKED
|
||||
#define PACKED __attribute__ ((__packed__))
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
@@ -124,6 +126,7 @@ typedef unsigned long in_addr_t;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined(SWITCH_CORE_DECLARE_STATIC)
|
||||
#define SWITCH_DECLARE(type) type __stdcall
|
||||
#define SWITCH_DECLARE_NONSTD(type) type __cdecl
|
||||
@@ -152,11 +155,13 @@ typedef unsigned long in_addr_t;
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#define SWITCH_THREAD_FUNC __stdcall
|
||||
#else //not win32
|
||||
#define SWITCH_DECLARE(type) type
|
||||
#define SWITCH_DECLARE_NONSTD(type) type
|
||||
#define SWITCH_MOD_DECLARE(type) type
|
||||
#define SWITCH_DECLARE_DATA
|
||||
#define SWITCH_THREAD_FUNC
|
||||
#endif
|
||||
|
||||
#ifdef DOXYGEN
|
||||
@@ -171,10 +176,115 @@ typedef unsigned long in_addr_t;
|
||||
#define PRINTF_FUNCTION(fmtstr,vars)
|
||||
#endif
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
#ifdef SWITCH_INT32
|
||||
typedef SWITCH_INT32 switch_int32_t;
|
||||
#else
|
||||
typedef int32_t switch_int32_t;
|
||||
#endif
|
||||
|
||||
#ifdef SWITCH_SIZE_T
|
||||
typedef SWITCH_SIZE_T switch_size_t;
|
||||
#else
|
||||
typedef uintptr_t switch_size_t;
|
||||
#endif
|
||||
|
||||
#ifdef SWITCH_SSIZE_T
|
||||
typedef SWITCH_SSIZE_T switch_ssize_t;
|
||||
#else
|
||||
typedef intptr_t switch_ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef WIN64
|
||||
#define SWITCH_SSIZE_T_FMT "%I64d"
|
||||
#define SWITCH_SIZE_T_FMT "%I64d"
|
||||
#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"
|
||||
|
||||
#else
|
||||
#ifndef SWITCH_SSIZE_T_FMT
|
||||
#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "%ld" : sizeof (switch_ssize_t) == sizeof (int) ? "%d" : "%lld")
|
||||
#endif
|
||||
|
||||
#ifndef SWITCH_SIZE_T_FMT
|
||||
#define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "%lu" : sizeof (switch_size_t) == sizeof (int) ? "%u" : "%llu")
|
||||
#endif
|
||||
|
||||
#ifndef SWITCH_INT64_T_FMT
|
||||
#define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "%ld" : "%lld")
|
||||
#endif
|
||||
|
||||
#ifndef SWITCH_UINT64_T_FMT
|
||||
#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "%lu" : "%llu")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
/* these includes must be outside the extern "C" block on windows or it will break compatibility with c++ modules*/
|
||||
#ifdef WIN32
|
||||
/* Has windows.h already been included? If so, our preferences don't matter,
|
||||
* but we will still need the winsock things no matter what was included.
|
||||
* If not, include a restricted set of windows headers to our tastes.
|
||||
*/
|
||||
#ifndef _WINDOWS_
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
|
||||
/* Restrict the server to a subset of Windows NT 4.0 header files by default
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
#ifndef NOUSER
|
||||
#define NOUSER
|
||||
#endif
|
||||
#ifndef NOMCX
|
||||
#define NOMCX
|
||||
#endif
|
||||
#ifndef NOIME
|
||||
#define NOIME
|
||||
#endif
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Add a _very_few_ declarations missing from the restricted set of headers
|
||||
* (If this list becomes extensive, re-enable the required headers above!)
|
||||
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
|
||||
*/
|
||||
#define SW_HIDE 0
|
||||
#ifndef _WIN32_WCE
|
||||
#include <winsock2.h>
|
||||
#include <mswsock.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif /* !_WINDOWS_ */
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/* src/include/switch_private.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Enable extra debugging. */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mlock' function. */
|
||||
#undef HAVE_MLOCK
|
||||
|
||||
/* Define to 1 if you have the `mlockall' function. */
|
||||
#undef HAVE_MLOCKALL
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#undef HAVE_VASPRINTF
|
||||
|
||||
/* Enable Optimization. */
|
||||
#undef OPTIMZER
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* The size of a `char', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of size_t */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of ssize_t */
|
||||
#undef SIZEOF_SSIZE_T
|
||||
|
||||
/* The size of a `void*', as computed by sizeof. */
|
||||
#undef SIZEOF_VOIDP
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Little Endian */
|
||||
#undef SWITCH_BYTE_ORDER
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* sunpro is bad at inline */
|
||||
#undef __inline__
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef ssize_t
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* 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
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
*
|
||||
* switch_regex.h -- pcre wrapper and extensions Header
|
||||
*
|
||||
*/
|
||||
/*! \file switch_regex.h
|
||||
\brief Regex Header
|
||||
*/
|
||||
#ifndef SWITCH_REGEX_H
|
||||
#define SWITCH_REGEX_H
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
/**
|
||||
* @defgroup switch_regex
|
||||
* @ingroup FREESWITCH
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct real_pcre switch_regex_t;
|
||||
|
||||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
|
||||
int options,
|
||||
const char **errorptr,
|
||||
int *erroroffset,
|
||||
const unsigned char *tables);
|
||||
|
||||
SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject,
|
||||
int *ovector,
|
||||
int stringcount,
|
||||
int stringnumber,
|
||||
char *buffer,
|
||||
int size);
|
||||
|
||||
SWITCH_DECLARE(void) switch_regex_free(void *data);
|
||||
|
||||
SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen);
|
||||
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector);
|
||||
|
||||
/*!
|
||||
\brief Function to evaluate an expression against a string
|
||||
\param target The string to find a match in
|
||||
\param expression The regular expression to run against the string
|
||||
\return Boolean if a match was found or not
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression);
|
||||
|
||||
#define switch_regex_safe_free(re) if (re) {\
|
||||
switch_regex_free(re);\
|
||||
re = NULL;\
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
#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 expandtab:
|
||||
*/
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
#include <switch.h>
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
#include <stdlib.h>
|
||||
|
||||
/*!
|
||||
\defgroup resamp Audio Resample Functions
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#define SWITCH_TYPES_H
|
||||
|
||||
#include <switch.h>
|
||||
#include <ctype.h>
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
#define SWITCH_SEQ_ESC "\033["
|
||||
@@ -503,7 +502,6 @@ typedef enum {
|
||||
SCSMF_DYNAMIC = (1 << 0)
|
||||
} switch_core_session_message_flag_t;
|
||||
|
||||
#define SWITCH_UUID_FORMATTED_LENGTH APR_UUID_FORMATTED_LENGTH
|
||||
#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__
|
||||
#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__
|
||||
#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__
|
||||
@@ -944,6 +942,7 @@ typedef enum {
|
||||
SCSC_CHECK_RUNNING
|
||||
} switch_session_ctl_t;
|
||||
|
||||
typedef uint16_t switch_port_t;
|
||||
typedef uint8_t switch_payload_t;
|
||||
typedef struct switch_rtp switch_rtp_t;
|
||||
typedef struct switch_core_session_message switch_core_session_message_t;
|
||||
@@ -1032,7 +1031,6 @@ typedef switch_status_t (*switch_say_callback_t)(switch_core_session_t *session,
|
||||
switch_say_type_t type,
|
||||
switch_say_method_t method,
|
||||
switch_input_args_t *args);
|
||||
typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames);
|
||||
typedef switch_status_t (*switch_module_load_t) (switch_loadable_module_interface_t **, char *);
|
||||
typedef switch_status_t (*switch_module_reload_t) (void);
|
||||
typedef switch_status_t (*switch_module_pause_t) (void);
|
||||
|
||||
@@ -39,30 +39,15 @@
|
||||
#define SWITCH_UTILS_H
|
||||
|
||||
#include <switch.h>
|
||||
#include <pcre.h>
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
#ifndef snprintf
|
||||
#define snprintf apr_snprintf
|
||||
#endif
|
||||
#ifndef vsnprintf
|
||||
#define vsnprintf apr_vsnprintf
|
||||
#endif
|
||||
|
||||
#define switch_bytes_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
|
||||
|
||||
#define SWITCH_SMAX 32767
|
||||
#define SWITCH_SMIN -32768
|
||||
#define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2;
|
||||
|
||||
SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in);
|
||||
|
||||
SWITCH_DECLARE(apr_status_t) switch_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock,
|
||||
apr_int32_t flags, char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
|
||||
#define switch_codec2str(codec,buf,len) snprintf(buf, len, "%s@%uk@%ui", \
|
||||
codec->implementation->iananame, \
|
||||
codec->implementation->samples_per_second, \
|
||||
@@ -133,10 +118,6 @@ SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key);
|
||||
*/
|
||||
#define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
|
||||
|
||||
/*!
|
||||
\brief Duplicate a string
|
||||
*/
|
||||
#define switch_copy_string apr_cpystrn
|
||||
|
||||
/*!
|
||||
\brief Test for the existance of a flag on an arbitary object
|
||||
@@ -209,13 +190,7 @@ switch_mutex_unlock(obj->flag_mutex);
|
||||
/*!
|
||||
\brief Wait a desired number of microseconds and yield the CPU
|
||||
*/
|
||||
#if defined(HAVE_USLEEP)
|
||||
#define switch_yield(ms) usleep(ms);
|
||||
#elif defined(WIN32)
|
||||
#define switch_yield(ms) Sleep((DWORD)((ms) / 1000));
|
||||
#else
|
||||
#define switch_yield(ms) apr_sleep(ms); //apr_thread_yield();
|
||||
#endif
|
||||
#define switch_yield(ms) switch_sleep(ms);
|
||||
|
||||
/*!
|
||||
\brief Converts a string representation of a date into a switch_time_t
|
||||
@@ -252,16 +227,6 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t *pool, char *in, char *delim, char esc);
|
||||
|
||||
/*!
|
||||
\brief Create a set of file descriptors to poll
|
||||
\param poll the polfd to create
|
||||
\param sock the socket to add
|
||||
\param flags the flags to modify the behaviour
|
||||
\param pool the memory pool to use
|
||||
\return SWITCH_STATUS_SUCCESS when successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, switch_int16_t flags, switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Wait for a socket
|
||||
\param poll the pollfd to wait on
|
||||
@@ -276,20 +241,12 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
||||
*/
|
||||
SWITCH_DECLARE(const char *) switch_cut_path(const char *in);
|
||||
|
||||
#define switch_clean_re(re) if (re) {\
|
||||
pcre_free(re);\
|
||||
re = NULL;\
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace);
|
||||
SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
|
||||
SWITCH_DECLARE(int) switch_perform_regex(char *field, char *expression, pcre **new_re, int *ovector, uint32_t olen);
|
||||
SWITCH_DECLARE(void) switch_perform_substitution(pcre *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector);
|
||||
|
||||
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK)
|
||||
SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len);
|
||||
SWITCH_DECLARE(char *) switch_url_decode(char *s);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename);
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,11 +55,7 @@
|
||||
|
||||
#ifndef _SWITCH_XML_H
|
||||
#define _SWITCH_XML_H
|
||||
#include <switch_types.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <switch.h>
|
||||
|
||||
|
||||
///\defgroup xml1 XML Library Functions
|
||||
|
||||
Reference in New Issue
Block a user