move some modules to use the new module interface macros.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5343 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-06-13 17:06:10 +00:00
parent 50fe6fbac8
commit b67f9c5b2a
34 changed files with 161 additions and 113 deletions

View File

@ -51,7 +51,8 @@
#undef SWIFT_FAILED
#define SWIFT_FAILED(r) ((void *)(r) < (void *)0)
static const char modname[] = "mod_cepstral";
SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load);
SWITCH_MODULE_DEFINITION(mod_cepstral, mod_cepstral_load, NULL, NULL);
static swift_engine *engine;
@ -426,7 +427,7 @@ static const switch_loadable_module_interface_t cepstral_module_interface = {
/*.directory_interface */ NULL
};
switch_status_t switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load)
{
/* Open the Swift TTS Engine */

View File

@ -32,7 +32,9 @@
*
*/
#include "switch.h"
static const char modname[] = "mod_amr";
SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load);
SWITCH_MODULE_DEFINITION(mod_amr, mod_amr_load, NULL, NULL);
#ifndef AMR_PASSTHROUGH
#include "amr/interf_enc.h"
@ -322,7 +324,7 @@ static switch_loadable_module_interface_t amr_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
{
#ifndef AMR_PASSTHROUGH
char *cf = "amr.conf";

View File

@ -32,8 +32,8 @@
#include <switch.h>
#include <g7xx/g711.h>
static const char modname[] = "mod_g711";
SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load);
SWITCH_MODULE_DEFINITION(mod_g711, mod_g711_load, NULL, NULL);
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@ -415,7 +415,7 @@ static switch_loadable_module_interface_t g711_module_interface = {
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g711_module_interface;

View File

@ -33,7 +33,8 @@
#include <switch.h>
#include "g7xx/g722.h"
static const char modname[] = "mod_g722";
SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load);
SWITCH_MODULE_DEFINITION(mod_g722, mod_g722_load, NULL, NULL);
struct g722_context {
g722_decode_state_t decoder_object;
@ -172,7 +173,7 @@ static switch_loadable_module_interface_t g722_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g722_module_interface;

View File

@ -49,7 +49,8 @@ Flag UseVx = True;
enum Crate WrkRate = Rate63;
#endif
static const char modname[] = "mod_g723_1";
SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load);
SWITCH_MODULE_DEFINITION(mod_g723_1, mod_g723_1_load, NULL, NULL);
#ifndef G723_PASSTHROUGH
struct g723_context {
@ -202,7 +203,7 @@ static switch_loadable_module_interface_t g723_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g723_module_interface;

View File

@ -33,7 +33,8 @@
#include "g72x.h"
#include "switch_bitpack.h"
static const char modname[] = "mod_g726";
SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load);
SWITCH_MODULE_DEFINITION(mod_g726, mod_g726_load, NULL, NULL);
typedef int (*encoder_t) (int, int, g726_state *);
typedef int (*decoder_t) (int, int, g726_state *);
@ -427,7 +428,7 @@ static switch_loadable_module_interface_t g726_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g726_module_interface;

View File

@ -31,11 +31,11 @@
* mod_g729.c -- G729 Codec Module
*
*/
static const char modname[] = "mod_g729";
#include "switch.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load);
SWITCH_MODULE_DEFINITION(mod_g729, mod_g729_load, NULL, NULL);
#ifndef G729_PASSTHROUGH
#include "g729/g729.h"
@ -310,7 +310,7 @@ static switch_loadable_module_interface_t g729_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g729_module_interface;

View File

