Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
openairinterface5G
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
20
Merge Requests
20
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
oai
openairinterface5G
Commits
45302792
Commit
45302792
authored
Feb 23, 2018
by
oai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config module fix and extensions for Nb-IoT, shared lib loader and telnet server implementation
parent
307e2f29
Changes
53
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
2728 additions
and
1282 deletions
+2728
-1282
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+20
-4
cmake_targets/build_oai
cmake_targets/build_oai
+7
-11
common/config/config_load_configmodule.c
common/config/config_load_configmodule.c
+22
-7
common/config/config_load_configmodule.h
common/config/config_load_configmodule.h
+12
-9
common/config/config_paramdesc.h
common/config/config_paramdesc.h
+61
-13
common/config/config_userapi.c
common/config/config_userapi.c
+131
-4
common/config/config_userapi.h
common/config/config_userapi.h
+19
-9
common/config/libconfig/config_libconfig.c
common/config/libconfig/config_libconfig.c
+42
-9
common/ran_context.h
common/ran_context.h
+13
-1
common/utils/load_module_shlib.c
common/utils/load_module_shlib.c
+100
-27
common/utils/load_module_shlib.h
common/utils/load_module_shlib.h
+28
-11
common/utils/telnetsrv/CMakeLists.txt
common/utils/telnetsrv/CMakeLists.txt
+0
-59
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+161
-67
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+6
-5
common/utils/telnetsrv/telnetsrv_CMakeLists.txt
common/utils/telnetsrv/telnetsrv_CMakeLists.txt
+28
-0
common/utils/telnetsrv/telnetsrv_loader.c
common/utils/telnetsrv/telnetsrv_loader.c
+84
-0
common/utils/telnetsrv/telnetsrv_loader.h
common/utils/telnetsrv/telnetsrv_loader.h
+55
-0
common/utils/telnetsrv/telnetsrv_phycmd.c
common/utils/telnetsrv/telnetsrv_phycmd.c
+2
-2
common/utils/telnetsrv/telnetsrv_phycmd.h
common/utils/telnetsrv/telnetsrv_phycmd.h
+1
-3
common/utils/telnetsrv/telnetsrv_proccmd.c
common/utils/telnetsrv/telnetsrv_proccmd.c
+159
-30
common/utils/telnetsrv/telnetsrv_proccmd.h
common/utils/telnetsrv/telnetsrv_proccmd.h
+24
-5
openair1/PHY/CODING/3gpplte.c
openair1/PHY/CODING/3gpplte.c
+6
-4
openair1/PHY/CODING/3gpplte_sse.c
openair1/PHY/CODING/3gpplte_sse.c
+25
-8
openair1/PHY/CODING/3gpplte_turbo_decoder.c
openair1/PHY/CODING/3gpplte_turbo_decoder.c
+2
-2
openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
+35
-3
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
+1
-1
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+1
-1
openair1/PHY/CODING/coding_load.c
openair1/PHY/CODING/coding_load.c
+134
-0
openair1/PHY/CODING/defs.h
openair1/PHY/CODING/defs.h
+1
-31
openair1/PHY/CODING/extern.h
openair1/PHY/CODING/extern.h
+6
-2
openair1/PHY/INIT/init_top.c
openair1/PHY/INIT/init_top.c
+4
-11
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+28
-28
openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
+5
-18
openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
+7
-7
openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+15
-54
openair1/PHY/defs.h
openair1/PHY/defs.h
+47
-0
openair1/SCHED/phy_procedures_lte_eNb.c
openair1/SCHED/phy_procedures_lte_eNb.c
+1
-1
openair2/ENB_APP/L1_paramdef.h
openair2/ENB_APP/L1_paramdef.h
+73
-0
openair2/ENB_APP/MACRLC_paramdef.h
openair2/ENB_APP/MACRLC_paramdef.h
+98
-0
openair2/ENB_APP/RRC_config_tools.c
openair2/ENB_APP/RRC_config_tools.c
+123
-0
openair2/ENB_APP/RRC_config_tools.h
openair2/ENB_APP/RRC_config_tools.h
+50
-0
openair2/ENB_APP/RRC_paramsvalues.h
openair2/ENB_APP/RRC_paramsvalues.h
+94
-0
openair2/ENB_APP/enb_config.c
openair2/ENB_APP/enb_config.c
+39
-585
openair2/ENB_APP/enb_paramdef.h
openair2/ENB_APP/enb_paramdef.h
+154
-166
openair2/ENB_APP/nbiot_config.c
openair2/ENB_APP/nbiot_config.c
+295
-0
openair2/ENB_APP/nbiot_config.h
openair2/ENB_APP/nbiot_config.h
+37
-0
openair2/ENB_APP/nbiot_paramdef.h
openair2/ENB_APP/nbiot_paramdef.h
+400
-0
openair2/UTIL/LOG/log.c
openair2/UTIL/LOG/log.c
+4
-3
openair2/UTIL/LOG/log.h
openair2/UTIL/LOG/log.h
+13
-3
targets/ARCH/COMMON/common_lib.c
targets/ARCH/COMMON/common_lib.c
+14
-39
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+2
-2
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+35
-34
targets/RT/USER/lte-softmodem.h
targets/RT/USER/lte-softmodem.h
+4
-3
No files found.
cmake_targets/CMakeLists.txt
View file @
45302792
...
...
@@ -1042,6 +1042,19 @@ include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
set
(
PHY_TURBOSRC
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_sse.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder.c
)
set
(
PHY_TURBOIF
${
OPENAIR1_DIR
}
/PHY/CODING/coding_load.c
)
add_library
(
coding MODULE
${
PHY_TURBOSRC
}
)
set
(
PHY_SRC
# depend on code generation from asn1c
${
RRC_FULL_DIR
}
/asn1_constants.h
...
...
@@ -1109,11 +1122,8 @@ set(PHY_SRC
${
OPENAIR1_DIR
}
/PHY/CODING/lte_segmentation.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte_lte.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_sse.c
${
OPENAIR1_DIR
}
/PHY/CODING/crc_byte.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${
PHY_TURBOIF
}
${
OPENAIR1_DIR
}
/PHY/CODING/lte_rate_matching.c
${
OPENAIR1_DIR
}
/PHY/CODING/viterbi.c
${
OPENAIR1_DIR
}
/PHY/CODING/viterbi_lte.c
...
...
@@ -1373,6 +1383,7 @@ set (MAC_SRC_UE
set
(
ENB_APP_SRC
${
OPENAIR2_DIR
}
/ENB_APP/enb_app.c
${
OPENAIR2_DIR
}
/ENB_APP/enb_config.c
${
OPENAIR2_DIR
}
/ENB_APP/RRC_config_tools.c
)
add_library
(
L2
...
...
@@ -2398,3 +2409,8 @@ ADD_CUSTOM_TARGET(oarf
DEPENDS
${
OCT_FILES
}
)
include
(
${
OPENAIR_DIR
}
/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
)
cmake_targets/build_oai
View file @
45302792
...
...
@@ -544,6 +544,9 @@ function main() {
compilations
\
$lte_build_dir
$config_libconfig_shlib
\
lib
$config_libconfig_shlib
.so
$dbin
/lib
$config_libconfig_shlib
.so
compilations
\
$lte_build_dir
coding
\
libcoding.so
$dbin
/libcoding.so
if
[
"
$NOS1
"
=
"1"
]
;
then
compilations
\
...
...
@@ -766,17 +769,10 @@ function main() {
# Telnet server compilation
#####################
if
[
"
$BUILD_TELNETSRV
"
=
"1"
]
;
then
telnetsrv_build_dir
=
telnetsrv
mkdir
-p
$DIR
/
$telnetsrv_build_dir
/build
cd
$DIR
/
$telnetsrv_build_dir
/build
echo_info
"Compiling telnet server library ..."
[
"
$CLEAN
"
=
"1"
]
&&
rm
-rf
$DIR
/
$telnetsrv_build_dir
cmake_file
=
$OPENAIR_DIR
/common/utils/
$telnetsrv_build_dir
/CMakeLists.txt
cd
$DIR
/
$telnetsrv_build_dir
/build
eval
"
$CMAKE_CMD
$OPENAIR_DIR
/common/utils/
$telnetsrv_build_dir
/"
make
build_dir
=
$lte_build_dir
compilations
\
$build_dir
telnetsrv
\
libtelnetsrv.so
$dbin
/libtelnetsrv.so
fi
# build RF device and transport protocol libraries
...
...
common/config/config_load_configmodule.c
View file @
45302792
...
...
@@ -197,25 +197,40 @@ int i;
return
cfgptr
;
}
void
end_configmodule
()
/* free memory allocated when reading parameters */
/* config module could be initialized again after this call */
void
end_configmodule
(
void
)
{
if
(
cfgptr
!=
NULL
)
{
if
(
cfgptr
->
end
!=
NULL
)
{
printf
(
"[CONFIG] calling config module end function...
\n
"
);
cfgptr
->
end
();
}
if
(
cfgptr
->
cfgmode
!=
NULL
)
free
(
cfgptr
->
cfgmode
);
printf
(
"[CONFIG] free %u config parameter pointers
\n
"
,
cfgptr
->
num_cfgP
);
for
(
int
i
=
0
;
i
<
cfgptr
->
num_cfgP
;
i
++
)
{
if
(
cfgptr
->
cfgP
[
i
]
!=
NULL
)
free
(
cfgptr
->
cfgP
[
i
]);
}
printf
(
"[CONFIG] free %u config value pointers
\n
"
,
cfgptr
->
numptrs
);
for
(
int
i
=
0
;
i
<
cfgptr
->
numptrs
;
i
++
)
{
if
(
cfgptr
->
ptrs
[
i
]
!=
NULL
)
{
free
(
cfgptr
->
ptrs
[
i
]);
cfgptr
->
ptrs
[
i
]
=
NULL
;
}
cfgptr
->
ptrs
[
i
]
=
NULL
;
}
cfgptr
->
numptrs
=
0
;
}
}
/* free all memory used by config module */
/* should be called only at program exit */
void
free_configmodule
(
void
)
{
if
(
cfgptr
!=
NULL
)
{
end_configmodule
();
if
(
cfgptr
->
cfgmode
!=
NULL
)
free
(
cfgptr
->
cfgmode
);
printf
(
"[CONFIG] free %u config parameter pointers
\n
"
,
cfgptr
->
num_cfgP
);
for
(
int
i
=
0
;
i
<
cfgptr
->
num_cfgP
;
i
++
)
{
if
(
cfgptr
->
cfgP
[
i
]
!=
NULL
)
free
(
cfgptr
->
cfgP
[
i
]);
}
free
(
cfgptr
);
cfgptr
=
NULL
;
...
...
common/config/config_load_configmodule.h
View file @
45302792
...
...
@@ -3,7 +3,7 @@
* 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.
0
(the "License"); you may not use this file
* 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
*
...
...
@@ -40,15 +40,18 @@
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 4 // print command line processing messages
#define CONFIG_HELP 8 // print help message
#define CONFIG_ABORT 16 // config failed,abort execution
#define CONFIG_NOOOPT 32 // no -O option found when parsing command line
/* default values for configuration module parameters */
#define DEFAULT_CFGMODE "libconfig" // use libconfig file
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 1<<1 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 1<<2 // print command line processing messages
#define CONFIG_NOABORTONCHKF 1<<3 // disable abort execution when parameter checking function fails
#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
);
...
...
common/config/config_paramdesc.h
View file @
45302792
...
...
@@ -3,7 +3,7 @@
* 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.
0
(the "License"); you may not use this file
* 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
*
...
...
@@ -55,16 +55,61 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20
typedef
struct
paramdef
paramdef_t
;
typedef
union
checkedparam
{
struct
{
int
(
*
f1
)(
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 */
/* 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
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 */
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 */
/* 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 */
}
s4
;
struct
{
void
(
*
checkfunc
)(
void
)
;
}
s5
;
}
checkedparam_t
;
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
/* config apis used to retrieve parameters values */
typedef
struct
paramdef
{
char
optname
[
MAX_OPTNAME_SIZE
];
/* parameter name, can be used as long command line option */
char
*
helpstr
;
/* help string */
unsigned
int
paramflags
;
/* value is a "ored" combination of above PARAMFLAG_XXXX values */
union
{
/* pointer to the parameter value, completed by the config module */
char
optname
[
MAX_OPTNAME_SIZE
];
/* parameter name, can be used as long command line option */
char
*
helpstr
;
/* help string */
unsigned
int
paramflags
;
/* value is a "ored" combination of above PARAMFLAG_XXXX values */
union
{
/* pointer to the parameter value, completed by the config module */
char
**
strptr
;
char
**
strlistptr
;
uint8_t
*
u8ptr
;
char
*
i8ptr
;
int8_t
*
i8ptr
;
uint16_t
*
u16ptr
;
int16_t
*
i16ptr
;
uint32_t
*
uptr
;
...
...
@@ -72,18 +117,21 @@ typedef struct paramdef
uint64_t
*
u64ptr
;
int64_t
*
i64ptr
;
double
*
dblptr
;
void
*
voidptr
;
}
;
union
{
/* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
char
*
defstrval
;
char
**
defstrlistval
;
uint32_t
defuintval
;
int
defintval
;
uint64_t
defint64val
;
int
*
defintarrayval
;
double
defdblval
;
char
*
defstrval
;
char
**
defstrlistval
;
uint32_t
defuintval
;
int
defintval
;
uint64_t
defint64val
;
int
*
defintarrayval
;
double
defdblval
;
}
;
char
type
;
/* parameter value type, as listed below as TYPE_XXXX macro */
int
numelt
;
/* number of elements in a list or array parameters or max size of string value */
checkedparam_t
*
chkPptr
;
/* possible pointer to the structure containing the info used to check parameter values */
int
*
processedvalue
;
/* used to store integer values computed from string original value */
}
paramdef_t
;
#define TYPE_INT TYPE_INT32
...
...
common/config/config_userapi.c
View file @
45302792
...
...
@@ -3,7 +3,7 @@
* 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.
0
(the "License"); you may not use this file
* 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
*
...
...
@@ -36,6 +36,7 @@
#include <errno.h>
#include <dlfcn.h>
#include "config_userapi.h"
extern
void
exit_fun
(
const
char
*
s
);
// lte-softmodem clean exit function
configmodule_interface_t
*
config_get_if
(
void
)
...
...
@@ -59,7 +60,7 @@ char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
*
ptr
=
malloc
(
length
);
if
(
*
ptr
!=
NULL
)
{
memset
(
*
ptr
,
0
,
length
);
if
(
(
cfgoptions
->
paramflags
&
PARAMFLAG_NOFREE
)
!
=
0
)
{
if
(
(
cfgoptions
->
paramflags
&
PARAMFLAG_NOFREE
)
=
=
0
)
{
config_get_if
()
->
ptrs
[
config_get_if
()
->
numptrs
]
=
*
ptr
;
config_get_if
()
->
numptrs
++
;
}
...
...
@@ -111,7 +112,29 @@ int tmpval=val;
break
;
}
}
void
config_assign_processedint
(
paramdef_t
*
cfgoption
,
int
val
)
{
cfgoption
->
processedvalue
=
malloc
(
sizeof
(
int
));
if
(
cfgoption
->
processedvalue
!=
NULL
)
{
*
(
cfgoption
->
processedvalue
)
=
val
;
}
else
{
fprintf
(
stderr
,
"[CONFIG] %s %d malloc error
\n
"
,
__FILE__
,
__LINE__
);
exit
(
-
1
);
}
}
int
config_get_processedint
(
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
);
}
else
{
fprintf
(
stderr
,
"[CONFIG] %s %d %s has no processed integer availablle
\n
"
,
__FILE__
,
__LINE__
,
cfgoption
->
optname
);
ret
=
0
;
}
return
ret
;
}
void
config_printhelp
(
paramdef_t
*
params
,
int
numparams
)
{
for
(
int
i
=
0
;
i
<
numparams
;
i
++
)
{
...
...
@@ -124,11 +147,31 @@ void config_printhelp(paramdef_t *params,int numparams)
}
}
int
config_execcheck
(
paramdef_t
*
params
,
int
numparams
,
char
*
prefix
)
{
int
st
=
0
;
for
(
int
i
=
0
;
i
<
numparams
;
i
++
)
{
if
(
params
[
i
].
chkPptr
==
NULL
)
{
continue
;
}
if
(
params
[
i
].
chkPptr
->
s4
.
f4
!=
NULL
)
{
st
+=
params
[
i
].
chkPptr
->
s4
.
f4
(
&
(
params
[
i
]));
}
}
if
(
st
!=
0
)
{
fprintf
(
stderr
,
"[CONFIG] config_execcheck: %i parameters with wrong value
\n
"
,
-
st
);
if
(
CONFIG_ISFLAGSET
(
CONFIG_NOABORTONCHKF
)
==
0
)
{
exit_fun
(
"exit because configuration failed
\n
"
);
}
}
return
st
;
}
int
config_get
(
paramdef_t
*
params
,
int
numparams
,
char
*
prefix
)
{
int
ret
=
-
1
;
printf
(
"numparams:%d prefix:%s
\n
"
,
numparams
,
prefix
);
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
))
{
fprintf
(
stderr
,
"[CONFIG] config_get skipped, config module not properly initialized
\n
"
);
return
ret
;
...
...
@@ -138,6 +181,7 @@ configmodule_interface_t *cfgif = config_get_if();
ret
=
config_get_if
()
->
get
(
params
,
numparams
,
prefix
);
if
(
ret
>=
0
)
{
config_process_cmdline
(
params
,
numparams
,
prefix
);
config_execcheck
(
params
,
numparams
,
prefix
);
}
return
ret
;
}
...
...
@@ -153,6 +197,89 @@ int config_isparamset(paramdef_t *params,int paramidx)
}
}
int
config_getparamval_fromparamdefidx
(
paramdef_t
*
cfgoptions
,
int
paramidx
)
{
void
print_intvalueerror
(
paramdef_t
*
param
,
char
*
fname
,
int
*
okval
,
int
numokval
)
{
fprintf
(
stderr
,
"[CONFIG] %s: %s: %i invalid value, authorized values:
\n
"
,
fname
,
param
->
optname
,
(
int
)
*
(
param
->
uptr
));
for
(
int
i
=
0
;
i
<
numokval
;
i
++
)
{
fprintf
(
stderr
,
" %i"
,
okval
[
i
]);
}
fprintf
(
stderr
,
"
\n
"
);
}
int
config_check_intval
(
paramdef_t
*
param
)
{
if
(
param
==
NULL
){
fprintf
(
stderr
,
"[CONFIG] config_check_intval: NULL param argument
\n
"
);
return
-
1
;
}
for
(
int
i
=
0
;
i
<
param
->
chkPptr
->
s1
.
num_okintval
;
i
++
)
{
if
(
*
(
param
->
uptr
)
==
param
->
chkPptr
->
s1
.
okintval
[
i
]
)
{
return
0
;
}
}
print_intvalueerror
(
param
,
"config_check_intval"
,
param
->
chkPptr
->
s1
.
okintval
,
param
->
chkPptr
->
s1
.
num_okintval
);
return
-
1
;
}
int
config_check_modify_integer
(
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
]);
*
(
param
->
uptr
)
=
param
->
chkPptr
->
s1a
.
setintval
[
i
];
return
0
;
}
}
print_intvalueerror
(
param
,
"config_check_modify_integer"
,
param
->
chkPptr
->
s1a
.
okintval
,
param
->
chkPptr
->
s1a
.
num_okintval
);
return
-
1
;
}
int
config_check_intrange
(
paramdef_t
*
param
)
{
if
(
*
(
param
->
iptr
)
>=
param
->
chkPptr
->
s2
.
okintrange
[
0
]
&&
*
(
param
->
iptr
)
<=
param
->
chkPptr
->
s2
.
okintrange
[
1
]
)
{
return
0
;
}
fprintf
(
stderr
,
"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i
\n
"
,
param
->
optname
,
(
int
)
*
(
param
->
uptr
),
param
->
chkPptr
->
s2
.
okintrange
[
0
],
param
->
chkPptr
->
s2
.
okintrange
[
1
]);
return
-
1
;
}
void
print_strvalueerror
(
paramdef_t
*
param
,
char
*
fname
,
char
**
okval
,
int
numokval
)
{
fprintf
(
stderr
,
"[CONFIG] %s: %s: %s invalid value, authorized values:
\n
"
,
fname
,
param
->
optname
,
*
(
param
->
strptr
));
for
(
int
i
=
0
;
i
<
numokval
;
i
++
)
{
fprintf
(
stderr
,
" %s"
,
okval
[
i
]);
}
fprintf
(
stderr
,
"
\n
"
);
}
int
config_check_strval
(
paramdef_t
*
param
)
{
if
(
param
==
NULL
){
fprintf
(
stderr
,
"[CONFIG] config_check_strval: NULL param argument
\n
"
);
return
-
1
;
}
for
(
int
i
=
0
;
i
<
param
->
chkPptr
->
s3
.
num_okstrval
;
i
++
)
{
if
(
strcasecmp
(
*
(
param
->
strptr
),
param
->
chkPptr
->
s3
.
okstrval
[
i
]
)
==
0
)
{
return
0
;
}
}
print_strvalueerror
(
param
,
"config_check_strval"
,
param
->
chkPptr
->
s3
.
okstrval
,
param
->
chkPptr
->
s3
.
num_okstrval
);
return
-
1
;
}
int
config_checkstr_assign_integer
(
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
]);
return
0
;
}
}
print_strvalueerror
(
param
,
"config_check_strval"
,
param
->
chkPptr
->
s3a
.
okstrval
,
param
->
chkPptr
->
s3a
.
num_okstrval
);
return
-
1
;
}
common/config/config_userapi.h
View file @
45302792
...
...
@@ -3,7 +3,7 @@
* 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.
0
(the "License"); you may not use this file
* 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
*
...
...
@@ -38,24 +38,34 @@
extern
"C"
{
#endif
#define DEFAULT_CFGFILENAME "oaisoftmodem.conf"
#define DEFAULT_CFGMODE "libconfig"
#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_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
/* utility functions, to be used by configuration module and/or configuration libraries */
extern
configmodule_interface_t
*
config_get_if
(
void
);
extern
char
*
config_check_valptr
(
paramdef_t
*
cfgoptions
,
char
**
ptr
,
int
length
)
;
extern
void
config_printhelp
(
paramdef_t
*
,
int
numparams
);
extern
int
config_process_cmdline
(
paramdef_t
*
params
,
int
numparams
,
char
*
prefix
);
extern
int
config_get
(
paramdef_t
*
params
,
int
numparams
,
char
*
prefix
);
extern
int
config_isparamset
(
paramdef_t
*
params
,
int
paramidx
);
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_process_cmdline
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
);
extern
int
config_getparamval_fromparamdefidx
(
paramdef_t
*
cfgoptions
,
int
paramidx
);
/* apis to get parameters, to be used by oai modules, at configuration time */
extern
int
config_get
(
paramdef_t
*
params
,
int
numparams
,
char
*
prefix
);
#define config_getlist config_get_if()->getlist
/* 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
);
/* 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
);
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
#ifdef __cplusplus
...
...
common/config/libconfig/config_libconfig.c
View file @
45302792
/*
* 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/libconfig/config_libconfig.c
* \brief: implementation libconfig configuration library
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <libconfig.h>
...
...
@@ -21,21 +51,23 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
{
const
char
*
str
;
int
st
;
int
numelt
;
cfgoptions
->
numelt
=
config_setting_length
(
setting
);
c
fgoptions
->
strlistptr
=
malloc
(
sizeof
(
char
*
)
*
(
cfgoptions
->
numelt
)
);
numelt
=
config_setting_length
(
setting
);
c
onfig_check_valptr
(
cfgoptions
,(
char
**
)
&
(
cfgoptions
->
strlistptr
),
sizeof
(
char
*
)
*
numelt
);
st
=
0
;
for
(
int
i
=
0
;
i
<
cfgoptions
->
numelt
&&
cfgoptions
->
strlistptr
!=
NULL
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numelt
;
i
++
)
{
str
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
str
==
NULL
)
{
printf
(
"[LIBCONFIG] %s%i not found in config file
\n
"
,
cfgoptions
->
optname
,
i
);
}
else
{
c
fgoptions
->
strlistptr
[
i
]
=
malloc
(
strlen
(
str
)
+
1
);
c
onfig_check_valptr
(
cfgoptions
,
&
(
cfgoptions
->
strlistptr
[
i
]),
strlen
(
str
)
+
1
);
sprintf
(
cfgoptions
->
strlistptr
[
i
],
"%s"
,
str
);
st
++
;
printf_params
(
"[LIBCONFIG] %s%i: %s
\n
"
,
cfgpath
,
i
,
cfgoptions
->
strlistptr
[
i
]);
}
}
cfgoptions
->
numelt
=
numelt
;
return
st
;
}
...
...
@@ -108,10 +140,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr
(
&
(
cfgoptions
[
i
]),
(
char
**
)(
&
(
cfgoptions
[
i
].
strptr
)),
sizeof
(
char
*
));
config_check_valptr
(
&
(
cfgoptions
[
i
]),
cfgoptions
[
i
].
strptr
,
strlen
(
str
)
+
1
);
sprintf
(
*
(
cfgoptions
[
i
].
strptr
)
,
"%s"
,
str
);
printf_params
(
"[LIBCONFIG] %s:
%s
\n
"
,
cfgpath
,
*
(
cfgoptions
[
i
].
strptr
)
);
printf_params
(
"[LIBCONFIG] %s:
\"
%s
\"
\n
"
,
cfgpath
,
*
(
cfgoptions
[
i
].
strptr
)
);
}
else
{
sprintf
(
(
char
*
)(
cfgoptions
[
i
].
strptr
)
,
"%s"
,
str
);
printf_params
(
"[LIBCONFIG] %s:
%s
\n
"
,
cfgpath
,(
char
*
)
cfgoptions
[
i
].
strptr
);
printf_params
(
"[LIBCONFIG] %s:
\"
%s
\"
\n
"
,
cfgpath
,(
char
*
)
cfgoptions
[
i
].
strptr
);
}
}
else
{
if
(
cfgoptions
[
i
].
defstrval
!=
NULL
)
{
...
...
@@ -121,10 +153,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr
(
&
(
cfgoptions
[
i
]),
(
char
**
)(
&
(
cfgoptions
[
i
].
strptr
)),
sizeof
(
char
*
));
config_check_valptr
(
&
(
cfgoptions
[
i
]),
cfgoptions
[
i
].
strptr
,
strlen
(
cfgoptions
[
i
].
defstrval
)
+
1
);
sprintf
(
*
(
cfgoptions
[
i
].
strptr
),
"%s"
,
cfgoptions
[
i
].
defstrval
);
printf_params
(
"[LIBCONFIG] %s set to default value
%s
\n
"
,
cfgpath
,
*
(
cfgoptions
[
i
].
strptr
));
printf_params
(
"[LIBCONFIG] %s set to default value
\"
%s
\"
\n
"
,
cfgpath
,
*
(
cfgoptions
[
i
].
strptr
));
}
else
{
sprintf
((
char
*
)(
cfgoptions
[
i
].
strptr
),
"%s"
,
cfgoptions
[
i
].
defstrval
);
printf_params
(
"[LIBCONFIG] %s set to default value
%s
\n
"
,
cfgpath
,
(
char
*
)
cfgoptions
[
i
].
strptr
);
sprintf
((
char
*
)
*
(
cfgoptions
[
i
].
strptr
),
"%s"
,
cfgoptions
[
i
].
defstrval
);
printf_params
(
"[LIBCONFIG] %s set to default value
\"
%s
\"\n
"
,
cfgpath
,
(
char
*
)
*
(
cfgoptions
[
i
].
strptr
)
);
}
}
else
{
notfound
=
1
;
...
...
@@ -374,6 +406,7 @@ void config_libconfig_end(void )
config_destroy
(
&
(
libconfig_privdata
.
cfg
));
if
(
libconfig_privdata
.
configfile
!=
NULL
)
{
free
(
libconfig_privdata
.
configfile
);
libconfig_privdata
.
configfile
=
NULL
;
}
}
common/ran_context.h
View file @
45302792
...
...
@@ -55,12 +55,18 @@ typedef struct {
int
nb_inst
;
/// Number of Component Carriers per instance in this node
int
*
nb_CC
;
/// Number of NB_IoT instances in this node
int
nb_nb_iot_rrc_inst
;
/// Number of MACRLC instances in this node
int
nb_macrlc_inst
;
/// Number of NB_IoT MACRLC instances in this node