mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
simplify openzap signaling configuration API
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@879 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
00c5bf0033
commit
c1ee86a046
@ -2306,43 +2306,47 @@ static switch_status_t load_config(void)
|
|||||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||||
char *id = (char *) switch_xml_attr(myspan, "id");
|
char *id = (char *) switch_xml_attr(myspan, "id");
|
||||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||||
|
char *sigmod = (char *) switch_xml_attr(myspan, "sigmod");
|
||||||
zap_status_t zstatus = ZAP_FAIL;
|
zap_status_t zstatus = ZAP_FAIL;
|
||||||
const char *context = "default";
|
const char *context = "default";
|
||||||
const char *dialplan = "XML";
|
const char *dialplan = "XML";
|
||||||
uint32_t span_id = 0;
|
uint32_t span_id = 0;
|
||||||
zap_span_t *span = NULL;
|
zap_span_t *span = NULL;
|
||||||
const char *tonegroup = NULL;
|
const char *tonegroup = NULL;
|
||||||
char *local_ip = NULL;
|
zap_conf_parameter_t spanparameters[30];
|
||||||
int local_port = 0;
|
unsigned paramindex = 0;
|
||||||
char *remote_ip = NULL;
|
|
||||||
int remote_port = 0;
|
if (!id && !name) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "boost span requires an id or name as attribute: <span id=ozid|name=ozname>\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
memset(spanparameters, 0, sizeof(spanparameters));
|
||||||
|
if (sigmod) {
|
||||||
|
spanparameters[paramindex].var = "sigmod";
|
||||||
|
spanparameters[paramindex].val = sigmod;
|
||||||
|
paramindex++;
|
||||||
|
}
|
||||||
|
|
||||||
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
|
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
|
if (sizeof(spanparameters)/sizeof(spanparameters[0]) == paramindex) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!strcasecmp(var, "tonegroup")) {
|
if (!strcasecmp(var, "tonegroup")) {
|
||||||
tonegroup = val;
|
tonegroup = val;
|
||||||
} else if (!strcasecmp(var, "local-ip")) {
|
|
||||||
local_ip = val;
|
|
||||||
} else if (!strcasecmp(var, "local-port")) {
|
|
||||||
local_port = atoi(val);
|
|
||||||
} else if (!strcasecmp(var, "remote-ip")) {
|
|
||||||
remote_ip = val;
|
|
||||||
} else if (!strcasecmp(var, "remote-port")) {
|
|
||||||
remote_port = atoi(val);
|
|
||||||
} else if (!strcasecmp(var, "context")) {
|
} else if (!strcasecmp(var, "context")) {
|
||||||
context = val;
|
context = val;
|
||||||
} else if (!strcasecmp(var, "dialplan")) {
|
} else if (!strcasecmp(var, "dialplan")) {
|
||||||
dialplan = val;
|
dialplan = val;
|
||||||
|
} else {
|
||||||
|
spanparameters[paramindex].var = var;
|
||||||
|
spanparameters[paramindex].val = val;
|
||||||
|
paramindex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id && !name) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tonegroup) {
|
if (!tonegroup) {
|
||||||
tonegroup = "us";
|
tonegroup = "us";
|
||||||
}
|
}
|
||||||
@ -2369,12 +2373,7 @@ static switch_status_t load_config(void)
|
|||||||
span_id = span->span_id;
|
span_id = span->span_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zap_configure_span("sangoma_boost", span, on_clear_channel_signal,
|
if (zap_configure_span_signaling("sangoma_boost", span, on_clear_channel_signal, spanparameters) != ZAP_SUCCESS) {
|
||||||
"local_ip", local_ip,
|
|
||||||
"local_port", &local_port,
|
|
||||||
"remote_ip", remote_ip,
|
|
||||||
"remote_port", &remote_port,
|
|
||||||
TAG_END) != ZAP_SUCCESS) {
|
|
||||||
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d error: %s\n", span_id, span->last_error);
|
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d error: %s\n", span_id, span->last_error);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -737,6 +737,7 @@ OZ_DECLARE(zap_status_t) zap_channel_init(zap_channel_t *zchan);
|
|||||||
OZ_DECLARE(int) zap_load_modules(void);
|
OZ_DECLARE(int) zap_load_modules(void);
|
||||||
OZ_DECLARE(zap_status_t) zap_unload_modules(void);
|
OZ_DECLARE(zap_status_t) zap_unload_modules(void);
|
||||||
OZ_DECLARE(zap_status_t) zap_configure_span(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, ...);
|
OZ_DECLARE(zap_status_t) zap_configure_span(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, ...);
|
||||||
|
OZ_DECLARE(zap_status_t) zap_configure_span_signaling(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, zap_conf_parameter_t *parameters);
|
||||||
OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span);
|
OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span);
|
||||||
OZ_DECLARE(zap_status_t) zap_span_stop(zap_span_t *span);
|
OZ_DECLARE(zap_status_t) zap_span_stop(zap_span_t *span);
|
||||||
OZ_DECLARE(char *) zap_build_dso_path(const char *name, char *path, zap_size_t len);
|
OZ_DECLARE(char *) zap_build_dso_path(const char *name, char *path, zap_size_t len);
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
*
|
||||||
|
* Moises Silva <moy@sangoma.com>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZAP_TYPES_H
|
#ifndef ZAP_TYPES_H
|
||||||
@ -428,6 +433,11 @@ typedef enum zap_channel_hw_link_status {
|
|||||||
ZAP_HW_LINK_CONNECTED
|
ZAP_HW_LINK_CONNECTED
|
||||||
} zap_channel_hw_link_status_t;
|
} zap_channel_hw_link_status_t;
|
||||||
|
|
||||||
|
typedef struct zap_conf_parameter_s {
|
||||||
|
const char *var;
|
||||||
|
const char *val;
|
||||||
|
} zap_conf_parameter_t;
|
||||||
|
|
||||||
typedef struct zap_channel zap_channel_t;
|
typedef struct zap_channel zap_channel_t;
|
||||||
typedef struct zap_event zap_event_t;
|
typedef struct zap_event zap_event_t;
|
||||||
typedef struct zap_sigmsg zap_sigmsg_t;
|
typedef struct zap_sigmsg zap_sigmsg_t;
|
||||||
@ -464,6 +474,7 @@ typedef zap_status_t (*zap_stream_handle_write_function_t) (zap_stream_handle_t
|
|||||||
#define ZIO_IO_UNLOAD_ARGS (void)
|
#define ZIO_IO_UNLOAD_ARGS (void)
|
||||||
#define ZIO_SIG_LOAD_ARGS (void)
|
#define ZIO_SIG_LOAD_ARGS (void)
|
||||||
#define ZIO_SIG_CONFIGURE_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, va_list ap)
|
#define ZIO_SIG_CONFIGURE_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, va_list ap)
|
||||||
|
#define ZIO_CONFIGURE_SPAN_SIGNALING_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, zap_conf_parameter_t *zap_parameters)
|
||||||
#define ZIO_SIG_UNLOAD_ARGS (void)
|
#define ZIO_SIG_UNLOAD_ARGS (void)
|
||||||
#define ZIO_API_ARGS (zap_stream_handle_t *stream, const char *data)
|
#define ZIO_API_ARGS (zap_stream_handle_t *stream, const char *data)
|
||||||
|
|
||||||
@ -489,6 +500,7 @@ typedef zap_status_t (*zio_write_t) ZIO_WRITE_ARGS ;
|
|||||||
typedef zap_status_t (*zio_io_load_t) ZIO_IO_LOAD_ARGS ;
|
typedef zap_status_t (*zio_io_load_t) ZIO_IO_LOAD_ARGS ;
|
||||||
typedef zap_status_t (*zio_sig_load_t) ZIO_SIG_LOAD_ARGS ;
|
typedef zap_status_t (*zio_sig_load_t) ZIO_SIG_LOAD_ARGS ;
|
||||||
typedef zap_status_t (*zio_sig_configure_t) ZIO_SIG_CONFIGURE_ARGS ;
|
typedef zap_status_t (*zio_sig_configure_t) ZIO_SIG_CONFIGURE_ARGS ;
|
||||||
|
typedef zap_status_t (*zio_configure_span_signaling_t) ZIO_CONFIGURE_SPAN_SIGNALING_ARGS ;
|
||||||
typedef zap_status_t (*zio_io_unload_t) ZIO_IO_UNLOAD_ARGS ;
|
typedef zap_status_t (*zio_io_unload_t) ZIO_IO_UNLOAD_ARGS ;
|
||||||
typedef zap_status_t (*zio_sig_unload_t) ZIO_SIG_UNLOAD_ARGS ;
|
typedef zap_status_t (*zio_sig_unload_t) ZIO_SIG_UNLOAD_ARGS ;
|
||||||
typedef zap_status_t (*zio_api_t) ZIO_API_ARGS ;
|
typedef zap_status_t (*zio_api_t) ZIO_API_ARGS ;
|
||||||
@ -516,14 +528,13 @@ typedef zap_status_t (*zio_api_t) ZIO_API_ARGS ;
|
|||||||
#define ZIO_IO_LOAD_FUNCTION(name) zap_status_t name ZIO_IO_LOAD_ARGS
|
#define ZIO_IO_LOAD_FUNCTION(name) zap_status_t name ZIO_IO_LOAD_ARGS
|
||||||
#define ZIO_SIG_LOAD_FUNCTION(name) zap_status_t name ZIO_SIG_LOAD_ARGS
|
#define ZIO_SIG_LOAD_FUNCTION(name) zap_status_t name ZIO_SIG_LOAD_ARGS
|
||||||
#define ZIO_SIG_CONFIGURE_FUNCTION(name) zap_status_t name ZIO_SIG_CONFIGURE_ARGS
|
#define ZIO_SIG_CONFIGURE_FUNCTION(name) zap_status_t name ZIO_SIG_CONFIGURE_ARGS
|
||||||
|
#define ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(name) zap_status_t name ZIO_CONFIGURE_SPAN_SIGNALING_ARGS
|
||||||
#define ZIO_IO_UNLOAD_FUNCTION(name) zap_status_t name ZIO_IO_UNLOAD_ARGS
|
#define ZIO_IO_UNLOAD_FUNCTION(name) zap_status_t name ZIO_IO_UNLOAD_ARGS
|
||||||
#define ZIO_SIG_UNLOAD_FUNCTION(name) zap_status_t name ZIO_SIG_UNLOAD_ARGS
|
#define ZIO_SIG_UNLOAD_FUNCTION(name) zap_status_t name ZIO_SIG_UNLOAD_ARGS
|
||||||
#define ZIO_API_FUNCTION(name) zap_status_t name ZIO_API_ARGS
|
#define ZIO_API_FUNCTION(name) zap_status_t name ZIO_API_ARGS
|
||||||
|
|
||||||
#include "zap_dso.h"
|
#include "zap_dso.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[256];
|
char name[256];
|
||||||
zio_io_load_t io_load;
|
zio_io_load_t io_load;
|
||||||
@ -533,6 +544,15 @@ typedef struct {
|
|||||||
zio_sig_unload_t sig_unload;
|
zio_sig_unload_t sig_unload;
|
||||||
zap_dso_lib_t lib;
|
zap_dso_lib_t lib;
|
||||||
char path[256];
|
char path[256];
|
||||||
|
/*!
|
||||||
|
\brief configure a given span signaling
|
||||||
|
\see sig_configure
|
||||||
|
This is just like sig_configure but receives
|
||||||
|
an array of paramters instead of va_list
|
||||||
|
I'd like to deprecate sig_configure and move
|
||||||
|
all modules to use sigparam_configure
|
||||||
|
*/
|
||||||
|
zio_configure_span_signaling_t configure_span_signaling;
|
||||||
} zap_module_t;
|
} zap_module_t;
|
||||||
|
|
||||||
#ifndef __FUNCTION__
|
#ifndef __FUNCTION__
|
||||||
|
@ -1566,7 +1566,7 @@ static ZIO_CHANNEL_GET_SIG_STATUS_FUNCTION(sangoma_boost_get_sig_status)
|
|||||||
* \param ap List of configuration variables
|
* \param ap List of configuration variables
|
||||||
* \return Success or failure
|
* \return Success or failure
|
||||||
*/
|
*/
|
||||||
static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
static ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(zap_sangoma_boost_configure_span)
|
||||||
{
|
{
|
||||||
#define FAIL_CONFIG_RETURN(retstatus) \
|
#define FAIL_CONFIG_RETURN(retstatus) \
|
||||||
if (sangoma_boost_data) \
|
if (sangoma_boost_data) \
|
||||||
@ -1577,7 +1577,6 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
|||||||
zap_mutex_unlock(g_boost_modules_mutex); \
|
zap_mutex_unlock(g_boost_modules_mutex); \
|
||||||
if (lib) \
|
if (lib) \
|
||||||
zap_dso_destroy(lib); \
|
zap_dso_destroy(lib); \
|
||||||
va_end(conflist); \
|
|
||||||
return retstatus;
|
return retstatus;
|
||||||
|
|
||||||
boost_sigmod_interface_t *sigmod_iface = NULL;
|
boost_sigmod_interface_t *sigmod_iface = NULL;
|
||||||
@ -1585,44 +1584,27 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
|||||||
const char *local_ip = "127.0.0.65", *remote_ip = "127.0.0.66";
|
const char *local_ip = "127.0.0.65", *remote_ip = "127.0.0.66";
|
||||||
const char *sigmod = NULL;
|
const char *sigmod = NULL;
|
||||||
int local_port = 53000, remote_port = 53000;
|
int local_port = 53000, remote_port = 53000;
|
||||||
char *var = NULL, *val = NULL;
|
const char *var = NULL, *val = NULL;
|
||||||
int *intval = NULL;
|
|
||||||
int hash_locked = 0;
|
int hash_locked = 0;
|
||||||
zap_dso_lib_t lib = NULL;
|
zap_dso_lib_t lib = NULL;
|
||||||
char path[255] = "";
|
char path[255] = "";
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
va_list conflist;
|
unsigned paramindex = 0;
|
||||||
|
|
||||||
/* we need to copy the list before moving with va_arg in case this configuration should be handled by a sigmod */
|
for (; zap_parameters[paramindex].var; paramindex++) {
|
||||||
va_copy(conflist, ap); /* WARNING: must be freed before returning */
|
var = zap_parameters[paramindex].var;
|
||||||
|
val = zap_parameters[paramindex].val;
|
||||||
while((var = va_arg(ap, char *))) {
|
|
||||||
if (!strcasecmp(var, "sigmod")) {
|
if (!strcasecmp(var, "sigmod")) {
|
||||||
if (!(val = va_arg(ap, char *))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sigmod = val;
|
sigmod = val;
|
||||||
} else if (!strcasecmp(var, "local_ip")) {
|
} else if (!strcasecmp(var, "local_ip")) {
|
||||||
if (!(val = va_arg(ap, char *))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
local_ip = val;
|
local_ip = val;
|
||||||
} else if (!strcasecmp(var, "remote_ip")) {
|
} else if (!strcasecmp(var, "remote_ip")) {
|
||||||
if (!(val = va_arg(ap, char *))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
remote_ip = val;
|
remote_ip = val;
|
||||||
} else if (!strcasecmp(var, "local_port")) {
|
} else if (!strcasecmp(var, "local_port")) {
|
||||||
if (!(intval = va_arg(ap, int *))) {
|
local_port = atoi(val);
|
||||||
break;
|
|
||||||
}
|
|
||||||
local_port = *intval;
|
|
||||||
} else if (!strcasecmp(var, "remote_port")) {
|
} else if (!strcasecmp(var, "remote_port")) {
|
||||||
if (!(intval = va_arg(ap, int *))) {
|
remote_port = atoi(val);
|
||||||
break;
|
} else if (!sigmod) {
|
||||||
}
|
|
||||||
remote_port = *intval;
|
|
||||||
} else {
|
|
||||||
snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var);
|
snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var);
|
||||||
FAIL_CONFIG_RETURN(ZAP_FAIL);
|
FAIL_CONFIG_RETURN(ZAP_FAIL);
|
||||||
}
|
}
|
||||||
@ -1676,7 +1658,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
|||||||
}
|
}
|
||||||
zap_log(ZAP_LOG_NOTICE, "Span %s will use Sangoma Boost Signaling Module %s\n", span->name, sigmod_iface->name);
|
zap_log(ZAP_LOG_NOTICE, "Span %s will use Sangoma Boost Signaling Module %s\n", span->name, sigmod_iface->name);
|
||||||
sangoma_boost_data->sigmod = sigmod_iface;
|
sangoma_boost_data->sigmod = sigmod_iface;
|
||||||
sigmod_iface->configure_span(span, conflist);
|
sigmod_iface->configure_span(span, zap_parameters);
|
||||||
} else {
|
} else {
|
||||||
zap_set_string(sangoma_boost_data->mcon.cfg.local_ip, local_ip);
|
zap_set_string(sangoma_boost_data->mcon.cfg.local_ip, local_ip);
|
||||||
sangoma_boost_data->mcon.cfg.local_port = local_port;
|
sangoma_boost_data->mcon.cfg.local_port = local_port;
|
||||||
@ -1693,9 +1675,6 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
|||||||
span->get_sig_status = sangoma_boost_get_sig_status;
|
span->get_sig_status = sangoma_boost_get_sig_status;
|
||||||
span->state_map = &boost_state_map;
|
span->state_map = &boost_state_map;
|
||||||
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
|
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
|
||||||
|
|
||||||
va_end(conflist);
|
|
||||||
|
|
||||||
return ZAP_SUCCESS;
|
return ZAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1703,12 +1682,10 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
|
|||||||
* \brief Openzap sangoma boost signaling module definition
|
* \brief Openzap sangoma boost signaling module definition
|
||||||
*/
|
*/
|
||||||
zap_module_t zap_module = {
|
zap_module_t zap_module = {
|
||||||
"sangoma_boost",
|
.name = "sangoma_boost",
|
||||||
NULL,
|
.sig_load = zap_sangoma_boost_init,
|
||||||
NULL,
|
.sig_unload = zap_sangoma_boost_destroy,
|
||||||
zap_sangoma_boost_init,
|
.configure_span_signaling = zap_sangoma_boost_configure_span
|
||||||
zap_sangoma_boost_configure_span,
|
|
||||||
zap_sangoma_boost_destroy
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
|
@ -116,10 +116,10 @@ typedef zap_status_t (*boost_set_sig_status_func_t) BOOST_SET_SIG_STATUS_ARGS;
|
|||||||
/*!
|
/*!
|
||||||
\brief Configure the given span signaling
|
\brief Configure the given span signaling
|
||||||
\param span The openzap span
|
\param span The openzap span
|
||||||
\param ap The list of configuration key,value pairs (must be null terminated)
|
\param parameters The array of configuration key,value pairs (must be null terminated)
|
||||||
\return ZAP_SUCCESS or ZAP_FAIL
|
\return ZAP_SUCCESS or ZAP_FAIL
|
||||||
*/
|
*/
|
||||||
#define BOOST_CONFIGURE_SPAN_ARGS (zap_span_t *span, va_list ap)
|
#define BOOST_CONFIGURE_SPAN_ARGS (zap_span_t *span, zap_conf_parameter_t *parameters)
|
||||||
typedef zap_status_t (*boost_configure_span_func_t) BOOST_CONFIGURE_SPAN_ARGS;
|
typedef zap_status_t (*boost_configure_span_func_t) BOOST_CONFIGURE_SPAN_ARGS;
|
||||||
#define BOOST_CONFIGURE_SPAN_FUNCTION(name) zap_status_t name BOOST_CONFIGURE_SPAN_ARGS
|
#define BOOST_CONFIGURE_SPAN_FUNCTION(name) zap_status_t name BOOST_CONFIGURE_SPAN_ARGS
|
||||||
|
|
||||||
|
@ -2806,6 +2806,32 @@ OZ_DECLARE(zap_status_t) zap_configure_span(const char *type, zap_span_t *span,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OZ_DECLARE(zap_status_t) zap_configure_span_signaling(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, zap_conf_parameter_t *parameters)
|
||||||
|
{
|
||||||
|
zap_module_t *mod = (zap_module_t *) hashtable_search(globals.module_hash, (void *)type);
|
||||||
|
zap_status_t status = ZAP_FAIL;
|
||||||
|
|
||||||
|
zap_assert(type != NULL, ZAP_FAIL, "No signaling type");
|
||||||
|
zap_assert(span != NULL, ZAP_FAIL, "No span");
|
||||||
|
zap_assert(sig_cb != NULL, ZAP_FAIL, "No signaling callback");
|
||||||
|
zap_assert(parameters != NULL, ZAP_FAIL, "No parameters");
|
||||||
|
|
||||||
|
if (!mod) {
|
||||||
|
zap_load_module_assume(type);
|
||||||
|
if ((mod = (zap_module_t *) hashtable_search(globals.module_hash, (void *)type))) {
|
||||||
|
zap_log(ZAP_LOG_INFO, "auto-loaded '%s'\n", type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mod && mod->configure_span_signaling) {
|
||||||
|
status = mod->configure_span_signaling(span, sig_cb, parameters);
|
||||||
|
} else {
|
||||||
|
zap_log(ZAP_LOG_ERROR, "can't find module '%s' or the module did not implement the signaling configuration method\n", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span)
|
OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span)
|
||||||
{
|
{
|
||||||
if (span->start) {
|
if (span->start) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user