update it
This commit is contained in:
parent
29c068ba96
commit
740b3c39e7
|
@ -14,6 +14,7 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
|||
|
||||
static status_t s6a_conf_init();
|
||||
static status_t s6a_fd_ext_init();
|
||||
static status_t s6a_dict_objs_init();
|
||||
|
||||
status_t s6a_initialize()
|
||||
{
|
||||
|
@ -52,6 +53,20 @@ status_t s6a_initialize()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_dict_objs_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_conf_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_thread_start()
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = fd_core_start();
|
||||
if (ret != 0)
|
||||
{
|
||||
|
@ -69,45 +84,7 @@ status_t s6a_initialize()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_conf_init()
|
||||
{
|
||||
fd_g_config->cnf_flags.no_fwd = 1;
|
||||
fd_g_config->cnf_flags.no_ip6 = 1;
|
||||
fd_g_config->cnf_flags.no_sctp = 1;
|
||||
fd_g_config->cnf_flags.pr_tcp = 1;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_identity(char *identity)
|
||||
{
|
||||
fd_g_config->cnf_diamid = identity;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamid,
|
||||
&fd_g_config->cnf_diamid_len, 1);
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_realm(char *realm)
|
||||
{
|
||||
fd_g_config->cnf_diamrlm = realm;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamrlm,
|
||||
&fd_g_config->cnf_diamrlm_len, 1);
|
||||
}
|
||||
|
||||
void s6a_conf_show()
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
|
||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
||||
{
|
||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void s6a_terminate()
|
||||
void s6a_thread_stop()
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -170,6 +147,45 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
status_t s6a_conf_init()
|
||||
{
|
||||
fd_g_config->cnf_flags.no_fwd = 1;
|
||||
fd_g_config->cnf_flags.no_ip6 = 1;
|
||||
fd_g_config->cnf_flags.no_sctp = 1;
|
||||
fd_g_config->cnf_flags.pr_tcp = 1;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_identity(char *identity)
|
||||
{
|
||||
fd_g_config->cnf_diamid = identity;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamid,
|
||||
&fd_g_config->cnf_diamid_len, 1);
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_realm(char *realm)
|
||||
{
|
||||
fd_g_config->cnf_diamrlm = realm;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamrlm,
|
||||
&fd_g_config->cnf_diamrlm_len, 1);
|
||||
}
|
||||
|
||||
void s6a_conf_show()
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
|
||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
||||
{
|
||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
status_t s6a_fd_ext_init()
|
||||
{
|
||||
int ret;
|
||||
|
@ -203,3 +219,7 @@ status_t s6a_fd_ext_init()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_dict_objs_init()
|
||||
{
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ extern "C" {
|
|||
#define S6A_SDU_SIZE 2048
|
||||
|
||||
CORE_DECLARE(status_t) s6a_initialize();
|
||||
CORE_DECLARE(void) s6a_terminate();
|
||||
|
||||
CORE_DECLARE(status_t) s6a_thread_start();
|
||||
CORE_DECLARE(void) s6a_thread_stop();
|
||||
|
||||
CORE_DECLARE(status_t) s6a_conf_set_identity(char *identity);
|
||||
CORE_DECLARE(status_t) s6a_conf_set_realm(char *realm);
|
||||
|
|
25
src/init.c
25
src/init.c
|
@ -14,8 +14,8 @@
|
|||
|
||||
#define EVENT_WAIT_TIMEOUT 10000 /* 10 msec */
|
||||
|
||||
static thread_id mme_thread;
|
||||
static thread_id path_thread;
|
||||
static thread_id mme_sm_thread;
|
||||
static thread_id mme_net_thread;
|
||||
|
||||
status_t cellwire_initialize(char *config_path)
|
||||
{
|
||||
|
@ -40,12 +40,10 @@ status_t cellwire_initialize(char *config_path)
|
|||
|
||||
void cellwire_terminate(void)
|
||||
{
|
||||
s6a_terminate();
|
||||
|
||||
context_final();
|
||||
}
|
||||
|
||||
void *THREAD_FUNC mme_main(void *data)
|
||||
void *THREAD_FUNC mme_sm_main(void *data)
|
||||
{
|
||||
event_t event;
|
||||
msgq_id queue_id;
|
||||
|
@ -100,7 +98,7 @@ void *THREAD_FUNC mme_main(void *data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *THREAD_FUNC path_main(void *data)
|
||||
void *THREAD_FUNC mme_net_main(void *data)
|
||||
{
|
||||
while (!thread_should_stop())
|
||||
{
|
||||
|
@ -114,16 +112,21 @@ void threads_start()
|
|||
{
|
||||
status_t rv;
|
||||
|
||||
rv = thread_create(&mme_thread, NULL, mme_main, NULL);
|
||||
rv = thread_create(&mme_sm_thread, NULL, mme_sm_main, NULL);
|
||||
d_assert(rv == CORE_OK, return,
|
||||
"MME State machine thread creation failed");
|
||||
rv = thread_create(&path_thread, NULL, path_main, NULL);
|
||||
rv = thread_create(&mme_net_thread, NULL, mme_net_main, NULL);
|
||||
d_assert(rv == CORE_OK, return,
|
||||
"Network PATH thread creation failed");
|
||||
"MME Network socket recv thread creation failed");
|
||||
|
||||
rv = s6a_thread_start();
|
||||
d_assert(rv == CORE_OK, return,
|
||||
"HSS thread creation failed");
|
||||
}
|
||||
|
||||
void threads_stop()
|
||||
{
|
||||
thread_delete(mme_thread);
|
||||
thread_delete(path_thread);
|
||||
s6a_thread_stop();
|
||||
thread_delete(mme_net_thread);
|
||||
thread_delete(mme_sm_thread);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue