mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 23:37:22 +00:00
[SEPP] Initial Update for 5G Roaming (#2739)
[SEPP] Initial Update for 5G Roaming
This commit is contained in:
parent
e12b1be313
commit
e92293e0af
324 changed files with 26622 additions and 14319 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
int __ogs_app_domain;
|
||||
|
||||
static int read_config(void);
|
||||
static int parse_config(void);
|
||||
|
||||
int ogs_app_initialize(
|
||||
const char *version, const char *default_config,
|
||||
const char *const argv[])
|
||||
|
|
@ -38,6 +41,7 @@ int ogs_app_initialize(
|
|||
ogs_app_setup_log();
|
||||
|
||||
ogs_app_context_init();
|
||||
ogs_app_config_init();
|
||||
ogs_app()->version = version;
|
||||
|
||||
/**************************************************************************
|
||||
|
|
@ -75,16 +79,16 @@ int ogs_app_initialize(
|
|||
else
|
||||
ogs_app()->file = default_config;
|
||||
|
||||
rv = ogs_app_config_read();
|
||||
rv = read_config();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = ogs_app_context_parse_config();
|
||||
rv = parse_config();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
/**************************************************************************
|
||||
* Stage 3 : Initialize Default Memory Pool
|
||||
*/
|
||||
ogs_pkbuf_default_create(&ogs_app()->pool.defconfig);
|
||||
ogs_pkbuf_default_create(&ogs_global_conf()->pkbuf_config);
|
||||
|
||||
/**************************************************************************
|
||||
* Stage 4 : Setup LOG Module
|
||||
|
|
@ -151,6 +155,7 @@ int ogs_app_initialize(
|
|||
|
||||
void ogs_app_terminate(void)
|
||||
{
|
||||
ogs_app_config_final();
|
||||
ogs_app_context_final();
|
||||
|
||||
ogs_pkbuf_default_destroy();
|
||||
|
|
@ -158,7 +163,7 @@ void ogs_app_terminate(void)
|
|||
ogs_core_terminate();
|
||||
}
|
||||
|
||||
int ogs_app_config_read(void)
|
||||
static int read_config(void)
|
||||
{
|
||||
FILE *file;
|
||||
yaml_parser_t parser;
|
||||
|
|
@ -236,6 +241,68 @@ int ogs_app_config_read(void)
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int context_prepare(void)
|
||||
{
|
||||
#define USRSCTP_LOCAL_UDP_PORT 9899
|
||||
ogs_app()->usrsctp.udp_port = USRSCTP_LOCAL_UDP_PORT;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int context_validation(void)
|
||||
{
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int parse_config(void)
|
||||
{
|
||||
int rv;
|
||||
yaml_document_t *document = NULL;
|
||||
ogs_yaml_iter_t root_iter;
|
||||
|
||||
document = ogs_app()->document;
|
||||
ogs_assert(document);
|
||||
|
||||
rv = context_prepare();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
ogs_yaml_iter_init(&root_iter, document);
|
||||
while (ogs_yaml_iter_next(&root_iter)) {
|
||||
const char *root_key = ogs_yaml_iter_key(&root_iter);
|
||||
ogs_assert(root_key);
|
||||
if (!strcmp(root_key, "db_uri")) {
|
||||
ogs_app()->db_uri = ogs_yaml_iter_value(&root_iter);
|
||||
} else if (!strcmp(root_key, "logger")) {
|
||||
ogs_yaml_iter_t logger_iter;
|
||||
ogs_yaml_iter_recurse(&root_iter, &logger_iter);
|
||||
while (ogs_yaml_iter_next(&logger_iter)) {
|
||||
const char *logger_key = ogs_yaml_iter_key(&logger_iter);
|
||||
ogs_assert(logger_key);
|
||||
if (!strcmp(logger_key, "file")) {
|
||||
ogs_app()->logger.file = ogs_yaml_iter_value(&logger_iter);
|
||||
} else if (!strcmp(logger_key, "level")) {
|
||||
ogs_app()->logger.level =
|
||||
ogs_yaml_iter_value(&logger_iter);
|
||||
} else if (!strcmp(logger_key, "domain")) {
|
||||
ogs_app()->logger.domain =
|
||||
ogs_yaml_iter_value(&logger_iter);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(root_key, "global")) {
|
||||
rv = ogs_app_parse_global_conf(&root_iter);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_global_conf_parse_config() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv = context_validation();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
void ogs_app_setup_log(void)
|
||||
{
|
||||
ogs_log_install_domain(&__ogs_app_domain, "app", ogs_core()->log.level);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue