All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
mod-test.c source code

You can copy and paste the following code to start a turbulence module.

This code is checked (through compilation) against Turbulence source code.

/* Turbulence BEEP application server
* Copyright (C) 2010 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2.1 of the
* License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to develop
* proprietary applications using this library without any royalty or
* fee but returning back any change, improvement or addition in the
* form of source code, project image, documentation patches, etc.
*
* For commercial support on build BEEP enabled solutions, supporting
* turbulence based solutions, etc, contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* C/ Antonio Suarez NÂș10, Edificio Alius A, Despacho 102
* Alcala de Henares, 28802 (MADRID)
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/turbulence
*/
#include <turbulence.h>
/* use this declarations to avoid c++ compilers to mangle exported
* names. */
BEGIN_C_DECLS
#define MOD_TEST_URI1 "http://turbulence.ws/profiles/test1"
#define MOD_TEST_URI2 "http://turbulence.ws/profiles/test2"
#define MOD_TEST_URI3 "http://turbulence.ws/profiles/test3"
#define MOD_TEST_URI4 "http://turbulence.ws/profiles/test4"
TurbulenceCtx * ctx = NULL;
static int test_init (TurbulenceCtx * _ctx)
{
/* configure the module */
/* using TBC_VORTEX_CTX allows to get the vortex context from
* the turbulence ctx */
msg ("Turbulence BEEP server, test module: init");
/* register all profiles without handlers: testing purposes */
vortex_profiles_register (TBC_VORTEX_CTX (ctx),
MOD_TEST_URI1,
NULL, NULL,
NULL, NULL,
NULL, NULL);
vortex_profiles_register (TBC_VORTEX_CTX (ctx),
MOD_TEST_URI2,
NULL, NULL,
NULL, NULL,
NULL, NULL);
vortex_profiles_register (TBC_VORTEX_CTX (ctx),
MOD_TEST_URI3,
NULL, NULL,
NULL, NULL,
NULL, NULL);
vortex_profiles_register (TBC_VORTEX_CTX (ctx),
MOD_TEST_URI4,
NULL, NULL,
NULL, NULL,
NULL, NULL);
return axl_true;
}
static void test_close (TurbulenceCtx * ctx)
{
msg ("Turbulence BEEP server, test module: close");
return;
}
static void test_reconf (TurbulenceCtx * ctx) {
msg ("Turbulence BEEP server configuration have change");
return;
}
static axl_bool test_ppath_selected (TurbulenceCtx * ctx, TurbulencePPathDef * ppath_selected, VortexConnection * conn) {
msg ("Turbulence configured ppath %s to connection id %d",
turbulence_ppath_get_name (ppath_selected),
vortex_connection_get_id (conn));
return axl_true;
}
TurbulenceModDef module_def = {
"mod-test",
"Turbulence BEEP server, test module",
test_init,
test_close,
test_reconf,
NULL,
test_ppath_selected
};
END_C_DECLS