fix ozmod_sangoma_boost compilation and linking
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@917 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
4778d58223
commit
432a195053
|
@ -617,9 +617,7 @@ struct zap_io_interface {
|
||||||
zio_api_t api;
|
zio_api_t api;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct zap_queue;
|
typedef struct zap_queue zap_queue_t;
|
||||||
#define zap_queue_t struct zap_queue
|
|
||||||
|
|
||||||
typedef zap_status_t (*zap_queue_create_func_t)(zap_queue_t **queue, zap_size_t capacity);
|
typedef zap_status_t (*zap_queue_create_func_t)(zap_queue_t **queue, zap_size_t capacity);
|
||||||
typedef zap_status_t (*zap_queue_enqueue_func_t)(zap_queue_t *queue, void *obj);
|
typedef zap_status_t (*zap_queue_enqueue_func_t)(zap_queue_t *queue, void *obj);
|
||||||
typedef void *(*zap_queue_dequeue_func_t)(zap_queue_t *queue);
|
typedef void *(*zap_queue_dequeue_func_t)(zap_queue_t *queue);
|
||||||
|
|
|
@ -28,9 +28,9 @@ extern "C" {
|
||||||
typedef void (*zap_func_ptr_t) (void);
|
typedef void (*zap_func_ptr_t) (void);
|
||||||
typedef void * zap_dso_lib_t;
|
typedef void * zap_dso_lib_t;
|
||||||
|
|
||||||
void zap_dso_destroy(zap_dso_lib_t *lib);
|
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib);
|
||||||
zap_dso_lib_t zap_dso_open(const char *path, char **err);
|
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err);
|
||||||
void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err);
|
OZ_DECLARE(void *) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,9 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="openzap.lib"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""$(OutDir)""
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
|
|
|
@ -1374,14 +1374,19 @@ static sangomabc_event_t *zap_boost_read_event(zap_span_t *span)
|
||||||
mcon = &sangoma_boost_data->mcon;
|
mcon = &sangoma_boost_data->mcon;
|
||||||
pcon = &sangoma_boost_data->pcon;
|
pcon = &sangoma_boost_data->pcon;
|
||||||
|
|
||||||
if (sangoma_boost_data->sigmod || FD_ISSET(pcon->socket, &sangoma_boost_data->rfds)) {
|
if (sangoma_boost_data->sigmod
|
||||||
|
#ifndef WIN32
|
||||||
|
|| FD_ISSET(pcon->socket, &sangoma_boost_data->rfds)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
event = sangomabc_connection_readp(pcon, sangoma_boost_data->iteration);
|
event = sangomabc_connection_readp(pcon, sangoma_boost_data->iteration);
|
||||||
}
|
}
|
||||||
|
#ifndef WIN32
|
||||||
/* if there is no event and this is not a sigmod-driven span it's time to try the other connection for events */
|
/* if there is no event and this is not a sigmod-driven span it's time to try the other connection for events */
|
||||||
if (!event && !sangoma_boost_data->sigmod && FD_ISSET(mcon->socket, &sangoma_boost_data->rfds)) {
|
if (!event && !sangoma_boost_data->sigmod && FD_ISSET(mcon->socket, &sangoma_boost_data->rfds)) {
|
||||||
event = sangomabc_connection_readp(mcon, sangoma_boost_data->iteration);
|
event = sangomabc_connection_readp(mcon, sangoma_boost_data->iteration);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;C:\wanpipe\include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="openzap.lib libsangoma.lib"
|
AdditionalDependencies="openzap.lib libsangoma.lib"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86"
|
AdditionalLibraryDirectories=""$(OutDir)";C:\wanpipe\lib"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
RandomizedBaseAddress="1"
|
RandomizedBaseAddress="1"
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
void zap_dso_destroy(zap_dso_lib_t *lib) {
|
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||||
if (lib && *lib) {
|
if (lib && *lib) {
|
||||||
FreeLibrary(*lib);
|
FreeLibrary(*lib);
|
||||||
*lib = NULL;
|
*lib = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err) {
|
||||||
HINSTANCE lib;
|
HINSTANCE lib;
|
||||||
|
|
||||||
lib = LoadLibraryEx(path, NULL, 0);
|
lib = LoadLibraryEx(path, NULL, 0);
|
||||||
|
@ -53,7 +53,7 @@ zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
OZ_DECLARE(void*) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||||
FARPROC func = GetProcAddress(lib, sym);
|
FARPROC func = GetProcAddress(lib, sym);
|
||||||
if (!func) {
|
if (!func) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
|
@ -78,14 +78,14 @@ void* zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
void zap_dso_destroy(zap_dso_lib_t *lib) {
|
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||||
if (lib && *lib) {
|
if (lib && *lib) {
|
||||||
dlclose(*lib);
|
dlclose(*lib);
|
||||||
*lib = NULL;
|
*lib = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err) {
|
||||||
void *lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
void *lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
||||||
if (lib == NULL) {
|
if (lib == NULL) {
|
||||||
*err = zap_strdup(dlerror());
|
*err = zap_strdup(dlerror());
|
||||||
|
@ -93,7 +93,7 @@ zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
OZ_DECLARE(void*) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||||
void *func = dlsym(lib, sym);
|
void *func = dlsym(lib, sym);
|
||||||
if (!func) {
|
if (!func) {
|
||||||
*err = zap_strdup(dlerror());
|
*err = zap_strdup(dlerror());
|
||||||
|
|
|
@ -34,8 +34,13 @@
|
||||||
|
|
||||||
#include "openzap.h"
|
#include "openzap.h"
|
||||||
|
|
||||||
#undef zap_queue_t
|
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity);
|
||||||
typedef struct zap_queue {
|
static zap_status_t zap_std_queue_enqueue(zap_queue_t *queue, void *obj);
|
||||||
|
static void *zap_std_queue_dequeue(zap_queue_t *queue);
|
||||||
|
static zap_status_t zap_std_queue_wait(zap_queue_t *queue, int ms);
|
||||||
|
static zap_status_t zap_std_queue_destroy(zap_queue_t **inqueue);
|
||||||
|
|
||||||
|
struct zap_queue {
|
||||||
zap_mutex_t *mutex;
|
zap_mutex_t *mutex;
|
||||||
zap_condition_t *condition;
|
zap_condition_t *condition;
|
||||||
zap_size_t capacity;
|
zap_size_t capacity;
|
||||||
|
@ -43,21 +48,15 @@ typedef struct zap_queue {
|
||||||
unsigned rindex;
|
unsigned rindex;
|
||||||
unsigned windex;
|
unsigned windex;
|
||||||
void **elements;
|
void **elements;
|
||||||
} zap_queue_t;
|
};
|
||||||
|
|
||||||
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity);
|
|
||||||
static zap_status_t zap_std_queue_enqueue(zap_queue_t *queue, void *obj);
|
|
||||||
static void *zap_std_queue_dequeue(zap_queue_t *queue);
|
|
||||||
static zap_status_t zap_std_queue_wait(zap_queue_t *queue, int ms);
|
|
||||||
static zap_status_t zap_std_queue_destroy(zap_queue_t **inqueue);
|
|
||||||
|
|
||||||
OZ_DECLARE_DATA zap_queue_handler_t g_zap_queue_handler =
|
OZ_DECLARE_DATA zap_queue_handler_t g_zap_queue_handler =
|
||||||
{
|
{
|
||||||
.create = zap_std_queue_create,
|
/*.create = */ zap_std_queue_create,
|
||||||
.enqueue = zap_std_queue_enqueue,
|
/*.enqueue = */ zap_std_queue_enqueue,
|
||||||
.dequeue = zap_std_queue_dequeue,
|
/*.dequeue = */ zap_std_queue_dequeue,
|
||||||
.wait = zap_std_queue_wait,
|
/*.wait = */ zap_std_queue_wait,
|
||||||
.destroy = zap_std_queue_destroy
|
/*.destroy = */ zap_std_queue_destroy
|
||||||
};
|
};
|
||||||
|
|
||||||
OZ_DECLARE(zap_status_t) zap_global_set_queue_handler(zap_queue_handler_t *handler)
|
OZ_DECLARE(zap_status_t) zap_global_set_queue_handler(zap_queue_handler_t *handler)
|
||||||
|
@ -76,11 +75,12 @@ OZ_DECLARE(zap_status_t) zap_global_set_queue_handler(zap_queue_handler_t *handl
|
||||||
|
|
||||||
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity)
|
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity)
|
||||||
{
|
{
|
||||||
|
zap_queue_t *queue = NULL;
|
||||||
zap_assert_return(outqueue, ZAP_FAIL, "Queue double pointer is null\n");
|
zap_assert_return(outqueue, ZAP_FAIL, "Queue double pointer is null\n");
|
||||||
zap_assert_return(capacity > 0, ZAP_FAIL, "Queue capacity is not bigger than 0\n");
|
zap_assert_return(capacity > 0, ZAP_FAIL, "Queue capacity is not bigger than 0\n");
|
||||||
|
|
||||||
*outqueue = NULL;
|
*outqueue = NULL;
|
||||||
zap_queue_t *queue = zap_calloc(1, sizeof(*queue));
|
queue = zap_calloc(1, sizeof(*queue));
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue