#ifndef SWITCH_H
#define SWITCH_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifdef __cplusplus\r
+#define BEGIN_EXTERN_C extern "C" {\r
+#define END_EXTERN_C }\r
+#else\r
+#define BEGIN_EXTERN_C\r
+#define END_EXTERN_C\r
+#endif\r
+
+BEGIN_EXTERN_C
//Need to include this before any other includes (MSVC Bug)
#include <switch_platform.h>
#include <switch_stun.h>
#include <switch_stun.h>
#include <switch_log.h>
-#ifdef __cplusplus
-}
-#endif
+
+END_EXTERN_C
/** \mainpage FreeSWITCH
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
#ifndef SWITCH_APR_H
#define SWITCH_APR_H
-#ifdef __cplusplus
-extern "C" {
-#ifdef __FORMATBUG
-}
-#endif
-#endif
+BEGIN_EXTERN_C
#include <apr.h>
#include <apr_network_io.h>
/** @} */
/** @} */
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_BUFFER_H
#define SWITCH_BUFFER_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/**
* @defgroup switch_buffer Buffer Routines
* @ingroup core1
SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer *buffer);
/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
#endif
#ifndef SWITCH_CALLER_H
#define SWITCH_CALLER_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*! \brief Call Specific Data
*/
struct switch_caller_profile {
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event);
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
/** @} */
#ifndef SWITCH_CHANNEL_H
#define SWITCH_CHANNEL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __FORMATBUG
-}
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
struct switch_channel_timetable {
switch_time_t created;
switch_time_t answered;
SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode (switch_channel *channel, int *freq, int *bits, int *channels, int *ms, int *kbps);
/** @} */
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_CONFIG_H
#define SWITCH_CONFIG_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*! \brief A simple file handle representing an open configuration file **/
struct switch_config {
/*! FILE stream buffer to the opened file */
*/
SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char **val);
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
+
/** @} */
#endif
#ifndef SWITCH_CONSOLE_H
#define SWITCH_CONSOLE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*!
\brief A simple comand loop that reads input from the terminal
*/
*/
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel channel, char *file, const char *func, int line, char *fmt, ...);
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_CORE_H
#define SWITCH_CORE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_STREAMS 128
\}
*/
-
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
#endif
#ifndef SWITCH_EVENT_H
#define SWITCH_EVENT_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*! \brief An event Header */
struct switch_event_header {
/*! the header name */
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data)
///\}
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_FRAME_H
#define SWITCH_FRAME_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*! \brief An abstraction of a data frame */
struct switch_frame {
/*! a pointer to the codec information */
switch_frame_flag flags;
};
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_IVR_H
#define SWITCH_IVR_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/**
* @defgroup switch_ivr IVR Library
* @ingroup core1
/** @} */
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_LOADABLE_MODULE_H
#define SWITCH_LOADABLE_MODULE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*!
\defgroup mods Loadable Module Functions
\ingroup core1
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void);
///\}
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_LOG_H
#define SWITCH_LOG_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
///\defgroup log Logger Routines
///\ingroup core1
///\{
SWITCH_DECLARE(switch_log_level) switch_log_str2level(const char *str);
///\}
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_MODULE_INTERFACES_H
#define SWITCH_MODULE_INTERFACES_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
+BEGIN_EXTERN_C
+
/*! \brief A table of functions to execute at various states
*/
struct switch_state_handler_table {
const struct switch_api_interface *next;
};
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_PLATFORM_H
#define SWITCH_PLATFORM_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_EXTERN_C
#ifdef __ICC
#pragma warning (disable:810 869 981 279 1469 188)
#define DoxyDefine(x)
#endif
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_RESAMPLE_H
#define SWITCH_RESAMPLE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <stdlib.h>
#include <switch.h>
+BEGIN_EXTERN_C
+#include <stdlib.h>
/*!
\defgroup resamp Audio Resample Functions
///\}
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
#endif
#ifndef SWITCH_RTP_H
#define SWITCH_RTP_H
-#ifdef __cplusplus
-extern "C" {
-#ifdef _FORMATBUG
-}
-#endif
-#endif
+BEGIN_EXTERN_C
#define SWITCH_RTP_MAX_BUF_LEN 16384
\}
*/
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_SQLITE_H
#define SWITCH_SQLITE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_EXTERN_C
#include <sqlite3.h>
/** @} */
/** @} */
-
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
*/
#ifndef _SWITCH_STUN_PARSER_H
#define _SWITCH_STUN_PARSER_H
+
+BEGIN_EXTERN_C
+
#define SWITCH_STUN_DEFAULT_PORT 3478
#define SWITCH_STUN_PACKET_MIN_LEN 20
*/
#define switch_stun_packet_length(packet) ntohs(packet->header.length) + sizeof(switch_stun_packet_header_t)
///\}
+
+END_EXTERN_C
+
#endif
#ifndef SWITCH_TYPES_H
#define SWITCH_TYPES_H
-#ifdef __cplusplus
-extern "C" {
-#ifdef _FORMATBUG
-}
-#endif
-#endif
-
#include <switch.h>
-#include <switch_platform.h>
+
+BEGIN_EXTERN_C
#ifdef WIN32
#define SWITCH_PATH_SEPARATOR "\\"
/*! \brief A core session representing a call and all of it's resources */
struct switch_core_session;
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
#ifndef SWITCH_UTILS_H
#define SWITCH_UTILS_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <switch.h>
-
+BEGIN_EXTERN_C
#ifndef snprintf
#define snprintf apr_snprintf
#define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
#endif
}
} else { /* time off the channel (if you must) */
switch_frame *read_frame;
-
+ switch_status status;
while (switch_channel_test_flag(channel, CF_HOLD)) {
switch_yield(10000);
}
- switch_status status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+ status = switch_core_session_read_frame(session, &read_frame, -1, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}