open5gs/src/pgw.c

47 lines
966 B
C
Raw Normal View History

2017-07-11 10:16:45 +00:00
#define TRACE_MODULE _pgw_main
#include "core_debug.h"
#include "core_signal.h"
#include "core_semaphore.h"
2018-01-04 11:38:22 +00:00
#include "app/context.h"
#include "app/app.h"
2017-07-11 10:16:45 +00:00
2017-10-24 06:55:28 +00:00
const char *app_name = "pgw";
2017-10-29 11:48:17 +00:00
status_t app_initialize(const char *config_path, const char *log_path)
2017-07-11 10:16:45 +00:00
{
status_t rv;
2017-08-04 03:06:56 +00:00
int others = 0;
2017-07-11 10:16:45 +00:00
rv = app_will_initialize(config_path, log_path);
if (rv != CORE_OK) return rv;
2017-07-11 10:16:45 +00:00
2017-11-27 06:45:33 +00:00
others = context_self()->logger.trace.others;
2017-08-04 03:06:56 +00:00
if (others)
{
d_trace_level(&_pgw_main, others);
}
d_trace(1, "PGW try to initialize\n");
2017-07-11 10:16:45 +00:00
rv = pgw_initialize();
2017-08-04 03:06:56 +00:00
d_assert(rv == CORE_OK, return rv, "Failed to intialize PGW");
d_trace(1, "PGW initialize...done\n");
2017-07-11 10:16:45 +00:00
2017-10-29 11:48:17 +00:00
rv = app_did_initialize();
if (rv != CORE_OK) return rv;
2017-07-11 10:16:45 +00:00
return CORE_OK;
}
2017-07-11 14:38:52 +00:00
void app_terminate(void)
2017-07-11 10:16:45 +00:00
{
2017-07-11 14:38:52 +00:00
app_will_terminate();
2017-07-11 10:16:45 +00:00
2017-08-04 03:06:56 +00:00
d_trace(1, "PGW try to terminate\n");
2017-07-11 10:16:45 +00:00
pgw_terminate();
2017-08-04 03:06:56 +00:00
d_trace(1, "PGW terminate...done\n");
2017-07-11 10:16:45 +00:00
2017-07-11 14:38:52 +00:00
app_did_terminate();
2017-07-11 10:16:45 +00:00
}