@ -31,7 +31,10 @@
*/
#include "switch.h"
#include "gsm.h"
static const char modname[] = "mod_gsm";
SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load);
SWITCH_MODULE_DEFINITION(mod_gsm, mod_gsm_load, NULL, NULL);
struct gsm_context {
gsm encoder;
gsm decoder;
@ -162,7 +165,8 @@ static switch_loadable_module_interface_t gsm_module_interface = {
/*.codec_interface */ &gsm_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load)
{
/* connect my internal structure to the blank pointer passed to me */

View File

@ -31,8 +31,8 @@
*/
#include <switch.h>
static const char modname[] = "mod_h26x";
SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load);
SWITCH_MODULE_DEFINITION(mod_h26x, mod_h26x_load, NULL, NULL);
static switch_status_t switch_h26x_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
{
@ -132,8 +132,7 @@ static switch_loadable_module_interface_t h26x_module_interface = {
/*.api_interface */ NULL,
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &h26x_module_interface;

View File

@ -34,7 +34,8 @@
#include "iLBC_decode.h"
#include "iLBC_define.h"
static const char modname[] = "mod_ilbc";
SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load);
SWITCH_MODULE_DEFINITION(mod_ilbc, mod_ilbc_load, NULL, NULL);
struct ilbc_context {
iLBC_Enc_Inst_t encoder;
@ -314,9 +315,7 @@ static switch_loadable_module_interface_t ilbc_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load)
{
/* connect my internal structure to the blank pointer passed to me */

View File

@ -31,8 +31,8 @@
*/
#include <switch.h>
static const char modname[] = "mod_l16";
SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load);
SWITCH_MODULE_DEFINITION(mod_l16, mod_l16_load, NULL, NULL);
static switch_status_t switch_raw_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
{
@ -424,7 +424,7 @@ static switch_loadable_module_interface_t raw_module_interface = {
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &raw_module_interface;

View File

@ -33,7 +33,8 @@
#include <speex/speex.h>
#include <speex/speex_preprocess.h>
static const char modname[] = "mod_speex";
SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load);
SWITCH_MODULE_DEFINITION(mod_speex, mod_speex_load, NULL, NULL);
static const switch_codec_settings_t default_codec_settings = {
/*.quality */ 5,
@ -403,7 +404,7 @@ static switch_loadable_module_interface_t speex_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &speex_module_interface;

View File

@ -34,8 +34,8 @@
#include <sys/stat.h>
#include <fcntl.h>
static const char modname[] = "mod_dialplan_directory";
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load);
SWITCH_MODULE_DEFINITION(mod_dialplan_directory, mod_dialplan_directory_load, NULL, NULL);
static struct {
char *directory_name;
@ -166,7 +166,7 @@ static const switch_loadable_module_interface_t directory_dialplan_module_interf
/*.application_interface = */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load)
{
load_config();

View File

@ -34,7 +34,8 @@
#include <sys/stat.h>
#include <fcntl.h>
static const char modname[] = "mod_dialplan_xml";
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_xml_load);
SWITCH_MODULE_DEFINITION(mod_dialplan_xml, mod_dialplan_xml_load, NULL, NULL);
typedef enum {
BREAK_ON_TRUE,
@ -392,7 +393,7 @@ static const switch_loadable_module_interface_t dialplan_module_interface = {
/*.application_interface = */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_xml_load)
{
/* connect my internal structure to the blank pointer passed to me */

View File

@ -40,7 +40,8 @@
#include <ldap.h>
#endif
static const char modname[] = "mod_ldap";
SWITCH_MODULE_LOAD_FUNCTION(mod_ldap_load);
SWITCH_MODULE_DEFINITION(mod_ldap, mod_ldap_load, NULL, NULL);
struct ldap_context {
LDAP *ld;
@ -207,7 +208,7 @@ static const switch_directory_interface_t ldap_directory_interface = {
};
static switch_loadable_module_interface_t skel_module_interface = {
static switch_loadable_module_interface_t ldap_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
@ -220,10 +221,10 @@ static switch_loadable_module_interface_t skel_module_interface = {
/*.directory_interface */ &ldap_directory_interface
};
switch_status_t switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_ldap_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &skel_module_interface;
*module_interface = &ldap_module_interface;
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;

View File

@ -43,7 +43,9 @@
#define DL_EVENT_CONNECTED "dingaling::connected"
#define MDL_CHAT_PROTO "jingle"
static const char modname[] = "mod_dingaling";
SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown);
SWITCH_MODULE_DEFINITION(mod_dingaling, mod_dingaling_load, mod_dingaling_shutdown, NULL);
static switch_memory_pool_t *module_pool = NULL;
@ -1824,7 +1826,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load)
{
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
@ -1927,8 +1929,7 @@ static switch_status_t init_profile(mdl_profile_t *profile, uint8_t login)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown)
{
sign_off();

View File

@ -39,7 +39,9 @@
#define MY_EVENT_RINGING "portaudio::ringing"
static const char modname[] = "mod_portaudio";
SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown);
SWITCH_MODULE_DEFINITION(mod_portaudio, mod_portaudio_load, mod_portaudio_shutdown, NULL);
static switch_memory_pool_t *module_pool = NULL;
//static int running = 1;
@ -872,7 +874,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
{
switch_status_t status;
@ -1039,7 +1041,7 @@ static switch_status_t load_config(void)
return status;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
{
if (globals.read_codec.implementation) {
switch_core_codec_destroy(&globals.read_codec);

View File

@ -48,7 +48,10 @@
//#define MEDIA_ANSWER "ANSWER"
//#define USE_ANSWER 1
static const char modname[] = "mod_woomera";
SWITCH_MODULE_LOAD_FUNCTION(mod_woomera_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_woomera_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_woomera_runtime);
SWITCH_MODULE_DEFINITION(mod_woomera, mod_woomera_load, mod_woomera_shutdown, mod_woomera_runtime);
static switch_memory_pool_t *module_pool = NULL;
@ -1269,7 +1272,7 @@ static void *woomera_thread_run(void *obj)
return NULL;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_woomera_runtime)
{
woomera_thread_run(&default_profile);
@ -1277,7 +1280,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
return SWITCH_STATUS_TERM;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_woomera_shutdown)
{
int x = 0;
woomera_profile_thread_running(&default_profile, 1, 0);
@ -1291,7 +1294,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_woomera_load)
{
struct woomera_profile *profile = &default_profile;

View File

@ -40,7 +40,11 @@
#include <sys/stat.h>
#include <fcntl.h>
static const char modname[] = "mod_cdr - CDR Engine";
SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_cdr_runtime);
SWITCH_MODULE_DEFINITION(mod_cdr, mod_cdr_load, mod_cdr_shutdown, mod_cdr_runtime);
static int RUNNING = 0;
static CDRContainer *newcdrcontainer;
static switch_memory_pool_t *module_pool;
@ -122,10 +126,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface **interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_load)
{
/* connect my internal structure to the blank pointer passed to me */
*interface = &cdr_module_interface;
*module_interface = &cdr_module_interface;
switch_core_add_state_handler(&state_handlers);
@ -142,7 +146,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_cdr_runtime)
{
RUNNING = 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr made it to runtime. Wee!\n");
@ -196,7 +200,7 @@ SWITCH_STANDARD_API(modcdr_show_available)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_shutdown)
{
delete newcdrcontainer;
switch_thread_rwlock_destroy(cdr_rwlock);

View File

@ -32,7 +32,10 @@
#include <switch.h>
static char *MARKER = "1";
static const char modname[] = "mod_event_multicast";
SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime);
SWITCH_MODULE_DEFINITION(mod_event_multicast, mod_event_multicast_load, mod_event_multicast_shutdown, mod_event_multicast_runtime);
static switch_memory_pool_t *module_pool = NULL;
@ -183,7 +186,7 @@ static switch_loadable_module_interface_t event_test_module_interface = {
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
{
memset(&globals, 0, sizeof(globals));
@ -246,7 +249,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown)
{
int x = 0;
@ -259,8 +262,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
{
switch_event_t *local_event;
char buf[65536] = { 0 };

View File

@ -32,7 +32,11 @@
#include <switch.h>
#define CMD_BUFLEN 1024 * 1000
static const char modname[] = "mod_event_socket";
SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime);
SWITCH_MODULE_DEFINITION(mod_event_socket, mod_event_socket_load, mod_event_socket_shutdown, mod_event_socket_runtime);
static char *MARKER = "1";
typedef enum {
@ -280,7 +284,7 @@ static void close_socket(switch_socket_t ** sock)
switch_mutex_unlock(listen_list.sock_mutex);
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown)
{
listener_t *l;
@ -300,8 +304,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &event_socket_module_interface;
@ -1188,7 +1191,7 @@ static int config(void)
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
{
switch_memory_pool_t *pool = NULL, *listener_pool = NULL;
switch_status_t rv;

View File

@ -31,7 +31,8 @@
*/
#include <switch.h>
static const char modname[] = "mod_event_test";
SWITCH_MODULE_LOAD_FUNCTION(mod_event_test_load);
SWITCH_MODULE_DEFINITION(mod_event_test, mod_event_test_load, NULL, NULL);
//#define TORTURE_ME
@ -124,8 +125,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
}
#endif
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_event_test_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &event_test_module_interface;

View File

@ -32,7 +32,10 @@
#include <switch.h>
#include <iksemel.h>
static const char modname[] = "mod_xmpp_event";
SWITCH_MODULE_LOAD_FUNCTION(mod_xmpp_event_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xmpp_event_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xmpp_event_runtime);
SWITCH_MODULE_DEFINITION(mod_xmpp_event, mod_xmpp_event_load, mod_xmpp_event_shutdown, mod_xmpp_event_runtime);
static int RUNNING = 0;
static iksfilter *my_filter;
@ -397,7 +400,7 @@ static switch_loadable_module_interface_t xmpp_event_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_xmpp_event_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &xmpp_event_module_interface;
@ -411,7 +414,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xmpp_event_shutdown)
{
if (RUNNING) {
@ -424,7 +427,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xmpp_event_runtime)
{
RUNNING = 1;
xmpp_connect(globals.jid, globals.passwd);

View File

@ -35,7 +35,10 @@
#endif
#include <howl.h>
static const char modname[] = "mod_zeroconf";
SWITCH_MODULE_LOAD_FUNCTION(mod_zeroconf_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_zeroconf_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_zeroconf_runtime);
SWITCH_MODULE_DEFINITION(mod_zeroconf, mod_zeroconf_load, mod_zeroconf_shutdown, mod_zeroconf_runtime);
static switch_memory_pool_t *module_pool = NULL;
@ -249,7 +252,7 @@ static switch_loadable_module_interface_t zeroconf_module_interface = {
static int RUNNING = 0;
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_zeroconf_shutdown)
{
if (RUNNING == 1) {
RUNNING = -1;
@ -258,8 +261,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_zeroconf_load)
{
memset(&globals, 0, sizeof(globals));
@ -298,7 +300,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_zeroconf_runtime)
{
RUNNING = 1;

View File

@ -31,7 +31,8 @@
*/
#include <switch.h>
static const char modname[] = "mod_native_file";
SWITCH_MODULE_LOAD_FUNCTION(mod_native_file_load);
SWITCH_MODULE_DEFINITION(mod_native_file, mod_native_file_load, NULL, NULL);
struct native_file_context {
switch_file_t *fd;
@ -163,7 +164,7 @@ static switch_loadable_module_interface_t native_file_module_interface = {
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_native_file_load)
{
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];

View File

@ -32,7 +32,8 @@
#include <switch.h>
#include <sndfile.h>
static const char modname[] = "mod_sndfile";
SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load);
SWITCH_MODULE_DEFINITION(mod_sndfile, mod_sndfile_load, NULL, NULL);
static switch_memory_pool_t *module_pool = NULL;
@ -361,7 +362,7 @@ static switch_status_t setup_formats(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
{
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {

View File

@ -43,7 +43,9 @@
static char *embedding[] = { "", "-e", "" };
EXTERN_C void xs_init(pTHX);
static const char modname[] = "mod_perl";
SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown);
SWITCH_MODULE_DEFINITION(mod_perl, mod_perl_load, mod_perl_shutdown, NULL);
static struct {
PerlInterpreter *my_perl;
@ -100,7 +102,7 @@ static switch_loadable_module_interface_t perl_module_interface = {
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown)
{
if (globals.my_perl) {
perl_destruct(globals.my_perl);
@ -111,7 +113,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load)
{
PerlInterpreter *my_perl;

View File

@ -38,8 +38,9 @@
#include <curl/curl.h>
#endif
static const char modname[] = "mod_spidermonkey";
SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown);
SWITCH_MODULE_DEFINITION(mod_spidermonkey, mod_spidermonkey_load, mod_spidermonkey_shutdown, NULL);
static void session_destroy(JSContext * cx, JSObject * obj);
static JSBool session_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval);
@ -3046,7 +3047,7 @@ static void message_query_handler(switch_event_t *event)
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load)
{
switch_status_t status;
@ -3069,7 +3070,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown)
{
curl_global_cleanup();
return SWITCH_STATUS_SUCCESS;

View File

@ -31,7 +31,9 @@
*/
#include <switch.h>
static const char modname[] = "mod_console";
SWITCH_MODULE_LOAD_FUNCTION(mod_console_load);
SWITCH_MODULE_DEFINITION(mod_console, mod_console_load, NULL, NULL);
static const uint8_t STATIC_LEVELS[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
static int COLORIZE = 0;
#ifdef WIN32
@ -188,7 +190,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
{
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");

View File

@ -33,8 +33,8 @@
#include <math.h>
#include <ctype.h>
static const char modname[] = "mod_say_en";
SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load);
SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL);
#define say_num(num, t) { \
char tmp[80];\
@ -537,7 +537,7 @@ static switch_loadable_module_interface_t say_en_module_interface = {
/*.asr_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &say_en_module_interface;

View File

@ -46,7 +46,11 @@ static struct {
switch_mutex_t *mutex;
} globals;
static const char modname[] = "mod_softtimer";
SWITCH_MODULE_LOAD_FUNCTION(mod_softtimer_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_softtimer_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_softtimer_runtime);
SWITCH_MODULE_DEFINITION(mod_softtimer, mod_softtimer_load, mod_softtimer_shutdown, mod_softtimer_runtime);
#define MAX_ELEMENTS 1000
struct timer_private {
@ -191,13 +195,13 @@ static const switch_timer_interface_t timer_interface = {
/*.timer_destroy */ timer_destroy
};
static const switch_loadable_module_interface_t mod_softtimer_module_interface = {
static const switch_loadable_module_interface_t softtimer_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ &timer_interface
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_softtimer_load)
{
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
@ -206,7 +210,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &mod_softtimer_module_interface;
*module_interface = &softtimer_module_interface;
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
@ -218,7 +222,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
#define STEP_MS 1
#define STEP_MIC 1000
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_softtimer_runtime)
{
switch_time_t reference = switch_time_now();
uint32_t current_ms = 0;
@ -267,8 +272,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
return SWITCH_STATUS_TERM;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_softtimer_shutdown)
{
if (globals.RUNNING) {

View File

@ -32,7 +32,8 @@
#include <sys/stat.h>
#include <switch.h>
static const char modname[] = "mod_xml_cdr";
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
SWITCH_MODULE_DEFINITION(mod_xml_cdr, mod_xml_cdr_load, NULL, NULL);
static switch_status_t my_on_hangup(switch_core_session_t *session)
{
@ -91,7 +92,7 @@ static const switch_state_handler_table_t state_handlers = {
};
static const switch_loadable_module_interface_t mod_xml_cdr_module_interface = {
static const switch_loadable_module_interface_t xml_cdr_module_interface = {
/*.module_name = */ modname,
/*.endpoint_interface = */ NULL,
/*.timer_interface = */ NULL,
@ -100,12 +101,12 @@ static const switch_loadable_module_interface_t mod_xml_cdr_module_interface = {
/*.application_interface */ NULL
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
{
/* test global state handlers */
switch_core_add_state_handler(&state_handlers);
*module_interface = &mod_xml_cdr_module_interface;
*module_interface = &xml_cdr_module_interface;
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;

View File

@ -31,7 +31,9 @@
#include <switch.h>
#include <curl/curl.h>
static const char modname[] = "mod_xml_curl";
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_curl_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_curl_shutdown);
SWITCH_MODULE_DEFINITION(mod_xml_curl, mod_xml_curl_load, mod_xml_curl_shutdown, NULL);
struct xml_binding {
char *url;
@ -229,7 +231,7 @@ static switch_status_t do_config(void)
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_curl_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &xml_curl_module_interface;
@ -244,7 +246,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_curl_shutdown)
{
curl_global_cleanup();
return SWITCH_STATUS_SUCCESS;

View File

@ -42,7 +42,10 @@
#include <xmlrpc-c/server.h>
#include <xmlrpc-c/server_abyss.h>
static const char modname[] = "mod_xml_rpc";
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime);
SWITCH_MODULE_DEFINITION(mod_xml_rpc, mod_xml_rpc_load, mod_xml_rpc_shutdown, mod_xml_rpc_runtime);
static switch_loadable_module_interface_t xml_rpc_module_interface = {
/*.module_name */ modname,
@ -112,7 +115,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm)
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &xml_rpc_module_interface;
@ -357,7 +360,7 @@ static xmlrpc_value *freeswitch_man(xmlrpc_env * const envP, xmlrpc_value * cons
return val;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime)
{
TServer abyssServer;
xmlrpc_registry *registryP;
@ -402,7 +405,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown)
{
globals.running = 0;
return SWITCH_STATUS_SUCCESS;