update it
This commit is contained in:
parent
92648c3295
commit
2f90a1492b
|
@ -5,11 +5,11 @@ SUBDIRS = freeDiameter
|
|||
noinst_LTLIBRARIES = libs6a.la
|
||||
|
||||
libs6a_la_SOURCES = \
|
||||
s6a_app.h
|
||||
s6a_fd.h s6a_app.h
|
||||
|
||||
nodist_libs6a_la_SOURCES = \
|
||||
s6a_fd_init.c s6a_fd_config.c \
|
||||
s6a_app.c s6a_dict.c s6a_server.c s6a_client.c
|
||||
s6a_app.c
|
||||
|
||||
libs6a_la_DEPENDENCIES = \
|
||||
$(top_srcdir)/lib/s6a/freeDiameter/libs6afreeDiameter.la
|
||||
|
@ -21,7 +21,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/core/include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
-Wall -Werror -Wno-unused -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
|
|
|
@ -1,93 +1,46 @@
|
|||
/*********************************************************************************************************
|
||||
* Software License Agreement (BSD License) *
|
||||
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
|
||||
* *
|
||||
* Copyright (c) 2013, WIDE Project and NICT *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use of this software in source and binary forms, with or without modification, are *
|
||||
* permitted provided that the following conditions are met: *
|
||||
* *
|
||||
* * Redistributions of source code must retain the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer. *
|
||||
* *
|
||||
* * Redistributions in binary form must reproduce the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer in the documentation and/or other *
|
||||
* materials provided with the distribution. *
|
||||
* *
|
||||
* * Neither the name of the WIDE Project or NICT nor the *
|
||||
* names of its contributors may be used to endorse or *
|
||||
* promote products derived from this software without *
|
||||
* specific prior written permission of WIDE Project and *
|
||||
* NICT. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
*********************************************************************************************************/
|
||||
|
||||
/*
|
||||
* Test application for freeDiameter.
|
||||
*/
|
||||
#define TRACE_MODULE _s6a_app
|
||||
|
||||
#include "s6a_app.h"
|
||||
|
||||
/* Initialize the configuration */
|
||||
struct ta_conf * ta_conf = NULL;
|
||||
static struct ta_conf _conf;
|
||||
static pthread_t ta_stats_th = (pthread_t)NULL;
|
||||
struct s6a_conf *s6a_conf = NULL;
|
||||
static struct s6a_conf _conf;
|
||||
static pthread_t s6a_stats_th = (pthread_t)NULL;
|
||||
|
||||
static int ta_conf_init(void)
|
||||
static int s6a_conf_init(void)
|
||||
{
|
||||
ta_conf = &_conf;
|
||||
memset(ta_conf, 0, sizeof(struct ta_conf));
|
||||
s6a_conf = &_conf;
|
||||
memset(s6a_conf, 0, sizeof(struct s6a_conf));
|
||||
|
||||
/* Set the default values */
|
||||
ta_conf->vendor_id = 999999; /* Dummy value */
|
||||
ta_conf->appli_id = 0xffffff; /* dummy value */
|
||||
ta_conf->cmd_id = 0xfffffe; /* Experimental */
|
||||
ta_conf->avp_id = 0xffffff; /* dummy value */
|
||||
ta_conf->long_avp_len = 5000;
|
||||
ta_conf->mode = MODE_SERV | MODE_CLI;
|
||||
ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
|
||||
ta_conf->dest_host = NULL;
|
||||
ta_conf->signal = TEST_APP_DEFAULT_SIGNAL;
|
||||
ta_conf->bench_concur = 100;
|
||||
ta_conf->bench_duration = 10;
|
||||
s6a_conf->vendor_id = 10415; /* 3GPP Vendor ID */
|
||||
s6a_conf->appli_id = 16777251; /* 3GPP S6A Application ID */
|
||||
s6a_conf->mode = MODE_SERV | MODE_CLI;
|
||||
s6a_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
|
||||
s6a_conf->dest_host = NULL;
|
||||
|
||||
/* Initialize the mutex */
|
||||
CHECK_POSIX( pthread_mutex_init(&ta_conf->stats_lock, NULL) );
|
||||
CHECK_POSIX( pthread_mutex_init(&s6a_conf->stats_lock, NULL) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ta_conf_dump(void)
|
||||
static void s6a_conf_dump(void)
|
||||
{
|
||||
if (!TRACE_BOOL(INFO))
|
||||
return;
|
||||
fd_log_debug( "------- app_test configuration dump: ---------");
|
||||
fd_log_debug( " Vendor Id .......... : %u", ta_conf->vendor_id);
|
||||
fd_log_debug( " Application Id ..... : %u", ta_conf->appli_id);
|
||||
fd_log_debug( " Command Id ......... : %u", ta_conf->cmd_id);
|
||||
fd_log_debug( " AVP Id ............. : %u", ta_conf->avp_id);
|
||||
fd_log_debug( " Long AVP Id ........ : %u", ta_conf->long_avp_id);
|
||||
fd_log_debug( " Long AVP len ....... : %zu", ta_conf->long_avp_len);
|
||||
fd_log_debug( " Mode ............... : %s%s%s", ta_conf->mode & MODE_SERV ? "Serv" : "", ta_conf->mode & MODE_CLI ? "Cli" : "", ta_conf->mode & MODE_BENCH ? " (Benchmark)" : "");
|
||||
fd_log_debug( " Destination Realm .. : %s", ta_conf->dest_realm ?: "- none -");
|
||||
fd_log_debug( " Destination Host ... : %s", ta_conf->dest_host ?: "- none -");
|
||||
fd_log_debug( " Signal ............. : %i", ta_conf->signal);
|
||||
fd_log_debug( "------- /app_test configuration dump ---------");
|
||||
LOG_N( "------- s6a configuration dump: ---------");
|
||||
LOG_N( " Vendor Id .......... : %u", s6a_conf->vendor_id);
|
||||
LOG_N( " Application Id ..... : %u", s6a_conf->appli_id);
|
||||
LOG_N( " Mode ............... : %s%s",
|
||||
s6a_conf->mode & MODE_SERV ? "Serv" : "",
|
||||
s6a_conf->mode & MODE_CLI ? "Cli" : "");
|
||||
LOG_N( " Destination Realm .. : %s",
|
||||
s6a_conf->dest_realm ?: "- none -");
|
||||
LOG_N( " Destination Host ... : %s",
|
||||
s6a_conf->dest_host ?: "- none -");
|
||||
LOG_N( "------- /s6a configuration dump ---------");
|
||||
}
|
||||
|
||||
/* Function to display statistics periodically */
|
||||
static void * ta_stats(void * arg) {
|
||||
static void * s6a_stats(void * arg) {
|
||||
|
||||
struct timespec start, now;
|
||||
struct ta_stats copy;
|
||||
|
@ -98,12 +51,12 @@ static void * ta_stats(void * arg) {
|
|||
/* Now, loop until canceled */
|
||||
while (1) {
|
||||
/* Display statistics every XX seconds */
|
||||
sleep(ta_conf->bench_duration + 3);
|
||||
sleep(10);
|
||||
|
||||
/* Now, get the current stats */
|
||||
CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), );
|
||||
memcpy(©, &ta_conf->stats, sizeof(struct ta_stats));
|
||||
CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), );
|
||||
CHECK_POSIX_DO( pthread_mutex_lock(&s6a_conf->stats_lock), );
|
||||
memcpy(©, &s6a_conf->stats, sizeof(struct ta_stats));
|
||||
CHECK_POSIX_DO( pthread_mutex_unlock(&s6a_conf->stats_lock), );
|
||||
|
||||
/* Get the current execution time */
|
||||
CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &now), );
|
||||
|
@ -120,17 +73,14 @@ static void * ta_stats(void * arg) {
|
|||
(long)(now.tv_nsec + 1000000000 - start.tv_nsec) / 1000);
|
||||
}
|
||||
|
||||
if (ta_conf->mode & MODE_SERV) {
|
||||
if (s6a_conf->mode & MODE_SERV) {
|
||||
fd_log_debug( " Server: %llu message(s) echoed", copy.nb_echoed);
|
||||
}
|
||||
if (ta_conf->mode & MODE_CLI) {
|
||||
if (s6a_conf->mode & MODE_CLI) {
|
||||
fd_log_debug( " Client:");
|
||||
fd_log_debug( " %llu message(s) sent", copy.nb_sent);
|
||||
fd_log_debug( " %llu error(s) received", copy.nb_errs);
|
||||
fd_log_debug( " %llu answer(s) received", copy.nb_recv);
|
||||
fd_log_debug( " fastest: %ld.%06ld sec.", copy.shortest / 1000000, copy.shortest % 1000000);
|
||||
fd_log_debug( " slowest: %ld.%06ld sec.", copy.longest / 1000000, copy.longest % 1000000);
|
||||
fd_log_debug( " Average: %ld.%06ld sec.", copy.avg / 1000000, copy.avg % 1000000);
|
||||
}
|
||||
fd_log_debug( "-------------------------------------");
|
||||
}
|
||||
|
@ -138,30 +88,15 @@ static void * ta_stats(void * arg) {
|
|||
return NULL; /* never called */
|
||||
}
|
||||
|
||||
static struct fd_hook_hdl * hookhdl[2] = { NULL, NULL };
|
||||
static void ta_hook_cb_silent(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata) {
|
||||
}
|
||||
static void ta_hook_cb_oneline(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata) {
|
||||
char * buf = NULL;
|
||||
size_t len;
|
||||
|
||||
CHECK_MALLOC_DO( fd_msg_dump_summary(&buf, &len, NULL, msg, NULL, 0, 0),
|
||||
{ LOG_E("Error while dumping a message"); return; } );
|
||||
|
||||
LOG_N("{%d} %s: %s", type, (char *)other ?:"<nil>", buf ?:"<nil>");
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
|
||||
/* entry point */
|
||||
int s6a_app_init(void)
|
||||
{
|
||||
/* Initialize configuration */
|
||||
CHECK_FCT( ta_conf_init() );
|
||||
CHECK_FCT( s6a_conf_init() );
|
||||
|
||||
ta_conf_dump();
|
||||
s6a_conf_dump();
|
||||
|
||||
#if 0
|
||||
/* Install objects definitions for this test application */
|
||||
CHECK_FCT( ta_dict_init() );
|
||||
|
||||
|
@ -178,17 +113,9 @@ int s6a_app_init(void)
|
|||
/* Advertise the support for the test application in the peer */
|
||||
CHECK_FCT( fd_disp_app_support ( ta_appli, ta_vendor, 1, 0 ) );
|
||||
|
||||
if (ta_conf->mode & MODE_BENCH) {
|
||||
/* Register an empty hook to disable the default handling */
|
||||
CHECK_FCT( fd_hook_register( HOOK_MASK( HOOK_DATA_RECEIVED, HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_SENT, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL ),
|
||||
ta_hook_cb_silent, NULL, NULL, &hookhdl[0]) );
|
||||
CHECK_FCT( fd_hook_register( HOOK_MASK( HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED ),
|
||||
ta_hook_cb_oneline, NULL, NULL, &hookhdl[1]) );
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Start the statistics thread */
|
||||
CHECK_POSIX( pthread_create(&ta_stats_th, NULL, ta_stats, NULL) );
|
||||
CHECK_POSIX( pthread_create(&s6a_stats_th, NULL, s6a_stats, NULL) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -196,14 +123,13 @@ int s6a_app_init(void)
|
|||
/* Unload */
|
||||
void s6a_app_final(void)
|
||||
{
|
||||
#if 0
|
||||
if (ta_conf->mode & MODE_CLI)
|
||||
ta_cli_fini();
|
||||
if (ta_conf->mode & MODE_SERV)
|
||||
ta_serv_fini();
|
||||
if (hookhdl[0])
|
||||
fd_hook_unregister( hookhdl[0] );
|
||||
if (hookhdl[1])
|
||||
fd_hook_unregister( hookhdl[1] );
|
||||
CHECK_FCT_DO( fd_thr_term(&ta_stats_th), );
|
||||
CHECK_POSIX_DO( pthread_mutex_destroy(&ta_conf->stats_lock), );
|
||||
#endif
|
||||
|
||||
CHECK_FCT_DO( fd_thr_term(&s6a_stats_th), );
|
||||
CHECK_POSIX_DO( pthread_mutex_destroy(&s6a_conf->stats_lock), );
|
||||
}
|
||||
|
|
|
@ -1,93 +1,48 @@
|
|||
/*********************************************************************************************************
|
||||
* Software License Agreement (BSD License) *
|
||||
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
|
||||
* *
|
||||
* Copyright (c) 2013, WIDE Project and NICT *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use of this software in source and binary forms, with or without modification, are *
|
||||
* permitted provided that the following conditions are met: *
|
||||
* *
|
||||
* * Redistributions of source code must retain the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer. *
|
||||
* *
|
||||
* * Redistributions in binary form must reproduce the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer in the documentation and/or other *
|
||||
* materials provided with the distribution. *
|
||||
* *
|
||||
* * Neither the name of the WIDE Project or NICT nor the *
|
||||
* names of its contributors may be used to endorse or *
|
||||
* promote products derived from this software without *
|
||||
* specific prior written permission of WIDE Project and *
|
||||
* NICT. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
*********************************************************************************************************/
|
||||
#ifndef __S6A_APP_H__
|
||||
#define __S6A_APP_H__
|
||||
|
||||
/* Header file for the app_test extension.
|
||||
*
|
||||
* This extension provides a way to send configurable messages on the network
|
||||
*
|
||||
* See the app_test.conf.sample file for the format of the configuration file.
|
||||
*/
|
||||
|
||||
#include "core_errno.h"
|
||||
#include <freeDiameter/extension.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef TEST_APP_DEFAULT_SIGNAL
|
||||
#define TEST_APP_DEFAULT_SIGNAL SIGUSR1
|
||||
#endif /* TEST_APP_DEFAULT_SIGNAL */
|
||||
#include "freeDiameter/freeDiameter-host.h"
|
||||
#include "freeDiameter/libfdcore.h"
|
||||
#include "freeDiameter/extension.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Mode for the extension */
|
||||
#define MODE_SERV 0x1
|
||||
#define MODE_CLI 0x2
|
||||
#define MODE_BENCH 0x4
|
||||
|
||||
/* The module configuration */
|
||||
struct ta_conf {
|
||||
uint32_t vendor_id; /* default 999999 */
|
||||
uint32_t appli_id; /* default 123456 */
|
||||
uint32_t cmd_id; /* default 234567 */
|
||||
uint32_t avp_id; /* default 345678 */
|
||||
uint32_t long_avp_id; /* default 0 */
|
||||
size_t long_avp_len; /* default 5000 */
|
||||
int mode; /* default MODE_SERV | MODE_CLI */
|
||||
char * dest_realm; /* default local realm */
|
||||
char * dest_host; /* default NULL */
|
||||
char * user_name; /* default NULL */
|
||||
int signal; /* default TEST_APP_DEFAULT_SIGNAL */
|
||||
int bench_concur; /* default 100 */
|
||||
int bench_duration; /* default 10 */
|
||||
struct ta_stats {
|
||||
unsigned long long nb_echoed; /* server */
|
||||
unsigned long long nb_sent; /* client */
|
||||
unsigned long long nb_recv; /* client */
|
||||
unsigned long long nb_errs; /* client */
|
||||
unsigned long shortest; /* fastest answer, in microseconds */
|
||||
unsigned long longest; /* slowest answer, in microseconds */
|
||||
unsigned long avg; /* average answer time, in microseconds */
|
||||
} stats;
|
||||
pthread_mutex_t stats_lock;
|
||||
struct s6a_conf {
|
||||
c_uint32_t vendor_id; /* default 999999 */
|
||||
c_uint32_t appli_id; /* default 123456 */
|
||||
int mode; /* default MODE_SERV | MODE_CLI */
|
||||
char *dest_realm; /* default local realm */
|
||||
char *dest_host; /* default NULL */
|
||||
char *user_name; /* default NULL */
|
||||
struct ta_stats {
|
||||
c_uint64_t nb_echoed; /* server */
|
||||
c_uint64_t nb_sent; /* client */
|
||||
c_uint64_t nb_recv; /* client */
|
||||
c_uint64_t nb_errs; /* client */
|
||||
} stats;
|
||||
pthread_mutex_t stats_lock;
|
||||
};
|
||||
extern struct ta_conf * ta_conf;
|
||||
extern struct s6a_conf *s6a_conf;
|
||||
|
||||
int s6a_app_init(void);
|
||||
CORE_DECLARE(int) s6a_app_init(void);
|
||||
void s6a_app_final(void);
|
||||
|
||||
/* Parse the configuration file */
|
||||
int ta_conf_handle(char * conffile);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ! __S6A_APP_H__ */
|
||||
|
||||
#if 0
|
||||
/* Handle incoming messages (server) */
|
||||
int ta_serv_init(void);
|
||||
void ta_serv_fini(void);
|
||||
|
@ -99,7 +54,6 @@ void ta_cli_fini(void);
|
|||
/* Initialize dictionary definitions */
|
||||
int ta_dict_init(void);
|
||||
|
||||
|
||||
/* Some global variables for dictionary */
|
||||
extern struct dict_object * ta_vendor;
|
||||
extern struct dict_object * ta_appli;
|
||||
|
@ -115,3 +69,4 @@ extern struct dict_object * ta_dest_host;
|
|||
extern struct dict_object * ta_dest_realm;
|
||||
extern struct dict_object * ta_user_name;
|
||||
extern struct dict_object * ta_res_code;
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef __S6A_LIB_H__
|
||||
#define __S6A_LIB_H__
|
||||
#ifndef __S6A_FD_H__
|
||||
#define __S6A_FD_H__
|
||||
|
||||
#include "core.h"
|
||||
#include "core_errno.h"
|
||||
|
||||
#include "s6a_app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -27,7 +29,7 @@ struct s6a_fd_config_t {
|
|||
|
||||
extern struct s6a_fd_config_t *s6a_fd_config;
|
||||
|
||||
CORE_DECLARE(status_t) s6a_fd_init();
|
||||
CORE_DECLARE(int) s6a_fd_init();
|
||||
CORE_DECLARE(void) s6a_fd_final();
|
||||
|
||||
CORE_DECLARE(char *) s6a_fd_hss_config();
|
||||
|
@ -38,4 +40,4 @@ CORE_DECLARE(status_t) s6a_fd_config_apply();
|
|||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ! __S6A_LIB_H__ */
|
||||
#endif /* ! __S6A_FD_H__ */
|
|
@ -4,11 +4,7 @@
|
|||
#include "core_lib.h"
|
||||
#include "core_file.h"
|
||||
|
||||
#include "s6a_app.h"
|
||||
#include "s6a_lib.h"
|
||||
|
||||
#include "freeDiameter/freeDiameter-host.h"
|
||||
#include "freeDiameter/libfdcore.h"
|
||||
#include "s6a_fd.h"
|
||||
|
||||
static struct s6a_fd_config_t g_conf;
|
||||
struct s6a_fd_config_t *s6a_fd_config;
|
||||
|
@ -74,7 +70,8 @@ status_t s6a_fd_config_apply()
|
|||
|
||||
/* Display configuration */
|
||||
b = fd_conf_dump(&buf, &len, NULL);
|
||||
LOG_SPLIT(FD_LOG_DEBUG, NULL, b ?: "<Error during configuration dump...>", NULL);
|
||||
LOG_SPLIT(FD_LOG_NOTICE, NULL,
|
||||
b ?: "<Error during configuration dump...>", NULL);
|
||||
free(buf);
|
||||
|
||||
/* Since some extensions might have modified the definitions from the dict_base_protocol, we only load the objects now */
|
||||
|
|
|
@ -5,12 +5,7 @@
|
|||
#include "core_signal.h"
|
||||
#include "core_semaphore.h"
|
||||
|
||||
#include "s6a_app.h"
|
||||
#include "s6a_lib.h"
|
||||
|
||||
#include "freeDiameter/freeDiameter-host.h"
|
||||
#include "freeDiameter/libfdcore.h"
|
||||
#include "freeDiameter/extension.h"
|
||||
#include "s6a_fd.h"
|
||||
|
||||
static pid_t s6a_fd_hss_pid;
|
||||
|
||||
|
@ -19,7 +14,7 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
|||
|
||||
static int check_signal(int signum);
|
||||
|
||||
static status_t s6a_fd_init_internal(const char *conffile)
|
||||
static int s6a_fd_init_internal(const char *conffile)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -32,14 +27,14 @@ static status_t s6a_fd_init_internal(const char *conffile)
|
|||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_log_handler_register() failed");
|
||||
return CORE_ERROR;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fd_core_initialize();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_core_initialize() failed");
|
||||
return CORE_ERROR;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Parse the configuration file */
|
||||
|
@ -57,28 +52,24 @@ static status_t s6a_fd_init_internal(const char *conffile)
|
|||
|
||||
CHECK_FCT_DO( fd_core_waitstartcomplete(), goto error );
|
||||
|
||||
ret = s6a_app_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_app_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
CHECK_FCT_DO( s6a_app_init(), goto error );
|
||||
|
||||
return CORE_OK;
|
||||
return 0;
|
||||
error:
|
||||
CHECK_FCT_DO( fd_core_shutdown(), );
|
||||
CHECK_FCT_DO( fd_core_wait_shutdown_complete(), );
|
||||
|
||||
return CORE_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
status_t s6a_fd_init()
|
||||
int s6a_fd_init()
|
||||
{
|
||||
status_t rv;
|
||||
int ret;
|
||||
semaphore_id semaphore;
|
||||
|
||||
rv = semaphore_create(&semaphore, 0);
|
||||
d_assert(rv == CORE_OK, return rv, "semaphore_create() failed");
|
||||
d_assert(rv == CORE_OK, return -1, "semaphore_create() failed");
|
||||
|
||||
s6a_fd_hss_pid = fork();
|
||||
d_assert(s6a_fd_hss_pid >= 0, _exit(EXIT_FAILURE), "fork() failed");
|
||||
|
@ -101,16 +92,17 @@ status_t s6a_fd_init()
|
|||
}
|
||||
|
||||
/* Parent */
|
||||
rv = s6a_fd_init_internal(s6a_fd_mme_config());
|
||||
if (rv != CORE_OK)
|
||||
ret = s6a_fd_init_internal(s6a_fd_mme_config());
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_fd_init_internal() failed");
|
||||
return CORE_ERROR;
|
||||
return ret;
|
||||
}
|
||||
rv = semaphore_post(semaphore);
|
||||
d_assert(rv == CORE_OK, return rv, "semaphore_post() failed");
|
||||
|
||||
return CORE_OK;
|
||||
rv = semaphore_post(semaphore);
|
||||
d_assert(rv == CORE_OK, return -1, "semaphore_post() failed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void s6a_fd_final()
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "core_thread.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "s6a_lib.h"
|
||||
#include "s6a_fd.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "event.h"
|
||||
|
@ -22,6 +22,7 @@ static thread_id mme_net_thread;
|
|||
status_t cellwire_initialize(char *config_path, char *log_path)
|
||||
{
|
||||
status_t rv;
|
||||
int ret;
|
||||
|
||||
core_initialize();
|
||||
|
||||
|
@ -38,8 +39,8 @@ status_t cellwire_initialize(char *config_path, char *log_path)
|
|||
rv = context_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
rv = s6a_fd_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
ret = s6a_fd_init();
|
||||
if (ret != 0) return CORE_ERROR;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue