update it
This commit is contained in:
parent
b3a51df778
commit
1f187f5de9
|
@ -10,12 +10,11 @@ dist_cellwired_SOURCES = main.c symtbl.h
|
|||
nodist_cellwired_SOURCES = symtbl.c
|
||||
|
||||
cellwired_LDADD = \
|
||||
$(top_srcdir)/src/mme/libmme.la
|
||||
|
||||
$(top_srcdir)/src/libcellwire.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/lib/core/include \
|
||||
-I$(top_srcdir)/src/mme
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
CLEANFILES = symtbl.c
|
||||
DISTCLEANFILES = $(DIST_ARCHIVES)
|
||||
|
|
2
main.c
2
main.c
|
@ -135,7 +135,6 @@ int main(int argc, char *argv[])
|
|||
d_fatal("CellWire initialization failed. Aborted");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
threads_start();
|
||||
|
||||
show_version();
|
||||
d_info("CellWire daemon start");
|
||||
|
@ -143,7 +142,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
d_info("CellWire daemon terminating...");
|
||||
|
||||
threads_stop();
|
||||
cellwire_terminate();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -1,6 +1,32 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
SUBDIRS = mme
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
noinst_LTLIBRARIES = libcellwire.la
|
||||
|
||||
libcellwire_la_SOURCES = \
|
||||
cellwire.h
|
||||
|
||||
nodist_libcellwire_la_SOURCES = \
|
||||
init.c
|
||||
|
||||
libcellwire_la_DEPENDENCIES = \
|
||||
$(top_srcdir)/src/mme/libmme.la
|
||||
|
||||
libcellwire_la_LIBADD = \
|
||||
$(top_srcdir)/src/mme/libmme.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/lib/core/include \
|
||||
-I$(top_srcdir)/lib/logger \
|
||||
-I$(top_srcdir)/src/mme/include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror
|
||||
|
||||
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = core *.stackdump
|
||||
|
||||
EXTRA_DIST = .libs $(noinst_LTLIBRARIES)
|
||||
|
|
|
@ -8,15 +8,11 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define S1_SCTP_PORT 36412
|
||||
#define GTP_C_UDP_PORT 2123
|
||||
#define GTP_U_UDP_PORT 2152
|
||||
|
||||
CORE_DECLARE(status_t) cellwire_initialize(char *config_path, char *log_path);
|
||||
CORE_DECLARE_NONSTD(void) cellwire_terminate(void);
|
||||
|
||||
CORE_DECLARE(void) threads_start(void);
|
||||
CORE_DECLARE(void) threads_stop(void);
|
||||
CORE_DECLARE(status_t) mme_initialize();
|
||||
CORE_DECLARE_NONSTD(void) mme_terminate(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* @file init.c
|
||||
*/
|
||||
|
||||
/* Core library */
|
||||
#define TRACE_MODULE _cellwire_init
|
||||
#include "core_general.h"
|
||||
#include "core_thread.h"
|
||||
#include "core_net.h"
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include "cellwire.h"
|
||||
|
||||
static thread_id net_thread;
|
||||
|
||||
void *THREAD_FUNC net_main(void *data);
|
||||
|
||||
status_t cellwire_initialize(char *config_path, char *log_path)
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
core_initialize();
|
||||
|
||||
if (config_path)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
if (log_path)
|
||||
logger_start(log_path);
|
||||
|
||||
rv = mme_initialize();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
rv = thread_create(&net_thread, NULL, net_main, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void cellwire_terminate(void)
|
||||
{
|
||||
thread_delete(net_thread);
|
||||
|
||||
mme_terminate();
|
||||
core_terminate();
|
||||
}
|
||||
|
||||
void *THREAD_FUNC net_main(void *data)
|
||||
{
|
||||
while (!thread_should_stop())
|
||||
{
|
||||
net_fds_read_run(50);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -3,12 +3,11 @@
|
|||
noinst_LTLIBRARIES = libmme.la
|
||||
|
||||
libmme_la_SOURCES = \
|
||||
cellwire.h event.h context.h \
|
||||
event.h context.h \
|
||||
s1ap_build.h s1ap_conv.h s1ap_path.h \
|
||||
s6_auth_info.h \
|
||||
sm.h
|
||||
|
||||
|
||||
nodist_libmme_la_SOURCES = \
|
||||
init.c event.c context.c \
|
||||
s1ap_build.c s1ap_conv.c s1ap_path.c \
|
||||
|
@ -32,7 +31,6 @@ libmme_la_LIBADD = \
|
|||
$(top_srcdir)/lib/s6a/libs6a.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/lib/core/include \
|
||||
-I$(top_srcdir)/lib/logger \
|
||||
-I$(top_srcdir)/lib/3gpp \
|
||||
|
@ -44,8 +42,6 @@ AM_CPPFLAGS = \
|
|||
AM_CFLAGS = \
|
||||
-Wall -Werror
|
||||
|
||||
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = core *.stackdump
|
||||
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
#include "core_rwlock.h"
|
||||
#include "core_index.h"
|
||||
|
||||
#include "cellwire.h"
|
||||
#include "context.h"
|
||||
#include "s1ap_message.h"
|
||||
|
||||
#define S1_SCTP_PORT 36412
|
||||
#define GTP_C_UDP_PORT 2123
|
||||
#define GTP_U_UDP_PORT 2152
|
||||
|
||||
static mme_ctx_t self;
|
||||
|
||||
pool_declare(enb_pool, enb_ctx_t, SIZE_OF_ENB_POOL);
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
/**
|
||||
* @file init.c
|
||||
*/
|
||||
#define TRACE_MODULE _mme_init
|
||||
|
||||
/* Core library */
|
||||
#define TRACE_MODULE _init
|
||||
#include "core_general.h"
|
||||
#include "core_debug.h"
|
||||
#include "core_thread.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "s6a_app.h"
|
||||
|
||||
#include "context.h"
|
||||
|
@ -17,37 +11,31 @@
|
|||
#define EVENT_WAIT_TIMEOUT 10000 /* 10 msec */
|
||||
|
||||
static thread_id mme_sm_thread;
|
||||
static thread_id mme_net_thread;
|
||||
void *THREAD_FUNC mme_sm_main(void *data);
|
||||
|
||||
status_t cellwire_initialize(char *config_path, char *log_path)
|
||||
status_t mme_initialize()
|
||||
{
|
||||
status_t rv;
|
||||
int ret;
|
||||
|
||||
core_initialize();
|
||||
|
||||
if (config_path)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
if (log_path)
|
||||
logger_start(log_path);
|
||||
|
||||
rv = context_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
ret = s6a_init();
|
||||
if (ret != 0) return CORE_ERROR;
|
||||
|
||||
rv = thread_create(&mme_sm_thread, NULL, mme_sm_main, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void cellwire_terminate(void)
|
||||
void mme_terminate(void)
|
||||
{
|
||||
thread_delete(mme_sm_thread);
|
||||
|
||||
s6a_final();
|
||||
context_final();
|
||||
core_terminate();
|
||||
}
|
||||
|
||||
void *THREAD_FUNC mme_sm_main(void *data)
|
||||
|
@ -114,21 +102,3 @@ void *THREAD_FUNC mme_net_main(void *data)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void threads_start()
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
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(&mme_net_thread, NULL, mme_net_main, NULL);
|
||||
d_assert(rv == CORE_OK, return,
|
||||
"MME Network socket recv thread creation failed");
|
||||
}
|
||||
|
||||
void threads_stop()
|
||||
{
|
||||
thread_delete(mme_net_thread);
|
||||
thread_delete(mme_sm_thread);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ testcellwire_SOURCES = \
|
|||
security_test.c
|
||||
|
||||
testcellwire_LDADD = \
|
||||
$(top_srcdir)/src/mme/libmme.la
|
||||
$(top_srcdir)/src/libcellwire.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/lib/core/include \
|
||||
|
@ -20,7 +20,8 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/s1ap \
|
||||
-I$(top_srcdir)/lib/nas \
|
||||
-I$(top_srcdir)/lib/s6a \
|
||||
-I$(top_srcdir)/src/mme
|
||||
-I$(top_srcdir)/src/mme \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror \
|
||||
|
|
|
@ -38,7 +38,6 @@ void core_assert_ok(abts_case* tc, const char* context, status_t rv,
|
|||
|
||||
void test_terminate(void)
|
||||
{
|
||||
threads_stop();
|
||||
d_msg_to(D_MSG_TO_STDOUT, 1);
|
||||
cellwire_terminate();
|
||||
}
|
||||
|
@ -47,7 +46,6 @@ void test_initialize(void)
|
|||
{
|
||||
cellwire_initialize(NULL, NULL);
|
||||
d_msg_to(D_MSG_TO_STDOUT, 0);
|
||||
threads_start();
|
||||
|
||||
inet_pton(AF_INET, "127.0.0.1", &mme_self()->enb_local_addr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue