make multiple config instead of one implicit global
This commit is contained in:
+7
-3
@@ -463,19 +463,23 @@ add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4
|
||||
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
|
||||
|
||||
set (CONFIG_ROOTDIR ${OPENAIR_DIR}/common/config)
|
||||
add_library(config_internals OBJECT
|
||||
${CONFIG_ROOTDIR}/config_common.c
|
||||
)
|
||||
|
||||
add_library(CONFIG_LIB
|
||||
${CONFIG_ROOTDIR}/config_load_configmodule.c
|
||||
${CONFIG_ROOTDIR}/config_userapi.c
|
||||
${CONFIG_ROOTDIR}/config_cmdline.c
|
||||
)
|
||||
target_link_libraries(CONFIG_LIB PRIVATE config_internals dl UTIL)
|
||||
|
||||
# CONFIG_LIB is a wrapper around a particular config implementation, default is
|
||||
# libconfig in params_libconfig below
|
||||
pkg_check_modules(libconfig REQUIRED libconfig)
|
||||
target_link_libraries(CONFIG_LIB PRIVATE dl UTIL)
|
||||
add_library(params_libconfig MODULE ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c)
|
||||
target_include_directories(params_libconfig PRIVATE ${libconfig_INCLUDE_DIRS})
|
||||
target_link_libraries(params_libconfig PRIVATE ${libconfig_LIBRARIES})
|
||||
target_link_libraries(params_libconfig PRIVATE config_internals ${libconfig_LIBRARIES})
|
||||
|
||||
# shared library loader
|
||||
add_library(shlib_loader OBJECT common/utils/load_module_shlib.c)
|
||||
@@ -2367,7 +2371,7 @@ if (${T_TRACER})
|
||||
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
||||
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_UE_NR ngap
|
||||
CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU SIMU_ETH OPENAIR0_LIB
|
||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts)
|
||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts config_internals)
|
||||
if (TARGET ${i})
|
||||
add_dependencies(${i} generate_T)
|
||||
endif()
|
||||
|
||||
@@ -11,7 +11,7 @@ paramdef_t someoptions[] = {
|
||||
{"opt1", "<help opt1>", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
|
||||
};
|
||||
|
||||
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
|
||||
config_get( someoptions,sizeofArray(someoptions),"somesection");
|
||||
|
||||
```
|
||||
new code:
|
||||
@@ -31,7 +31,7 @@ paramdef_t someoptions[] = {
|
||||
{"opt2", "<help opt2>", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
|
||||
};
|
||||
|
||||
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
|
||||
config_get( someoptions,sizeofArray(someoptions),"somesection");
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ character string, used as a prefix for the section name. It has to be specified
|
||||
list to be read is under another section.
|
||||
*/
|
||||
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,
|
||||
sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
|
||||
sizeofArray(NbIoT_MacRLC_Params),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
|
||||
@@ -37,9 +37,11 @@
|
||||
#include <errno.h>
|
||||
#include <platform_types.h>
|
||||
#include "config_userapi.h"
|
||||
#include "config_common.h"
|
||||
#include "../utils/LOG/log.h"
|
||||
|
||||
int parse_stringlist(paramdef_t *cfgoptions, char *val) {
|
||||
static int parse_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *val)
|
||||
{
|
||||
char *atoken;
|
||||
char *tokctx = NULL;
|
||||
char *tmpval=strdup(val);
|
||||
@@ -57,21 +59,22 @@ int parse_stringlist(paramdef_t *cfgoptions, char *val) {
|
||||
AssertFatal(MAX_LIST_SIZE > numelt,
|
||||
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
|
||||
MAX_LIST_SIZE );
|
||||
config_check_valptr(cfgoptions, sizeof(char*), numelt);
|
||||
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(char *), numelt);
|
||||
|
||||
cfgoptions->numelt=numelt;
|
||||
atoken=strtok_r(val, ",",&tokctx);
|
||||
|
||||
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
|
||||
snprintf(cfgoptions->strlistptr[i],DEFAULT_EXTRA_SZ,"%s",atoken);
|
||||
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
|
||||
printf_params(cfg, "[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname, i, cfgoptions->strlistptr[i]);
|
||||
atoken=strtok_r(NULL, ",",&tokctx);
|
||||
}
|
||||
|
||||
return (cfgoptions->numelt > 0);
|
||||
}
|
||||
|
||||
int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
static int processoption(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *value)
|
||||
{
|
||||
char *tmpval = value;
|
||||
int optisset=0;
|
||||
char defbool[2]="1";
|
||||
@@ -89,19 +92,18 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
|
||||
case TYPE_STRING:
|
||||
if (cfgoptions->numelt == 0 )
|
||||
config_check_valptr(cfgoptions, 1,
|
||||
strlen(tmpval)+1);
|
||||
config_check_valptr(cfg, cfgoptions, 1, strlen(tmpval) + 1);
|
||||
if (cfgoptions->numelt < (strlen(tmpval)+1)) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] command line option %s value too long\n",
|
||||
cfgoptions->optname);
|
||||
}
|
||||
snprintf(*cfgoptions->strptr, cfgoptions->numelt ,"%s",tmpval);
|
||||
printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
|
||||
printf_cmdl(cfg, "[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_STRINGLIST:
|
||||
optisset=parse_stringlist(cfgoptions,tmpval);
|
||||
optisset = parse_stringlist(cfg, cfgoptions, tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT32:
|
||||
@@ -110,8 +112,8 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->iptr), 1);
|
||||
config_assign_int(cfg, cfgoptions, cfgoptions->optname, (int32_t)strtol(tmpval, &charptr, 0));
|
||||
|
||||
if( *charptr != 0) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
|
||||
@@ -122,14 +124,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
|
||||
*(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
|
||||
|
||||
if( *charptr != 0) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
|
||||
}
|
||||
|
||||
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*cfgoptions->i64ptr);
|
||||
printf_cmdl(cfg, "[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*cfgoptions->i64ptr);
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
@@ -138,14 +140,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->dblptr), 1);
|
||||
*cfgoptions->dblptr = strtof(tmpval,&charptr);
|
||||
|
||||
if( *charptr != 0) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
|
||||
}
|
||||
|
||||
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
printf_cmdl(cfg, "[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
@@ -167,7 +169,8 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* check unknown options in the command line
|
||||
*/
|
||||
int config_check_unknown_cmdlineopt(char *prefix) {
|
||||
int config_check_unknown_cmdlineopt(configmodule_interface_t *cfg, char *prefix)
|
||||
{
|
||||
int unknowndetected=0;
|
||||
char testprefix[CONFIG_MAXOPTLENGTH];
|
||||
int finalcheck = 0;
|
||||
@@ -182,18 +185,21 @@ int config_check_unknown_cmdlineopt(char *prefix) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=1; i<config_get_if()->argc ; i++) {
|
||||
if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue;
|
||||
for (int i = 1; i < cfg->argc; i++) {
|
||||
if (!finalcheck && strstr(cfg->argv[i], testprefix) == NULL)
|
||||
continue;
|
||||
|
||||
if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
|
||||
if (!finalcheck && testprefix[0] == 0 && index(cfg->argv[i], '.') != NULL)
|
||||
continue;
|
||||
|
||||
if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue;
|
||||
if (!finalcheck && isdigit(cfg->argv[i][0]))
|
||||
continue;
|
||||
|
||||
if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
|
||||
if (!finalcheck && cfg->argv[i][0] == '-' && isdigit(cfg->argv[i][1]))
|
||||
continue;
|
||||
|
||||
if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
|
||||
fprintf(stderr,"[CONFIG] unknown option: %s\n",
|
||||
config_get_if()->argv[i] );
|
||||
if ((cfg->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0) {
|
||||
fprintf(stderr, "[CONFIG] unknown option: %s\n", cfg->argv[i]);
|
||||
unknowndetected++;
|
||||
}
|
||||
}
|
||||
@@ -204,10 +210,11 @@ int config_check_unknown_cmdlineopt(char *prefix) {
|
||||
}
|
||||
|
||||
return unknowndetected;
|
||||
} /* config_check_unknown_cmdlineopt */
|
||||
} /* config_check_unknown_cmdlineopt */
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
|
||||
int c = config_get_if()->argc;
|
||||
int config_process_cmdline(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
{
|
||||
int c = cfg->argc;
|
||||
int i,j;
|
||||
char *pp;
|
||||
char cfgpath[CONFIG_MAXOPTLENGTH];
|
||||
@@ -215,15 +222,16 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
i = 0;
|
||||
|
||||
while (c > 0 ) {
|
||||
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
char *oneargv =
|
||||
strdup(cfg->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
if(!oneargv) abort();
|
||||
/* first check help options, either --help, -h or --help_<section> */
|
||||
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
|
||||
char *tokctx = NULL;
|
||||
pp=strtok_r(oneargv, "_",&tokctx);
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
|
||||
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
||||
if (pp == NULL || strcasecmp(pp, cfg->argv[i]) == 0) {
|
||||
if( prefix == NULL) {
|
||||
config_printhelp(cfgoptions,numoptions,"(root section)");
|
||||
|
||||
@@ -263,10 +271,10 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
|
||||
char *valptr=NULL;
|
||||
int ret;
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
|
||||
if (c > 0) {
|
||||
pp = config_get_if()->argv[i+1];
|
||||
pp = cfg->argv[i + 1];
|
||||
|
||||
if (pp != NULL ) {
|
||||
ret = strlen(pp);
|
||||
@@ -280,11 +288,11 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
}
|
||||
}
|
||||
|
||||
j += processoption(&(cfgoptions[n]), valptr);
|
||||
j += processoption(cfg, &(cfgoptions[n]), valptr);
|
||||
|
||||
if ( valptr != NULL ) {
|
||||
i++;
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
c--;
|
||||
}
|
||||
|
||||
@@ -298,6 +306,6 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
c--;
|
||||
} /* fin du while */
|
||||
|
||||
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
|
||||
printf_cmdl(cfg, "[CONFIG] %s %i options set from command line\n", ((prefix == NULL) ? "(root)" : prefix), j);
|
||||
return j;
|
||||
} /* parse_cmdline*/
|
||||
} /* parse_cmdline*/
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <platform_types.h>
|
||||
#include "config_common.h"
|
||||
#include "../utils/LOG/log.h"
|
||||
static int managed_ptr_sz(configmodule_interface_t *cfg, void *ptr)
|
||||
{
|
||||
AssertFatal(cfg->numptrs < CONFIG_MAX_ALLOCATEDPTRS,
|
||||
"This code use fixed size array as #define CONFIG_MAX_ALLOCATEDPTRS %d\n",
|
||||
CONFIG_MAX_ALLOCATEDPTRS);
|
||||
int i;
|
||||
pthread_mutex_lock(&cfg->memBlocks_mutex);
|
||||
int numptrs=cfg->numptrs;
|
||||
for (i=0; i<numptrs; i++ )
|
||||
if (cfg->oneBlock[i].ptrs == ptr)
|
||||
break;
|
||||
pthread_mutex_unlock(&cfg->memBlocks_mutex);
|
||||
if ( i == numptrs )
|
||||
return -1;
|
||||
else
|
||||
return cfg->oneBlock[i].sz;
|
||||
}
|
||||
|
||||
void config_check_valptr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int elt_sz, int nb_elt)
|
||||
{
|
||||
const bool toFree=!(cfgoptions->paramflags & PARAMFLAG_NOFREE);
|
||||
|
||||
// let's see if the value has been read
|
||||
// the datamodel is more difficult than it should be
|
||||
// and it is not thread safe
|
||||
if (cfgoptions->voidptr) {
|
||||
int sz;
|
||||
if ( cfgoptions-> type == TYPE_STRING)
|
||||
sz = managed_ptr_sz(cfg, *cfgoptions->strptr);
|
||||
else
|
||||
sz = managed_ptr_sz(cfg, cfgoptions->voidptr);
|
||||
if ( sz != -1 ) // the same variable pointer has been used!
|
||||
cfgoptions->numelt=sz;
|
||||
}
|
||||
|
||||
if (cfgoptions->voidptr != NULL
|
||||
&& (cfgoptions->type == TYPE_INTARRAY
|
||||
|| cfgoptions->type == TYPE_UINTARRAY
|
||||
|| cfgoptions->type == TYPE_STRINGLIST )) {
|
||||
int sz;
|
||||
if (cfgoptions->type == TYPE_STRING || cfgoptions->type == TYPE_STRINGLIST)
|
||||
sz = managed_ptr_sz(cfg, *cfgoptions->strptr);
|
||||
else
|
||||
sz = managed_ptr_sz(cfg, cfgoptions->voidptr);
|
||||
if ( sz == -1) {
|
||||
fprintf(stderr,"[CONFIG] %s NOT SUPPORTED not NULL pointer with array types", cfgoptions->optname);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgoptions->voidptr == NULL ) {
|
||||
if (cfgoptions->type == TYPE_STRING) {
|
||||
// difficult datamodel
|
||||
cfgoptions->strptr = config_allocate_new(cfg, sizeof(*cfgoptions->strptr), toFree);
|
||||
} else if ( cfgoptions->type == TYPE_STRINGLIST) {
|
||||
AssertFatal(nb_elt<MAX_LIST_SIZE,
|
||||
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
|
||||
MAX_LIST_SIZE );
|
||||
cfgoptions->strlistptr = config_allocate_new(cfg, sizeof(char *) * MAX_LIST_SIZE, toFree);
|
||||
for (int i=0; i<MAX_LIST_SIZE; i++)
|
||||
cfgoptions->strlistptr[i] = config_allocate_new(cfg, DEFAULT_EXTRA_SZ, toFree);
|
||||
} else {
|
||||
if ( cfgoptions->type == TYPE_INTARRAY || cfgoptions->type == TYPE_UINTARRAY )
|
||||
nb_elt=max(nb_elt, MAX_LIST_SIZE); // make room if the list is larger than the default one
|
||||
cfgoptions->voidptr = config_allocate_new(cfg, elt_sz * nb_elt, toFree);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgoptions->type == TYPE_STRING && *cfgoptions->strptr == NULL) {
|
||||
*cfgoptions->strptr = config_allocate_new(cfg, nb_elt + DEFAULT_EXTRA_SZ, toFree);
|
||||
cfgoptions->numelt=nb_elt+DEFAULT_EXTRA_SZ;
|
||||
}
|
||||
}
|
||||
|
||||
void *config_allocate_new(configmodule_interface_t *cfg, int sz, bool autoFree)
|
||||
{
|
||||
void *ptr = calloc(sz, 1);
|
||||
AssertFatal(ptr, "calloc fails\n");
|
||||
// add the memory piece in the managed memory pieces list
|
||||
pthread_mutex_lock(&cfg->memBlocks_mutex);
|
||||
int newBlockIdx=cfg->numptrs++;
|
||||
oneBlock_t* tmp=&cfg->oneBlock[newBlockIdx];
|
||||
tmp->ptrs = (char *)ptr;
|
||||
tmp->ptrsAllocated = true;
|
||||
tmp->sz=sz;
|
||||
tmp->toFree=autoFree;
|
||||
pthread_mutex_unlock(&cfg->memBlocks_mutex);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int config_setdefault_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->iptr), 1);
|
||||
|
||||
if (((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(cfg, cfgoptions, cfgoptions->optname, cfgoptions->defintval);
|
||||
status=1;
|
||||
printf_params(cfg, "[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int64(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
|
||||
|
||||
if (((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr) = cfgoptions->defuintval;
|
||||
status=1;
|
||||
printf_params(cfg,
|
||||
"[CONFIG] %s.%s set to default value %llu\n",
|
||||
((prefix == NULL) ? "" : prefix),
|
||||
cfgoptions->optname,
|
||||
(long long unsigned)(*(cfgoptions->u64ptr)));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_intlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defintarrayval != NULL) {
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(cfgoptions->iptr), cfgoptions->numelt);
|
||||
cfgoptions->iptr = cfgoptions->defintarrayval;
|
||||
status=1;
|
||||
|
||||
for (int j = 0; j < cfgoptions->numelt; j++) {
|
||||
printf_params(cfg, "[CONFIG] %s[%i] set to default value %i\n", cfgoptions->optname, j, (int)cfgoptions->iptr[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_string(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defstrval != NULL) {
|
||||
status=1;
|
||||
|
||||
if (cfgoptions->numelt == 0)
|
||||
config_check_valptr(cfg, cfgoptions, 1, strlen(cfgoptions->defstrval) + 1);
|
||||
if (cfgoptions->numelt < strlen(cfgoptions->defstrval) + 1) {
|
||||
fprintf(stderr,"[CONFIG] %s size too small\n", cfgoptions->optname);
|
||||
}
|
||||
snprintf(*cfgoptions->strptr, cfgoptions->numelt, "%s", cfgoptions->defstrval);
|
||||
printf_params(cfg,
|
||||
"[CONFIG] %s.%s set to default value \"%s\"\n",
|
||||
((prefix == NULL) ? "" : prefix),
|
||||
cfgoptions->optname,
|
||||
*cfgoptions->strptr);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defstrlistval != NULL) {
|
||||
cfgoptions->strlistptr = cfgoptions->defstrlistval;
|
||||
status=1;
|
||||
|
||||
for (int j = 0; j < cfgoptions->numelt; j++)
|
||||
printf_params(cfg,
|
||||
"[CONFIG] %s.%s[%i] set to default value %s\n",
|
||||
((prefix == NULL) ? "" : prefix),
|
||||
cfgoptions->optname,
|
||||
j,
|
||||
cfgoptions->strlistptr[j]);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_double(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->dblptr), 1);
|
||||
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->dblptr)=cfgoptions->defdblval;
|
||||
status=1;
|
||||
printf_params(cfg, "[CONFIG] %s set to default value %lf\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_assign_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *ipv4addr)
|
||||
{
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->uptr), 1);
|
||||
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
|
||||
|
||||
if (rst == 1 && *(cfgoptions->uptr) > 0) {
|
||||
printf_params(cfg, "[CONFIG] %s: %s\n", cfgoptions->optname, ipv4addr);
|
||||
return 1;
|
||||
} else {
|
||||
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params(cfg, "[CONFIG] %s:%s (INADDR_ANY) \n", cfgoptions->optname, ipv4addr);
|
||||
*cfgoptions->uptr=INADDR_ANY;
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_setdefault_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defstrval != NULL) {
|
||||
status = config_assign_ipv4addr(cfg, cfgoptions, cfgoptions->defstrval);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void config_assign_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *fullname, int val)
|
||||
{
|
||||
int tmpval=val;
|
||||
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
|
||||
tmpval =1;
|
||||
}
|
||||
|
||||
switch (cfgoptions->type) {
|
||||
case TYPE_UINT8:
|
||||
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT8:
|
||||
*(cfgoptions->i8ptr) = (int8_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT16:
|
||||
*(cfgoptions->i16ptr) = (int16_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT32:
|
||||
*(cfgoptions->uptr) = (uint32_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_MASK:
|
||||
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT32:
|
||||
*(cfgoptions->iptr) = (int32_t)tmpval;
|
||||
printf_params(cfg, "[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file common/config/config_userapi.h
|
||||
* \brief: configuration module, include file to be used by the source code calling the
|
||||
* configuration module to access configuration parameters
|
||||
* \author Francois TABURET
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#ifndef INCLUDE_CONFIG_COMMON_H
|
||||
#define INCLUDE_CONFIG_COMMON_H
|
||||
#include "config_load_configmodule.h"
|
||||
#include "common/utils/utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
void config_check_valptr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int elt_sz, int nb_elt);
|
||||
/* functions to set a parameter to its default value */
|
||||
int config_setdefault_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_int64(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_intlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_string(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_double(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
int config_setdefault_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
|
||||
void *config_allocate_new(configmodule_interface_t *cfg, int sz, bool autoFree);
|
||||
void config_assign_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *fullname, int val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -44,6 +44,25 @@
|
||||
#include "../utils/LOG/log.h"
|
||||
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "config_common.h"
|
||||
|
||||
// clang-format off
|
||||
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
|
||||
debugflags can also be defined in the config section of the config file\n \
|
||||
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
|
||||
4->print command line processing debug messages\n \
|
||||
incp parameter can be used to define the include path used for config files (@include directive)\n \
|
||||
defaults is set to the path of the main config file.\n";
|
||||
|
||||
static paramdef_t Config_Params[] = {
|
||||
/*--------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* config parameters for config module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------*/
|
||||
{CONFIGP_DEBUGFLAGS, config_helpstr, 0, .uptr = NULL, .defintval = 0, TYPE_MASK, 0},
|
||||
{CONFIGP_TMPDIR, CONFIG_HELP_TMPDIR, PARAMFLAG_NOFREE, .strptr = NULL, .defstrval = "/tmp", TYPE_STRING, 0},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||
void *lib_handle;
|
||||
@@ -52,7 +71,7 @@ int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||
int st;
|
||||
st=0;
|
||||
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
|
||||
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
|
||||
lib_handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE);
|
||||
|
||||
if (!lib_handle) {
|
||||
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
|
||||
@@ -65,7 +84,7 @@ int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
} else {
|
||||
st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
|
||||
st = cfgptr->init(cfgptr);
|
||||
printf("[CONFIG] function %s returned %i\n",
|
||||
fname, st);
|
||||
}
|
||||
@@ -121,14 +140,18 @@ int nooptfunc(void) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
|
||||
paramdef_t *params, int numparams, char *prefix) {
|
||||
int config_cmdlineonly_getlist(configmodule_interface_t *cfg,
|
||||
paramlist_def_t *ParamList,
|
||||
paramdef_t *params,
|
||||
int numparams,
|
||||
char *prefix)
|
||||
{
|
||||
ParamList->numelt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
int config_cmdlineonly_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
{
|
||||
int defval;
|
||||
int fatalerror=0;
|
||||
int numdefvals=0;
|
||||
@@ -138,11 +161,11 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
|
||||
|
||||
switch(cfgoptions[i].type) {
|
||||
case TYPE_STRING:
|
||||
defval=config_setdefault_string(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_string(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_STRINGLIST:
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_stringlist(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_UINT8:
|
||||
@@ -152,25 +175,25 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
defval=config_setdefault_int(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_int(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_int64(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_intlist(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
defval=config_setdefault_double(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_double(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
case TYPE_IPV4ADDR:
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix);
|
||||
defval = config_setdefault_ipv4addr(cfg, &cfgoptions[i], prefix);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -231,7 +254,7 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
OWoptIdx = i;
|
||||
}
|
||||
if ( strstr(argv[i], "help_config") != NULL ) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME);
|
||||
config_printhelp(Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -271,8 +294,12 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
modeparams=cfgmode;
|
||||
cfgmode=strdup(CONFIG_LIBCONFIGFILE);
|
||||
}
|
||||
if (cfgptr == NULL) {
|
||||
cfgptr = calloc(sizeof(configmodule_interface_t),1);
|
||||
static configmodule_interface_t *cfgptr;
|
||||
if (cfgptr)
|
||||
printf("ERROR: Call load_configmodule more than one time\n");
|
||||
|
||||
// The macros are not thread safe print_params and similar
|
||||
cfgptr = calloc(sizeof(configmodule_interface_t), 1);
|
||||
/* argv_info is used to memorize command line options which have been recognized */
|
||||
/* and to detect unrecognized command line options which might have been specified */
|
||||
cfgptr->argv_info = calloc(sizeof(int32_t), argc+10);
|
||||
@@ -314,11 +341,10 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
atoken = strtok_r(NULL,":",&strtokctx);
|
||||
}
|
||||
|
||||
printf("[CONFIG] get parameters from %s ",cfgmode);
|
||||
}
|
||||
for (i=0; i<cfgptr->num_cfgP; i++) {
|
||||
printf("%s ",cfgptr->cfgP[i]);
|
||||
}
|
||||
printf("[CONFIG] get parameters from %s ", cfgmode);
|
||||
for (i = 0; i < cfgptr->num_cfgP; i++) {
|
||||
printf("%s ", cfgptr->cfgP[i]);
|
||||
}
|
||||
|
||||
if (cfgptr->rtflags & CONFIG_PRINTPARAMS) {
|
||||
cfgptr->status = malloc(sizeof(configmodule_status_t));
|
||||
@@ -328,11 +354,11 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
|
||||
if (i == 0) {
|
||||
printf("[CONFIG] config module %s loaded\n",cfgmode);
|
||||
int idx = config_paramidx_fromname(Config_Params, CONFIG_PARAMLENGTH(Config_Params), CONFIGP_DEBUGFLAGS);
|
||||
int idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_DEBUGFLAGS);
|
||||
Config_Params[idx].uptr = &(cfgptr->rtflags);
|
||||
idx = config_paramidx_fromname(Config_Params, CONFIG_PARAMLENGTH(Config_Params), CONFIGP_TMPDIR);
|
||||
idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_TMPDIR);
|
||||
Config_Params[idx].strptr = &(cfgptr->tmpdir);
|
||||
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
|
||||
config_get(cfgptr, Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
|
||||
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
|
||||
@@ -351,7 +377,7 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
if (cfgmode != NULL) free(cfgmode);
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME );
|
||||
config_printhelp(Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
@@ -359,10 +385,11 @@ configmodule_interface_t *load_configmodule(int argc,
|
||||
}
|
||||
|
||||
/* Possibly write config file, with parameters which have been read and after command line parsing */
|
||||
void write_parsedcfg(void)
|
||||
void write_parsedcfg(configmodule_interface_t *cfgptr)
|
||||
{
|
||||
if (cfgptr->status && (cfgptr->rtflags & CONFIG_SAVERUNCFG)) {
|
||||
printf_params("[CONFIG] Runtime params creation status: %i null values, %i errors, %i empty list or array, %i successfull \n",
|
||||
printf_params(cfgptr,
|
||||
"[CONFIG] Runtime params creation status: %i null values, %i errors, %i empty list or array, %i successfull \n",
|
||||
cfgptr->status->num_err_nullvalue,
|
||||
cfgptr->status->num_err_write,
|
||||
cfgptr->status->emptyla,
|
||||
@@ -371,19 +398,20 @@ void write_parsedcfg(void)
|
||||
if (cfgptr != NULL) {
|
||||
if (cfgptr->write_parsedcfg != NULL) {
|
||||
printf("[CONFIG] calling config module write_parsedcfg function...\n");
|
||||
cfgptr->write_parsedcfg();
|
||||
cfgptr->write_parsedcfg(cfgptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* free memory allocated when reading parameters */
|
||||
/* config module could be initialized again after this call */
|
||||
void end_configmodule(void) {
|
||||
write_parsedcfg();
|
||||
void end_configmodule(configmodule_interface_t *cfgptr)
|
||||
{
|
||||
write_parsedcfg(cfgptr);
|
||||
if (cfgptr != NULL) {
|
||||
if (cfgptr->end != NULL) {
|
||||
printf ("[CONFIG] calling config module end function...\n");
|
||||
cfgptr->end();
|
||||
cfgptr->end(cfgptr);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&cfgptr->memBlocks_mutex);
|
||||
@@ -408,8 +436,3 @@ void end_configmodule(void) {
|
||||
cfgptr=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,11 +59,14 @@
|
||||
#define CONFIG_HELP (1<<20) // print help message
|
||||
#define CONFIG_ABORT (1<<21) // config failed,abort execution
|
||||
#define CONFIG_NOOOPT (1<<22) // no -O option found when parsing command line
|
||||
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
|
||||
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
|
||||
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
|
||||
struct configmodule_interface;
|
||||
typedef int (*configmodule_getfunc_t)(struct configmodule_interface *, paramdef_t *, int numparams, char *prefix);
|
||||
typedef int (
|
||||
*configmodule_getlistfunc_t)(struct configmodule_interface *, paramlist_def_t *, paramdef_t *, int numparams, char *prefix);
|
||||
typedef int (*configmodule_setfunc_t)(paramdef_t *cfgoptions, int numoptions, char *prefix);
|
||||
typedef void(*configmodule_endfunc_t)(void);
|
||||
typedef void (*configmodule_endfunc_t)(struct configmodule_interface *cfg);
|
||||
|
||||
typedef int (*configmodule_initfunc_t)(struct configmodule_interface *cfg);
|
||||
|
||||
typedef struct configmodule_status {
|
||||
int num_paramgroups;
|
||||
@@ -105,41 +108,23 @@ typedef struct configmodule_interface {
|
||||
configmodule_status_t *status; // allocated in debug mode only
|
||||
} configmodule_interface_t;
|
||||
|
||||
#ifdef CONFIG_LOADCONFIG_MAIN
|
||||
configmodule_interface_t *cfgptr=NULL;
|
||||
|
||||
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
|
||||
debugflags can also be defined in the config section of the config file\n \
|
||||
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
|
||||
4->print command line processing debug messages\n \
|
||||
incp parameter can be used to define the include path used for config files (@include directive)\n \
|
||||
defaults is set to the path of the main config file.\n";
|
||||
|
||||
#define CONFIG_HELP_TMPDIR "<Repository to create temporary file>"
|
||||
|
||||
#define CONFIG_SECTIONNAME "config"
|
||||
#define CONFIGP_DEBUGFLAGS "debugflags"
|
||||
#define CONFIGP_TMPDIR "tmpdir"
|
||||
|
||||
// clang-format off
|
||||
static paramdef_t Config_Params[] = {
|
||||
/*--------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* config parameters for config module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------*/
|
||||
{CONFIGP_DEBUGFLAGS, config_helpstr, 0, .uptr = NULL, .defintval = 0, TYPE_MASK, 0},
|
||||
{CONFIGP_TMPDIR, CONFIG_HELP_TMPDIR, PARAMFLAG_NOFREE, .strptr = NULL, .defstrval = "/tmp", TYPE_STRING, 0},
|
||||
};
|
||||
// clang-format on
|
||||
// extern configmodule_interface_t *cfgptr;
|
||||
|
||||
#else
|
||||
extern configmodule_interface_t *cfgptr;
|
||||
#endif
|
||||
#define printf_params(cfg, ...) \
|
||||
if ((cfg->rtflags & (CONFIG_PRINTPARAMS)) != 0) { \
|
||||
printf(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
|
||||
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_cmdl(cfg, ...) \
|
||||
if ((cfg->rtflags & (CONFIG_DEBUGCMDLINE)) != 0) { \
|
||||
printf(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
#define CONFIG_ENABLECMDLINEONLY (1<<1)
|
||||
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
|
||||
@@ -148,8 +133,8 @@ extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32
|
||||
* should be used as soon as there is no need to read parameters but doesn't prevent
|
||||
* a new config module init
|
||||
*/
|
||||
extern void end_configmodule(void);
|
||||
extern void write_parsedcfg(void);
|
||||
void end_configmodule(configmodule_interface_t *cfg);
|
||||
void write_parsedcfg(configmodule_interface_t *cfg);
|
||||
|
||||
/* free all config module memory, to be used at end of program as
|
||||
* it will free parameters values even those specified with the PARAMFLAG_NOFREE flag */
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#ifndef INCLUDE_CONFIG_PARAMDESC_H
|
||||
#define INCLUDE_CONFIG_PARAMDESC_H
|
||||
|
||||
|
||||
#define MAX_OPTNAME_SIZE 64
|
||||
#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[<index>].prefix2.optname */
|
||||
|
||||
@@ -56,42 +55,47 @@
|
||||
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
|
||||
#define CONFIG_MAX_NUMCHECKVAL 20
|
||||
typedef struct paramdef paramdef_t;
|
||||
typedef struct configmodule_interface configmodule_interface_t;
|
||||
typedef union checkedparam {
|
||||
struct {
|
||||
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
|
||||
int (*f1)(configmodule_interface_t *cfg, paramdef_t *param); /* check an integer against a list of authorized values */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1;
|
||||
struct {
|
||||
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
|
||||
int (*f1a)(configmodule_interface_t *cfg,
|
||||
paramdef_t *param); /* check an integer against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1a;
|
||||
struct {
|
||||
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
|
||||
int (*f2)(configmodule_interface_t *cfg,
|
||||
paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
|
||||
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
|
||||
|
||||
} s2;
|
||||
struct {
|
||||
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
|
||||
int (*f3)(configmodule_interface_t *cfg, paramdef_t *param); /* check a string against a list of authorized values */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3;
|
||||
struct {
|
||||
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
|
||||
int (*f3a)(configmodule_interface_t *cfg,
|
||||
paramdef_t *param); /* check a string against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3a;
|
||||
struct {
|
||||
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
|
||||
int (*f4)(configmodule_interface_t *cfg,
|
||||
paramdef_t *param); /* generic check function, no arguments but the param description */
|
||||
|
||||
} s4;
|
||||
struct {
|
||||
void (*checkfunc)(void) ;
|
||||
void (*checkfunc)(configmodule_interface_t *cfg);
|
||||
} s5;
|
||||
} checkedparam_t;
|
||||
|
||||
@@ -157,13 +161,10 @@ typedef struct paramdef {
|
||||
#define TYPE_LIST 55
|
||||
|
||||
#define ANY_IPV4ADDR_STRING "0.0.0.0"
|
||||
|
||||
typedef struct paramlist_def {
|
||||
char listname[MAX_OPTNAME_SIZE];
|
||||
paramdef_t **paramarray;
|
||||
int numelt ;
|
||||
} paramlist_def_t;
|
||||
|
||||
/* macro helpers for module users */
|
||||
#define CONFIG_PARAMLENGTH(A) (sizeof(A)/sizeof(paramdef_t))
|
||||
#endif /* INCLUDE_CONFIG_PARAMDESC_H */
|
||||
|
||||
+39
-299
@@ -41,160 +41,12 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <platform_types.h>
|
||||
#include "config_userapi.h"
|
||||
#include "config_common.h"
|
||||
#include "../utils/LOG/log.h"
|
||||
|
||||
configmodule_interface_t *config_get_if(void) {
|
||||
if (cfgptr == NULL) {
|
||||
if (isLogInitDone())
|
||||
LOG_W(ENB_APP,"[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
return cfgptr;
|
||||
}
|
||||
|
||||
static int managed_ptr_sz(void* ptr) {
|
||||
configmodule_interface_t * cfg=config_get_if();
|
||||
AssertFatal(cfg->numptrs < CONFIG_MAX_ALLOCATEDPTRS,
|
||||
"This code use fixed size array as #define CONFIG_MAX_ALLOCATEDPTRS %d\n",
|
||||
CONFIG_MAX_ALLOCATEDPTRS);
|
||||
int i;
|
||||
pthread_mutex_lock(&cfg->memBlocks_mutex);
|
||||
int numptrs=cfg->numptrs;
|
||||
for (i=0; i<numptrs; i++ )
|
||||
if (cfg->oneBlock[i].ptrs == ptr)
|
||||
break;
|
||||
pthread_mutex_unlock(&cfg->memBlocks_mutex);
|
||||
if ( i == numptrs )
|
||||
return -1;
|
||||
else
|
||||
return cfg->oneBlock[i].sz;
|
||||
}
|
||||
|
||||
void *config_allocate_new(int sz, bool autoFree) {
|
||||
void *ptr = calloc(sz,1);
|
||||
AssertFatal(ptr, "calloc fails\n");
|
||||
configmodule_interface_t * cfg=config_get_if();
|
||||
// add the memory piece in the managed memory pieces list
|
||||
pthread_mutex_lock(&cfg->memBlocks_mutex);
|
||||
int newBlockIdx=cfg->numptrs++;
|
||||
oneBlock_t* tmp=&cfg->oneBlock[newBlockIdx];
|
||||
tmp->ptrs = (char *)ptr;
|
||||
tmp->ptrsAllocated = true;
|
||||
tmp->sz=sz;
|
||||
tmp->toFree=autoFree;
|
||||
pthread_mutex_unlock(&cfg->memBlocks_mutex);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt) {
|
||||
|
||||
const bool toFree=!(cfgoptions->paramflags & PARAMFLAG_NOFREE);
|
||||
|
||||
// let's see if the value has been read
|
||||
// the datamodel is more difficult than it should be
|
||||
// and it is not thread safe
|
||||
if (cfgoptions->voidptr) {
|
||||
int sz;
|
||||
if ( cfgoptions-> type == TYPE_STRING)
|
||||
sz=managed_ptr_sz(*cfgoptions->strptr);
|
||||
else
|
||||
sz=managed_ptr_sz(cfgoptions->voidptr);
|
||||
if ( sz != -1 ) // the same variable pointer has been used!
|
||||
cfgoptions->numelt=sz;
|
||||
}
|
||||
|
||||
if (cfgoptions->voidptr != NULL
|
||||
&& (cfgoptions->type == TYPE_INTARRAY
|
||||
|| cfgoptions->type == TYPE_UINTARRAY
|
||||
|| cfgoptions->type == TYPE_STRINGLIST )) {
|
||||
int sz;
|
||||
if ( cfgoptions->type == TYPE_STRING ||
|
||||
cfgoptions->type == TYPE_STRINGLIST )
|
||||
sz=managed_ptr_sz(*cfgoptions->strptr);
|
||||
else
|
||||
sz=managed_ptr_sz(cfgoptions->voidptr);
|
||||
if ( sz == -1) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] %s NOT SUPPORTED not NULL pointer with array types", cfgoptions->optname);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgoptions->voidptr == NULL ) {
|
||||
if (cfgoptions->type == TYPE_STRING) {
|
||||
// difficult datamodel
|
||||
cfgoptions->strptr = config_allocate_new(sizeof(*cfgoptions->strptr), toFree);
|
||||
} else if ( cfgoptions->type == TYPE_STRINGLIST) {
|
||||
AssertFatal(nb_elt<MAX_LIST_SIZE,
|
||||
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
|
||||
MAX_LIST_SIZE );
|
||||
cfgoptions->strlistptr= config_allocate_new(sizeof(char*)*MAX_LIST_SIZE, toFree);
|
||||
for (int i=0; i<MAX_LIST_SIZE; i++)
|
||||
cfgoptions->strlistptr[i]= config_allocate_new(DEFAULT_EXTRA_SZ, toFree);
|
||||
} else {
|
||||
if ( cfgoptions->type == TYPE_INTARRAY || cfgoptions->type == TYPE_UINTARRAY )
|
||||
nb_elt=max(nb_elt, MAX_LIST_SIZE); // make room if the list is larger than the default one
|
||||
cfgoptions->voidptr = config_allocate_new(elt_sz*nb_elt, toFree);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgoptions->type == TYPE_STRING && *cfgoptions->strptr == NULL) {
|
||||
*cfgoptions->strptr = config_allocate_new(nb_elt+DEFAULT_EXTRA_SZ, toFree);
|
||||
cfgoptions->numelt=nb_elt+DEFAULT_EXTRA_SZ;
|
||||
}
|
||||
|
||||
printf_ptrs("[CONFIG] %s ptr: %p requested size: elt_sz: %d, nb_elt: %d\n",cfgoptions->optname, cfgoptions->voidptr, elt_sz, nb_elt);
|
||||
}
|
||||
|
||||
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
|
||||
int tmpval=val;
|
||||
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
|
||||
tmpval =1;
|
||||
}
|
||||
|
||||
switch (cfgoptions->type) {
|
||||
case TYPE_UINT8:
|
||||
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT8:
|
||||
*(cfgoptions->i8ptr) = (int8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT16:
|
||||
*(cfgoptions->i16ptr) = (int16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT32:
|
||||
*(cfgoptions->uptr) = (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_MASK:
|
||||
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT32:
|
||||
*(cfgoptions->iptr) = (int32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void config_assign_processedint(paramdef_t *cfgoption, int val) {
|
||||
cfgoption->processedvalue = config_allocate_new(sizeof(int),!(cfgoption->paramflags & PARAMFLAG_NOFREE));
|
||||
static void config_assign_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption, int val)
|
||||
{
|
||||
cfgoption->processedvalue = config_allocate_new(cfg, sizeof(int), !(cfgoption->paramflags & PARAMFLAG_NOFREE));
|
||||
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
*(cfgoption->processedvalue) = val;
|
||||
@@ -203,14 +55,15 @@ void config_assign_processedint(paramdef_t *cfgoption, int val) {
|
||||
}
|
||||
}
|
||||
|
||||
int config_get_processedint(paramdef_t *cfgoption) {
|
||||
int config_get_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
ret=*(cfgoption->processedvalue);
|
||||
free( cfgoption->processedvalue);
|
||||
cfgoption->processedvalue=NULL;
|
||||
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *cfgoption->strptr, ret);
|
||||
printf_params(cfg, "[CONFIG] %s: set from %s to %i\n", cfgoption->optname, *cfgoption->strptr, ret);
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
|
||||
ret=0;
|
||||
@@ -231,7 +84,8 @@ void config_printhelp(paramdef_t *params,int numparams, char *prefix) {
|
||||
printf("--------------------------------------------------------------------\n\n");
|
||||
}
|
||||
|
||||
int config_execcheck(paramdef_t *params, int numparams, char *prefix) {
|
||||
int config_execcheck(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
int st=0;
|
||||
|
||||
for (int i=0 ; i<numparams ; i++) {
|
||||
@@ -240,7 +94,7 @@ int config_execcheck(paramdef_t *params, int numparams, char *prefix) {
|
||||
}
|
||||
|
||||
if (params[i].chkPptr->s4.f4 != NULL) {
|
||||
st += params[i].chkPptr->s4.f4(&(params[i]));
|
||||
st += params[i].chkPptr->s4.f4(cfg, &(params[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +115,8 @@ int config_paramidx_fromname(paramdef_t *params, int numparams, char *name) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_get(paramdef_t *params, int numparams, char *prefix) {
|
||||
int config_get(configmodule_interface_t *cfgif, paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
int ret= -1;
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
@@ -269,16 +124,15 @@ int config_get(paramdef_t *params, int numparams, char *prefix) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
configmodule_interface_t *cfgif = config_get_if();
|
||||
if (cfgif != NULL) {
|
||||
ret = config_get_if()->get(params, numparams, prefix);
|
||||
ret = cfgif->get(cfgif, params, numparams, prefix);
|
||||
|
||||
if (ret >= 0) {
|
||||
config_process_cmdline(params, numparams, prefix);
|
||||
config_process_cmdline(cfgif, params, numparams, prefix);
|
||||
if (cfgif->rtflags & CONFIG_SAVERUNCFG) {
|
||||
config_get_if()->set(params, numparams, prefix);
|
||||
cfgif->set(params, numparams, prefix);
|
||||
}
|
||||
config_execcheck(params, numparams, prefix);
|
||||
config_execcheck(cfgif, params, numparams, prefix);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -287,16 +141,13 @@ int config_get(paramdef_t *params, int numparams, char *prefix) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) {
|
||||
int config_getlist(configmodule_interface_t *cfg, paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!config_get_if())
|
||||
return -1;
|
||||
|
||||
const int ret = config_get_if()->getlist(ParamList, params, numparams, prefix);
|
||||
const int ret = cfg->getlist(cfg, ParamList, params, numparams, prefix);
|
||||
|
||||
if (ret >= 0 && params) {
|
||||
char *newprefix;
|
||||
@@ -314,11 +165,11 @@ int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams
|
||||
for (int i = 0; i < ParamList->numelt; ++i) {
|
||||
// TODO config_process_cmdline?
|
||||
sprintf(cfgpath, "%s.[%i]", newprefix, i);
|
||||
config_process_cmdline(ParamList->paramarray[i],numparams,cfgpath);
|
||||
if (config_get_if()->rtflags & CONFIG_SAVERUNCFG) {
|
||||
config_get_if()->set(ParamList->paramarray[i], numparams, cfgpath);
|
||||
config_process_cmdline(cfg, ParamList->paramarray[i], numparams, cfgpath);
|
||||
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
|
||||
cfg->set(ParamList->paramarray[i], numparams, cfgpath);
|
||||
}
|
||||
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
|
||||
config_execcheck(cfg, ParamList->paramarray[i], numparams, cfgpath);
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
@@ -347,7 +198,8 @@ void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokva
|
||||
fprintf(stderr, " \n");
|
||||
}
|
||||
|
||||
int config_check_intval(paramdef_t *param) {
|
||||
int config_check_intval(configmodule_interface_t *cfg, paramdef_t *param)
|
||||
{
|
||||
if ( param == NULL ) {
|
||||
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
|
||||
return -1;
|
||||
@@ -363,10 +215,15 @@ int config_check_intval(paramdef_t *param) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_check_modify_integer(paramdef_t *param) {
|
||||
int config_check_modify_integer(configmodule_interface_t *cfg, paramdef_t *param)
|
||||
{
|
||||
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
|
||||
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
|
||||
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
|
||||
printf_params(cfg,
|
||||
"[CONFIG] %s: read value %i, set to %i\n",
|
||||
param->optname,
|
||||
*(param->uptr),
|
||||
param->chkPptr->s1a.setintval[i]);
|
||||
*(param->uptr) = param->chkPptr->s1a.setintval [i];
|
||||
return 0;
|
||||
}
|
||||
@@ -376,7 +233,8 @@ int config_check_modify_integer(paramdef_t *param) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_check_intrange(paramdef_t *param) {
|
||||
int config_check_intrange(configmodule_interface_t *cfg, paramdef_t *param)
|
||||
{
|
||||
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
|
||||
return 0;
|
||||
}
|
||||
@@ -397,7 +255,8 @@ void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numok
|
||||
fprintf(stderr, " \n");
|
||||
}
|
||||
|
||||
int config_check_strval(paramdef_t *param) {
|
||||
int config_check_strval(configmodule_interface_t *cfg, paramdef_t *param)
|
||||
{
|
||||
if ( param == NULL ) {
|
||||
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
|
||||
return -1;
|
||||
@@ -413,10 +272,11 @@ int config_check_strval(paramdef_t *param) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_checkstr_assign_integer(paramdef_t *param) {
|
||||
int config_checkstr_assign_integer(configmodule_interface_t *cfg, paramdef_t *param)
|
||||
{
|
||||
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
|
||||
if (strcasecmp(*param->strptr,param->chkPptr->s3a.okstrval[i] ) == 0) {
|
||||
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
|
||||
config_assign_processedint(cfg, param, param->chkPptr->s3a.setintval[i]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -430,123 +290,3 @@ void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunction
|
||||
params[i].chkPptr = &(checkfunctions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defstrval != NULL) {
|
||||
status=1;
|
||||
|
||||
if (cfgoptions->numelt == 0 )
|
||||
config_check_valptr(cfgoptions, 1, strlen(cfgoptions->defstrval)+1);
|
||||
if ( cfgoptions->numelt < strlen(cfgoptions->defstrval)+1 ) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] %s size too small\n", cfgoptions->optname);
|
||||
}
|
||||
snprintf(*cfgoptions->strptr, cfgoptions->numelt, "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *cfgoptions->strptr);
|
||||
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defstrlistval != NULL) {
|
||||
cfgoptions->strlistptr=cfgoptions->defstrlistval;
|
||||
status=1;
|
||||
|
||||
for(int j=0; j<cfgoptions->numelt; j++)
|
||||
printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
|
||||
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
|
||||
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defuintval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defintarrayval != NULL) {
|
||||
config_check_valptr(cfgoptions, sizeof(cfgoptions->iptr), cfgoptions->numelt);
|
||||
cfgoptions->iptr=cfgoptions->defintarrayval;
|
||||
status=1;
|
||||
|
||||
for (int j=0; j<cfgoptions->numelt ; j++) {
|
||||
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname,j,(int)cfgoptions->iptr[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
|
||||
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->dblptr)=cfgoptions->defdblval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
|
||||
config_check_valptr(cfgoptions, sizeof(*cfgoptions->uptr), 1);
|
||||
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
|
||||
|
||||
if (rst == 1 && *(cfgoptions->uptr) > 0) {
|
||||
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
|
||||
return 1;
|
||||
} else {
|
||||
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
|
||||
*cfgoptions->uptr=INADDR_ANY;
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if (cfgoptions->defstrval != NULL) {
|
||||
status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -33,60 +33,49 @@
|
||||
#ifndef INCLUDE_CONFIG_USERAPI_H
|
||||
#define INCLUDE_CONFIG_USERAPI_H
|
||||
#include "config_load_configmodule.h"
|
||||
#include "common/utils/utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef NOT_uniqCfg
|
||||
extern configmodule_interface_t *uniqCfg;
|
||||
#define config_get_if() uniqCfg // Existing code implicit uniq configuration context
|
||||
#endif
|
||||
/* utility functions to ease usage of config module structures */
|
||||
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
|
||||
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
|
||||
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
|
||||
#define CONFIG_GETSOURCE ((config_get_if() == NULL) ? NULL : config_get_if()->cfgmode)
|
||||
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
|
||||
#define CONFIG_SETRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags |= P; }
|
||||
#define CONFIG_CLEARRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags &= (~P); }
|
||||
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
|
||||
extern int config_paramidx_fromname(paramdef_t *params,int numparams, char *name);
|
||||
int config_paramidx_fromname(paramdef_t *params, int numparams, char *name);
|
||||
|
||||
/* utility functions, to be used by configuration module and/or configuration libraries */
|
||||
extern configmodule_interface_t *config_get_if(void);
|
||||
void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt);
|
||||
extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
|
||||
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
|
||||
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
|
||||
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
|
||||
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
|
||||
void config_printhelp(paramdef_t *, int numparams, char *prefix);
|
||||
int config_process_cmdline(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix);
|
||||
int config_assign_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *ipv4addr);
|
||||
|
||||
/* apis to get/check parameters, to be used by oai modules, at configuration time */
|
||||
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
|
||||
extern int config_check_unknown_cmdlineopt(char *prefix);
|
||||
extern int config_get(paramdef_t *params,int numparams, char *prefix);
|
||||
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
|
||||
int config_check_unknown_cmdlineopt(configmodule_interface_t *cfg, char *prefix);
|
||||
int config_get(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix);
|
||||
int config_getlist(configmodule_interface_t *cfg, paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
|
||||
|
||||
/* apis to set some of the paramdef_t fields before using the get/getlist api's */
|
||||
extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
|
||||
void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
|
||||
|
||||
/* apis to retrieve parameters info after calling get or getlist functions */
|
||||
extern int config_isparamset(paramdef_t *params,int paramidx);
|
||||
extern int config_get_processedint(paramdef_t *cfgoption);
|
||||
int config_isparamset(paramdef_t *params, int paramidx);
|
||||
int config_get_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption);
|
||||
|
||||
/* functions to be used in parameters definition, to check parameters values */
|
||||
extern int config_check_intval(paramdef_t *param);
|
||||
extern int config_check_modify_integer(paramdef_t *param);
|
||||
extern int config_check_intrange(paramdef_t *param);
|
||||
extern int config_check_strval(paramdef_t *param);
|
||||
extern int config_checkstr_assign_integer(paramdef_t *param);
|
||||
int config_check_intval(configmodule_interface_t *cfg, paramdef_t *param);
|
||||
int config_check_modify_integer(configmodule_interface_t *cfg, paramdef_t *param);
|
||||
int config_check_intrange(configmodule_interface_t *cfg, paramdef_t *param);
|
||||
int config_check_strval(configmodule_interface_t *cfg, paramdef_t *param);
|
||||
int config_checkstr_assign_integer(configmodule_interface_t *cfg, paramdef_t *param);
|
||||
|
||||
/* functions to set a parameter to its default value */
|
||||
extern int config_setdefault_string(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_int(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_double(paramdef_t *cfgoptions, char *prefix);
|
||||
extern int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix);
|
||||
void *config_allocate_new(int sz, bool autoFree);
|
||||
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include "config_libconfig.h"
|
||||
#include "config_libconfig_private.h"
|
||||
#define NOT_uniqCfg
|
||||
#include "../config_common.h"
|
||||
#include "../config_userapi.h"
|
||||
#include "errno.h"
|
||||
#include "assertions.h"
|
||||
@@ -51,14 +53,15 @@
|
||||
#define config_setting_lookup config_lookup_from
|
||||
#endif
|
||||
|
||||
void config_libconfig_end(void );
|
||||
void config_libconfig_end(configmodule_interface_t *cfg);
|
||||
|
||||
int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
|
||||
int read_strlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, config_setting_t *setting, char *cfgpath)
|
||||
{
|
||||
const char *str;
|
||||
int st;
|
||||
int numelt;
|
||||
numelt=config_setting_length(setting);
|
||||
config_check_valptr(cfgoptions, sizeof(char *), numelt);
|
||||
config_check_valptr(cfg, cfgoptions, sizeof(char *), numelt);
|
||||
st=0;
|
||||
AssertFatal(MAX_LIST_SIZE > numelt,
|
||||
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
|
||||
@@ -71,7 +74,7 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
|
||||
} else {
|
||||
snprintf(cfgoptions->strlistptr[i], DEFAULT_EXTRA_SZ, "%s",str);
|
||||
st++;
|
||||
printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
|
||||
printf_params(cfg, "[LIBCONFIG] %s%i: %s\n", cfgpath, i, cfgoptions->strlistptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,22 +82,27 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
|
||||
return st;
|
||||
}
|
||||
|
||||
int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
|
||||
static int read_intarray(configmodule_interface_t *cfg, paramdef_t *cfgoptions, config_setting_t *setting, char *cfgpath)
|
||||
{
|
||||
cfgoptions->numelt=config_setting_length(setting);
|
||||
|
||||
if (cfgoptions->numelt > 0) {
|
||||
cfgoptions->iptr=config_allocate_new(cfgoptions->numelt*sizeof(*cfgoptions->iptr),
|
||||
!(cfgoptions->paramflags & PARAMFLAG_NOFREE) );
|
||||
cfgoptions->iptr =
|
||||
config_allocate_new(cfg, cfgoptions->numelt * sizeof(*cfgoptions->iptr), !(cfgoptions->paramflags & PARAMFLAG_NOFREE));
|
||||
|
||||
for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
|
||||
cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
|
||||
printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
|
||||
printf_params(cfg, "[LIBCONFIG] %s[%i]: %i\n", cfgpath, i, cfgoptions->iptr[i]);
|
||||
} /* for loop on array element... */
|
||||
}
|
||||
|
||||
return cfgoptions->numelt;
|
||||
}
|
||||
int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_setting_t *asetting, char *prefix)
|
||||
int config_libconfig_setparams(configmodule_interface_t *cfg,
|
||||
paramdef_t *cfgoptions,
|
||||
int numoptions,
|
||||
config_setting_t *asetting,
|
||||
char *prefix)
|
||||
{
|
||||
int status;
|
||||
int errors = 0;
|
||||
@@ -106,7 +114,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
|
||||
for (int i = 0; i < numoptions; i++) {
|
||||
if (cfgoptions[i].paramflags & PARAMFLAG_CMDLINEONLY) {
|
||||
continue;
|
||||
printf_params("[LIBCONFIG] setting %s.%s skipped (command line only) \n", secprefix, cfgoptions[i].optname);
|
||||
printf_params(cfg, "[LIBCONFIG] setting %s.%s skipped (command line only) \n", secprefix, cfgoptions[i].optname);
|
||||
}
|
||||
status = CONFIG_FALSE;
|
||||
config_setting_t *psetting;
|
||||
@@ -115,7 +123,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
|
||||
psetting = config_lookup(&(libconfig_privdata.runtcfg), spath);
|
||||
free(spath);
|
||||
if (psetting != NULL) {
|
||||
printf_params("[LIBCONFIG] setting %s.%s already created \n", secprefix, cfgoptions[i].optname);
|
||||
printf_params(cfg, "[LIBCONFIG] setting %s.%s already created \n", secprefix, cfgoptions[i].optname);
|
||||
continue;
|
||||
}
|
||||
switch (cfgoptions[i].type) {
|
||||
@@ -137,7 +145,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
|
||||
if (psetting != NULL) {
|
||||
if (cfgoptions[i].numelt <= 0) {
|
||||
emptyla++;
|
||||
printf_params("[LIBCONFIG], no element in list %s\n", cfgoptions[i].optname);
|
||||
printf_params(cfg, "[LIBCONFIG], no element in list %s\n", cfgoptions[i].optname);
|
||||
status = CONFIG_TRUE;
|
||||
}
|
||||
for (int j = 0; j < cfgoptions[i].numelt; j++) {
|
||||
@@ -176,7 +184,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
|
||||
if (psetting != NULL) {
|
||||
if (cfgoptions[i].numelt <= 0) {
|
||||
emptyla++;
|
||||
printf_params("[LIBCONFIG], no element in array %s.%s\n", secprefix, cfgoptions[i].optname);
|
||||
printf_params(cfg, "[LIBCONFIG], no element in array %s.%s\n", secprefix, cfgoptions[i].optname);
|
||||
status = CONFIG_TRUE;
|
||||
}
|
||||
for (int j = 0; j < cfgoptions[i].numelt; j++) {
|
||||
@@ -222,24 +230,24 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
|
||||
fprintf(stderr, "[LIBCONFIG] Error creating setting %i: %s.%s type %i\n", i, secprefix, cfgoptions[i].optname, cfgoptions[i].type);
|
||||
}
|
||||
}
|
||||
printf_params("[LIBCONFIG], in group \"%s\" %i settings \n", secprefix, numoptions);
|
||||
printf_params(cfg, "[LIBCONFIG], in group \"%s\" %i settings \n", secprefix, numoptions);
|
||||
if (notused > 0)
|
||||
printf_params("[LIBCONFIG], ..... %i settings with NULL value pointer\n", notused);
|
||||
printf_params(cfg, "[LIBCONFIG], ..... %i settings with NULL value pointer\n", notused);
|
||||
if (errors > 0)
|
||||
fprintf(stderr, "[LIBCONFIG] .....%i settings creation errors \n", errors);
|
||||
if (emptyla > 0)
|
||||
fprintf(stderr, "[LIBCONFIG] .....%i empty lists or arrays settings \n", emptyla);
|
||||
|
||||
if (cfgptr->status) {
|
||||
cfgptr->status->num_err_nullvalue += notused;
|
||||
cfgptr->status->num_err_write += errors;
|
||||
cfgptr->status->num_write += numoptions;
|
||||
cfgptr->status->emptyla += emptyla;
|
||||
if (cfg->status) {
|
||||
cfg->status->num_err_nullvalue += notused;
|
||||
cfg->status->num_err_write += errors;
|
||||
cfg->status->num_write += numoptions;
|
||||
cfg->status->emptyla += emptyla;
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
int config_libconfig_set(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
{
|
||||
char *tokctx1 = NULL;
|
||||
int listidx = -1;
|
||||
@@ -250,13 +258,13 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
prefixbck = strdup(prefix);
|
||||
prefix_elem1 = strtok_r(prefixbck, ".", &tokctx1);
|
||||
}
|
||||
printf_params("[LIBCONFIG], processing prefix %s\n", (prefix == NULL) ? "NULL" : prefix);
|
||||
printf_params(cfg, "[LIBCONFIG], processing prefix %s\n", (prefix == NULL) ? "NULL" : prefix);
|
||||
|
||||
/* parse the prefix , possibly creating groups, lists and list elements */
|
||||
while (prefix_elem1 != NULL) {
|
||||
int n1 = strlen(prefix_elem1);
|
||||
char *prefix_elem2 = prefix_elem1 + n1 + 1;
|
||||
printf_params("[LIBCONFIG], processing elem1 %s elem2 %s\n", prefix_elem1, prefix_elem2);
|
||||
printf_params(cfg, "[LIBCONFIG], processing elem1 %s elem2 %s\n", prefix_elem1, prefix_elem2);
|
||||
/* prefix (the path to the parameter name) may contain groups and elements from a list, which are specified with [] */
|
||||
if (prefix_elem2[0] != '[') { // not a list
|
||||
|
||||
@@ -265,11 +273,11 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
asetting = config_setting_add(asetting, prefix_elem1, CONFIG_TYPE_GROUP);
|
||||
else
|
||||
asetting = tmpset;
|
||||
printf_params("[LIBCONFIG], creating or looking for group %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
|
||||
printf_params(cfg, "[LIBCONFIG], creating or looking for group %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
|
||||
} else { // a list
|
||||
listidx = (int)strtol(prefix_elem2 + 1, NULL, 10);
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
printf_params("[LIBCONFIG], Error %s looking for list index in %s \n", strerror(errno), prefix_elem2);
|
||||
printf_params(cfg, "[LIBCONFIG], Error %s looking for list index in %s \n", strerror(errno), prefix_elem2);
|
||||
break;
|
||||
}
|
||||
config_setting_t *tmpset = config_setting_lookup(asetting, prefix_elem1);
|
||||
@@ -277,14 +285,17 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
asetting = config_setting_add(asetting, prefix_elem1, CONFIG_TYPE_LIST);
|
||||
else
|
||||
asetting = tmpset;
|
||||
printf_params("[LIBCONFIG], creating or looking for list %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
|
||||
printf_params(cfg, "[LIBCONFIG], creating or looking for list %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
|
||||
if (asetting != NULL) {
|
||||
tmpset = config_setting_get_elem(asetting, listidx);
|
||||
if (tmpset == NULL)
|
||||
asetting = config_setting_add(asetting, NULL, CONFIG_TYPE_GROUP);
|
||||
else
|
||||
asetting = tmpset;
|
||||
printf_params("[LIBCONFIG], creating or looking for list element %i: %s\n", listidx, (asetting == NULL) ? "NOK" : "OK");
|
||||
printf_params(cfg,
|
||||
"[LIBCONFIG], creating or looking for list element %i: %s\n",
|
||||
listidx,
|
||||
(asetting == NULL) ? "NOK" : "OK");
|
||||
}
|
||||
prefix_elem1 = strtok_r(NULL, ".", &tokctx1); // skip the [x] elements we already took care of it
|
||||
if (prefix_elem1 == NULL) {
|
||||
@@ -299,8 +310,8 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
}
|
||||
free(prefixbck);
|
||||
if (asetting != NULL) {
|
||||
config_libconfig_setparams(cfgoptions, numoptions, asetting, prefix);
|
||||
printf_params("[LIBCONFIG] %i settings added in group %s\n", numoptions, (prefix == NULL) ? "" : prefix);
|
||||
config_libconfig_setparams(cfg, cfgoptions, numoptions, asetting, prefix);
|
||||
printf_params(cfg, "[LIBCONFIG] %i settings added in group %s\n", numoptions, (prefix == NULL) ? "" : prefix);
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "[LIBCONFIG] Error parsing %s params, skipped...\n", (prefix == NULL) ? "" : prefix);
|
||||
@@ -308,7 +319,8 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
}
|
||||
}
|
||||
|
||||
int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||
{
|
||||
config_setting_t *setting;
|
||||
char *str;
|
||||
int i,u;
|
||||
@@ -330,7 +342,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
}
|
||||
|
||||
if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) {
|
||||
printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
|
||||
printf_params(cfg, "[LIBCONFIG] %s.%s ignored\n", cfgpath, cfgoptions[i].optname);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -340,14 +352,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
switch(cfgoptions[i].type) {
|
||||
case TYPE_STRING:
|
||||
if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, (const char**)&str)) {
|
||||
config_check_valptr(&(cfgoptions[i]), 1, strlen(str)+1);
|
||||
config_check_valptr(cfg, &cfgoptions[i], 1, strlen(str) + 1);
|
||||
if ( strlen(str)+1 > cfgoptions[i].numelt )
|
||||
fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
|
||||
cfgpath,str,cfgoptions[i].numelt);
|
||||
snprintf( *cfgoptions[i].strptr , cfgoptions[i].numelt, "%s", str);
|
||||
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath, *cfgoptions[i].strptr);
|
||||
printf_params(cfg, "[LIBCONFIG] %s: \"%s\"\n", cfgpath, *cfgoptions[i].strptr);
|
||||
} else {
|
||||
defval=config_setdefault_string(&cfgoptions[i],prefix);
|
||||
defval = config_setdefault_string(cfg, &cfgoptions[i], prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -356,9 +368,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
|
||||
|
||||
if ( setting != NULL) {
|
||||
read_strlist(&cfgoptions[i],setting,cfgpath);
|
||||
read_strlist(cfg, &cfgoptions[i], setting, cfgpath);
|
||||
} else {
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_stringlist(cfg, &(cfgoptions[i]), prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -371,10 +383,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
|
||||
config_check_valptr(&(cfgoptions[i]), sizeof(*cfgoptions[i].iptr), 1);
|
||||
config_assign_int(&(cfgoptions[i]),cfgpath,u);
|
||||
config_check_valptr(cfg, &(cfgoptions[i]), sizeof(*cfgoptions[i].iptr), 1);
|
||||
config_assign_int(cfg, &(cfgoptions[i]), cfgpath, u);
|
||||
} else {
|
||||
defval=config_setdefault_int(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_int(cfg, &(cfgoptions[i]), prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -382,17 +394,17 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
|
||||
config_check_valptr(&cfgoptions[i], sizeof(*cfgoptions[i].i64ptr), 1);
|
||||
config_check_valptr(cfg, &cfgoptions[i], sizeof(*cfgoptions[i].i64ptr), 1);
|
||||
|
||||
if(cfgoptions[i].type==TYPE_UINT64) {
|
||||
*(cfgoptions[i].u64ptr) = (uint64_t)llu;
|
||||
printf_params("[LIBCONFIG] %s: %lu\n", cfgpath,*cfgoptions[i].u64ptr);
|
||||
printf_params(cfg, "[LIBCONFIG] %s: %lu\n", cfgpath, *cfgoptions[i].u64ptr);
|
||||
} else {
|
||||
*(cfgoptions[i].i64ptr) = llu;
|
||||
printf_params("[LIBCONFIG] %s: %ld\n", cfgpath,*cfgoptions[i].i64ptr);
|
||||
printf_params(cfg, "[LIBCONFIG] %s: %ld\n", cfgpath, *cfgoptions[i].i64ptr);
|
||||
}
|
||||
} else {
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_int64(cfg, &(cfgoptions[i]), prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -402,29 +414,29 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
|
||||
|
||||
if ( setting != NULL) {
|
||||
read_intarray(&cfgoptions[i],setting,cfgpath);
|
||||
read_intarray(cfg, &cfgoptions[i], setting, cfgpath);
|
||||
} else {
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_intlist(cfg, &(cfgoptions[i]), prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
|
||||
config_check_valptr(&cfgoptions[i],sizeof(*cfgoptions[i].dblptr), 1);
|
||||
config_check_valptr(cfg, &cfgoptions[i], sizeof(*cfgoptions[i].dblptr), 1);
|
||||
*cfgoptions[i].dblptr = dbl;
|
||||
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
|
||||
printf_params(cfg, "[LIBCONFIG] %s: %lf\n", cfgpath, *(cfgoptions[i].dblptr));
|
||||
} else {
|
||||
defval=config_setdefault_double(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_double(cfg, &(cfgoptions[i]), prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_IPV4ADDR:
|
||||
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
|
||||
defval = config_setdefault_ipv4addr(cfg, &(cfgoptions[i]), prefix);
|
||||
} else {
|
||||
rst=config_assign_ipv4addr(cfgoptions, str);
|
||||
rst = config_assign_ipv4addr(cfg, cfgoptions, str);
|
||||
|
||||
if (rst < 0) {
|
||||
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
|
||||
@@ -478,15 +490,19 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
|
||||
if (fatalerror == 1) {
|
||||
fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
|
||||
config_libconfig_end();
|
||||
end_configmodule();
|
||||
config_libconfig_end(cfg);
|
||||
end_configmodule(cfg);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_libconfig_getlist(paramlist_def_t *ParamList,
|
||||
paramdef_t *params, int numparams, char *prefix) {
|
||||
int config_libconfig_getlist(configmodule_interface_t *cfg,
|
||||
paramlist_def_t *ParamList,
|
||||
paramdef_t *params,
|
||||
int numparams,
|
||||
char *prefix)
|
||||
{
|
||||
config_setting_t *setting;
|
||||
int i,j,status;
|
||||
char *listpath=NULL;
|
||||
@@ -502,8 +518,7 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
|
||||
|
||||
if ( setting) {
|
||||
status = ParamList->numelt = config_setting_length(setting);
|
||||
printf_params("[LIBCONFIG] %i %s in config file %s \n",
|
||||
ParamList->numelt,listpath,libconfig_privdata.configfile );
|
||||
printf_params(cfg, "[LIBCONFIG] %i %s in config file %s \n", ParamList->numelt, listpath, libconfig_privdata.configfile);
|
||||
} else {
|
||||
printf("[LIBCONFIG] list %s not found in config file %s \n",
|
||||
listpath,libconfig_privdata.configfile );
|
||||
@@ -512,10 +527,10 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
|
||||
}
|
||||
|
||||
if (ParamList->numelt > 0 && params != NULL) {
|
||||
ParamList->paramarray = config_allocate_new(ParamList->numelt * sizeof(paramdef_t *), true);
|
||||
ParamList->paramarray = config_allocate_new(cfg, ParamList->numelt * sizeof(paramdef_t *), true);
|
||||
|
||||
for (i=0 ; i < ParamList->numelt ; i++) {
|
||||
ParamList->paramarray[i] = config_allocate_new(numparams * sizeof(paramdef_t), true);
|
||||
ParamList->paramarray[i] = config_allocate_new(cfg, numparams * sizeof(paramdef_t), true);
|
||||
memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
|
||||
|
||||
for (j=0; j<numparams; j++) {
|
||||
@@ -523,7 +538,7 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
|
||||
}
|
||||
|
||||
sprintf(cfgpath,"%s.[%i]",listpath,i);
|
||||
config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
|
||||
config_libconfig_get(cfg, ParamList->paramarray[i], numparams, cfgpath);
|
||||
} /* for i... */
|
||||
} /* ParamList->numelt > 0 && params != NULL */
|
||||
|
||||
@@ -533,12 +548,15 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_libconfig_init(char *cfgP[], int numP) {
|
||||
int config_libconfig_init(configmodule_interface_t *cfg)
|
||||
{
|
||||
char **cfgP = cfg->cfgP;
|
||||
int numP = cfg->num_cfgP;
|
||||
config_init(&(libconfig_privdata.cfg));
|
||||
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
|
||||
config_get_if()->numptrs=0;
|
||||
pthread_mutex_init(&config_get_if()->memBlocks_mutex, NULL);
|
||||
memset(config_get_if()->oneBlock,0,sizeof(config_get_if()->oneBlock));
|
||||
cfg->numptrs = 0;
|
||||
pthread_mutex_init(&cfg->memBlocks_mutex, NULL);
|
||||
memset(cfg->oneBlock, 0, sizeof(cfg->oneBlock));
|
||||
/* search for include path parameter and set config file include path accordingly */
|
||||
for (int i=0; i<numP; i++) {
|
||||
if (strncmp(cfgP[i],"incp",4) == 0) {
|
||||
@@ -569,7 +587,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
|
||||
}
|
||||
|
||||
/* possibly init a libconfig struct for saving really used params */
|
||||
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
|
||||
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
|
||||
config_init(&(libconfig_privdata.runtcfg));
|
||||
// config_set_options (&(libconfig_privdata.runtcfg), CONFIG_OPTION_ALLOW_OVERRIDES, CONFIG_TRUE);
|
||||
}
|
||||
@@ -577,25 +595,34 @@ int config_libconfig_init(char *cfgP[], int numP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void config_libconfig_write_parsedcfg(void)
|
||||
void config_libconfig_write_parsedcfg(configmodule_interface_t *cfg)
|
||||
{
|
||||
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
|
||||
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
|
||||
char *fname = strdup(libconfig_privdata.configfile);
|
||||
int newcfgflen = strlen(libconfig_privdata.configfile) + strlen(cfgptr->tmpdir) + 20;
|
||||
cfgptr->status->debug_cfgname = realloc(cfgptr->status->debug_cfgname, newcfgflen);
|
||||
int newcfgflen = strlen(libconfig_privdata.configfile) + strlen(cfg->tmpdir) + 20;
|
||||
cfg->status->debug_cfgname = realloc(cfg->status->debug_cfgname, newcfgflen);
|
||||
time_t t = time(NULL);
|
||||
struct tm tm = *localtime(&t);
|
||||
snprintf(cfgptr->status->debug_cfgname, newcfgflen, "%s/%s-run%d_%02d_%02d_%02d%02d", cfgptr->tmpdir, basename(fname), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min);
|
||||
if (config_write_file(&(libconfig_privdata.runtcfg), cfgptr->status->debug_cfgname) != CONFIG_TRUE) {
|
||||
snprintf(cfg->status->debug_cfgname,
|
||||
newcfgflen,
|
||||
"%s/%s-run%d_%02d_%02d_%02d%02d",
|
||||
cfg->tmpdir,
|
||||
basename(fname),
|
||||
tm.tm_year + 1900,
|
||||
tm.tm_mon + 1,
|
||||
tm.tm_mday,
|
||||
tm.tm_hour,
|
||||
tm.tm_min);
|
||||
if (config_write_file(&(libconfig_privdata.runtcfg), cfg->status->debug_cfgname) != CONFIG_TRUE) {
|
||||
fprintf(stderr,
|
||||
"[LIBCONFIG] %s %d file %s - line %d: %s\n",
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
cfgptr->status->debug_cfgname,
|
||||
cfg->status->debug_cfgname,
|
||||
config_error_line(&(libconfig_privdata.runtcfg)),
|
||||
config_error_text(&(libconfig_privdata.runtcfg)));
|
||||
} else {
|
||||
printf("[LIBCONFIG] file %s created successfully\n", cfgptr->status->debug_cfgname);
|
||||
printf("[LIBCONFIG] file %s created successfully\n", cfg->status->debug_cfgname);
|
||||
}
|
||||
free(fname);
|
||||
} else {
|
||||
@@ -603,9 +630,10 @@ void config_libconfig_write_parsedcfg(void)
|
||||
}
|
||||
}
|
||||
|
||||
void config_libconfig_end(void ) {
|
||||
void config_libconfig_end(configmodule_interface_t *cfg)
|
||||
{
|
||||
config_destroy(&(libconfig_privdata.cfg));
|
||||
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
|
||||
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
|
||||
config_destroy(&(libconfig_privdata.runtcfg));
|
||||
}
|
||||
if ( libconfig_privdata.configfile != NULL ) {
|
||||
|
||||
@@ -89,7 +89,7 @@ const mapping log_options[] = {{"nocolor", FLAG_NOCOLOR},
|
||||
{"wall_clock", FLAG_REAL_TIME},
|
||||
{NULL, -1}};
|
||||
|
||||
mapping log_maskmap[] = LOG_MASKMAP_INIT;
|
||||
const mapping log_maskmap[] = LOG_MASKMAP_INIT;
|
||||
|
||||
static const char *const log_level_highlight_start[] =
|
||||
{LOG_RED, LOG_ORANGE, LOG_GREEN, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
|
||||
@@ -283,7 +283,7 @@ void log_getconfig(log_t *g_log)
|
||||
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
|
||||
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
|
||||
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
|
||||
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||
int ret = config_get(config_get_if(), logparams_defaults, sizeofArray(logparams_defaults), CONFIG_STRING_LOG_PREFIX);
|
||||
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed\n");
|
||||
@@ -337,8 +337,8 @@ void log_getconfig(log_t *g_log)
|
||||
}
|
||||
|
||||
/* read the per component parameters */
|
||||
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get(config_get_if(), logparams_level, MAX_LOG_PREDEF_COMPONENTS, CONFIG_STRING_LOG_PREFIX);
|
||||
config_get(config_get_if(), logparams_logfile, MAX_LOG_PREDEF_COMPONENTS, CONFIG_STRING_LOG_PREFIX);
|
||||
|
||||
/* now set the log levels and infile option, according to what we read */
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||
@@ -367,10 +367,10 @@ void log_getconfig(log_t *g_log)
|
||||
logparams_dump[i].numelt = 0;
|
||||
}
|
||||
|
||||
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get(config_get_if(), logparams_debug, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX);
|
||||
config_get(config_get_if(), logparams_dump, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX);
|
||||
|
||||
if (config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX) > 0)
|
||||
if (config_check_unknown_cmdlineopt(config_get_if(), CONFIG_STRING_LOG_PREFIX) > 0)
|
||||
exit(1);
|
||||
|
||||
/* set the debug mask according to the debug parameters values */
|
||||
|
||||
@@ -25,7 +25,7 @@ extern log_t *g_log;
|
||||
|
||||
extern const mapping log_level_names[];
|
||||
extern const mapping log_options[];
|
||||
extern mapping log_maskmap[];
|
||||
extern const mapping log_maskmap[];
|
||||
extern int log_mem_flag;
|
||||
extern char * log_mem_filename;
|
||||
extern char logmem_filename[1024];
|
||||
|
||||
+2
-6
@@ -192,13 +192,9 @@ void T_Config_Init(void)
|
||||
int T_nowait = 0;
|
||||
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
|
||||
|
||||
config_get(ttraceparams,
|
||||
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||
TTRACER_CONFIG_PREFIX);
|
||||
config_get(config_get_if(), ttraceparams, sizeofArray(ttraceparams), TTRACER_CONFIG_PREFIX);
|
||||
/* compatibility: look for TTracer command line options in root section */
|
||||
config_process_cmdline(ttraceparams,
|
||||
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||
NULL);
|
||||
config_process_cmdline(config_get_if(), ttraceparams, sizeofArray(ttraceparams), NULL);
|
||||
|
||||
if (T_stdout < 0 || T_stdout > 2) {
|
||||
printf("fatal error: T_stdout = %d but only values 0, 1, or 2 are allowed\n", T_stdout);
|
||||
|
||||
@@ -46,7 +46,7 @@ void loader_init(void) {
|
||||
paramdef_t LoaderParams[] = LOADER_PARAMS_DESC;
|
||||
|
||||
loader_data.mainexec_buildversion = PACKAGE_VERSION;
|
||||
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),LOADER_CONFIG_PREFIX);
|
||||
int ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), LOADER_CONFIG_PREFIX);
|
||||
if (ret <0) {
|
||||
printf("[LOADER] configuration couldn't be performed via config module, parameters set to default values\n");
|
||||
if (loader_data.shlibpath == NULL) {
|
||||
@@ -82,7 +82,7 @@ static char *loader_format_shlibpath(char *modname, char *version)
|
||||
/* shared lib name is formatted as lib<module name><module version>.so */
|
||||
char cfgprefix[sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16];
|
||||
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
|
||||
ret = config_get(LoaderParams, sizeofArray(LoaderParams), cfgprefix);
|
||||
ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), cfgprefix);
|
||||
if (ret <0) {
|
||||
fprintf(stderr, "[LOADER] %s %d couldn't retrieve config from section %s\n", __FILE__, __LINE__, cfgprefix);
|
||||
}
|
||||
|
||||
@@ -844,7 +844,7 @@ static bool exec_moduleinit(char *modname) {
|
||||
|
||||
int add_embeddedmodules(void) {
|
||||
int ret=0;
|
||||
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_STATICMOD);
|
||||
int pindex = config_paramidx_fromname(telnetoptions, sizeofArray(telnetoptions), TELNETSRV_OPTNAME_STATICMOD);
|
||||
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
|
||||
bool success = exec_moduleinit(telnetoptions[pindex].strlistptr[i]);
|
||||
if (success)
|
||||
@@ -856,7 +856,7 @@ int add_embeddedmodules(void) {
|
||||
|
||||
int add_sharedmodules(void) {
|
||||
int ret=0;
|
||||
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_SHRMOD);
|
||||
int pindex = config_paramidx_fromname(telnetoptions, sizeofArray(telnetoptions), TELNETSRV_OPTNAME_SHRMOD);
|
||||
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
|
||||
char *name = telnetoptions[pindex].strlistptr[i];
|
||||
char libname[256];
|
||||
@@ -875,7 +875,7 @@ int add_sharedmodules(void) {
|
||||
*/
|
||||
int telnetsrv_autoinit(void) {
|
||||
memset(&telnetparams,0,sizeof(telnetparams));
|
||||
config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
|
||||
config_get(config_get_if(), telnetoptions, sizeofArray(telnetoptions), "telnetsrv");
|
||||
/* possibly load a exec specific shared lib */
|
||||
char *execfunc=get_softmodem_function(NULL);
|
||||
char libname[64];
|
||||
|
||||
@@ -511,9 +511,9 @@ int proccmd_exit(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
int proccmd_restart(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
if (debug > 0)
|
||||
prnt("process module received %s\n", buf);
|
||||
end_configmodule();
|
||||
prnt("process module received %s\n", buf);
|
||||
configmodule_interface_t *cfg = config_get_if();
|
||||
end_configmodule(cfg);
|
||||
execvpe(cfg->argv[0], cfg->argv, environ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ void initFloatingCoresTpool(int nbThreads,tpool_t *pool, bool performanceMeas, c
|
||||
}
|
||||
|
||||
#ifdef TEST_THREAD_POOL
|
||||
volatile int oai_exit=0;
|
||||
int oai_exit = 0;
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
|
||||
{
|
||||
|
||||
@@ -278,8 +278,8 @@ void run_cpumeasur(void) {
|
||||
void init_meas(void) {
|
||||
pthread_t thid;
|
||||
paramdef_t cpumeasur_params[] = CPUMEASUR_PARAMS_DESC;
|
||||
int numparams=sizeof(cpumeasur_params)/sizeof(paramdef_t);
|
||||
int rt = config_get( cpumeasur_params,numparams,CPUMEASUR_SECTION);
|
||||
int numparams = sizeofArray(cpumeasur_params);
|
||||
int rt = config_get(config_get_if(), cpumeasur_params, numparams, CPUMEASUR_SECTION);
|
||||
AssertFatal(rt >= 0, "cpumeasur configuration couldn't be performed");
|
||||
measur_table=calloc(max_cpumeasur,sizeof( time_stats_t *));
|
||||
AssertFatal(measur_table!=NULL, "couldn't allocate %u cpu measurements entries\n",max_cpumeasur);
|
||||
|
||||
@@ -753,7 +753,7 @@ int websrv_callback_get_softmodemstatus(const struct _u_request *request, struct
|
||||
}
|
||||
websrv_add_modeminfo(modemvars, "command line", cmdline, "string");
|
||||
if ((config_get_if()->rtflags & CONFIG_SAVERUNCFG) && (config_get_if()->write_parsedcfg != NULL)) {
|
||||
config_get_if()->write_parsedcfg();
|
||||
config_get_if()->write_parsedcfg(config_get_if());
|
||||
|
||||
websrv_add_modeminfo(modemvars, "Parsed config file", config_get_if()->status->debug_cfgname, "configfile");
|
||||
}
|
||||
@@ -819,7 +819,7 @@ void *websrv_autoinit()
|
||||
{
|
||||
int ret;
|
||||
memset(&websrvparams, 0, sizeof(websrvparams));
|
||||
config_get(websrvoptions, sizeof(websrvoptions) / sizeof(paramdef_t), "websrv");
|
||||
config_get(websrvoptions, sizeofArray(websrvoptions), "websrv");
|
||||
/* check if telnet server is loaded or not */
|
||||
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
|
||||
if (addcmd != NULL) {
|
||||
|
||||
@@ -2889,7 +2889,7 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas
|
||||
int i = 0;
|
||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
|
||||
RU_t **ru=NULL;
|
||||
if ( RUParamList.numelt > 0) {
|
||||
ru = (RU_t **)malloc(nb_RU*sizeof(RU_t *));
|
||||
|
||||
@@ -289,10 +289,10 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
static void get_options(configmodule_interface_t *cfg)
|
||||
{
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options(SOFTMODEM_ENB_BIT );
|
||||
get_common_options(cfg, SOFTMODEM_ENB_BIT);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
|
||||
@@ -313,10 +313,6 @@ static void get_options(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
int CC_id;
|
||||
|
||||
@@ -438,7 +434,7 @@ static void wait_nfapi_init(char *thread_name) {
|
||||
pthread_mutex_unlock(&nfapi_sync_mutex);
|
||||
printf( "NFAPI: got sync (%s)\n", thread_name);
|
||||
}
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
int CC_id = 0;
|
||||
@@ -446,7 +442,7 @@ int main ( int argc, char **argv )
|
||||
|
||||
start_background_system();
|
||||
|
||||
if ( load_configmodule(argc,argv,0) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, 0)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
@@ -454,7 +450,7 @@ int main ( int argc, char **argv )
|
||||
logInit();
|
||||
set_latency_target();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
get_options(uniqCfg);
|
||||
|
||||
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
|
||||
@@ -617,7 +613,7 @@ int main ( int argc, char **argv )
|
||||
|
||||
create_tasks_mbms(1);
|
||||
sleep(1);
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
config_check_unknown_cmdlineopt(uniqCfg, CONFIG_CHECKALLSECTIONS);
|
||||
|
||||
// wait for end of program
|
||||
LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");
|
||||
|
||||
@@ -270,7 +270,8 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
|
||||
extern int16_t dlsch_demod_shift;
|
||||
uint16_t node_number;
|
||||
static void get_options(void) {
|
||||
static void get_options(configmodule_interface_t *cfg)
|
||||
{
|
||||
int CC_id=0;
|
||||
int tddflag=0;
|
||||
int dumpframe=0;
|
||||
@@ -281,11 +282,11 @@ static void get_options(void) {
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
/* unknown parameters on command line will be checked in main
|
||||
after all init have been performed */
|
||||
get_common_options(SOFTMODEM_4GUE_BIT );
|
||||
get_common_options(cfg, SOFTMODEM_4GUE_BIT);
|
||||
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
|
||||
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
|
||||
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
|
||||
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
|
||||
config_process_cmdline(cfg, cmdline_uemodeparams, sizeofArray(cmdline_uemodeparams), NULL);
|
||||
config_process_cmdline(cfg, cmdline_ueparams, sizeofArray(cmdline_ueparams), NULL);
|
||||
nfapi_setmode(nfapi_mode);
|
||||
|
||||
get_softmodem_params()->hw_timing_advance = timingadv;
|
||||
@@ -356,7 +357,6 @@ static void get_options(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
int CC_id;
|
||||
|
||||
@@ -518,6 +518,7 @@ AssertFatal(false,"");
|
||||
}
|
||||
|
||||
int NB_UE_INST = 1;
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
|
||||
@@ -525,11 +526,10 @@ int main( int argc, char **argv ) {
|
||||
uint8_t abstraction_flag=0;
|
||||
// Default value for the number of UEs. It will hold,
|
||||
// if not changed from the command line option --num-ues
|
||||
configmodule_interface_t *config_mod;
|
||||
start_background_system();
|
||||
config_mod = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
|
||||
uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
|
||||
|
||||
if (config_mod == NULL) {
|
||||
if (uniqCfg == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
|
||||
|
||||
get_options ();
|
||||
get_options(uniqCfg);
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
|
||||
sf_ahead = 1;
|
||||
@@ -680,7 +680,7 @@ int main( int argc, char **argv ) {
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
load_softscope("ue",NULL);
|
||||
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
config_check_unknown_cmdlineopt(uniqCfg, CONFIG_CHECKALLSECTIONS);
|
||||
printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex);
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
sync_var=0;
|
||||
|
||||
+10
-15
@@ -115,20 +115,15 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
static void get_options(configmodule_interface_t *cfg)
|
||||
{
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options(SOFTMODEM_ENB_BIT );
|
||||
get_common_options(cfg, SOFTMODEM_ENB_BIT);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
|
||||
//RCConfig();
|
||||
|
||||
// RCConfig();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void phy_free_RU(RU_t *);
|
||||
|
||||
nfapi_mode_t nfapi_getmode(void) {
|
||||
@@ -144,17 +139,17 @@ void wait_eNBs(void){ return; }
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
|
||||
if ( load_configmodule(argc,argv,0) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, 0)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
logInit();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
get_options(uniqCfg);
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
@@ -180,7 +175,7 @@ int main ( int argc, char **argv )
|
||||
|
||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
|
||||
|
||||
int j=0;
|
||||
uint64_t ru_mask=1;
|
||||
@@ -366,8 +361,8 @@ int main ( int argc, char **argv )
|
||||
phy_free_RU(ru);
|
||||
|
||||
free_lte_top();
|
||||
end_configmodule();
|
||||
|
||||
end_configmodule(uniqCfg);
|
||||
|
||||
if (ru->rfdevice.trx_end_func) {
|
||||
ru->rfdevice.trx_end_func(&ru->rfdevice);
|
||||
ru->rfdevice.trx_end_func = NULL;
|
||||
|
||||
@@ -111,11 +111,11 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP)
|
||||
fake.gtpInst = e1inst->gtpInstF1U;
|
||||
return &fake;
|
||||
}
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/// static configuration for NR at the moment
|
||||
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
logInit();
|
||||
|
||||
+8
-11
@@ -94,16 +94,13 @@ extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
||||
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
//extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
|
||||
void init_NR_RU(char *);
|
||||
void start_NR_RU();
|
||||
void stop_RU(int nb_ru);
|
||||
|
||||
void configure_ru(int idx, void *arg);
|
||||
void configure_rru(int idx, void *arg);
|
||||
int attach_rru(RU_t *ru);
|
||||
int connect_rau(RU_t *ru);
|
||||
static void NRRCconfig_RU(void);
|
||||
|
||||
static void NRRCconfig_RU(configmodule_interface_t *cfg);
|
||||
|
||||
extern int emulate_rf;
|
||||
extern int numerology;
|
||||
@@ -1784,7 +1781,8 @@ void set_function_spec_param(RU_t *ru) {
|
||||
} // switch on interface type
|
||||
}
|
||||
|
||||
void init_NR_RU(char *rf_config_file) {
|
||||
void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file)
|
||||
{
|
||||
int ru_id;
|
||||
RU_t *ru;
|
||||
PHY_VARS_gNB *gNB_RC;
|
||||
@@ -1797,7 +1795,7 @@ void init_NR_RU(char *rf_config_file) {
|
||||
pthread_cond_init(&RC.ru_cond,NULL);
|
||||
// read in configuration file)
|
||||
printf("configuring RU from file\n");
|
||||
NRRCconfig_RU();
|
||||
NRRCconfig_RU(cfg);
|
||||
LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs());
|
||||
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
|
||||
|
||||
@@ -1884,7 +1882,6 @@ void start_NR_RU()
|
||||
start_RU_proc(ru);
|
||||
}
|
||||
|
||||
|
||||
void stop_RU(int nb_ru) {
|
||||
for (int inst = 0; inst < nb_ru; inst++) {
|
||||
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
|
||||
@@ -1895,19 +1892,19 @@ void stop_RU(int nb_ru) {
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
/* from here function to use configuration module */
|
||||
static void NRRCconfig_RU(void)
|
||||
static void NRRCconfig_RU(configmodule_interface_t *cfg)
|
||||
{
|
||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
config_getlist(&RUParamList, RUParams, sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(cfg, &RUParamList, RUParams, sizeofArray(RUParams), NULL);
|
||||
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
|
||||
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
config_get(cfg, GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(cfg, &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
|
||||
int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr;
|
||||
int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;
|
||||
|
||||
+15
-14
@@ -288,7 +288,7 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
}
|
||||
}
|
||||
|
||||
static int create_gNB_tasks(ngran_node_t node_type)
|
||||
static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cfg)
|
||||
{
|
||||
uint32_t gnb_nb = RC.nb_nr_inst;
|
||||
uint32_t gnb_id_start = 0;
|
||||
@@ -297,12 +297,13 @@ static int create_gNB_tasks(ngran_node_t node_type)
|
||||
itti_wait_ready(1);
|
||||
LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__);
|
||||
|
||||
RCconfig_verify(node_type);
|
||||
RCconfig_verify(cfg, node_type);
|
||||
|
||||
RCconfig_NR_L1();
|
||||
RCconfig_nr_prs();
|
||||
|
||||
if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc();
|
||||
if (RC.nb_nr_macrlc_inst > 0)
|
||||
RCconfig_nr_macrlc(cfg);
|
||||
|
||||
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
|
||||
|
||||
@@ -367,8 +368,8 @@ static int create_gNB_tasks(ngran_node_t node_type)
|
||||
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
config_get(cfg, NETParams, sizeofArray(NETParams), aprefix);
|
||||
|
||||
for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) {
|
||||
if( NETParams[i].strptr == NULL) {
|
||||
LOG_E(NGAP, "No AMF configuration in the file.\n");
|
||||
@@ -426,12 +427,12 @@ static int create_gNB_tasks(ngran_node_t node_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
static void get_options(configmodule_interface_t *cfg)
|
||||
{
|
||||
paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options(SOFTMODEM_GNB_BIT );
|
||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
get_common_options(cfg, SOFTMODEM_GNB_BIT);
|
||||
config_process_cmdline(cfg, cmdline_params, sizeofArray(cmdline_params), NULL);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
|
||||
@@ -448,7 +449,6 @@ static void get_options(void) {
|
||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||
}
|
||||
|
||||
|
||||
void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs],
|
||||
NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
@@ -570,12 +570,13 @@ void init_pdcp(void) {
|
||||
}
|
||||
}
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main( int argc, char **argv ) {
|
||||
int ru_id, CC_id = 0;
|
||||
start_background_system();
|
||||
|
||||
///static configuration for NR at the moment
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
@@ -590,7 +591,7 @@ int main( int argc, char **argv ) {
|
||||
logInit();
|
||||
set_latency_target();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
get_options(uniqCfg);
|
||||
|
||||
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
|
||||
@@ -639,7 +640,7 @@ int main( int argc, char **argv ) {
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
const ngran_node_t node_type = get_node_type();
|
||||
if (NFAPI_MODE != NFAPI_MODE_PNF) {
|
||||
int ret = create_gNB_tasks(node_type);
|
||||
int ret = create_gNB_tasks(node_type, uniqCfg);
|
||||
AssertFatal(ret == 0, "cannot create ITTI tasks\n");
|
||||
}
|
||||
|
||||
@@ -673,7 +674,7 @@ int main( int argc, char **argv ) {
|
||||
int sl_ahead=6;
|
||||
if (RC.nb_RU >0) {
|
||||
printf("Initializing RU threads\n");
|
||||
init_NR_RU(get_softmodem_params()->rf_config_file);
|
||||
init_NR_RU(uniqCfg, get_softmodem_params()->rf_config_file);
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
RC.ru[ru_id]->rf_map.card=0;
|
||||
|
||||
@@ -52,7 +52,7 @@ extern void stop_gNB(int);
|
||||
extern void kill_gNB_proc(int inst);
|
||||
|
||||
// In nr-ru.c
|
||||
extern void init_NR_RU(char *);
|
||||
extern void init_NR_RU(configmodule_interface_t *cfg, char *);
|
||||
extern void init_RU_proc(RU_t *ru);
|
||||
extern void start_NR_RU(void);
|
||||
extern void stop_RU(int nb_ru);
|
||||
|
||||
@@ -258,12 +258,11 @@ uint64_t set_nrUE_optmask(uint64_t bitmask) {
|
||||
nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
|
||||
static void get_options(void) {
|
||||
|
||||
static void get_options(configmodule_interface_t *cfg)
|
||||
{
|
||||
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
|
||||
int numparams = sizeof(cmdline_params)/sizeof(paramdef_t);
|
||||
config_get(cmdline_params,numparams,NULL);
|
||||
int numparams = sizeofArray(cmdline_params);
|
||||
config_get(cfg, cmdline_params, numparams, NULL);
|
||||
|
||||
AssertFatal(rrc_config_path == NULL, "the option \"rrc_config_path\" is deprecated. Please use --reconfig-file and --rbconfig-file separately to point to files reconfig.raw and rbconfig.raw\n");
|
||||
|
||||
@@ -414,9 +413,10 @@ static void trigger_deregistration(int sig)
|
||||
}
|
||||
}
|
||||
|
||||
static void get_channel_model_mode() {
|
||||
static void get_channel_model_mode(configmodule_interface_t *cfg)
|
||||
{
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
config_get(GNBParams, sizeof(GNBParams)/sizeof(paramdef_t), NULL);
|
||||
config_get(cfg, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
int num_xp_antennas = *GNBParams[GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;
|
||||
|
||||
if (num_xp_antennas == 2)
|
||||
@@ -426,6 +426,7 @@ static void get_channel_model_mode() {
|
||||
}
|
||||
|
||||
int NB_UE_INST = 1;
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
int set_exe_prio = 1;
|
||||
@@ -440,7 +441,7 @@ int main( int argc, char **argv ) {
|
||||
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
||||
start_background_system();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
//set_softmodem_sighandler();
|
||||
@@ -451,9 +452,9 @@ int main( int argc, char **argv ) {
|
||||
logInit();
|
||||
// get options and fill parameters from configuration file
|
||||
|
||||
get_options (); //Command-line options specific for NRUE
|
||||
get_options(uniqCfg); // Command-line options specific for NRUE
|
||||
|
||||
get_common_options(SOFTMODEM_5GUE_BIT);
|
||||
get_common_options(uniqCfg, SOFTMODEM_5GUE_BIT);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
#if T_TRACER
|
||||
T_Config_Init();
|
||||
@@ -496,7 +497,7 @@ int main( int argc, char **argv ) {
|
||||
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs);
|
||||
if (get_softmodem_params()->emulate_l1) {
|
||||
RCconfig_nr_ue_macrlc();
|
||||
get_channel_model_mode();
|
||||
get_channel_model_mode(uniqCfg);
|
||||
}
|
||||
|
||||
if (get_softmodem_params()->do_ra)
|
||||
@@ -568,7 +569,7 @@ int main( int argc, char **argv ) {
|
||||
// Sleep a while before checking all parameters have been used
|
||||
// Some are used directly in external threads, asynchronously
|
||||
sleep(2);
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
config_check_unknown_cmdlineopt(uniqCfg, CONFIG_CHECKALLSECTIONS);
|
||||
|
||||
// wait for end of program
|
||||
printf("Entering ITTI signals handler\n");
|
||||
|
||||
@@ -91,7 +91,8 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
|
||||
return "???";
|
||||
}
|
||||
|
||||
void get_common_options(uint32_t execmask) {
|
||||
void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
|
||||
{
|
||||
int32_t stats_disabled = 0;
|
||||
uint32_t online_log_messages=0;
|
||||
uint32_t glog_level=0 ;
|
||||
@@ -107,16 +108,16 @@ void get_common_options(uint32_t execmask) {
|
||||
checkedparam_t cmdline_CheckParams[] = CMDLINE_PARAMS_CHECK_DESC;
|
||||
int numparams = sizeofArray(cmdline_params);
|
||||
config_set_checkfunctions(cmdline_params, cmdline_CheckParams, numparams);
|
||||
config_get(cmdline_params, numparams, NULL);
|
||||
config_get(cfg, cmdline_params, numparams, NULL);
|
||||
nfapi_index = config_paramidx_fromname(cmdline_params, numparams, "nfapi");
|
||||
AssertFatal(nfapi_index >= 0,"Index for nfapi config option not found!");
|
||||
nfapi_mode = config_get_processedint(&cmdline_params[nfapi_index]);
|
||||
nfapi_mode = config_get_processedint(cfg, &cmdline_params[nfapi_index]);
|
||||
|
||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||
int numlogparams = sizeof(cmdline_logparams) / sizeof(paramdef_t);
|
||||
int numlogparams = sizeofArray(cmdline_logparams);
|
||||
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams, numlogparams);
|
||||
config_get(cmdline_logparams, numlogparams, NULL);
|
||||
config_get(cfg, cmdline_logparams, numlogparams, NULL);
|
||||
|
||||
if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) {
|
||||
set_glog_onlinelog(online_log_messages);
|
||||
|
||||
@@ -359,7 +359,7 @@ extern uint64_t get_softmodem_optmask(void);
|
||||
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
||||
extern uint64_t clear_softmodem_optmask(uint64_t bitmask);
|
||||
extern softmodem_params_t *get_softmodem_params(void);
|
||||
extern void get_common_options(uint32_t execmask);
|
||||
extern void get_common_options(configmodule_interface_t *cfg, uint32_t execmask);
|
||||
extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
|
||||
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
|
||||
extern void set_softmodem_sighandler(void);
|
||||
|
||||
@@ -430,6 +430,7 @@ int test_ldpc(short max_iterations,
|
||||
return *errors;
|
||||
}
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//#define DEBUG_POLAR_TIMING
|
||||
//#define DEBUG_POLARTEST
|
||||
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//Default simulation values (Aim for iterations = 1000000.)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
//#define DEBUG_SMALLBLOCKTEST
|
||||
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
time_stats_t timeEncoder,timeDecoder;
|
||||
|
||||
@@ -53,7 +53,7 @@ int load_nrLDPClib(char *version) {
|
||||
char libname[64] = "ldpc";
|
||||
|
||||
if (ptr == NULL) { // phy simulators, config module possibly not loaded
|
||||
load_configmodule(1, arg, CONFIG_ENABLECMDLINEONLY);
|
||||
uniqCfg = load_configmodule(1, arg, CONFIG_ENABLECMDLINEONLY);
|
||||
logInit();
|
||||
}
|
||||
shlib_fdesc[0].fname = "nrLDPC_decod";
|
||||
|
||||
@@ -46,7 +46,7 @@ void RCconfig_nrUE_prs(void *cfg)
|
||||
|
||||
paramlist_def_t gParamList = {CONFIG_STRING_PRS_LIST,NULL,0};
|
||||
paramdef_t gParams[] = PRS_GLOBAL_PARAMS_DESC;
|
||||
config_getlist( &gParamList,gParams,sizeof(gParams)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &gParamList, gParams, sizeofArray(gParams), NULL);
|
||||
if (gParamList.numelt > 0)
|
||||
{
|
||||
ue->prs_active_gNBs = *(gParamList.paramarray[j][PRS_ACTIVE_GNBS_IDX].uptr);
|
||||
@@ -61,7 +61,7 @@ void RCconfig_nrUE_prs(void *cfg)
|
||||
sprintf(PRS_ParamList.listname, "%s%i", CONFIG_STRING_PRS_CONFIG, i);
|
||||
|
||||
sprintf(aprefix, "%s.[%i]", CONFIG_STRING_PRS_LIST, 0);
|
||||
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PRS_ParamList, PRS_Params, sizeofArray(PRS_Params), aprefix);
|
||||
|
||||
if (PRS_ParamList.numelt > 0) {
|
||||
for (j = 0; j < PRS_ParamList.numelt; j++) {
|
||||
|
||||
@@ -30,10 +30,10 @@ char *uecap_file;
|
||||
int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;}
|
||||
void nfapi_setmode(nfapi_mode_t nfapi_mode) {}
|
||||
void set_taus_seed(unsigned int seed_init){};
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv) {
|
||||
///static configuration for NR at the moment
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
set_softmodem_sighandler();
|
||||
@@ -43,8 +43,8 @@ int main(int argc, char **argv) {
|
||||
paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
|
||||
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options(SOFTMODEM_GNB_BIT );
|
||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
get_common_options(uniqCfg, SOFTMODEM_GNB_BIT);
|
||||
config_process_cmdline(uniqCfg, cmdline_params, sizeofArray(cmdline_params), NULL);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
set_latency_target();
|
||||
|
||||
|
||||
@@ -43,22 +43,19 @@
|
||||
|
||||
/* function description array, to be used when loading the dfts/idfts lib */
|
||||
static loader_shlibfunc_t shlib_fdesc[2];
|
||||
static char *const arg[64] = {"phytest", "-O", "cmdlineonly::dbgl0"};
|
||||
|
||||
int load_dftslib(void) {
|
||||
|
||||
char *ptr = (char*)config_get_if();
|
||||
if ( ptr==NULL ) {// phy simulators, config module possibly not loaded
|
||||
load_configmodule(3,(char **)arg,CONFIG_ENABLECMDLINEONLY) ;
|
||||
logInit();
|
||||
}
|
||||
shlib_fdesc[0].fname = "dft";
|
||||
shlib_fdesc[1].fname = "idft";
|
||||
int ret=load_module_shlib("dfts",shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading dftsc decoder");
|
||||
dft = (dftfunc_t)shlib_fdesc[0].fptr;
|
||||
idft = (idftfunc_t)shlib_fdesc[1].fptr;
|
||||
return 0;
|
||||
static char *arg[64] = {"phytest", "-O", "cmdlineonly::dbgl0"};
|
||||
int load_dftslib(void)
|
||||
{
|
||||
char *ptr = (char *)config_get_if();
|
||||
if (ptr == NULL) { // phy simulators, config module possibly not loaded
|
||||
uniqCfg = load_configmodule(3, (char **)arg, CONFIG_ENABLECMDLINEONLY);
|
||||
logInit();
|
||||
}
|
||||
shlib_fdesc[0].fname = "dft";
|
||||
shlib_fdesc[1].fname = "idft";
|
||||
int ret = load_module_shlib("dfts", shlib_fdesc, sizeof(shlib_fdesc) / sizeof(loader_shlibfunc_t), NULL);
|
||||
AssertFatal((ret >= 0), "Error loading dftsc decoder");
|
||||
dft = (dftfunc_t)shlib_fdesc[0].fptr;
|
||||
idft = (idftfunc_t)shlib_fdesc[1].fptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -492,6 +492,7 @@ int extended_prefix_flag=0;
|
||||
int verbose=0, help=0;
|
||||
double SNR,snr0=-2.0,snr1,rate = 0;
|
||||
int print_perf=0;
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int k,i,j,aa;
|
||||
@@ -876,7 +877,8 @@ int main(int argc, char **argv) {
|
||||
if (transmission_mode>1) pa=dBm3;
|
||||
|
||||
printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
|
||||
AssertFatal(load_configmodule(argc,argv, CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n");
|
||||
AssertFatal((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) != NULL,
|
||||
"Cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog_onlinelog(true);
|
||||
// enable these lines if you need debug info
|
||||
|
||||
@@ -583,7 +583,7 @@ int extended_prefix_flag=0;
|
||||
int verbose=0, help=0;
|
||||
double SNR,snr0=-2.0,snr1,rate = 0;
|
||||
int print_perf=0;
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv) {
|
||||
int k = 0,i,j,aa;
|
||||
int re;
|
||||
@@ -984,7 +984,7 @@ int main(int argc, char **argv) {
|
||||
if (transmission_mode>1) pa=dBm3;
|
||||
|
||||
printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
|
||||
AssertFatal(load_configmodule(argc,argv, CONFIG_ENABLECMDLINEONLY) != NULL,
|
||||
AssertFatal((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) != NULL,
|
||||
"cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog_onlinelog(true);
|
||||
|
||||
@@ -306,7 +306,7 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB,
|
||||
|
||||
enum eTypes { eBool, eInt, eFloat, eText };
|
||||
static int verbose,help,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1;
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv) {
|
||||
int i,j,aa,u;
|
||||
PHY_VARS_eNB *eNB;
|
||||
@@ -395,7 +395,8 @@ int main(int argc, char **argv) {
|
||||
cpuf = cpu_freq_GHz;
|
||||
set_parallel_conf("PARALLEL_SINGLE_THREAD");
|
||||
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
|
||||
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n");
|
||||
AssertFatal((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) != NULL,
|
||||
"Cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog(OAILOG_INFO);
|
||||
// enable these lines if you need debug info
|
||||
|
||||
@@ -97,6 +97,7 @@ nrUE_params_t nrUE_params={0};
|
||||
nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -138,15 +139,15 @@ int main(int argc, char **argv)
|
||||
char gNBthreads[128]="n";
|
||||
int Tbslbrm = 950984;
|
||||
|
||||
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
exit_fun("[NR_DLSCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_DLSCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
//logInit();
|
||||
randominit(0);
|
||||
// logInit();
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt(argc, argv, "df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:X:")) != -1) {
|
||||
switch (c) {
|
||||
while ((c = getopt(argc, argv, "df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:X:")) != -1) {
|
||||
switch (c) {
|
||||
/*case 'f':
|
||||
write_output_file = 1;
|
||||
output_fd = fopen(optarg, "w");
|
||||
@@ -338,9 +339,9 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logInit();
|
||||
logInit();
|
||||
set_glog(loglvl);
|
||||
|
||||
if (snr1set == 0)
|
||||
@@ -671,10 +672,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (ouput_vcd)
|
||||
vcd_signal_dumper_close();
|
||||
end_configmodule();
|
||||
loader_reset();
|
||||
logTerm();
|
||||
end_configmodule(uniqCfg);
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return (n_errors);
|
||||
return (n_errors);
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ void validate_input_pmi(nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLaye
|
||||
|
||||
|
||||
int NB_UE_INST = 1;
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *csv_file = NULL;
|
||||
@@ -348,7 +348,7 @@ int main(int argc, char **argv)
|
||||
uint8_t dlsch_threads = 0;
|
||||
int chest_type[2] = {0};
|
||||
uint8_t max_ldpc_iterations = 5;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
gNB->configured = 1;
|
||||
LOG_I(PHY,"gNB configured\n");
|
||||
}
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -249,7 +250,7 @@ int main(int argc, char **argv)
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_PBCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ nr_bler_struct nr_bler_data[NR_NUM_MCS];
|
||||
|
||||
void processSlotTX(void *arg) {}
|
||||
int NB_UE_INST = 1;
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv){
|
||||
|
||||
char c;
|
||||
@@ -167,7 +167,7 @@ int main(int argc, char **argv){
|
||||
SCM_t channel_model = Rayleigh1;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
|
||||
int pucch_DTX_thres = 50;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_PUCCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -157,7 +158,7 @@ int main(int argc, char **argv)
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_ULSCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
channel_desc_t *UE2gNB[NUMBER_OF_UE_MAX][NUMBER_OF_gNB_MAX];
|
||||
int NB_UE_INST = 1;
|
||||
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *csv_file = NULL;
|
||||
@@ -217,7 +218,7 @@ int main(int argc, char *argv[])
|
||||
int params_from_file = 0;
|
||||
int threadCnt=0;
|
||||
int max_ldpc_iterations = 5;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) {
|
||||
exit_fun("[NR_ULSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
int ul_proc_error = 0; // uplink processing checking status flag
|
||||
|
||||
@@ -2270,8 +2270,8 @@ double channelmod_get_sinr_dB(void) {
|
||||
|
||||
void init_channelmod(void) {
|
||||
paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC;
|
||||
int numparams=sizeof(channelmod_params)/sizeof(paramdef_t);
|
||||
int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION);
|
||||
int numparams = sizeofArray(channelmod_params);
|
||||
int ret = config_get(config_get_if(), channelmod_params, numparams, CHANNELMOD_SECTION);
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed");
|
||||
defined_channels=calloc(max_chan,sizeof( channel_desc_t *));
|
||||
AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan);
|
||||
@@ -2289,8 +2289,8 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
|
||||
paramlist_def_t channel_list;
|
||||
memset(&channel_list,0,sizeof(paramlist_def_t));
|
||||
memcpy(channel_list.listname,modellist_name,sizeof(channel_list.listname)-1);
|
||||
int numparams = sizeof(achannel_params)/sizeof(paramdef_t);
|
||||
config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION);
|
||||
int numparams = sizeofArray(achannel_params);
|
||||
config_getlist(config_get_if(), &channel_list, achannel_params, numparams, CHANNELMOD_SECTION);
|
||||
AssertFatal(channel_list.numelt>0, "List %s.%s not found in config file\n",CHANNELMOD_SECTION,channel_list.listname);
|
||||
int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME);
|
||||
int pindex_DT = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_DT_PNAME );
|
||||
|
||||
@@ -44,12 +44,12 @@ static void get_NGU_S1U_addr(char **addr, uint16_t *port)
|
||||
LOG_I(GTPU, "Configuring GTPu\n");
|
||||
|
||||
/* get number of active eNodeBs */
|
||||
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs > 0, "Failed to parse config file no active gNodeBs in %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
sprintf(gtpupath, "%s.[%i].%s", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get(NETParams, sizeof(NETParams) / sizeof(paramdef_t), gtpupath);
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), gtpupath);
|
||||
char *address;
|
||||
if (NETParams[1].strptr != NULL) {
|
||||
LOG_I(GTPU, "SA mode \n");
|
||||
@@ -75,14 +75,14 @@ MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process)
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
|
||||
config_get(GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
char aprefix[MAX_OPTNAME_SIZE * 2 + 8];
|
||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs == 1, "Support only one gNB per process\n");
|
||||
|
||||
if (num_gnbs > 0) {
|
||||
config_getlist(&GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
paramdef_t *gnbParms = GNBParamList.paramarray[0];
|
||||
AssertFatal(gnbParms[GNB_GNB_ID_IDX].uptr != NULL, "gNB id %d is not defined in configuration file\n", 0);
|
||||
e1ap_setup_req_t *e1Setup = &E1AP_REGISTER_REQ(msgConfig).setup_req;
|
||||
@@ -99,7 +99,7 @@ MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
int numPLMNs = PLMNParamList.numelt;
|
||||
e1Setup->supported_plmns = numPLMNs;
|
||||
|
||||
@@ -112,7 +112,7 @@ MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process)
|
||||
sprintf(snssaistr, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_PLMN_LIST, I);
|
||||
paramlist_def_t SNSSAIParamList = {GNB_CONFIG_STRING_SNSSAI_LIST, NULL, 0};
|
||||
paramdef_t SNSSAIParams[] = GNBSNSSAIPARAMS_DESC;
|
||||
config_getlist(&SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams)/sizeof(paramdef_t), snssaistr);
|
||||
config_getlist(config_get_if(), &SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams) / sizeof(paramdef_t), snssaistr);
|
||||
e1Setup->plmn[I].supported_slices = SNSSAIParamList.numelt;
|
||||
e1Setup->plmn[I].slice = calloc(SNSSAIParamList.numelt, sizeof(*e1Setup->plmn[I].slice));
|
||||
AssertFatal(e1Setup->plmn[I].slice != NULL, "out of memory\n");
|
||||
@@ -133,7 +133,7 @@ MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process)
|
||||
if (separate_CUUP_process) {
|
||||
paramlist_def_t GNBE1ParamList = {GNB_CONFIG_STRING_E1_PARAMETERS, NULL, 0};
|
||||
paramdef_t GNBE1Params[] = GNBE1PARAMS_DESC;
|
||||
config_getlist(&GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix);
|
||||
config_getlist(config_get_if(), &GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix);
|
||||
paramdef_t *e1Parms = GNBE1ParamList.paramarray[0];
|
||||
strcpy(e1ap_nc->CUCP_e1_ip_address.ipv4_address, *(e1Parms[GNB_CONFIG_E1_IPV4_ADDRESS_CUCP].strptr));
|
||||
e1ap_nc->CUCP_e1_ip_address.ipv4 = 1;
|
||||
|
||||
@@ -54,7 +54,7 @@ void RCconfig_NbIoTL1(void) {
|
||||
paramlist_def_t NbIoT_L1_ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_L1_Params[L1_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
config_getlist( &NbIoT_L1_ParamList,NbIoT_L1_Params,sizeof(NbIoT_L1_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(&NbIoT_L1_ParamList, NbIoT_L1_Params, sizeofArray(NbIoT_L1_Params), NULL);
|
||||
|
||||
if (NbIoT_L1_ParamList.numelt > 0) {
|
||||
if (RC.L1_NB_IoT == NULL) {
|
||||
@@ -96,7 +96,7 @@ void RCconfig_NbIoTmacrlc(void) {
|
||||
paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_MacRLC_Params[MACRLC_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(&NbIoT_MacRLC_ParamList, NbIoT_MacRLC_Params, sizeofArray(NbIoT_MacRLC_Params), NULL);
|
||||
|
||||
if ( NbIoT_MacRLC_ParamList.numelt > 0) {
|
||||
mac_top_init_eNB_NB_IoT();
|
||||
@@ -152,15 +152,15 @@ int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nb
|
||||
checkedparam_t NBIoTLteCCCheckParams[] = NBIOT_LTECCPARAMS_CHECK_DESC;
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
for (int i=0; (i<sizeof(NBIoTParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
for (int i = 0; i < sizeofArray(NBIoTParams) && i < sizeofArray(NBIoTCheckParams); i++) {
|
||||
NBIoTParams[i].chkPptr = &(NBIoTCheckParams[i]);
|
||||
}
|
||||
|
||||
for (int i=0; (i<sizeof(NBIoTParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTCheckParamsB)/sizeof(checkedparam_t)); i++ ) {
|
||||
for (int i=0; (i<sizeofArray(NBIoTParams) && i<sizeofArray(NBIoTCheckParamsB); i++ ) {
|
||||
NBIoTParams[i+15].chkPptr = &(NBIoTCheckParamsB[i]);
|
||||
}
|
||||
|
||||
for (int i=0; (i<sizeof(NBIoTPrachParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTPrachCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
for (int i=0; i<sizeofArray(NBIoTPrachParams && i<sizeofArray(NBIoTPrachCheckParams); i++ ) {
|
||||
NBIoTPrachParams[i].chkPptr = &(NBIoTPrachCheckParams[i]);
|
||||
}
|
||||
|
||||
@@ -192,11 +192,11 @@ int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nb
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N310_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N311_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311_NB);
|
||||
sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]",nbiotrrc_id);
|
||||
config_get( NBIoTParams,sizeof(NBIoTParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierMSG3_RangeStart = config_get_processedint( &(NBIoTParams[NBIOT_NPRACH_SUBCARRIERMSG3_RANGESTART_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupHoppingEnabled = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapDurationCoeff_NB = config_get_processedint( &(NBIoTParams[NBIOT_DL_GAPDURATIONCOEFF_NB_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_alpha = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_ALPHA_IDX] ) );
|
||||
config_get( NBIoTParams,sizeofArray(NBIoTParams),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierMSG3_RangeStart = config_get_processedint(config_get_if(), &(NBIoTParams[NBIOT_NPRACH_SUBCARRIERMSG3_RANGESTART_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupHoppingEnabled = config_get_processedint(config_get_if(), &(NBIoTParams[NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapDurationCoeff_NB = config_get_processedint(config_get_if(), &(NBIoTParams[NBIOT_DL_GAPDURATIONCOEFF_NB_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_alpha = config_get_processedint(config_get_if(), &(NBIoTParams[NBIOT_NPUSCH_ALPHA_IDX] ) );
|
||||
|
||||
for (int i=0; i<MAX_NUM_NBIOT_CELEVELS; i++) {
|
||||
char *tmpptr=NULL;
|
||||
@@ -209,13 +209,14 @@ int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nb
|
||||
NBIoTParams[NBIOT_NPDCCH_STARTSF_CSS_RA_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_StartSF_CSS_RA[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_OFFSET_RA_IDX].strptr = &tmpptr;
|
||||
sprintf(instprefix, "%s.[%i].%s.[%i]",NBIOT_RRCLIST_CONFIG_STRING, nbiotrrc_id,NBIOT_RRCLIST_NPRACHPARAMS_CONFIG_STRING,i);
|
||||
config_get( NBIoTPrachParams,sizeof(NBIoTPrachParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_Offset_RA[i] = config_get_processedint( &(NBIoTPrachParams[NBIOT_NPDCCH_OFFSET_RA_IDX]) );
|
||||
config_get(NBIoTPrachParams, sizeofArray(NBIoTPrachParams), instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ(msg_p).npdcch_Offset_RA[i] =
|
||||
config_get_processedint(config_get_if(), &(NBIoTPrachParams[NBIOT_NPDCCH_OFFSET_RA_IDX]));
|
||||
}
|
||||
|
||||
/* get the LTE RRC and CC this NB-IoT RRC instance is attached to */
|
||||
sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]." NBIOT_LTERRCREF_CONFIG_STRING, nbiotrrc_id );
|
||||
config_get( NBIoTRRCRefParams,sizeof(NBIoTRRCRefParams)/sizeof(paramdef_t),instprefix);
|
||||
config_get( NBIoTRRCRefParams,sizeofArray(NBIoTRRCRefParams),instprefix);
|
||||
/* read SIB1 parameters in the LTE RRC and CC sections */
|
||||
sprintf(instprefix, ENB_CONFIG_STRING_ENB_LIST ".[%i]." ENB_CONFIG_STRING_COMPONENT_CARRIERS ".[%i]",
|
||||
*(NBIoTRRCRefParams[NBIOT_RRCINST_IDX].uptr), *(NBIoTRRCRefParams[NBIOT_CCINST_IDX].uptr));
|
||||
@@ -227,14 +228,14 @@ int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nb
|
||||
NBIoTLteCCParams[LTECCPARAMS_NID_CELL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).Nid_cell);
|
||||
NBIoTLteCCParams[LTECCPARAMS_N_RB_DL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).N_RB_DL);
|
||||
|
||||
for (int i=0; (i<sizeof(NBIoTLteCCParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTLteCCCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
for (int i=0;i<sizeofArray(NBIoTLteCCParams) && i<sizeofArray(NBIoTLteCCCheckParams); i++ ) {
|
||||
NBIoTLteCCParams[i].chkPptr = &(NBIoTLteCCCheckParams[i]);
|
||||
}
|
||||
|
||||
config_get( NBIoTLteCCParams,sizeof(NBIoTLteCCParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).frame_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_FRAME_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_UL_IDX]) );
|
||||
config_get( NBIoTLteCCParams,sizeofArray(NBIoTLteCCParams),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).frame_type = config_get_processedint(config_get_if(), &(NBIoTLteCCParams[LTECCPARAMS_FRAME_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint(config_get_if(), &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint(config_get_if(), &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_UL_IDX]) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void RCconfig_L1(void) {
|
||||
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
|
||||
}
|
||||
|
||||
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &L1_ParamList, L1_Params, sizeofArray(L1_Params), NULL);
|
||||
|
||||
if (L1_ParamList.numelt > 0) {
|
||||
for (j = 0; j < RC.nb_L1_inst; j++) {
|
||||
@@ -171,8 +171,8 @@ void RCconfig_macrlc(void)
|
||||
int j;
|
||||
paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
|
||||
paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
|
||||
config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &MacRLC_ParamList, MacRLC_Params, sizeofArray(MacRLC_Params), NULL);
|
||||
config_getlist(config_get_if(), &MacRLC_ParamList, MacRLC_Params, sizeofArray(MacRLC_Params), NULL);
|
||||
|
||||
if ( MacRLC_ParamList.numelt > 0) {
|
||||
RC.nb_macrlc_inst=MacRLC_ParamList.numelt;
|
||||
@@ -277,23 +277,23 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
paramdef_t SLParams[] = CCPARAMS_SIDELINK_DESC(SLconfig);
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t) ) ; I++) {
|
||||
for (int I = 0; I < sizeofArray(CCsParams); I++) {
|
||||
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
|
||||
}
|
||||
|
||||
for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
|
||||
for (int I = 0; I < sizeofArray(CCsParams); I++) {
|
||||
eMTCParams[I].chkPptr = &(config_check_eMTCparams[I]);
|
||||
}
|
||||
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
AssertFatal (i<num_enbs,
|
||||
"Failed to parse config file no %uth element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
|
||||
if (num_enbs>0) {
|
||||
// Output a list of all eNBs.
|
||||
config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &ENBParamList, ENBParams, sizeofArray(ENBParams), NULL);
|
||||
|
||||
if (ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default eNB ID
|
||||
@@ -323,7 +323,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
// In the configuration file it is in seconds. For RRC it has to be in milliseconds
|
||||
@@ -339,7 +339,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
"to\n"
|
||||
" tracking_area_code = 1; // no string!!\n"
|
||||
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), enbpath);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), enbpath);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -379,7 +379,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
RRCcfg->eMBMS_M2_configured = 0;
|
||||
|
||||
// Parse optional physical parameters
|
||||
config_getlist( &CCsParamList,NULL,0,enbpath);
|
||||
config_getlist(config_get_if(), &CCsParamList, NULL, 0, enbpath);
|
||||
LOG_I(RRC,"num component carriers %d \n",CCsParamList.numelt);
|
||||
|
||||
if ( CCsParamList.numelt> 0) {
|
||||
@@ -387,8 +387,12 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
|
||||
for (j = 0; j < CCsParamList.numelt ; j++) {
|
||||
sprintf(ccspath,"%s.%s.[%i]",enbpath,ENB_CONFIG_STRING_COMPONENT_CARRIERS,j);
|
||||
LOG_I(RRC, "enb_config::RCconfig_RRC() parameter number: %d, total number of parameters: %zd, ccspath: %s \n \n", j, sizeof(CCsParams)/sizeof(paramdef_t), ccspath);
|
||||
config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath);
|
||||
LOG_I(RRC,
|
||||
"enb_config::RCconfig_RRC() parameter number: %d, total number of parameters: %zd, ccspath: %s \n \n",
|
||||
j,
|
||||
sizeofArray(CCsParams),
|
||||
ccspath);
|
||||
config_get(config_get_if(), CCsParams, sizeofArray(CCsParams), ccspath);
|
||||
// printf("Component carrier %d\n",component_carrier);
|
||||
// Cell params, MIB/SIB1
|
||||
RRCcfg->tdd_config[j] = ccparams_lte.tdd_config;
|
||||
@@ -1488,7 +1492,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
// eMTC configuration
|
||||
char brparamspath[MAX_OPTNAME_SIZE*2 + 160];
|
||||
sprintf(brparamspath,"%s.%s", ccspath, ENB_CONFIG_STRING_EMTC_PARAMETERS);
|
||||
config_get(eMTCParams, sizeof(eMTCParams)/sizeof(paramdef_t), brparamspath);
|
||||
config_get(config_get_if(), eMTCParams, sizeofArray(eMTCParams), brparamspath);
|
||||
RRCcfg->eMTC_configured = eMTCconfig.eMTC_configured & 1;
|
||||
|
||||
if (eMTCconfig.eMTC_configured > 0)
|
||||
@@ -1498,7 +1502,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
// Sidelink configuration
|
||||
char SLparamspath[MAX_OPTNAME_SIZE*2 + 160];
|
||||
sprintf(SLparamspath,"%s.%s", ccspath, ENB_CONFIG_STRING_SL_PARAMETERS);
|
||||
config_get( SLParams, sizeof(SLParams)/sizeof(paramdef_t), SLparamspath);
|
||||
config_get(config_get_if(), SLParams, sizeofArray(SLParams), SLparamspath);
|
||||
// Sidelink Resource pool information
|
||||
RRCcfg->SL_configured = SLconfig.sidelink_configured & 1;
|
||||
|
||||
@@ -1511,7 +1515,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
|
||||
|
||||
char srb1path[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1);
|
||||
config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path);
|
||||
config_get(config_get_if(), SRB1Params, sizeofArray(SRB1Params), srb1path);
|
||||
|
||||
switch (srb1_params.srb1_max_retx_threshold) {
|
||||
case 1:
|
||||
@@ -1828,12 +1832,12 @@ int RCconfig_gtpu(void ) {
|
||||
paramdef_t GTPUParams[] = GTPUPARAMS_DESC;
|
||||
LOG_I(GTPU,"Configuring GTPu\n");
|
||||
/* get number of active eNodeBs */
|
||||
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
AssertFatal (num_enbs >0,
|
||||
"Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get( GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath);
|
||||
config_get(config_get_if(), GTPUParams, sizeofArray(GTPUParams), gtpupath);
|
||||
cidr = enb_ipv4_address_for_S1U;
|
||||
address = strtok(cidr, "/");
|
||||
|
||||
@@ -1863,7 +1867,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
paramdef_t ENBParams[] = ENBPARAMS_DESC;
|
||||
paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
|
||||
paramdef_t CCsParams[] = CCPARAMS_DESC(ccparams_lte);
|
||||
paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
|
||||
@@ -1875,7 +1879,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
for (I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
|
||||
for (I = 0; I < sizeofArray(CCsParams); I++) {
|
||||
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
|
||||
}
|
||||
|
||||
@@ -1885,7 +1889,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt > 0) {
|
||||
// Output a list of all eNBs.
|
||||
config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &ENBParamList, ENBParams, sizeofArray(ENBParams), NULL);
|
||||
|
||||
if (ENBParamList.numelt > 0) {
|
||||
for (k = 0; k < ENBParamList.numelt; k++) {
|
||||
@@ -1910,7 +1914,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
paramdef_t M2Params[] = M2PARAMS_DESC;
|
||||
@@ -1940,25 +1944,25 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr));
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).tac = *ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
|
||||
|
||||
|
||||
// char aprefix2[MAX_OPTNAME_SIZE*80 + 8];
|
||||
// sprintf(aprefix2,"%s.[%i].%s.[0]",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_MBMS_CONFIGURATION_DATA_LIST);
|
||||
// config_getlist(&MBMSParamList, MBMSParams, sizeof(MBMSParams)/sizeof(paramdef_t), aprefix2);
|
||||
// if (MBMSParamList.numelt < 1 || MBMSParamList.numelt > 8)
|
||||
// AssertFatal(0, "The number of MBMS Areas must be in [1,8], but is %d\n",
|
||||
// MBMSParamList.numelt);
|
||||
// M2AP_REGISTER_ENB_REQ (msg_p).num_mbms_service_area_list = MBMSParamList.numelt;
|
||||
// for(J=0; J<MBMSParamList.numelt;J++){
|
||||
// M2AP_REGISTER_ENB_REQ (msg_p).mbms_service_area_list[J] = *MBMSParamList.paramarray[J][ENB_MBMS_SERVICE_AREA_IDX].uptr;
|
||||
// }
|
||||
//
|
||||
// char aprefix2[MAX_OPTNAME_SIZE*80 + 8];
|
||||
// sprintf(aprefix2,"%s.[%i].%s.[0]",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_MBMS_CONFIGURATION_DATA_LIST);
|
||||
// config_getlist(config_get_if(),&MBMSParamList, MBMSParams, sizeofArray(MBMSParams),
|
||||
// aprefix2);
|
||||
// if (MBMSParamList.numelt < 1 || MBMSParamList.numelt > 8)
|
||||
// AssertFatal(0, "The number of MBMS Areas must be in [1,8], but is %d\n",
|
||||
// MBMSParamList.numelt);
|
||||
// M2AP_REGISTER_ENB_REQ (msg_p).num_mbms_service_area_list = MBMSParamList.numelt;
|
||||
// for(J=0; J<MBMSParamList.numelt;J++){
|
||||
// M2AP_REGISTER_ENB_REQ (msg_p).mbms_service_area_list[J] =
|
||||
// *MBMSParamList.paramarray[J][ENB_MBMS_SERVICE_AREA_IDX].uptr;
|
||||
// }
|
||||
//
|
||||
|
||||
char aprefix2[MAX_OPTNAME_SIZE*80 + 8];
|
||||
sprintf(aprefix2,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
|
||||
config_getlist(&MBMSConfigParamList, MBMSConfigParams, sizeof(MBMSConfigParams)/sizeof(paramdef_t), aprefix2);
|
||||
config_getlist(config_get_if(), &MBMSConfigParamList, MBMSConfigParams, sizeofArray(MBMSConfigParams), aprefix2);
|
||||
if (MBMSConfigParamList.numelt < 1 || MBMSConfigParamList.numelt > 8)
|
||||
AssertFatal(0, "The number of MBMS Config Data must be in [1,8], but is %d\n",
|
||||
MBMSConfigParamList.numelt);
|
||||
@@ -1966,7 +1970,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
for(int I=0; I < MBMSConfigParamList.numelt; I++){
|
||||
|
||||
sprintf(aprefix2,"%s.[%i].%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_MBMS_CONFIGURATION_DATA_LIST,I);
|
||||
config_getlist(&MBMSParamList, MBMSParams, sizeof(MBMSParams)/sizeof(paramdef_t), aprefix2);
|
||||
config_getlist(config_get_if(), &MBMSParamList, MBMSParams, sizeofArray(MBMSParams), aprefix2);
|
||||
if (MBMSParamList.numelt < 1 || MBMSParamList.numelt > 8)
|
||||
AssertFatal(0, "The number of MBMS Areas must be in [1,8], but is %d\n",
|
||||
MBMSParamList.numelt);
|
||||
@@ -1993,14 +1997,14 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
"MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
|
||||
M2AP_REGISTER_ENB_REQ(msg_p).mnc);
|
||||
/* CC params */
|
||||
config_getlist(&CCsParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &CCsParamList, NULL, 0, aprefix);
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).num_cc = CCsParamList.numelt;
|
||||
|
||||
if (CCsParamList.numelt > 0) {
|
||||
//char ccspath[MAX_OPTNAME_SIZE*2 + 16];
|
||||
for (J = 0; J < CCsParamList.numelt ; J++) {
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, J);
|
||||
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
|
||||
config_get(config_get_if(), CCsParams, sizeofArray(CCsParams), aprefix);
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).eutra_band[J] = ccparams_lte.eutra_band;
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).downlink_frequency[J] = (uint32_t) ccparams_lte.downlink_frequency;
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).uplink_frequency_offset[J] = (unsigned int) ccparams_lte.uplink_frequency_offset;
|
||||
@@ -2036,7 +2040,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
|
||||
config_getlist( &M2ParamList,M2Params,sizeof(M2Params)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &M2ParamList, M2Params, sizeofArray(M2Params), aprefix);
|
||||
AssertFatal(M2ParamList.numelt <= M2AP_MAX_NB_ENB_IP_ADDRESS,
|
||||
"value of M2ParamList.numelt %d must be lower than M2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase M2AP_MAX_NB_ENB_IP_ADDRESS\n",
|
||||
M2ParamList.numelt,M2AP_MAX_NB_ENB_IP_ADDRESS);
|
||||
@@ -2066,7 +2070,7 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
// { "t_reloc_prep", "t_reloc_prep", 0, iptr:&t_reloc_prep, defintval:0, TYPE_INT, 0 },
|
||||
// { "tx2_reloc_overall", "tx2_reloc_overall", 0, iptr:&tx2_reloc_overall, defintval:0, TYPE_INT, 0 }
|
||||
// };
|
||||
// config_get(p, sizeof(p)/sizeof(paramdef_t), aprefix);
|
||||
// config_get(p, sizeofArray(p), aprefix);
|
||||
|
||||
// if (t_reloc_prep <= 0 || t_reloc_prep > 10000 ||
|
||||
// tx2_reloc_overall <= 0 || tx2_reloc_overall > 20000) {
|
||||
@@ -2083,14 +2087,14 @@ int RCconfig_M2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (EPC_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), aprefix);
|
||||
M2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_M2C = (uint32_t)*(NETParams[ENB_PORT_FOR_M2C_IDX].uptr);
|
||||
|
||||
if ((NETParams[ENB_IPV4_ADDR_FOR_M2C_IDX].strptr == NULL) || (M2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_M2C == 0)) {
|
||||
@@ -2136,14 +2140,14 @@ int RCconfig_S1(
|
||||
paramdef_t ENBParams[] = ENBPARAMS_DESC;
|
||||
paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0};
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
AssertFatal (i < ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt,
|
||||
"Failed to parse config file %s, %uth attribute %s \n",
|
||||
RC.config_file_name, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
|
||||
if (ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt > 0) {
|
||||
// Output a list of all eNBs.
|
||||
config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &ENBParamList, ENBParams, sizeofArray(ENBParams), NULL);
|
||||
|
||||
if (ENBParamList.numelt > 0) {
|
||||
for (int k = 0; k < ENBParamList.numelt; k++) {
|
||||
@@ -2169,14 +2173,14 @@ int RCconfig_S1(
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
|
||||
for (int I = 0; I < sizeofArray(CCsParams); I++) {
|
||||
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
|
||||
}
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) {
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I) {
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
}
|
||||
|
||||
@@ -2275,7 +2279,7 @@ int RCconfig_S1(
|
||||
*ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr);
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = 0xffff;
|
||||
}
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) {
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -2302,7 +2306,7 @@ int RCconfig_S1(
|
||||
* in the conf file.
|
||||
*/
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0);
|
||||
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
|
||||
config_get(config_get_if(), CCsParams, sizeofArray(CCsParams), aprefix);
|
||||
|
||||
switch (ccparams_lte.pcch_defaultPagingCycle) {
|
||||
case 32: {
|
||||
@@ -2335,7 +2339,7 @@ int RCconfig_S1(
|
||||
|
||||
/* MME connection params */
|
||||
sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k);
|
||||
config_getlist(&S1ParamList, S1Params, sizeof(S1Params)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &S1ParamList, S1Params, sizeofArray(S1Params), aprefix);
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0;
|
||||
|
||||
for (int l = 0; l < S1ParamList.numelt; l++) {
|
||||
@@ -2395,14 +2399,14 @@ int RCconfig_S1(
|
||||
|
||||
if (EPC_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), aprefix);
|
||||
cidr = *(NETParams[ENB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr);
|
||||
address = strtok(cidr, "/");
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0;
|
||||
@@ -2429,13 +2433,13 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
paramdef_t ENBParams[] = ENBPARAMS_DESC;
|
||||
paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
|
||||
paramdef_t CCsParams[] = CCPARAMS_DESC(ccparams_lte);
|
||||
paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
for (I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
|
||||
for (I = 0; I < sizeofArray(CCsParams); I++) {
|
||||
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
|
||||
}
|
||||
|
||||
@@ -2445,7 +2449,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt > 0) {
|
||||
// Output a list of all eNBs.
|
||||
config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &ENBParamList, ENBParams, sizeofArray(ENBParams), NULL);
|
||||
|
||||
if (ENBParamList.numelt > 0) {
|
||||
for (k = 0; k < ENBParamList.numelt; k++) {
|
||||
@@ -2470,7 +2474,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
paramdef_t X2Params[] = X2PARAMS_DESC;
|
||||
@@ -2496,7 +2500,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr));
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).tac = *ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -2513,14 +2517,14 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
"MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
|
||||
X2AP_REGISTER_ENB_REQ(msg_p).mnc);
|
||||
/* CC params */
|
||||
config_getlist(&CCsParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &CCsParamList, NULL, 0, aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).num_cc = CCsParamList.numelt;
|
||||
|
||||
if (CCsParamList.numelt > 0) {
|
||||
//char ccspath[MAX_OPTNAME_SIZE*2 + 16];
|
||||
for (J = 0; J < CCsParamList.numelt ; J++) {
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, J);
|
||||
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
|
||||
config_get(config_get_if(), CCsParams, sizeofArray(CCsParams), aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).eutra_band[J] = ccparams_lte.eutra_band;
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).downlink_frequency[J] = (uint32_t) ccparams_lte.downlink_frequency;
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).uplink_frequency_offset[J] = (unsigned int) ccparams_lte.uplink_frequency_offset;
|
||||
@@ -2558,7 +2562,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
|
||||
config_getlist( &X2ParamList,X2Params,sizeof(X2Params)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &X2ParamList, X2Params, sizeofArray(X2Params), aprefix);
|
||||
AssertFatal(X2ParamList.numelt <= X2AP_MAX_NB_ENB_IP_ADDRESS,
|
||||
"value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n",
|
||||
X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS);
|
||||
@@ -2594,7 +2598,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
{ "t_dc_prep", "t_dc_prep", 0, .iptr=&t_dc_prep, .defintval=0, TYPE_INT, 0 },
|
||||
{ "t_dc_overall", "t_dc_overall", 0, .iptr=&t_dc_overall, .defintval=0, TYPE_INT, 0 }
|
||||
};
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), aprefix);
|
||||
config_get(config_get_if(), p, sizeofArray(p), aprefix);
|
||||
|
||||
if (t_reloc_prep <= 0 || t_reloc_prep > 10000 ||
|
||||
tx2_reloc_overall <= 0 || tx2_reloc_overall > 20000 ||
|
||||
@@ -2615,14 +2619,14 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (EPC_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C = (uint32_t)*(NETParams[ENB_PORT_FOR_X2C_IDX].uptr);
|
||||
|
||||
if ((NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr == NULL) || (X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C == 0)) {
|
||||
@@ -2649,11 +2653,11 @@ int RCconfig_parallel(void) {
|
||||
char *worker_conf = NULL;
|
||||
paramdef_t ThreadParams[] = THREAD_CONF_DESC;
|
||||
paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0};
|
||||
config_getlist( &THREADParamList,NULL,0,NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, NULL, 0, NULL);
|
||||
|
||||
if(parallel_config == NULL) {
|
||||
if(THREADParamList.numelt>0) {
|
||||
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, ThreadParams, sizeofArray(ThreadParams), NULL);
|
||||
parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
|
||||
} else {
|
||||
parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT");
|
||||
@@ -2664,7 +2668,7 @@ int RCconfig_parallel(void) {
|
||||
|
||||
if(worker_config == NULL) {
|
||||
if(THREADParamList.numelt>0) {
|
||||
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, ThreadParams, sizeofArray(ThreadParams), NULL);
|
||||
worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_WORKER_IDX].strptr));
|
||||
} else {
|
||||
worker_conf = strdup("WORKER_ENABLE");
|
||||
@@ -2687,7 +2691,7 @@ void RCConfig(void) {
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
printf("Getting ENBSParams\n");
|
||||
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), ENBSParams, sizeofArray(ENBSParams), NULL);
|
||||
//EPC_MODE_ENABLED = ((*ENBSParams[ENB_NOS1_IDX].uptr) == 0);
|
||||
RC.nb_inst = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
|
||||
@@ -2696,20 +2700,20 @@ void RCConfig(void) {
|
||||
|
||||
for (int i=0; i<RC.nb_inst; i++) {
|
||||
sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,i);
|
||||
config_getlist( &CCsParamList,NULL,0, aprefix);
|
||||
config_getlist(config_get_if(), &CCsParamList, NULL, 0, aprefix);
|
||||
RC.nb_CC[i] = CCsParamList.numelt;
|
||||
}
|
||||
}
|
||||
|
||||
config_getlist( &MACRLCParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &MACRLCParamList, NULL, 0, NULL);
|
||||
RC.nb_macrlc_inst = MACRLCParamList.numelt;
|
||||
AssertFatal(RC.nb_macrlc_inst <= MAX_MAC_INST,
|
||||
"Too many macrlc instances %d\n",RC.nb_macrlc_inst);
|
||||
// Get num L1 instances
|
||||
config_getlist( &L1ParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &L1ParamList, NULL, 0, NULL);
|
||||
RC.nb_L1_inst = L1ParamList.numelt;
|
||||
// Get num RU instances
|
||||
config_getlist( &RUParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &RUParamList, NULL, 0, NULL);
|
||||
RC.nb_RU = RUParamList.numelt;
|
||||
RCconfig_parallel();
|
||||
}
|
||||
@@ -2933,7 +2937,7 @@ void read_config_and_init(void) {
|
||||
e2_agent_args_t RCconfig_E2agent(void)
|
||||
{
|
||||
paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC;
|
||||
int ret = config_get(e2agent_params, sizeof(e2agent_params) / sizeof(paramdef_t), CONFIG_STRING_E2AGENT);
|
||||
int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT);
|
||||
if (ret < 0) {
|
||||
LOG_W(GNB_APP, "configuration file does not contain a \"%s\" section, applying default parameters\n", CONFIG_STRING_E2AGENT);
|
||||
return (e2_agent_args_t) {0};
|
||||
|
||||
@@ -107,12 +107,12 @@ void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCc
|
||||
}
|
||||
|
||||
char schedulingInfoBrPath[MAX_OPTNAME_SIZE * 2];
|
||||
config_getlist(&schedulingInfoBrParamList, NULL, 0, brparamspath);
|
||||
config_getlist(config_get_if(), &schedulingInfoBrParamList, NULL, 0, brparamspath);
|
||||
RRCcfg->scheduling_info_br_size[cc_idx] = schedulingInfoBrParamList.numelt;
|
||||
int siInfoindex;
|
||||
for (siInfoindex = 0; siInfoindex < schedulingInfoBrParamList.numelt; siInfoindex++) {
|
||||
sprintf(schedulingInfoBrPath, "%s.%s.[%i]", brparamspath, ENB_CONFIG_STRING_EMTC_PARAMETERS, siInfoindex);
|
||||
config_get(schedulingInfoBrParams, sizeof(schedulingInfoBrParams) / sizeof(paramdef_t), schedulingInfoBrPath);
|
||||
config_get(config_get_if(), schedulingInfoBrParams, sizeofArray(schedulingInfoBrParams), schedulingInfoBrPath);
|
||||
RRCcfg->si_Narrowband_r13[cc_idx][siInfoindex] = eMTCconfig->si_Narrowband_r13;
|
||||
RRCcfg->si_TBS_r13[cc_idx][siInfoindex] = eMTCconfig->si_TBS_r13;
|
||||
}
|
||||
@@ -912,12 +912,12 @@ void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCc
|
||||
}
|
||||
|
||||
char rachCELevelInfoListPath[MAX_OPTNAME_SIZE * 2];
|
||||
config_getlist(&rachcelevellist, NULL, 0, brparamspath);
|
||||
config_getlist(config_get_if(), &rachcelevellist, NULL, 0, brparamspath);
|
||||
RRCcfg->rach_CE_LevelInfoList_r13_size[cc_idx] = rachcelevellist.numelt;
|
||||
int rachCEInfoIndex;
|
||||
for (rachCEInfoIndex = 0; rachCEInfoIndex < rachcelevellist.numelt; rachCEInfoIndex++) {
|
||||
sprintf(rachCELevelInfoListPath, "%s.%s.[%i]", brparamspath, ENB_CONFIG_STRING_RACH_CE_LEVELINFOLIST_R13, rachCEInfoIndex);
|
||||
config_get(rachcelevelParams, sizeof(rachcelevelParams) / sizeof(paramdef_t), rachCELevelInfoListPath);
|
||||
config_get(config_get_if(), rachcelevelParams, sizeofArray(rachcelevelParams), rachCELevelInfoListPath);
|
||||
|
||||
RRCcfg->firstPreamble_r13[cc_idx][rachCEInfoIndex] = eMTCconfig->firstPreamble_r13;
|
||||
RRCcfg->lastPreamble_r13[cc_idx][rachCEInfoIndex] = eMTCconfig->lastPreamble_r13;
|
||||
@@ -990,25 +990,25 @@ void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCc
|
||||
} // end for loop (rach ce level info)
|
||||
|
||||
char rsrpRangeListPath[MAX_OPTNAME_SIZE * 2];
|
||||
config_getlist(&rsrprangelist, NULL, 0, brparamspath);
|
||||
config_getlist(config_get_if(), &rsrprangelist, NULL, 0, brparamspath);
|
||||
RRCcfg->rsrp_range_list_size[cc_idx] = rsrprangelist.numelt;
|
||||
|
||||
int rsrprangeindex;
|
||||
for (rsrprangeindex = 0; rsrprangeindex < rsrprangelist.numelt; rsrprangeindex++) {
|
||||
sprintf(rsrpRangeListPath, "%s.%s.[%i]", brparamspath, ENB_CONFIG_STRING_RSRP_RANGE_LIST, rsrprangeindex);
|
||||
config_get(rsrprangeParams, sizeof(rsrprangeParams) / sizeof(paramdef_t), rsrpRangeListPath);
|
||||
config_get(config_get_if(), rsrprangeParams, sizeofArray(rsrprangeParams), rsrpRangeListPath);
|
||||
RRCcfg->rsrp_range[cc_idx][rsrprangeindex] = eMTCconfig->rsrp_range_br;
|
||||
}
|
||||
|
||||
|
||||
char prachparameterscePath[MAX_OPTNAME_SIZE * 2];
|
||||
config_getlist(&prachParamslist, NULL, 0, brparamspath);
|
||||
config_getlist(config_get_if(), &prachParamslist, NULL, 0, brparamspath);
|
||||
RRCcfg->prach_parameters_list_size[cc_idx] = prachParamslist.numelt;
|
||||
|
||||
int prachparamsindex;
|
||||
for (prachparamsindex = 0; prachparamsindex < prachParamslist.numelt; prachparamsindex++) {
|
||||
sprintf(prachparameterscePath, "%s.%s.[%i]", brparamspath, ENB_CONFIG_STRING_PRACH_PARAMETERS_CE_R13, prachparamsindex);
|
||||
config_get(prachParams, sizeof(prachParams) / sizeof(paramdef_t), prachparameterscePath);
|
||||
config_get(config_get_if(), prachParams, sizeofArray(prachParams), prachparameterscePath);
|
||||
|
||||
RRCcfg->prach_config_index[cc_idx][prachparamsindex] = eMTCconfig->prach_config_index_br;
|
||||
RRCcfg->prach_freq_offset[cc_idx][prachparamsindex] = eMTCconfig->prach_freq_offset_br;
|
||||
@@ -1137,21 +1137,19 @@ void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCc
|
||||
}
|
||||
|
||||
char n1PUCCHInfoParamsPath[MAX_OPTNAME_SIZE * 2];
|
||||
config_getlist(&n1PUCCHInfoList, NULL, 0, brparamspath);
|
||||
config_getlist(config_get_if(), &n1PUCCHInfoList, NULL, 0, brparamspath);
|
||||
RRCcfg->pucch_info_value_size[cc_idx] = n1PUCCHInfoList.numelt;
|
||||
|
||||
int n1PUCCHinfolistindex;
|
||||
for (n1PUCCHinfolistindex = 0; n1PUCCHinfolistindex < n1PUCCHInfoList.numelt; n1PUCCHinfolistindex++) {
|
||||
sprintf(n1PUCCHInfoParamsPath, "%s.%s.[%i]", brparamspath, ENB_CONFIG_STRING_N1PUCCH_AN_INFOLIST_R13, n1PUCCHinfolistindex);
|
||||
config_get(n1PUCCH_ANR13Params, sizeof(n1PUCCH_ANR13Params) / sizeof(paramdef_t), n1PUCCHInfoParamsPath);
|
||||
config_get(config_get_if(), n1PUCCH_ANR13Params, sizeofArray(n1PUCCH_ANR13Params), n1PUCCHInfoParamsPath);
|
||||
RRCcfg->pucch_info_value[cc_idx][n1PUCCHinfolistindex] = eMTCconfig->pucch_info_value;
|
||||
}
|
||||
|
||||
char PCCHConfigv1310Path[MAX_OPTNAME_SIZE*2 + 16];
|
||||
sprintf(PCCHConfigv1310Path, "%s.%s", brparamspath, ENB_CONFIG_STRING_PCCH_CONFIG_V1310);
|
||||
config_get(pcchv1310Params, sizeof(pcchv1310Params)/sizeof(paramdef_t), PCCHConfigv1310Path);
|
||||
|
||||
|
||||
config_get(config_get_if(), pcchv1310Params, sizeofArray(pcchv1310Params), PCCHConfigv1310Path);
|
||||
|
||||
/** PCCH CONFIG V1310 */
|
||||
RRCcfg->pcch_config_v1310[cc_idx] = true;
|
||||
@@ -1207,7 +1205,7 @@ void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCc
|
||||
|
||||
char sib2FreqHoppingParametersR13Path[MAX_OPTNAME_SIZE*2 + 16];
|
||||
sprintf(sib2FreqHoppingParametersR13Path, "%s.%s", brparamspath, ENB_CONFIG_STRING_SIB2_FREQ_HOPPINGPARAMETERS_R13);
|
||||
config_get(sib2freqhoppingParams, sizeof(sib2freqhoppingParams)/sizeof(paramdef_t), sib2FreqHoppingParametersR13Path);
|
||||
config_get(config_get_if(), sib2freqhoppingParams, sizeofArray(sib2freqhoppingParams), sib2FreqHoppingParametersR13Path);
|
||||
|
||||
RRCcfg->sib2_interval_ULHoppingConfigCommonModeA_r13[cc_idx] = CALLOC(1, sizeof(long));
|
||||
if (!strcmp(eMTCconfig->sib2_interval_ULHoppingConfigCommonModeA_r13, "FDD")) {
|
||||
|
||||
@@ -181,7 +181,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
|
||||
char sstr[100];
|
||||
/* TODO: be sure that %d in the line below is at the right place */
|
||||
sprintf(sstr, "%s.[%d].%s.[0]", GNB_CONFIG_STRING_GNB_LIST, i, GNB_CONFIG_STRING_PLMN_LIST);
|
||||
config_getlist(&SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams)/sizeof(paramdef_t), sstr);
|
||||
config_getlist(config_get_if(), &SNSSAIParamList, SNSSAIParams, sizeofArray(SNSSAIParams), sstr);
|
||||
AssertFatal(SNSSAIParamList.numelt > 0, "no slice configuration found (snssaiList in the configuration file)\n");
|
||||
AssertFatal(SNSSAIParamList.numelt <= 1024, "maximum size for slice support list is 1024, see F1AP 38.473 9.3.1.37\n");
|
||||
for (int s = 0; s < SNSSAIParamList.numelt; s++) {
|
||||
|
||||
+103
-99
@@ -658,27 +658,27 @@ static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char
|
||||
aprefix,
|
||||
paramname);
|
||||
}
|
||||
static void verify_section_notset(char *aprefix, const char *secname)
|
||||
static void verify_section_notset(configmodule_interface_t *cfg, char *aprefix, const char *secname)
|
||||
{
|
||||
paramlist_def_t pl = {0};
|
||||
strncpy(pl.listname, secname, sizeof(pl.listname) - 1);
|
||||
config_getlist(&pl, NULL, 0, aprefix);
|
||||
config_getlist(cfg, &pl, NULL, 0, aprefix);
|
||||
AssertFatal(pl.numelt == 0, "Section \"%s.%s\" not allowed in this config, please remove it\n", aprefix ? aprefix : "", secname);
|
||||
}
|
||||
void RCconfig_verify(ngran_node_t node_type)
|
||||
void RCconfig_verify(configmodule_interface_t *cfg, ngran_node_t node_type)
|
||||
{
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
config_get(cfg, GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs == 1, "need to have a " GNB_CONFIG_STRING_GNB_LIST " section, but %d found\n", num_gnbs);
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(cfg, &GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
paramdef_t *gnbp = GNBParamList.paramarray[0];
|
||||
|
||||
if (NODE_IS_CU(node_type)) {
|
||||
// verify that there is no SCC and radio config in the case of CU
|
||||
verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".[0]", GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON);
|
||||
verify_section_notset(cfg, GNB_CONFIG_STRING_GNB_LIST ".[0]", GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON);
|
||||
|
||||
verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N1_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1);
|
||||
verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N2_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2);
|
||||
@@ -691,16 +691,16 @@ void RCconfig_verify(ngran_node_t node_type)
|
||||
verify_gnb_param_notset(gnbp, GNB_FORCE256QAMOFF_IDX, GNB_CONFIG_STRING_FORCE256QAMOFF);
|
||||
|
||||
// check for some general sections
|
||||
verify_section_notset(NULL, CONFIG_STRING_L1_LIST);
|
||||
verify_section_notset(NULL, CONFIG_STRING_RU_LIST);
|
||||
verify_section_notset(NULL, CONFIG_STRING_MACRLC_LIST);
|
||||
verify_section_notset(cfg, NULL, CONFIG_STRING_L1_LIST);
|
||||
verify_section_notset(cfg, NULL, CONFIG_STRING_RU_LIST);
|
||||
verify_section_notset(cfg, NULL, CONFIG_STRING_MACRLC_LIST);
|
||||
} else if (NODE_IS_DU(node_type)) {
|
||||
// verify that there is no bearer config
|
||||
verify_gnb_param_notset(gnbp, GNB_ENABLE_SDAP_IDX, GNB_CONFIG_STRING_ENABLE_SDAP);
|
||||
verify_gnb_param_notset(gnbp, GNB_DRBS, GNB_CONFIG_STRING_DRBS);
|
||||
|
||||
verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".", GNB_CONFIG_STRING_AMF_IP_ADDRESS);
|
||||
verify_section_notset(NULL, CONFIG_STRING_SECURITY);
|
||||
verify_section_notset(cfg, GNB_CONFIG_STRING_GNB_LIST ".", GNB_CONFIG_STRING_AMF_IP_ADDRESS);
|
||||
verify_section_notset(cfg, NULL, CONFIG_STRING_SECURITY);
|
||||
} // else nothing to be checked
|
||||
|
||||
/* other possible verifications: PNF, VNF, CU-CP, CU-UP, ...? */
|
||||
@@ -720,7 +720,7 @@ void RCconfig_nr_prs(void)
|
||||
memset(RC.gNB,0,(1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
|
||||
}
|
||||
|
||||
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &PRS_ParamList, PRS_Params, sizeofArray(PRS_Params), NULL);
|
||||
|
||||
if (PRS_ParamList.numelt > 0) {
|
||||
for (j = 0; j < RC.nb_nr_L1_inst; j++) {
|
||||
@@ -820,11 +820,11 @@ void RCconfig_NR_L1(void)
|
||||
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
|
||||
|
||||
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
|
||||
int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr;
|
||||
int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;
|
||||
@@ -858,7 +858,7 @@ void RCconfig_NR_L1(void)
|
||||
paramdef_t L1_Params[] = L1PARAMS_DESC;
|
||||
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0};
|
||||
|
||||
config_getlist(&L1_ParamList, L1_Params, sizeof(L1_Params) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &L1_ParamList, L1_Params, sizeofArray(L1_Params), NULL);
|
||||
|
||||
if (L1_ParamList.numelt > 0) {
|
||||
for (j = 0; j < RC.nb_nr_L1_inst; j++) {
|
||||
@@ -933,7 +933,7 @@ void RCconfig_NR_L1(void)
|
||||
|
||||
static void check_ssb_raster(uint64_t freq, int band, int scs);
|
||||
|
||||
static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME)
|
||||
static NR_ServingCellConfigCommon_t *get_scc_config(configmodule_interface_t *cfg, int minRXTXTIME)
|
||||
{
|
||||
NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));
|
||||
uint64_t ssb_bitmap=0xff;
|
||||
@@ -943,30 +943,28 @@ static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME)
|
||||
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
||||
config_getlist(cfg, &SCCsParamList, NULL, 0, aprefix);
|
||||
if (SCCsParamList.numelt > 0) {
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0);
|
||||
config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix);
|
||||
config_get(cfg, SCCsParams, sizeofArray(SCCsParams), aprefix);
|
||||
struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
LOG_I(RRC,
|
||||
"Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW "
|
||||
"%d,RACH_TargetReceivedPower %d\n",
|
||||
(int)*scc->physCellId,
|
||||
(int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
|
||||
(int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
(int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA,
|
||||
(int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
(int)*frequencyInfoDL->absoluteFrequencySSB,
|
||||
(int)*frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
(int)frequencyInfoDL->absoluteFrequencyPointA,
|
||||
(int)frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
(int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric
|
||||
.preambleReceivedTargetPower);
|
||||
// SSB of the PCell is always on the sync raster
|
||||
uint64_t ssb_freq = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
uint64_t ssb_freq = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB);
|
||||
LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n",
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, ssb_freq);
|
||||
*frequencyInfoDL->absoluteFrequencySSB);
|
||||
LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", *frequencyInfoDL->absoluteFrequencySSB, ssb_freq);
|
||||
if (get_softmodem_params()->sa)
|
||||
check_ssb_raster(ssb_freq,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing);
|
||||
check_ssb_raster(ssb_freq, *frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
|
||||
fix_scc(scc, ssb_bitmap);
|
||||
}
|
||||
nr_rrc_config_ul_tda(scc, minRXTXTIME);
|
||||
@@ -995,7 +993,7 @@ static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME)
|
||||
return scc;
|
||||
}
|
||||
|
||||
static NR_ServingCellConfig_t *get_scd_config(void)
|
||||
static NR_ServingCellConfig_t *get_scd_config(configmodule_interface_t *cfg)
|
||||
{
|
||||
NR_ServingCellConfig_t *scd = calloc(1, sizeof(*scd));
|
||||
prepare_scd(scd);
|
||||
@@ -1004,10 +1002,10 @@ static NR_ServingCellConfig_t *get_scd_config(void)
|
||||
|
||||
char aprefix[MAX_OPTNAME_SIZE * 2 + 8];
|
||||
snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||
config_getlist(&SCDsParamList, NULL, 0, aprefix);
|
||||
config_getlist(cfg, &SCDsParamList, NULL, 0, aprefix);
|
||||
if (SCDsParamList.numelt > 0) {
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0);
|
||||
config_get(SCDsParams, sizeof(SCDsParams) / sizeof(paramdef_t), aprefix);
|
||||
config_get(cfg, SCDsParams, sizeof(SCDsParams) / sizeof(paramdef_t), aprefix);
|
||||
const NR_BWP_UplinkDedicated_t *bwp_Dedicated = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated;
|
||||
const NR_PTRS_UplinkConfig_t *setup =
|
||||
bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup;
|
||||
@@ -1029,7 +1027,11 @@ static NR_ServingCellConfig_t *get_scd_config(void)
|
||||
return scd;
|
||||
}
|
||||
|
||||
static int read_du_cell_info(uint64_t *id, char **name, f1ap_served_cell_info_t *info, int max_cell_info)
|
||||
static int read_du_cell_info(configmodule_interface_t *cfg,
|
||||
uint64_t *id,
|
||||
char **name,
|
||||
f1ap_served_cell_info_t *info,
|
||||
int max_cell_info)
|
||||
{
|
||||
AssertFatal(max_cell_info == 1, "only one cell supported\n");
|
||||
memset(info, 0, sizeof(*info));
|
||||
@@ -1037,12 +1039,12 @@ static int read_du_cell_info(uint64_t *id, char **name, f1ap_served_cell_info_t
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(cfg, GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs == 1, "cannot configure DU: required config section \"gNBs\" missing\n");
|
||||
|
||||
// Output a list of all eNBs.
|
||||
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(cfg, &GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
AssertFatal(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n", 0);
|
||||
|
||||
AssertFatal(strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr) == 0,
|
||||
@@ -1058,7 +1060,7 @@ static int read_du_cell_info(uint64_t *id, char **name, f1ap_served_cell_info_t
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0};
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix);
|
||||
config_getlist(cfg, &PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix);
|
||||
|
||||
*id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr);
|
||||
*name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr));
|
||||
@@ -1104,25 +1106,26 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id,
|
||||
req->cell[0].info.nr_cellid);
|
||||
|
||||
req->cell[0].info.nr_pci = *scc->physCellId;
|
||||
struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon) {
|
||||
LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for TDD\n", 0);
|
||||
req->cell[0].info.mode = F1AP_MODE_TDD;
|
||||
f1ap_tdd_info_t *tdd = &req->cell[0].info.tdd;
|
||||
tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
tdd->freqinfo.arfcn = frequencyInfoDL->absoluteFrequencyPointA;
|
||||
tdd->tbw.scs = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
tdd->tbw.nrb = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
tdd->freqinfo.band = *frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
} else {
|
||||
LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for FDD\n", 0);
|
||||
req->cell[0].info.mode = F1AP_MODE_FDD;
|
||||
f1ap_fdd_info_t *fdd = &req->cell[0].info.fdd;
|
||||
fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
fdd->dl_freqinfo.arfcn = frequencyInfoDL->absoluteFrequencyPointA;
|
||||
fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
fdd->dl_tbw.scs = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
fdd->dl_tbw.nrb = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
fdd->dl_freqinfo.band = *frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0];
|
||||
}
|
||||
|
||||
@@ -1151,21 +1154,22 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id,
|
||||
return req;
|
||||
}
|
||||
|
||||
void RCconfig_nr_macrlc() {
|
||||
void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
|
||||
{
|
||||
int j = 0;
|
||||
uint16_t prbbl[275] = {0};
|
||||
int num_prbbl = 0;
|
||||
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
|
||||
config_get(cfg, GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal(num_gnbs == 1,
|
||||
"Failed to parse config file: number of gnbs for gNB %s is %d != 1\n",
|
||||
GNB_CONFIG_STRING_ACTIVE_GNBS,
|
||||
num_gnbs);
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(cfg, &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
|
||||
if (NFAPI_MODE != NFAPI_MODE_PNF) {
|
||||
////////// Identification parameters
|
||||
@@ -1186,9 +1190,9 @@ void RCconfig_nr_macrlc() {
|
||||
paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0};
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_MacRLCParams[] = MACRLCPARAMS_CHECK;
|
||||
for (int i = 0; i < sizeof(MacRLC_Params) / sizeof(paramdef_t); ++i)
|
||||
for (int i = 0; i < sizeofArray(MacRLC_Params); ++i)
|
||||
MacRLC_Params[i].chkPptr = &(config_check_MacRLCParams[i]);
|
||||
config_getlist(&MacRLC_ParamList, MacRLC_Params, sizeof(MacRLC_Params) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &MacRLC_ParamList, MacRLC_Params, sizeofArray(MacRLC_Params), NULL);
|
||||
|
||||
nr_mac_config_t config = {0};
|
||||
config.pdsch_AntennaPorts.N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
|
||||
@@ -1215,9 +1219,9 @@ void RCconfig_nr_macrlc() {
|
||||
config.do_SRS,
|
||||
config.force_256qam_off ? "force off" : "may be on");
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = get_scc_config(config.minRXTXTIME);
|
||||
NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME);
|
||||
//xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc);
|
||||
NR_ServingCellConfig_t *scd = get_scd_config();
|
||||
NR_ServingCellConfig_t *scd = get_scd_config(cfg);
|
||||
|
||||
if (MacRLC_ParamList.numelt > 0) {
|
||||
RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt;
|
||||
@@ -1307,7 +1311,7 @@ void RCconfig_nr_macrlc() {
|
||||
uint64_t id;
|
||||
char *name = NULL;
|
||||
f1ap_served_cell_info_t info;
|
||||
read_du_cell_info(&id, &name, &info, 1);
|
||||
read_du_cell_info(cfg, &id, &name, &info, 1);
|
||||
|
||||
if (get_softmodem_params()->sa)
|
||||
nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac);
|
||||
@@ -1331,9 +1335,7 @@ void RCconfig_nr_macrlc() {
|
||||
void config_security(gNB_RRC_INST *rrc)
|
||||
{
|
||||
paramdef_t sec_params[] = SECURITY_GLOBALPARAMS_DESC;
|
||||
int ret = config_get(sec_params,
|
||||
sizeof(sec_params) / sizeof(paramdef_t),
|
||||
CONFIG_STRING_SECURITY);
|
||||
int ret = config_get(config_get_if(), sec_params, sizeofArray(sec_params), CONFIG_STRING_SECURITY);
|
||||
int i;
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -1514,8 +1516,8 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc)
|
||||
////////// Physical parameters
|
||||
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal (i<num_gnbs,"Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
AssertFatal(num_gnbs == 1, "required section \"gNBs\" not in config!\n");
|
||||
@@ -1523,7 +1525,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc)
|
||||
if (num_gnbs > 0) {
|
||||
|
||||
// Output a list of all gNBs. ////////// Identification parameters
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default gNB ID
|
||||
if (get_softmodem_params()->sa) {
|
||||
@@ -1546,7 +1548,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc)
|
||||
paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix,"%s.[%u].%s",GNB_CONFIG_STRING_GNB_LIST,i,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
rrc->node_id = gnb_id;
|
||||
LOG_I(GNB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id);
|
||||
rrc->node_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr));
|
||||
@@ -1595,7 +1597,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc)
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
nrrrc_config.tac = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
@@ -1608,7 +1610,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc)
|
||||
"to\n"
|
||||
" tracking_area_code = 1; // no string!!\n"
|
||||
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), gnbpath);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), gnbpath);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -1663,8 +1665,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
|
||||
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
|
||||
AssertFatal (i<GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt,
|
||||
"Failed to parse config file %s, %uth attribute %s \n",
|
||||
RC.config_file_name, i, GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
@@ -1672,7 +1674,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt>0) {
|
||||
// Output a list of all gNBs.
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
if (GNBParamList.numelt > 0) {
|
||||
for (k = 0; k < GNBParamList.numelt; k++) {
|
||||
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
@@ -1701,9 +1703,9 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
checkedparam_t config_check_SNSSAIParams [] = SNSSAIPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
for (int J = 0; J < sizeof(SNSSAIParams) / sizeof(paramdef_t); ++J)
|
||||
for (int J = 0; J < sizeofArray(SNSSAIParams); ++J)
|
||||
SNSSAIParams[J].chkPptr = &(config_check_SNSSAIParams[J]);
|
||||
|
||||
paramdef_t NGParams[] = GNBNGPARAMS_DESC;
|
||||
@@ -1737,7 +1739,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
"to\n"
|
||||
" tracking_area_code = 1; // no string!!\n"
|
||||
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -1748,7 +1750,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
for (int l = 0; l < PLMNParamList.numelt; ++l) {
|
||||
char snssaistr[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(snssaistr, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_PLMN_LIST, l);
|
||||
config_getlist(&SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams)/sizeof(paramdef_t), snssaistr);
|
||||
config_getlist(config_get_if(), &SNSSAIParamList, SNSSAIParams, sizeofArray(SNSSAIParams), snssaistr);
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
|
||||
@@ -1774,8 +1776,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
}
|
||||
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
|
||||
config_getlist( &NGParamList,NGParams,sizeof(NGParams)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
config_getlist(config_get_if(), &NGParamList, NGParams, sizeofArray(NGParams), aprefix);
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).nb_amf = 0;
|
||||
|
||||
for (int l = 0; l < NGParamList.numelt; l++) {
|
||||
@@ -1835,15 +1837,15 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
|
||||
if (get_softmodem_params()->sa) {
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), aprefix);
|
||||
|
||||
// NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU);
|
||||
cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr);
|
||||
char *save = NULL;
|
||||
@@ -1870,17 +1872,17 @@ int RCconfig_nr_parallel(void) {
|
||||
extern char *worker_config;
|
||||
paramdef_t ThreadParams[] = THREAD_CONF_DESC;
|
||||
paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0};
|
||||
config_getlist( &THREADParamList,NULL,0,NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, NULL, 0, NULL);
|
||||
|
||||
if(THREADParamList.numelt>0) {
|
||||
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, ThreadParams, sizeofArray(ThreadParams), NULL);
|
||||
parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
|
||||
} else {
|
||||
parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT");
|
||||
}
|
||||
|
||||
if(THREADParamList.numelt>0) {
|
||||
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &THREADParamList, ThreadParams, sizeofArray(ThreadParams), NULL);
|
||||
worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_WORKER_IDX].strptr));
|
||||
} else {
|
||||
worker_conf = strdup("WORKER_ENABLE");
|
||||
@@ -1902,19 +1904,19 @@ void NRRCConfig(void) {
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
|
||||
LOG_I(GNB_APP, "Getting GNBSParams\n");
|
||||
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
|
||||
// Get num MACRLC instances
|
||||
config_getlist( &MACRLCParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &MACRLCParamList, NULL, 0, NULL);
|
||||
RC.nb_nr_macrlc_inst = MACRLCParamList.numelt;
|
||||
// Get num L1 instances
|
||||
config_getlist( &L1ParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &L1ParamList, NULL, 0, NULL);
|
||||
RC.nb_nr_L1_inst = L1ParamList.numelt;
|
||||
|
||||
// Get num RU instances
|
||||
config_getlist( &RUParamList,NULL,0, NULL);
|
||||
config_getlist(config_get_if(), &RUParamList, NULL, 0, NULL);
|
||||
RC.nb_RU = RUParamList.numelt;
|
||||
|
||||
RCconfig_nr_parallel();
|
||||
@@ -1937,7 +1939,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
|
||||
/* get global parameters, defined outside any section in the config file */
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL);
|
||||
NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(NR_ServingCellConfigCommon_t));
|
||||
uint64_t ssb_bitmap=0xff;
|
||||
memset((void*)scc,0,sizeof(NR_ServingCellConfigCommon_t));
|
||||
@@ -1951,7 +1953,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt > 0) {
|
||||
// Output a list of all gNBs.
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
|
||||
if (GNBParamList.numelt > 0) {
|
||||
for (k = 0; k < GNBParamList.numelt; k++) {
|
||||
@@ -1976,7 +1978,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
for (int I = 0; I < sizeofArray(PLMNParams); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
paramdef_t X2Params[] = X2PARAMS_DESC;
|
||||
@@ -2005,7 +2007,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &PLMNParamList, PLMNParams, sizeofArray(PLMNParams), aprefix);
|
||||
|
||||
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
@@ -2024,19 +2026,21 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||
|
||||
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SCCsParamList, NULL, 0, aprefix);
|
||||
if (SCCsParamList.numelt > 0) {
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0);
|
||||
config_get( SCCsParams,sizeof(SCCsParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCCsParams, sizeofArray(SCCsParams), aprefix);
|
||||
fix_scc(scc,ssb_bitmap);
|
||||
}
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).num_cc = SCCsParamList.numelt;
|
||||
for (J = 0; J < SCCsParamList.numelt ; J++) {
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).nr_band[J] = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; //nr_band; //78
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).nrARFCN[J] = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
X2AP_REGISTER_ENB_REQ(msg_p).nr_band[J] = *frequencyInfoDL->frequencyBandList.list.array[0]; // nr_band; //78
|
||||
X2AP_REGISTER_ENB_REQ(msg_p).nrARFCN[J] = frequencyInfoDL->absoluteFrequencyPointA;
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).uplink_frequency_offset[J] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; //0
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).Nid_cell[J]= *scc->physCellId; //0
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).N_RB_DL[J]= scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;//106
|
||||
X2AP_REGISTER_ENB_REQ(msg_p).N_RB_DL[J] =
|
||||
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; // 106
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).frame_type[J] = TDD;
|
||||
LOG_I(X2AP, "gNB configuration parameters: nr_band: %d, nr_ARFCN: %d, DL_RBs: %d, num_cc: %d \n",
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).nr_band[J],
|
||||
@@ -2046,7 +2050,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
|
||||
config_getlist( &X2ParamList,X2Params,sizeof(X2Params)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &X2ParamList, X2Params, sizeofArray(X2Params), aprefix);
|
||||
AssertFatal(X2ParamList.numelt <= X2AP_MAX_NB_ENB_IP_ADDRESS,
|
||||
"value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n",
|
||||
X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS);
|
||||
@@ -2081,7 +2085,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
{ "t_dc_prep", "t_dc_prep", 0, .iptr=&t_dc_prep, .defintval=0, TYPE_INT, 0 },
|
||||
{ "t_dc_overall", "t_dc_overall", 0, .iptr=&t_dc_overall, .defintval=0, TYPE_INT, 0 }
|
||||
};
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), aprefix);
|
||||
config_get(config_get_if(), p, sizeofArray(p), aprefix);
|
||||
|
||||
if (t_reloc_prep <= 0 || t_reloc_prep > 10000 ||
|
||||
tx2_reloc_overall <= 0 || tx2_reloc_overall > 20000 ||
|
||||
@@ -2102,14 +2106,14 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
if (get_softmodem_params()->sa) {
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), NETParams, sizeofArray(NETParams), aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C = (uint32_t)*(NETParams[GNB_PORT_FOR_X2C_IDX].uptr);
|
||||
|
||||
//temp out
|
||||
@@ -2223,15 +2227,15 @@ ngran_node_t get_node_type(void)
|
||||
paramdef_t GNBE1Params[] = GNBE1PARAMS_DESC;
|
||||
paramlist_def_t GNBE1ParamList = {GNB_CONFIG_STRING_E1_PARAMETERS, NULL, 0};
|
||||
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
|
||||
|
||||
if (GNBParamList.numelt == 0) // We have no valid configuration, let's return a default
|
||||
return ngran_gNB;
|
||||
|
||||
config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
|
||||
config_getlist(config_get_if(), &MacRLC_ParamList, MacRLC_Params, sizeofArray(MacRLC_Params), NULL);
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||
config_getlist( &GNBE1ParamList, GNBE1Params, sizeof(GNBE1Params)/sizeof(paramdef_t), aprefix);
|
||||
config_getlist(config_get_if(), &GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix);
|
||||
if ( MacRLC_ParamList.numelt > 0) {
|
||||
RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt;
|
||||
for (int j = 0; j < RC.nb_nr_macrlc_inst; j++) {
|
||||
@@ -2261,7 +2265,7 @@ ngran_node_t get_node_type(void)
|
||||
e2_agent_args_t RCconfig_NR_E2agent(void)
|
||||
{
|
||||
paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC;
|
||||
int ret = config_get(e2agent_params, sizeof(e2agent_params) / sizeof(paramdef_t), CONFIG_STRING_E2AGENT);
|
||||
int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT);
|
||||
if (ret < 0) {
|
||||
LOG_W(GNB_APP, "configuration file does not contain a \"%s\" section, applying default parameters from FlexRIC\n", CONFIG_STRING_E2AGENT);
|
||||
return (e2_agent_args_t) { 0 };
|
||||
|
||||
@@ -92,11 +92,11 @@ typedef struct ru_config_s {
|
||||
} ru_config_t;
|
||||
*/
|
||||
|
||||
void RCconfig_verify(ngran_node_t node_type);
|
||||
void RCconfig_verify(configmodule_interface_t *cfg, ngran_node_t node_type);
|
||||
extern void NRRCconfig_RU(void);
|
||||
extern void RCconfig_nr_prs(void);
|
||||
extern void RCconfig_NR_L1(void);
|
||||
extern void RCconfig_nr_macrlc(void);
|
||||
extern void RCconfig_nr_macrlc(configmodule_interface_t *cfg);
|
||||
extern void NRRCConfig(void);
|
||||
|
||||
//void enb_config_display(void);
|
||||
|
||||
@@ -715,7 +715,7 @@ int is_m2ap_MCE_enabled(void)
|
||||
};
|
||||
|
||||
/* TODO: do it per module - we check only first MCE */
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "MCEs.[0]");
|
||||
config_get(config_get_if(), p, sizeofArray(p), "MCEs.[0]");
|
||||
if (enable_m2 != NULL && strcmp(enable_m2, "yes") == 0)
|
||||
enabled = 1;
|
||||
|
||||
|
||||
@@ -706,7 +706,7 @@ int is_m2ap_eNB_enabled(void)
|
||||
};
|
||||
|
||||
/* TODO: do it per module - we check only first eNB */
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "eNBs.[0]");
|
||||
config_get(config_get_if(), p, sizeofArray(p), "eNBs.[0]");
|
||||
if (enable_m2 != NULL && strcmp(enable_m2, "yes") == 0)
|
||||
enabled = 1;
|
||||
|
||||
|
||||
+216
-162
@@ -79,14 +79,14 @@ int RCconfig_MCE(void ) {
|
||||
paramdef_t MCEParams[] = MCE_NETPARAMS_DESC;
|
||||
|
||||
///* get number of active eNodeBs */
|
||||
//config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
//num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
//AssertFatal (num_enbs >0,
|
||||
// "Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
//sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// config_get( ENBSParams,sizeofArray(ENBSParams),NULL);
|
||||
// num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
// AssertFatal (num_enbs >0,
|
||||
// "Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
// sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
//config_get( GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath);
|
||||
config_get(MCEParams,sizeof(MCEParams)/sizeof(paramdef_t),mcepath);
|
||||
// config_get( GTPUParams,sizeofArray(GTPUParams),gtpupath);
|
||||
config_get(config_get_if(), MCEParams, sizeofArray(MCEParams), mcepath);
|
||||
//cidr = enb_ipv4_address_for_S1U;
|
||||
cidr = mce_ipv4_address_for_m2c;
|
||||
address = strtok(cidr, "/");
|
||||
@@ -143,7 +143,7 @@ int RCconfig_M3(MessageDef *msg_p, uint32_t i) {
|
||||
paramdef_t MCCHParams[] = MCCH_PARAMS_DESC;
|
||||
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get(MCEParams,sizeof(MCEParams)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), MCEParams, sizeofArray(MCEParams), mcepath);
|
||||
|
||||
paramlist_def_t M3ParamList = {MCE_CONFIG_STRING_TARGET_MME_M3_IP_ADDRESS,NULL,0};
|
||||
paramlist_def_t MCCHParamList = {MCE_CONFIG_STRING_MCCH_CONFIG_PER_MBSFN_AREA,NULL,0};
|
||||
@@ -154,7 +154,7 @@ int RCconfig_M3(MessageDef *msg_p, uint32_t i) {
|
||||
M3AP_REGISTER_MCE_REQ (msg_p).MCE_id = i;
|
||||
//M3AP_REGISTER_MCE_REQ (msg_p).MME_name = "kk";
|
||||
sprintf(aprefix,"%s.[%i]","MCEs",0);
|
||||
config_getlist( &M3ParamList,M3Params,sizeof(M3Params)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &M3ParamList, M3Params, sizeofArray(M3Params), aprefix);
|
||||
//printf("M3ParamList.numelt %d\n",M3ParamList.numelt);
|
||||
M3AP_REGISTER_MCE_REQ (msg_p).nb_m3 = 0;
|
||||
for (l = 0; l < M3ParamList.numelt; l++) {
|
||||
@@ -179,7 +179,7 @@ int RCconfig_M3(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get( MCEParams,sizeof(MCEParams)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), MCEParams, sizeofArray(MCEParams), aprefix);
|
||||
M3AP_REGISTER_MCE_REQ (msg_p).mme_port_for_M3C = (uint32_t)*(MCEParams[MCE2_PORT_FOR_M3C_IDX].uptr);
|
||||
|
||||
if ((MCEParams[MCE2_IPV4_ADDR_FOR_M3C_IDX].strptr == NULL) || (M3AP_REGISTER_MCE_REQ (msg_p).mme_port_for_M3C == 0)) {
|
||||
@@ -194,7 +194,7 @@ int RCconfig_M3(MessageDef *msg_p, uint32_t i) {
|
||||
strcpy(M3AP_REGISTER_MCE_REQ (msg_p).mme_m3_ip_address.ipv4_address, address);
|
||||
|
||||
sprintf(aprefix,"%s.[%i]","MCEs",0);
|
||||
config_getlist( &MCCHParamList,MCCHParams,sizeof(MCCHParams)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &MCCHParamList, MCCHParams, sizeofArray(MCCHParams), aprefix);
|
||||
//printf("MCCHParamList.numelt %d\n",MCCHParamList.numelt);
|
||||
for (l = 0; l < MCCHParamList.numelt; l++) {
|
||||
//M2AP_SETUP_RESP(msg_p).mcch_config_per_mbsfn[l].mbsfn_area = *(MCCHParamList.paramarray[l][MCCH_MBSFN_AREA_IDX].uptr);
|
||||
@@ -222,11 +222,11 @@ int RCconfig_m2_mcch(m2ap_setup_resp_t * m2ap_setup_resp, uint32_t i) {
|
||||
paramlist_def_t MCCHParamList = {MCE_CONFIG_STRING_MCCH_CONFIG_PER_MBSFN_AREA,NULL,0};
|
||||
char aprefix[MAX_OPTNAME_SIZE*80 + 8];
|
||||
sprintf(mcepath,"%s.[%i]","MCEs",0);
|
||||
config_get(MCEParams,sizeof(MCEParams)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), MCEParams, sizeofArray(MCEParams), mcepath);
|
||||
m2ap_setup_resp->MCE_id = *(MCEParams[MCE_MCE_ID_IDX].uptr);
|
||||
m2ap_setup_resp->MCE_name = strdup(*(MCEParams[MCE_MCE_NAME_IDX].strptr));;
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_PLMN);
|
||||
config_get(PLNMParams,sizeof(PLNMParams)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), PLNMParams, sizeofArray(PLNMParams), mcepath);
|
||||
m2ap_setup_resp->mcc = *(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
m2ap_setup_resp->mnc = *(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
m2ap_setup_resp->mnc_digit_length = *(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
@@ -235,7 +235,7 @@ int RCconfig_m2_mcch(m2ap_setup_resp_t * m2ap_setup_resp, uint32_t i) {
|
||||
|
||||
|
||||
sprintf(aprefix,"%s.[%i]","MCEs",0);
|
||||
config_getlist( &MCCHParamList,MCCHParams,sizeof(MCCHParams)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &MCCHParamList, MCCHParams, sizeofArray(MCCHParams), aprefix);
|
||||
//printf("MCCHParamList.numelt %d\n",MCCHParamList.numelt);
|
||||
AssertFatal(MCCHParamList.numelt <= 8, "File wrong parsed\n");
|
||||
for (l = 0; l < MCCHParamList.numelt; l++) {
|
||||
@@ -260,11 +260,11 @@ int RCconfig_M2_MCCH(MessageDef *msg_p, uint32_t i) {
|
||||
paramlist_def_t MCCHParamList = {MCE_CONFIG_STRING_MCCH_CONFIG_PER_MBSFN_AREA,NULL,0};
|
||||
char aprefix[MAX_OPTNAME_SIZE*80 + 8];
|
||||
sprintf(mcepath,"%s.[%i]","MCEs",0);
|
||||
config_get(MCEParams,sizeof(MCEParams)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), MCEParams, sizeofArray(MCEParams), mcepath);
|
||||
M2AP_SETUP_RESP (msg_p).MCE_id = *(MCEParams[MCE_MCE_ID_IDX].uptr);
|
||||
M2AP_SETUP_RESP (msg_p).MCE_name = strdup(*(MCEParams[MCE_MCE_NAME_IDX].strptr));;
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_PLMN);
|
||||
config_get(PLNMParams,sizeof(PLNMParams)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), PLNMParams, sizeofArray(PLNMParams), mcepath);
|
||||
M2AP_SETUP_RESP (msg_p).mcc = *(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
M2AP_SETUP_RESP (msg_p).mnc = *(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
M2AP_SETUP_RESP (msg_p).mnc_digit_length = *(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
@@ -273,7 +273,7 @@ int RCconfig_M2_MCCH(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
|
||||
sprintf(aprefix,"%s.[%i]","MCEs",0);
|
||||
config_getlist( &MCCHParamList,MCCHParams,sizeof(MCCHParams)/sizeof(paramdef_t),aprefix);
|
||||
config_getlist(config_get_if(), &MCCHParamList, MCCHParams, sizeofArray(MCCHParams), aprefix);
|
||||
//printf("MCCHParamList.numelt %d\n",MCCHParamList.numelt);
|
||||
AssertFatal(MCCHParamList.numelt <= 8, "File wrong parsed\n");
|
||||
for (l = 0; l < MCCHParamList.numelt; l++) {
|
||||
@@ -296,14 +296,18 @@ int RCconfig_m2_scheduling( m2ap_mbms_scheduling_information_t * m2ap_mbms_sche
|
||||
paramdef_t MBMS_SCHE_Params[] = MCE_MBMS_SCHEDULING_INFO_PARAMS_DESC;
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath);
|
||||
config_get(MBMS_SCHE_Params,sizeof(MBMS_SCHE_Params)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), MBMS_SCHE_Params, sizeofArray(MBMS_SCHE_Params), mcepath);
|
||||
//LOG_E(MCE_APP,"%s %d\n",mcepath, *(MBMS_SCHE_Params[MCE_CONFIG_STRING_MCCH_UPDATE_TIME_IDX].uptr));
|
||||
m2ap_mbms_scheduling_information->mcch_update_time=*(MBMS_SCHE_Params[MCE_CONFIG_STRING_MCCH_UPDATE_TIME_IDX].uptr);
|
||||
|
||||
paramdef_t MBMS_CONFIGURATION_Params[] = MCE_MBMS_AREA_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBMS_AREA_CONFIGURATION_ParamList = {MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO);
|
||||
config_getlist(&MBMS_AREA_CONFIGURATION_ParamList,MBMS_CONFIGURATION_Params,sizeof(MBMS_CONFIGURATION_Params)/sizeof(paramdef_t),mcepath);
|
||||
config_getlist(config_get_if(),
|
||||
&MBMS_AREA_CONFIGURATION_ParamList,
|
||||
MBMS_CONFIGURATION_Params,
|
||||
sizeofArray(MBMS_CONFIGURATION_Params),
|
||||
mcepath);
|
||||
AssertFatal(MBMS_AREA_CONFIGURATION_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath);
|
||||
//LOG_E(MCE_APP,"MBMS_AREA_CONFIGURATION_ParamList.numelt %d\n",MBMS_AREA_CONFIGURATION_ParamList.numelt);
|
||||
@@ -317,84 +321,107 @@ int RCconfig_m2_scheduling( m2ap_mbms_scheduling_information_t * m2ap_mbms_sche
|
||||
paramlist_def_t PMCH_ParamList = {MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath2);
|
||||
config_getlist(&PMCH_ParamList,PMCH_Params,sizeof(PMCH_Params)/sizeof(paramdef_t),mcepath2);
|
||||
AssertFatal(PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].num_pmch_config_list=PMCH_ParamList.numelt;
|
||||
for(j = 0; j < PMCH_ParamList.numelt; j++){
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].allocated_sf_end = *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_ALLOCATED_SF_END_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].data_mcs = *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_DATA_MCS_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mch_scheduling_period= *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_MCH_SCHEDULING_PERIOD_IDX].uptr);
|
||||
char mcepath3[MAX_OPTNAME_SIZE*2 + 8];
|
||||
paramdef_t MBMS_SESSION_LIST_Params[] = MCE_MBMS_MBMS_SESSION_LIST_DESC;
|
||||
config_getlist(config_get_if(), &PMCH_ParamList, PMCH_Params, sizeofArray(PMCH_Params), mcepath2);
|
||||
AssertFatal(PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].num_pmch_config_list = PMCH_ParamList.numelt;
|
||||
for (j = 0; j < PMCH_ParamList.numelt; j++) {
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].allocated_sf_end =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_ALLOCATED_SF_END_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].data_mcs =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_DATA_MCS_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mch_scheduling_period =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_MCH_SCHEDULING_PERIOD_IDX].uptr);
|
||||
char mcepath3[MAX_OPTNAME_SIZE * 2 + 8];
|
||||
paramdef_t MBMS_SESSION_LIST_Params[] = MCE_MBMS_MBMS_SESSION_LIST_DESC;
|
||||
paramlist_def_t MBMS_SESSION_LIST_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST,NULL,0};
|
||||
sprintf(mcepath3,"%s.[%u].%s.%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j);
|
||||
config_getlist(&MBMS_SESSION_LIST_ParamList,MBMS_SESSION_LIST_Params,sizeof(MBMS_SESSION_LIST_Params)/sizeof(paramdef_t),mcepath3);
|
||||
//LOG_E(MCE_APP,"%s ---- %d\n",mcepath3, MBMS_SESSION_LIST_ParamList.numelt);
|
||||
AssertFatal(MBMS_SESSION_LIST_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].num_mbms_session_list = MBMS_SESSION_LIST_ParamList.numelt;
|
||||
for(k = 0; k < MBMS_SESSION_LIST_ParamList.numelt; k++ ){
|
||||
config_getlist(config_get_if(),
|
||||
&MBMS_SESSION_LIST_ParamList,
|
||||
MBMS_SESSION_LIST_Params,
|
||||
sizeofArray(MBMS_SESSION_LIST_Params),
|
||||
mcepath3);
|
||||
// LOG_E(MCE_APP,"%s ---- %d\n",mcepath3, MBMS_SESSION_LIST_ParamList.numelt);
|
||||
AssertFatal(MBMS_SESSION_LIST_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].num_mbms_session_list =
|
||||
MBMS_SESSION_LIST_ParamList.numelt;
|
||||
for (k = 0; k < MBMS_SESSION_LIST_ParamList.numelt; k++) {
|
||||
// char mcepath4[MAX_OPTNAME_SIZE*8 + 8];
|
||||
// paramdef_t MBMS_SESSION_LIST_PER_PMCH_Params[] = MCE_MBMS_MBMS_SESSION_LIST_PER_PMCH_PARAMS_DESC;
|
||||
// paramlist_def_t MBMS_SESSION_LIST_PER_PMCH_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST_PER_PMCH,NULL,0};
|
||||
// sprintf(mcepath4,"%s.[%i].%s.%s.[%i].%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k);
|
||||
// LOG_E(MCE_APP,"%s\n",mcepath4);
|
||||
// config_getlist(config_get_if(),&MBMS_SESSION_LIST_PER_PMCH_ParamList,MBMS_SESSION_LIST_PER_PMCH_Params,sizeofArray(MBMS_SESSION_LIST_PER_PMCH_Params),mcepath4);
|
||||
// m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].num_mbms_session_per_pmch
|
||||
// = MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; for(m = 0; m < MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; m++){
|
||||
|
||||
//char mcepath4[MAX_OPTNAME_SIZE*8 + 8];
|
||||
//paramdef_t MBMS_SESSION_LIST_PER_PMCH_Params[] = MCE_MBMS_MBMS_SESSION_LIST_PER_PMCH_PARAMS_DESC;
|
||||
//paramlist_def_t MBMS_SESSION_LIST_PER_PMCH_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST_PER_PMCH,NULL,0};
|
||||
//sprintf(mcepath4,"%s.[%i].%s.%s.[%i].%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath4);
|
||||
//config_getlist(&MBMS_SESSION_LIST_PER_PMCH_ParamList,MBMS_SESSION_LIST_PER_PMCH_Params,sizeof(MBMS_SESSION_LIST_PER_PMCH_Params)/sizeof(paramdef_t),mcepath4);
|
||||
//m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].num_mbms_session_per_pmch = MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt;
|
||||
//for(m = 0; m < MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; m++){
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id =
|
||||
*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr);
|
||||
uint32_t lcid = *(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].lcid = lcid;
|
||||
// uint32_t service_id2=*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
// m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id2
|
||||
// =service_id2; LOG_E(MCE_APP,"lcid
|
||||
// %ld\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr)); LOG_E(MCE_APP,"service_id
|
||||
// %d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr));
|
||||
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id =
|
||||
*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr);
|
||||
uint32_t lcid =*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].lcid =lcid;
|
||||
//uint32_t service_id2=*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
//m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id2 =service_id2;
|
||||
//LOG_E(MCE_APP,"lcid %ld\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr));
|
||||
//LOG_E(MCE_APP,"service_id %d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr));
|
||||
char mcepath5[MAX_OPTNAME_SIZE * 8 + 8];
|
||||
paramdef_t PLNMParams[] = MCE_PLMN_PARAMS_DESC;
|
||||
sprintf(mcepath5,
|
||||
"%s.[%u].%s.%s.[%i].%s.[%i].%s.[%i].%s",
|
||||
"MCEs",
|
||||
i,
|
||||
MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,
|
||||
MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,
|
||||
l,
|
||||
MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,
|
||||
j,
|
||||
MCE_CONFIG_STRING_MBMS_SESSION_LIST,
|
||||
k,
|
||||
MCE_CONFIG_STRING_PLMN);
|
||||
config_get(config_get_if(), PLNMParams, sizeofArray(PLNMParams), mcepath5);
|
||||
// LOG_E(MCE_APP,"PLNM %d\n",*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr));
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mcc =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc_length =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
|
||||
char mcepath5[MAX_OPTNAME_SIZE*8 + 8];
|
||||
paramdef_t PLNMParams[] = MCE_PLMN_PARAMS_DESC;
|
||||
sprintf(mcepath5,"%s.[%u].%s.%s.[%i].%s.[%i].%s.[%i].%s","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k,MCE_CONFIG_STRING_PLMN);
|
||||
config_get(PLNMParams,sizeof(PLNMParams)/sizeof(paramdef_t),mcepath5);
|
||||
//LOG_E(MCE_APP,"PLNM %d\n",*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr));
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mcc = *(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc = *(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc_length = *(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
|
||||
//}
|
||||
//LOG_E(MCE_APP,"MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt %d\n",MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt);
|
||||
//AssertFatal(MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
//}
|
||||
// LOG_E(MCE_APP,"MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt %d\n",MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt);
|
||||
// AssertFatal(MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_PLNM_IDENTITY_IDX].uptr));
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_SERVICE_ID_IDX].uptr));
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_LCID_IDX].uptr));
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
}
|
||||
}
|
||||
paramdef_t MBSFN_SF_Params[] = MCE_MBMS_MBMS_SF_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBSFN_SF_ParamList = {MCE_CONFIG_STRING_MBMS_SF_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_PLNM_IDENTITY_IDX].uptr));
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_SERVICE_ID_IDX].uptr));
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_LCID_IDX].uptr));
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
}
|
||||
}
|
||||
paramdef_t MBSFN_SF_Params[] = MCE_MBMS_MBMS_SF_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBSFN_SF_ParamList = {MCE_CONFIG_STRING_MBMS_SF_CONFIGURATION_LIST, NULL, 0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath2);
|
||||
config_getlist(&MBSFN_SF_ParamList,MBSFN_SF_Params,sizeof(MBSFN_SF_Params)/sizeof(paramdef_t),mcepath2);
|
||||
AssertFatal(MBSFN_SF_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].num_mbms_sf_config_list=MBSFN_SF_ParamList.numelt;
|
||||
for(j = 0; j < MBSFN_SF_ParamList.numelt; j++){
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_period=*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOCATION_PERIOD_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_offset = *(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOOCATION_OFFSET_IDX].uptr);
|
||||
if(strcmp(*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_NUM_FRAME_IDX].strptr),"oneFrame")==0){
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 0;
|
||||
}else{
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 1;
|
||||
}
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].subframe_allocation = *(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_SUBFRAME_ALLOCATION_IDX].uptr);
|
||||
}
|
||||
|
||||
config_getlist(config_get_if(), &MBSFN_SF_ParamList, MBSFN_SF_Params, sizeofArray(MBSFN_SF_Params), mcepath2);
|
||||
AssertFatal(MBSFN_SF_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].num_mbms_sf_config_list = MBSFN_SF_ParamList.numelt;
|
||||
for (j = 0; j < MBSFN_SF_ParamList.numelt; j++) {
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_period =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOCATION_PERIOD_IDX].uptr);
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_offset =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOOCATION_OFFSET_IDX].uptr);
|
||||
if (strcmp(*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_NUM_FRAME_IDX].strptr), "oneFrame") == 0) {
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 0;
|
||||
} else {
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 1;
|
||||
}
|
||||
m2ap_mbms_scheduling_information->mbms_area_config_list[l].mbms_sf_config_list[j].subframe_allocation =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_SUBFRAME_ALLOCATION_IDX].uptr);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -404,14 +431,18 @@ int RCconfig_M2_SCHEDULING(MessageDef *msg_p, uint32_t i) {
|
||||
paramdef_t MBMS_SCHE_Params[] = MCE_MBMS_SCHEDULING_INFO_PARAMS_DESC;
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath);
|
||||
config_get(MBMS_SCHE_Params,sizeof(MBMS_SCHE_Params)/sizeof(paramdef_t),mcepath);
|
||||
config_get(config_get_if(), MBMS_SCHE_Params, sizeofArray(MBMS_SCHE_Params), mcepath);
|
||||
//LOG_E(MCE_APP,"%s %d\n",mcepath, *(MBMS_SCHE_Params[MCE_CONFIG_STRING_MCCH_UPDATE_TIME_IDX].uptr));
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mcch_update_time=*(MBMS_SCHE_Params[MCE_CONFIG_STRING_MCCH_UPDATE_TIME_IDX].uptr);
|
||||
|
||||
paramdef_t MBMS_CONFIGURATION_Params[] = MCE_MBMS_AREA_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBMS_AREA_CONFIGURATION_ParamList = {MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath,"%s.[%i].%s","MCEs",0,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO);
|
||||
config_getlist(&MBMS_AREA_CONFIGURATION_ParamList,MBMS_CONFIGURATION_Params,sizeof(MBMS_CONFIGURATION_Params)/sizeof(paramdef_t),mcepath);
|
||||
config_getlist(config_get_if(),
|
||||
&MBMS_AREA_CONFIGURATION_ParamList,
|
||||
MBMS_CONFIGURATION_Params,
|
||||
sizeofArray(MBMS_CONFIGURATION_Params),
|
||||
mcepath);
|
||||
AssertFatal(MBMS_AREA_CONFIGURATION_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath);
|
||||
//LOG_E(MCE_APP,"MBMS_AREA_CONFIGURATION_ParamList.numelt %d\n",MBMS_AREA_CONFIGURATION_ParamList.numelt);
|
||||
@@ -425,84 +456,107 @@ int RCconfig_M2_SCHEDULING(MessageDef *msg_p, uint32_t i) {
|
||||
paramlist_def_t PMCH_ParamList = {MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath2);
|
||||
config_getlist(&PMCH_ParamList,PMCH_Params,sizeof(PMCH_Params)/sizeof(paramdef_t),mcepath2);
|
||||
AssertFatal(PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].num_pmch_config_list=PMCH_ParamList.numelt;
|
||||
for(j = 0; j < PMCH_ParamList.numelt; j++){
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].allocated_sf_end = *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_ALLOCATED_SF_END_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].data_mcs = *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_DATA_MCS_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mch_scheduling_period= *(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_MCH_SCHEDULING_PERIOD_IDX].uptr);
|
||||
char mcepath3[MAX_OPTNAME_SIZE*2 + 8];
|
||||
paramdef_t MBMS_SESSION_LIST_Params[] = MCE_MBMS_MBMS_SESSION_LIST_DESC;
|
||||
paramlist_def_t MBMS_SESSION_LIST_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST,NULL,0};
|
||||
config_getlist(config_get_if(), &PMCH_ParamList, PMCH_Params, sizeofArray(PMCH_Params), mcepath2);
|
||||
AssertFatal(PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].num_pmch_config_list = PMCH_ParamList.numelt;
|
||||
for (j = 0; j < PMCH_ParamList.numelt; j++) {
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].allocated_sf_end =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_ALLOCATED_SF_END_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].data_mcs =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_DATA_MCS_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mch_scheduling_period =
|
||||
*(PMCH_ParamList.paramarray[j][MCE_CONFIG_STRING_MCH_SCHEDULING_PERIOD_IDX].uptr);
|
||||
char mcepath3[MAX_OPTNAME_SIZE * 2 + 8];
|
||||
paramdef_t MBMS_SESSION_LIST_Params[] = MCE_MBMS_MBMS_SESSION_LIST_DESC;
|
||||
paramlist_def_t MBMS_SESSION_LIST_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST, NULL, 0};
|
||||
sprintf(mcepath3,"%s.[%u].%s.%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j);
|
||||
config_getlist(&MBMS_SESSION_LIST_ParamList,MBMS_SESSION_LIST_Params,sizeof(MBMS_SESSION_LIST_Params)/sizeof(paramdef_t),mcepath3);
|
||||
//LOG_E(MCE_APP,"%s ---- %d\n",mcepath3, MBMS_SESSION_LIST_ParamList.numelt);
|
||||
AssertFatal(MBMS_SESSION_LIST_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].num_mbms_session_list = MBMS_SESSION_LIST_ParamList.numelt;
|
||||
for(k = 0; k < MBMS_SESSION_LIST_ParamList.numelt; k++ ){
|
||||
config_getlist(config_get_if(),
|
||||
&MBMS_SESSION_LIST_ParamList,
|
||||
MBMS_SESSION_LIST_Params,
|
||||
sizeofArray(MBMS_SESSION_LIST_Params),
|
||||
mcepath3);
|
||||
// LOG_E(MCE_APP,"%s ---- %d\n",mcepath3, MBMS_SESSION_LIST_ParamList.numelt);
|
||||
AssertFatal(MBMS_SESSION_LIST_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].num_mbms_session_list =
|
||||
MBMS_SESSION_LIST_ParamList.numelt;
|
||||
for (k = 0; k < MBMS_SESSION_LIST_ParamList.numelt; k++) {
|
||||
// char mcepath4[MAX_OPTNAME_SIZE*8 + 8];
|
||||
// paramdef_t MBMS_SESSION_LIST_PER_PMCH_Params[] = MCE_MBMS_MBMS_SESSION_LIST_PER_PMCH_PARAMS_DESC;
|
||||
// paramlist_def_t MBMS_SESSION_LIST_PER_PMCH_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST_PER_PMCH,NULL,0};
|
||||
// sprintf(mcepath4,"%s.[%i].%s.%s.[%i].%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k);
|
||||
// LOG_E(MCE_APP,"%s\n",mcepath4);
|
||||
// config_getlist(config_get_if(),&MBMS_SESSION_LIST_PER_PMCH_ParamList,MBMS_SESSION_LIST_PER_PMCH_Params,sizeofArray(MBMS_SESSION_LIST_PER_PMCH_Params),mcepath4);
|
||||
// M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].num_mbms_session_per_pmch
|
||||
// = MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; for(m = 0; m < MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; m++){
|
||||
|
||||
//char mcepath4[MAX_OPTNAME_SIZE*8 + 8];
|
||||
//paramdef_t MBMS_SESSION_LIST_PER_PMCH_Params[] = MCE_MBMS_MBMS_SESSION_LIST_PER_PMCH_PARAMS_DESC;
|
||||
//paramlist_def_t MBMS_SESSION_LIST_PER_PMCH_ParamList = {MCE_CONFIG_STRING_MBMS_SESSION_LIST_PER_PMCH,NULL,0};
|
||||
//sprintf(mcepath4,"%s.[%i].%s.%s.[%i].%s.[%i].%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath4);
|
||||
//config_getlist(&MBMS_SESSION_LIST_PER_PMCH_ParamList,MBMS_SESSION_LIST_PER_PMCH_Params,sizeof(MBMS_SESSION_LIST_PER_PMCH_Params)/sizeof(paramdef_t),mcepath4);
|
||||
//M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].num_mbms_session_per_pmch = MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt;
|
||||
//for(m = 0; m < MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt; m++){
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id =
|
||||
*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr);
|
||||
uint32_t lcid = *(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].lcid = lcid;
|
||||
// uint32_t service_id2=*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
// M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id2
|
||||
// =service_id2; LOG_E(MCE_APP,"lcid
|
||||
// %ld\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr)); LOG_E(MCE_APP,"service_id
|
||||
// %d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr));
|
||||
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id =
|
||||
*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr);
|
||||
uint32_t lcid =*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].lcid =lcid;
|
||||
//uint32_t service_id2=*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr);
|
||||
//M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].service_id2 =service_id2;
|
||||
//LOG_E(MCE_APP,"lcid %ld\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_LCID_IDX].uptr));
|
||||
//LOG_E(MCE_APP,"service_id %d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_MBMS_SERVICE_ID_IDX].uptr));
|
||||
char mcepath5[MAX_OPTNAME_SIZE * 8 + 8];
|
||||
paramdef_t PLNMParams[] = MCE_PLMN_PARAMS_DESC;
|
||||
sprintf(mcepath5,
|
||||
"%s.[%u].%s.%s.[%i].%s.[%i].%s.[%i].%s",
|
||||
"MCEs",
|
||||
i,
|
||||
MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,
|
||||
MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,
|
||||
l,
|
||||
MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,
|
||||
j,
|
||||
MCE_CONFIG_STRING_MBMS_SESSION_LIST,
|
||||
k,
|
||||
MCE_CONFIG_STRING_PLMN);
|
||||
config_get(config_get_if(), PLNMParams, sizeofArray(PLNMParams), mcepath5);
|
||||
// LOG_E(MCE_APP,"PLNM %d\n",*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr));
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mcc =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc_length =
|
||||
*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
|
||||
char mcepath5[MAX_OPTNAME_SIZE*8 + 8];
|
||||
paramdef_t PLNMParams[] = MCE_PLMN_PARAMS_DESC;
|
||||
sprintf(mcepath5,"%s.[%u].%s.%s.[%i].%s.[%i].%s.[%i].%s","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l,MCE_CONFIG_STRING_PMCH_CONFIGURATION_LIST,j,MCE_CONFIG_STRING_MBMS_SESSION_LIST,k,MCE_CONFIG_STRING_PLMN);
|
||||
config_get(PLNMParams,sizeof(PLNMParams)/sizeof(paramdef_t),mcepath5);
|
||||
//LOG_E(MCE_APP,"PLNM %d\n",*(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr));
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mcc = *(PLNMParams[MCE_CONFIG_STRING_MCC_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc = *(PLNMParams[MCE_CONFIG_STRING_MNC_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].pmch_config_list[j].mbms_session_list[k].mnc_length = *(PLNMParams[MCE_CONFIG_STRING_MNC_LENGTH_IDX].uptr);
|
||||
|
||||
//}
|
||||
//LOG_E(MCE_APP,"MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt %d\n",MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt);
|
||||
//AssertFatal(MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
//}
|
||||
// LOG_E(MCE_APP,"MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt %d\n",MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt);
|
||||
// AssertFatal(MBMS_SESSION_LIST_PER_PMCH_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_PLNM_IDENTITY_IDX].uptr));
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_SERVICE_ID_IDX].uptr));
|
||||
//printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_LCID_IDX].uptr));
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
}
|
||||
}
|
||||
paramdef_t MBSFN_SF_Params[] = MCE_MBMS_MBMS_SF_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBSFN_SF_ParamList = {MCE_CONFIG_STRING_MBMS_SF_CONFIGURATION_LIST,NULL,0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_PLNM_IDENTITY_IDX].uptr));
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_SERVICE_ID_IDX].uptr));
|
||||
// printf("%d\n",*(MBMS_SESSION_LIST_ParamList.paramarray[k][MCE_CONFIG_STRING_LCID_IDX].uptr));
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
//*((MBMS_SESSION_LIST_ParamList[k][].uptr);
|
||||
}
|
||||
}
|
||||
paramdef_t MBSFN_SF_Params[] = MCE_MBMS_MBMS_SF_CONFIGURATION_LIST_PARAMS_DESC;
|
||||
paramlist_def_t MBSFN_SF_ParamList = {MCE_CONFIG_STRING_MBMS_SF_CONFIGURATION_LIST, NULL, 0};
|
||||
sprintf(mcepath2,"%s.[%u].%s.%s.[%i]","MCEs",i,MCE_CONFIG_STRING_MBMS_SCHEDULING_INFO,MCE_CONFIG_STRING_MBMS_AREA_CONFIGURATION_LIST,l);
|
||||
//LOG_E(MCE_APP,"%s\n",mcepath2);
|
||||
config_getlist(&MBSFN_SF_ParamList,MBSFN_SF_Params,sizeof(MBSFN_SF_Params)/sizeof(paramdef_t),mcepath2);
|
||||
AssertFatal(MBSFN_SF_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].num_mbms_sf_config_list=MBSFN_SF_ParamList.numelt;
|
||||
for(j = 0; j < MBSFN_SF_ParamList.numelt; j++){
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_period=*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOCATION_PERIOD_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_offset = *(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOOCATION_OFFSET_IDX].uptr);
|
||||
if(strcmp(*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_NUM_FRAME_IDX].strptr),"oneFrame")==0){
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 0;
|
||||
}else{
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 1;
|
||||
}
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].subframe_allocation = *(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_SUBFRAME_ALLOCATION_IDX].uptr);
|
||||
}
|
||||
|
||||
config_getlist(config_get_if(), &MBSFN_SF_ParamList, MBSFN_SF_Params, sizeofArray(MBSFN_SF_Params), mcepath2);
|
||||
AssertFatal(MBSFN_SF_ParamList.numelt <= 8, "File wrong parsed\n");
|
||||
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].num_mbms_sf_config_list = MBSFN_SF_ParamList.numelt;
|
||||
for (j = 0; j < MBSFN_SF_ParamList.numelt; j++) {
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_period =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOCATION_PERIOD_IDX].uptr);
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].radioframe_allocation_offset =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_RADIOFRAME_ALLOOCATION_OFFSET_IDX].uptr);
|
||||
if (strcmp(*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_NUM_FRAME_IDX].strptr), "oneFrame") == 0) {
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 0;
|
||||
} else {
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].is_four_sf = 1;
|
||||
}
|
||||
M2AP_MBMS_SCHEDULING_INFORMATION(msg_p).mbms_area_config_list[l].mbms_sf_config_list[j].subframe_allocation =
|
||||
*(MBSFN_SF_ParamList.paramarray[j][MCE_CONFIG_STRING_SUBFRAME_ALLOCATION_IDX].uptr);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1296,7 +1296,7 @@ void RCconfig_nr_ue_macrlc(void) {
|
||||
paramdef_t MACRLC_Params[] = MACRLCPARAMS_DESC;
|
||||
paramlist_def_t MACRLC_ParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0};
|
||||
|
||||
config_getlist(&MACRLC_ParamList, MACRLC_Params, sizeof(MACRLC_Params) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &MACRLC_ParamList, MACRLC_Params, sizeofArray(MACRLC_Params), NULL);
|
||||
if (MACRLC_ParamList.numelt > 0) {
|
||||
for (j = 0; j < MACRLC_ParamList.numelt; j++) {
|
||||
if (strcmp(*(MACRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
|
||||
@@ -1150,7 +1150,7 @@ void UE_config_stub_pnf(void) {
|
||||
paramdef_t L1_Params[] = L1PARAMS_DESC;
|
||||
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0};
|
||||
|
||||
config_getlist(&L1_ParamList, L1_Params, sizeof(L1_Params) / sizeof(paramdef_t), NULL);
|
||||
config_getlist(config_get_if(), &L1_ParamList, L1_Params, sizeofArray(L1_Params), NULL);
|
||||
if (L1_ParamList.numelt > 0) {
|
||||
for (j = 0; j < L1_ParamList.numelt; j++) {
|
||||
// nb_L1_CC = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr); // Number of
|
||||
|
||||
@@ -70,7 +70,7 @@ void nas_getparams(void) {
|
||||
{"BroadcastAddr", NASHLP_BROADCASTADDR, 0, .strptr=&broadcastAddr, .defstrval="10.0.255.255", TYPE_STRING, 0 },
|
||||
};
|
||||
// clang-format on
|
||||
config_get( nasoptions,sizeof(nasoptions)/sizeof(paramdef_t),"nas.noS1");
|
||||
config_get(config_get_if(), nasoptions, sizeofArray(nasoptions), "nas.noS1");
|
||||
}
|
||||
|
||||
void setBaseNetAddress (char *baseAddr) {
|
||||
|
||||
@@ -65,10 +65,10 @@ static void prepare_NR_SL_SyncConfig(NR_SL_SyncConfig_r16_t *sl_syncconfig)
|
||||
paramdef_t SL_SYNCCFGPARAMS[] = SL_SYNCPARAMS_DESC(sl_syncconfig);
|
||||
paramlist_def_t SL_SYNCFGParamList = {SL_CONFIG_STRING_SL_SYNCCONFIG_LIST, NULL, 0};
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0);
|
||||
config_getlist(&SL_SYNCFGParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SL_SYNCFGParamList, NULL, 0, aprefix);
|
||||
LOG_I(RRC, "NUM SL-SYNCCFG elem in cfg file:%d\n", SL_SYNCFGParamList.numelt);
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0,SL_CONFIG_STRING_SL_SYNCCONFIG_LIST, 0);
|
||||
config_get(SL_SYNCCFGPARAMS,sizeof(SL_SYNCCFGPARAMS)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SL_SYNCCFGPARAMS, sizeofArray(SL_SYNCCFGPARAMS), aprefix);
|
||||
}
|
||||
|
||||
static void prepare_NR_SL_ResourcePool(NR_SL_ResourcePool_r16_t *sl_res_pool,
|
||||
@@ -184,7 +184,7 @@ static void prepare_NR_SL_ResourcePool(NR_SL_ResourcePool_r16_t *sl_res_pool,
|
||||
else
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0,SL_CONFIG_STRING_SL_RX_RPOOL_LIST, 0);
|
||||
|
||||
config_get(SL_POOLPARAMS,sizeof(SL_POOLPARAMS)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SL_POOLPARAMS, sizeofArray(SL_POOLPARAMS), aprefix);
|
||||
}
|
||||
|
||||
static void prepare_NR_SL_BWPConfigCommon(NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
|
||||
@@ -214,16 +214,16 @@ static void prepare_NR_SL_BWPConfigCommon(NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
|
||||
paramdef_t SL_BWPPARAMS[] = SL_BWPPARAMS_DESC(sl_bwp);
|
||||
paramlist_def_t SL_BWPParamList = {SL_CONFIG_STRING_SL_BWP_LIST, NULL, 0};
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0);
|
||||
config_getlist(&SL_BWPParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SL_BWPParamList, NULL, 0, aprefix);
|
||||
LOG_I(RRC, "NUM SL-BWP elem in cfg file:%d\n", SL_BWPParamList.numelt);
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0, SL_CONFIG_STRING_SL_BWP_LIST, 0);
|
||||
config_get( SL_BWPPARAMS,sizeof(SL_BWPPARAMS)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SL_BWPPARAMS, sizeofArray(SL_BWPPARAMS), aprefix);
|
||||
|
||||
sl_bwp->sl_BWP_PoolConfigCommon_r16 = calloc(1, sizeof(NR_SL_BWP_PoolConfigCommon_r16_t));
|
||||
|
||||
paramlist_def_t SL_RxPoolParamList = {SL_CONFIG_STRING_SL_RX_RPOOL_LIST, NULL, 0};
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0);
|
||||
config_getlist(&SL_RxPoolParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SL_RxPoolParamList, NULL, 0, aprefix);
|
||||
LOG_I(RRC, "NUM Rx RPOOLs in cfg file:%d\n", SL_RxPoolParamList.numelt);
|
||||
AssertFatal(SL_RxPoolParamList.numelt <= 1 && num_rx_pools <= 1, "Only Max 1 RX Respool Supported now\n");
|
||||
|
||||
@@ -239,7 +239,7 @@ static void prepare_NR_SL_BWPConfigCommon(NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
|
||||
|
||||
paramlist_def_t SL_TxPoolParamList = {SL_CONFIG_STRING_SL_TX_RPOOL_LIST, NULL, 0};
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0);
|
||||
config_getlist(&SL_TxPoolParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SL_TxPoolParamList, NULL, 0, aprefix);
|
||||
LOG_I(RRC, "NUM Tx RPOOL in cfg file:%d\n", SL_TxPoolParamList.numelt);
|
||||
AssertFatal(SL_TxPoolParamList.numelt <= 1 && num_tx_pools <= 1, "Only Max 1 TX Respool Supported now\n");
|
||||
|
||||
@@ -289,10 +289,10 @@ static void prepare_NR_SL_FreqConfigCommon(NR_SL_FreqConfigCommon_r16_t *sl_fcfg
|
||||
paramdef_t SL_FCCPARAMS[] = SL_FCCPARAMS_DESC(sl_fcfg);
|
||||
paramlist_def_t SL_FCCParamList = {SL_CONFIG_STRING_SL_FCC_LIST, NULL, 0};
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION,0);
|
||||
config_getlist(&SL_FCCParamList, NULL, 0, aprefix);
|
||||
config_getlist(config_get_if(), &SL_FCCParamList, NULL, 0, aprefix);
|
||||
LOG_I(RRC, "NUM SL-FCC elem in cfg file:%d\n", SL_FCCParamList.numelt);
|
||||
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION,0, SL_CONFIG_STRING_SL_FCC_LIST, 0);
|
||||
config_get( SL_FCCPARAMS,sizeof(SL_FCCPARAMS)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SL_FCCPARAMS, sizeofArray(SL_FCCPARAMS), aprefix);
|
||||
|
||||
// Sidelink BWP configuration.
|
||||
// In REL16, 17 SUPPORTS only 1 SIDELINK Bandwidth part
|
||||
@@ -374,7 +374,7 @@ NR_SL_PreconfigurationNR_r16_t *prepare_NR_SL_PRECONFIGURATION(uint16_t num_tx_p
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix, "%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION,0);
|
||||
paramdef_t SLTDDCFG_PARAMS[] = SL_TDDCONFIGPARAMS_DESC(tdd_uldl_cfg);
|
||||
config_get(SLTDDCFG_PARAMS,sizeof(SLTDDCFG_PARAMS)/sizeof(paramdef_t),aprefix);
|
||||
config_get(config_get_if(), SLTDDCFG_PARAMS, sizeofArray(SLTDDCFG_PARAMS), aprefix);
|
||||
|
||||
NR_SL_FreqConfigCommon_r16_t *fcc = sl_preconfig->sl_PreconfigFreqInfoList_r16->list.array[0];
|
||||
tdd_uldl_cfg->referenceSubcarrierSpacing =
|
||||
|
||||
@@ -542,11 +542,10 @@ void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsign
|
||||
int init_opt(void) {
|
||||
paramdef_t opt_params[] = OPT_PARAMS_DESC ;
|
||||
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
|
||||
config_set_checkfunctions(opt_params, opt_checkParams,
|
||||
sizeof(opt_params)/sizeof(paramdef_t));
|
||||
config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||
config_set_checkfunctions(opt_params, opt_checkParams, sizeofArray(opt_params));
|
||||
config_get(config_get_if(), opt_params, sizeofArray(opt_params), OPT_CONFIGPREFIX);
|
||||
subframesSinceCaptureStart = 0;
|
||||
int tmptype = config_get_processedint( &(opt_params[OPTTYPE_IDX]));
|
||||
int tmptype = config_get_processedint(config_get_if(), &(opt_params[OPTTYPE_IDX]));
|
||||
|
||||
if (tmptype == OPT_NONE) {
|
||||
opt_enabled=0;
|
||||
@@ -560,7 +559,7 @@ int init_opt(void) {
|
||||
opt_type = OPT_WIRESHARK;
|
||||
} else {
|
||||
LOG_E(OPT,"Invalid OPT configuration\n");
|
||||
config_printhelp(opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||
config_printhelp(opt_params, sizeofArray(opt_params), OPT_CONFIGPREFIX);
|
||||
}
|
||||
|
||||
// trace_mode
|
||||
|
||||
@@ -747,17 +747,17 @@ int is_x2ap_enabled(void)
|
||||
};
|
||||
|
||||
/* TODO: do it per module - we check only first eNB */
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "eNBs.[0]");
|
||||
config_get(config_get_if(), p, sizeofArray(p), "eNBs.[0]");
|
||||
if (enable_x2 != NULL && strcmp(enable_x2, "yes") == 0){
|
||||
enabled = 1;
|
||||
}
|
||||
|
||||
/*Consider also the case of enabling X2AP for a gNB by parsing a gNB configuration file*/
|
||||
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "gNBs.[0]");
|
||||
if (enable_x2 != NULL && strcmp(enable_x2, "yes") == 0){
|
||||
enabled = 1;
|
||||
}
|
||||
config_get(config_get_if(), p, sizeofArray(p), "gNBs.[0]");
|
||||
if (enable_x2 != NULL && strcmp(enable_x2, "yes") == 0) {
|
||||
enabled = 1;
|
||||
}
|
||||
|
||||
config_loaded = 1;
|
||||
|
||||
|
||||
@@ -687,7 +687,7 @@ int is_m3ap_MCE_enabled(void)
|
||||
};
|
||||
|
||||
/* TODO: do it per module - we check only first MCE */
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "MCEs.[0]");
|
||||
config_get(config_get_if(), p, sizeofArray(p), "MCEs.[0]");
|
||||
if (enable_m3 != NULL && strcmp(enable_m3, "yes") == 0)
|
||||
enabled = 1;
|
||||
|
||||
|
||||
@@ -712,7 +712,7 @@ int is_m3ap_MME_enabled(void)
|
||||
};
|
||||
|
||||
/* TODO: do it per module - we check only first MME */
|
||||
config_get(p, sizeof(p)/sizeof(paramdef_t), "MMEs.[0]");
|
||||
config_get(config_get_if(), p, sizeofArray(p), "MMEs.[0]");
|
||||
if (enable_m3 != NULL && strcmp(enable_m3, "yes") == 0)
|
||||
enabled = 1;
|
||||
|
||||
|
||||
@@ -73,14 +73,14 @@ int RCconfig_MME(void ) {
|
||||
paramdef_t MMEParams[] = MME_NETPARAMS_DESC;
|
||||
|
||||
///* get number of active eNodeBs */
|
||||
//config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
|
||||
//num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
//AssertFatal (num_enbs >0,
|
||||
// "Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
//sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// config_get( config_get_if(),ENBSParams,sizeofArray(ENBSParams),NULL);
|
||||
// num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
|
||||
// AssertFatal (num_enbs >0,
|
||||
// "Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS);
|
||||
// sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
sprintf(mmepath,"%s.[%i].%s","MMEs",0,MME_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
//config_get( GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath);
|
||||
config_get(MMEParams,sizeof(MMEParams)/sizeof(paramdef_t),mmepath);
|
||||
// config_get(config_get_if(), GTPUParams,sizeofArray(GTPUParams),gtpupath);
|
||||
config_get(config_get_if(), MMEParams, sizeofArray(MMEParams), mmepath);
|
||||
//cidr = enb_ipv4_address_for_S1U;
|
||||
cidr = mme_ipv4_address_for_m3c;
|
||||
address = strtok(cidr, "/");
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
|
||||
|
||||
volatile int oai_exit;
|
||||
configmodule_interface_t *uniqCfg = NULL;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ uicc_t *init_uicc(char *sectionName) {
|
||||
// here we call usim simulation, but calling actual usim is quite simple
|
||||
// the code is in open-cells.com => program_uicc open source
|
||||
// we can read the IMSI from the USIM
|
||||
// key, OPc, sqn, amf don't need to be read from the true USIM
|
||||
int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName);
|
||||
// key, OPc, sqn, amf don't need to be read from the true USIM
|
||||
int ret = config_get(config_get_if(), uicc_params, sizeofArray(uicc_params), sectionName);
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName);
|
||||
LOG_I(SIM,
|
||||
"UICC simulation: IMSI=%s, IMEISV=%s, Ki=%s, OPc=%s, DNN=%s, SST=0x%02x, SD=0x%06x\n",
|
||||
|
||||
@@ -125,12 +125,12 @@ int load_lib(openair0_device *device,
|
||||
|
||||
char *devname=NULL;
|
||||
paramdef_t device_params[]=DEVICE_PARAMS_DESC ;
|
||||
int numparams = sizeof(device_params)/sizeof(paramdef_t);
|
||||
int numparams = sizeofArray(device_params);
|
||||
int devname_pidx = config_paramidx_fromname(device_params,numparams, CONFIG_DEVICEOPT_NAME);
|
||||
device_params[devname_pidx].defstrval=deflibname;
|
||||
|
||||
config_get(device_params,numparams,DEVICE_SECTION);
|
||||
|
||||
|
||||
config_get(config_get_if(), device_params, numparams, DEVICE_SECTION);
|
||||
|
||||
ret=load_module_shlib(devname,shlib_fdesc,1,NULL);
|
||||
AssertFatal( (ret >= 0),
|
||||
"Library %s couldn't be loaded\n",devname);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {
|
||||
*recplay_conf = calloc(sizeof(recplay_conf_t),1);
|
||||
paramdef_t device_recplay_params[]=DEVICE_RECPLAY_PARAMS_DESC ;
|
||||
config_get(device_recplay_params,sizeof(device_recplay_params)/sizeof(paramdef_t),DEVICE_RECPLAY_SECTION);
|
||||
config_get(config_get_if(), device_recplay_params, sizeofArray(device_recplay_params), DEVICE_RECPLAY_SECTION);
|
||||
|
||||
if ((*recplay_conf)->u_sf_record || (*recplay_conf)->u_sf_replay ) {
|
||||
struct sysinfo systeminfo;
|
||||
|
||||
@@ -330,13 +330,9 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
|
||||
char *saveF=NULL;
|
||||
char *modelname=NULL;
|
||||
paramdef_t rfsimu_params[] = RFSIMULATOR_PARAMS_DESC;
|
||||
int p = config_paramidx_fromname(rfsimu_params,sizeof(rfsimu_params)/sizeof(paramdef_t), RFSIMU_OPTIONS_PARAMNAME) ;
|
||||
int ret = config_get( rfsimu_params,sizeof(rfsimu_params)/sizeof(paramdef_t),RFSIMU_SECTION);
|
||||
|
||||
if (ret < 0) {
|
||||
LOG_E(HW, "Configuration couldn't be performed\n");
|
||||
exit(-1);
|
||||
}
|
||||
int p = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_OPTIONS_PARAMNAME);
|
||||
int ret = config_get(config_get_if(), rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_SECTION);
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed\n");
|
||||
|
||||
rfsimulator->saveIQfile = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user