Commit 32786cc7 authored by Francois TABURET's avatar Francois TABURET

Integration of configuration module. Temporarily keep the legacy mode.

lte-softmodem -O <config file> will trigger legacy config mode
ltesoftmodem  -O libconfig:<config file> will trigger configuration module usage.
parent 293bcf13
Branches unavailable
2024.w06 2024.w05 2024.w04 2024.w03 2024.w02 2024.w01 2023.w51 2023.w50 2023.w49 2023.w48 2023.w47 2023.w45 2023.w43 2023.w42 2023.w41 2023.w40 2023.w39 2023.w38 2023.w37 2023.w36 2023.w34 2023.w33 2023.w32 2023.w31 2023.w30 2023.w29 2023.w28 2023.w27 2023.w26 2023.w25 2023.w24 2023.w23 2023.w22 2023.w21 2023.w20 2023.w19 2023.w18 2023.w18b 2023.w16 2023.w15 2023.w14 2023.w13 2023.w12 2023.w11 2023.w11b 2023.w10 2023.w10b 2023.w09 2023.w08 2023.w08b 2023.w07 2023.w06 2023.w05 2023.w03 2023.w02 2022.42 2022.41 2022.w51 2022.w50 2022.w49 2022.w48 2022.w47 2022.w46 2022.w45 2022.w43 2022.w42 2022.w42b 2022.w41 2022.w40 2022.w39 2022.w38 2022.w37 2022.w37b 2022.w36 2022.w35 2022.w33 2022.w32 2022.w31 2022.w31b 2022.w30 2022.w29 2022.w26 2022.w25 2022.w24 2022.w24b 2022.w23 2022.w22 2022.w21 2022.w20 2022.w19 2022.w18 2022.w17 2022.w15 2022.w15b 2022.w14a 2022.w13 2022.w13b 2022.w13a 2022.w12 2022.w10 2022.w09 2022.w09b 2022.w08 2022.w08b 2022.w07 2022.w07b 2022.w06 2022.w06a 2022.w05 2022.w05b 2022.w03_hotfix 2022.w03_b 2022.w02 2022.w01 2021.wk46 2021.wk14_a 2021.wk13_d 2021.wk13_c 2021.w51_c 2021.w51_a 2021.w50_a 2021.w49_b 2021.w49_a 2021.w48 2021.w47 2021.w46 2021.w46-powder 2021.w45 2021.w45_b 2021.w44 2021.w43 2021.w42 2021.w37 2021.w36 2021.w35 2021.w34 2021.w33 2021.w32 2021.w31 2021.w30 2021.w29 2021.w28 2021.w27 2021.w26 2021.w25 2021.w24 2021.w23 2021.w22 2021.w20 2021.w19 2021.w18_b 2021.w18_a 2021.w17_b 2021.w16 2021.w15 2021.w14 2021.w13_a 2021.w12 2021.w11 2021.w10 2021.w09 2021.w08 2021.w06 2021.w05 2021.w04 2021.w02 2020.w51_2 2020.w51 2020.w50 2020.w49 2020.w48_2 2020.w48 2020.w47 2020.w46_2 2020.w46 2020.w45_2 2020.w45 2020.w44 2020.w42_2 2020.w42 2020.w41 2020.w39 2020.w38 2020.w37 2020.w36 2020.w34 2020.w33 2020.w31 2020.w30 2020.w29 2020.w28 2020.w26 2020.w25 2020.w24 2020.w23 2020.w22 2020.w19 2020.w17 2020.w16 2020.w15 2020.w11 2020.w09 2020.w06 2020.w05 2020.w04 2020.w03 2019.w51 2019.w44 2019.w41 2019.w36 2019.w30 2019.w28 2019.w27 2019.w25 2019.w23 2019.w21 2019.w17 2019.w15 2019.w13 2019.w11 2019.w10 2019.w09 2019.w08 2019.w07 2019.w06 2019.w04 2019.w03 2018.w51 2018.w48 2018.w47 2018.w46 2018.w44 2018.w41 2018.w40 2018.w39 2018.w36 2018.w33 2018.w31 2018.w29 2018.w25 2018.w19 2018.w15 2018.w12 2018.w11 2018.w10 2018.w09 2018.w08 2018.w07 2018.w06 2018.w05 2018.w04 2018.w03 2018.w02 2017.w48 2017.w46 2017.w43 2017.w42 v2.1.0 v2.0.0 v1.2.2 v1.2.1 v1.2.0 v1.1.1 v1.1.0 v1.0.3 v1.0.2 v1.0.1 v1.0.0 setparam osa-etsi-ws-ue osa-etsi-ws-try2 osa-etsi-ws-try1 osa-etsi-ws-gNB oai_nr_sync nr-ip-over-lte nr-ip-over-lte-v.1.5 nr-ip-over-lte-v.1.4 nr-ip-over-lte-v.1.3 nr-ip-over-lte-v.1.2 nr-ip-over-lte-v.1.1 nr-ip-over-lte-v.1.0 flexran-eol develop-nr-pdcch develop-nr-2020w03 develop-nr-2020w02 develop-nr-2019w51 develop-nr-2019w50 develop-nr-2019w48 develop-nr-2019w47 develop-nr-2019w45 develop-nr-2019w43 develop-nr-2019w42 develop-nr-2019w40 develop-nr-2019w28 develop-nr-2019w23 benetel_phase_rotation benetel_gnb_rel_2.0 benetel_gnb_rel_1.0 benetel_enb_rel_2.0 benetel_enb_rel_1.0
No related merge requests found
...@@ -37,43 +37,73 @@ ...@@ -37,43 +37,73 @@
int processoption(paramdef_t *cfgoptions, char *value) int processoption(paramdef_t *cfgoptions, char *value)
{ {
int ret = 0; int optisset=0;
int noarg=0;
if ((cfgoptions->paramflags &PARAMFLAG_BOOL) == 0) {
if (value == NULL) {
noarg=1;
} else if ( value[0] == '-') {
noarg = 1;
}
if (noarg == 1) {
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
return 0;
}
}
switch(cfgoptions->type) switch(cfgoptions->type)
{ {
case TYPE_STRING: case TYPE_STRING:
check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *)); config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
check_valptr(cfgoptions, cfgoptions->strptr, strlen(value+1)); config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(value+1));
sprintf(*(cfgoptions->strptr), "%s",value); sprintf(*(cfgoptions->strptr), "%s",value);
printf_cmdl("[LIBCONFIG] %s set to %s from command line\n", cfgoptions->optname, value); printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, value);
ret++; optisset=1;
break; break;
case TYPE_STRINGLIST:
break;
case TYPE_UINT: case TYPE_STRINGLIST:
case TYPE_INT: break;
case TYPE_UINT32:
case TYPE_INT32:
case TYPE_UINT16:
case TYPE_INT16:
case TYPE_UINT8:
case TYPE_INT8:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(value,NULL,0));
optisset=1;
break;
case TYPE_UINT64: case TYPE_UINT64:
case TYPE_INT64: case TYPE_INT64:
check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t)); config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
*(cfgoptions->uptr) =strtol(value,NULL,0); *(cfgoptions->i64ptr)=strtoll(value,NULL,0);
printf_cmdl("[LIBCONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr)); printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
ret++; optisset=1;
break; break;
case TYPE_UINTARRAY: case TYPE_UINTARRAY:
case TYPE_INTARRAY: case TYPE_INTARRAY:
break; break;
case TYPE_DOUBLE:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
*(cfgoptions->dblptr) = strtof(value,NULL);
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
optisset=1;
break;
case TYPE_IPV4ADDR: case TYPE_IPV4ADDR:
break; break;
default: default:
fprintf(stderr,"[LIBCONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type); fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
break; break;
} /* switch on param type */ } /* switch on param type */
return ret; if (optisset == 1) {
cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
}
return optisset;
} }
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
...@@ -101,9 +131,13 @@ char *cfgpath; ...@@ -101,9 +131,13 @@ char *cfgpath;
if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) { if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
continue; continue;
} }
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname); if (prefix != NULL) {
if ( strcmp(*p + 1,cfgoptions[i].shortopt) == 0 || sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
strcmp(*p + 2,cfgpath ) == 0 ) { } else {
sprintf(cfgpath,"%s",cfgoptions[i].optname);
}
if ( ((strlen(*p) > 1) && (strcmp(*p + 1,cfgoptions[i].shortopt) == 0)) ||
((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) {
p++; p++;
j =+ processoption(&(cfgoptions[i]), *p); j =+ processoption(&(cfgoptions[i]), *p);
c--; c--;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "config_userapi.h" #include "config_userapi.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so" #define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
int load_config_sharedlib(char *cfgmode, char *cfgP[], int numP, configmodule_interface_t *cfgptr) int load_config_sharedlib(configmodule_interface_t *cfgptr)
{ {
void *lib_handle; void *lib_handle;
char fname[128]; char fname[128];
...@@ -50,46 +50,46 @@ char libname[FILENAME_MAX]; ...@@ -50,46 +50,46 @@ char libname[FILENAME_MAX];
int st; int st;
st=0; st=0;
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgmode); sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
if (!lib_handle) { if (!lib_handle) {
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror()); fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
st = -1; st = -1;
} else { } else {
sprintf (fname,"config_%s_init",cfgmode); sprintf (fname,"config_%s_init",cfgptr->cfgmode);
cfgptr->init = dlsym(lib_handle,fname); cfgptr->init = dlsym(lib_handle,fname);
if (cfgptr->init == NULL ) { if (cfgptr->init == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n", printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode); __FILE__, __LINE__,fname, cfgptr->cfgmode);
} else { } else {
st=cfgptr->init(cfgP,numP); st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
printf("[CONFIG] function %s returned %i\n", printf("[CONFIG] function %s returned %i\n",
fname, st); fname, st);
} }
sprintf (fname,"config_%s_get",cfgmode); sprintf (fname,"config_%s_get",cfgptr->cfgmode);
cfgptr->get = dlsym(lib_handle,fname); cfgptr->get = dlsym(lib_handle,fname);
if (cfgptr->get == NULL ) { if (cfgptr->get == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n", printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode); __FILE__, __LINE__,fname, cfgptr->cfgmode);
st = -1; st = -1;
} }
sprintf (fname,"config_%s_getlist",cfgmode); sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
cfgptr->getlist = dlsym(lib_handle,fname); cfgptr->getlist = dlsym(lib_handle,fname);
if (cfgptr->getlist == NULL ) { if (cfgptr->getlist == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n", printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode); __FILE__, __LINE__,fname, cfgptr->cfgmode);
st = -1; st = -1;
} }
sprintf (fname,"config_%s_end",cfgmode); sprintf (fname,"config_%s_end",cfgptr->cfgmode);
cfgptr->end = dlsym(lib_handle,fname); cfgptr->end = dlsym(lib_handle,fname);
if (cfgptr->getlist == NULL ) { if (cfgptr->getlist == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n", printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode); __FILE__, __LINE__,fname, cfgptr->cfgmode);
} }
} }
...@@ -105,16 +105,11 @@ char *cfgparam=NULL; ...@@ -105,16 +105,11 @@ char *cfgparam=NULL;
char *modeparams=NULL; char *modeparams=NULL;
char *cfgmode=NULL; char *cfgmode=NULL;
char *strtokctx=NULL; char *strtokctx=NULL;
char *cfgP[CONFIG_MAX_OOPT_PARAMS]; char *atoken;
int i;
int p;
int i;
for(i=0; i<CONFIG_MAX_OOPT_PARAMS ; i++) {
cfgP[i]=NULL;
}
/* first parse the command line to look for the -O option */ /* first parse the command line to look for the -O option */
opterr=0; opterr=0;
while ((i = getopt(argc, argv, "O:")) != -1) { while ((i = getopt(argc, argv, "O:")) != -1) {
...@@ -122,6 +117,8 @@ int p; ...@@ -122,6 +117,8 @@ int p;
cfgparam = optarg; cfgparam = optarg;
} }
} }
optind=1;
/* look for the OAI_CONFIGMODULE environement variable */ /* look for the OAI_CONFIGMODULE environement variable */
if ( cfgparam == NULL ) { if ( cfgparam == NULL ) {
cfgparam = getenv("OAI_CONFIGMODULE"); cfgparam = getenv("OAI_CONFIGMODULE");
...@@ -138,36 +135,47 @@ int p; ...@@ -138,36 +135,47 @@ int p;
return NULL; return NULL;
} }
else if ( i == 1 ) { else if ( i == 1 ) {
/* -O argument doesn't contain ":" separator, legacy -O <conf file> option, default cfgmode to libconfig
with one parameter, the path to the configuration file */
modeparams=cfgmode; modeparams=cfgmode;
cfgmode=strdup("libconfig"); cfgmode=strdup("libconfig");
} }
cfgptr = malloc(sizeof(configmodule_interface_t)); cfgptr = malloc(sizeof(configmodule_interface_t));
memset(cfgptr,0,sizeof(configmodule_interface_t));
p=0; /* temporary, legacy mode */
cfgP[p]=strtok_r(modeparams,":",&strtokctx); if (i==1) cfgptr->rtflags = cfgptr->rtflags | CONFIG_LEGACY;
while ( p< CONFIG_MAX_OOPT_PARAMS && cfgP[p] != NULL) { /*--*/
cfgptr->argc = argc;
cfgptr->argv = argv;
cfgptr->cfgmode=strdup(cfgmode);
cfgptr->num_cfgP=0;
atoken=strtok_r(modeparams,":",&strtokctx);
while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
/* look for debug level in the config parameters, it is commom to all config mode
and will be removed frome the parameter array passed to the shared module */
char *aptr; char *aptr;
aptr=strcasestr(cfgP[p],"dbgl"); aptr=strcasestr(atoken,"dbgl");
if (aptr != NULL) { if (aptr != NULL) {
cfgptr->rtflags = strtol(aptr+4,NULL,0); cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].paramflags = Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].paramflags | PARAMFLAG_DONOTREAD;
for (int j=p; j<(CONFIG_MAX_OOPT_PARAMS-1); j++) cfgP[j] = cfgP[j+1]; } else {
p--; cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
cfgptr->num_cfgP++;
} }
p++; atoken = strtok_r(NULL,":",&strtokctx);
cfgP[p] = strtok_r(NULL,":",&strtokctx);
} }
printf("[CONFIG] get parameters from %s ",cfgmode); printf("[CONFIG] get parameters from %s ",cfgmode);
for (i=0;i<p; i++) { for (i=0;i<cfgptr->num_cfgP; i++) {
printf("%s ",cfgP[i]); printf("%s ",cfgptr->cfgP[i]);
} }
printf("\n"); printf("\n");
i=load_config_sharedlib(cfgmode, cfgP,p,cfgptr); i=load_config_sharedlib(cfgptr);
if (i< 0) { if (i< 0) {
fprintf(stderr,"[CONFIG] %s %d config module %s couldn't be loaded\n", __FILE__, __LINE__,cfgmode); fprintf(stderr,"[CONFIG] %s %d config module %s couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
return NULL; return NULL;
...@@ -180,26 +188,30 @@ int p; ...@@ -180,26 +188,30 @@ int p;
if (modeparams != NULL) free(modeparams); if (modeparams != NULL) free(modeparams);
if (cfgmode != NULL) free(cfgmode); if (cfgmode != NULL) free(cfgmode);
optind=1;
cfgptr->argc = argc;
cfgptr->argv = argv;
return cfgptr; return cfgptr;
} }
void end_configmodule() void end_configmodule()
{ {
if (cfgptr != NULL) { if (cfgptr != NULL) {
printf ("[CONFIG] free %u pointers\n",cfgptr->numptrs); 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++) { for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) { if (cfgptr->ptrs[i] != NULL) {
free(cfgptr->ptrs[i]); free(cfgptr->ptrs[i]);
} }
cfgptr->ptrs[i]=NULL; cfgptr->ptrs[i]=NULL;
} }
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
}
free(cfgptr); free(cfgptr);
cfgptr=NULL; cfgptr=NULL;
} }
......
...@@ -38,28 +38,34 @@ ...@@ -38,28 +38,34 @@
#include <stdlib.h> #include <stdlib.h>
#include "common/config/config_paramdesc.h" #include "common/config/config_paramdesc.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2... #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 alloted in the config module #define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
/* rtflags bit position definitions */ /* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing #define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages #define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 4 // print command line processing messages #define CONFIG_DEBUGCMDLINE 4 // print command line processing messages
/* temporary flag to be able to use legacy config mechanism */
#define CONFIG_LEGACY (1 << 10)
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix); 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); typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
typedef void(*configmodule_endfunc_t)(void); typedef void(*configmodule_endfunc_t)(void);
typedef struct configmodule_interface typedef struct configmodule_interface
{ {
int argc; int argc;
char **argv; char **argv;
char *cfgmode;
int num_cfgP;
char *cfgP[CONFIG_MAX_OOPT_PARAMS];
configmodule_initfunc_t init; configmodule_initfunc_t init;
configmodule_getfunc_t get; configmodule_getfunc_t get;
configmodule_getlistfunc_t getlist; configmodule_getlistfunc_t getlist;
configmodule_endfunc_t end; configmodule_endfunc_t end;
uint32_t numptrs; uint32_t numptrs;
uint32_t rtflags; uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t; } configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN #ifdef CONFIG_LOADCONFIG_MAIN
...@@ -75,7 +81,7 @@ static char config_helpstr [] =" \ ...@@ -75,7 +81,7 @@ static char config_helpstr [] =" \
#define CONFIGPARAM_DEBUGFLAGS_IDX 0 #define CONFIGPARAM_DEBUGFLAGS_IDX 0
static paramdef_t Config_Params[] = { static paramdef_t Config_Params[] = {
{"debugflags", "", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, {"debugflags", "", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
}; };
#else #else
......
...@@ -42,51 +42,64 @@ ...@@ -42,51 +42,64 @@
/* parameter flags definitions */ /* parameter flags definitions */
/* Flags to be used by calling modules in their parameters definitions: */ /* Flags to be used by calling modules in their parameters definitions to modify config module behavior*/
#define PARAMFLAG_DISABLECMDLINE (1 << 0) // parameter can bet set from comand line #define PARAMFLAG_MANDATORY (1 << 0) // parameter must be explicitely set, default value ignored
#define PARAMFLAG_DISABLECMDLINE (1 << 1) // parameter cannot bet set from comand line
#define PARAMFLAG_DONOTREAD (1 << 2) // parameter must be ignored in get function
#define PARAMFLAG_NOFREE (1 << 3) // don't free parameter in end function
#define PARAMFLAG_BOOL (1 << 4) // integer param can be 0 or 1
/* Flags used by config modules: */
/* flags to be used by caller modules when defining parameters */
#define PARAMFLAG_MANDATORY (1 << 1) // parameter must be explicitely set, default value ignored
/* flags used by config modules, at runtime to manage memory allocations */ /* Flags used by config modules to return info to calling modules and/or to for internal usage*/
#define PARAMFLAG_MALLOCINCONFIG (1 << 15) // parameter allocated in config module #define PARAMFLAG_MALLOCINCONFIG (1 << 15) // parameter allocated in config module
#define PARAMFLAG_NOFREE (1 << 14) // don't free parameter in end function #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
/* flags to be used by caller modules to modify get behavior */
#define PARAMFLAG_DONOTREAD (1 << 20) // parameter must be ignored in get function
typedef struct paramdef typedef struct paramdef
{ {
char optname[MAX_OPTNAME_SIZE]; char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char shortopt[MAX_SHORTOPT_SIZE]; char shortopt[MAX_SHORTOPT_SIZE]; /* short command line option */
char *helpstr; char *helpstr; /* help string */
unsigned int paramflags; unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { union { /* pointer to the parameter value, completed by the config module */
char **strptr; char **strptr;
char **strlistptr; char **strlistptr;
uint32_t *uptr; uint8_t *u8ptr;
int32_t *iptr; char *i8ptr;
uint64_t *u64ptr; uint16_t *u16ptr;
int64_t *i64ptr; int16_t *i16ptr;
uint32_t *uptr;
int32_t *iptr;
uint64_t *u64ptr;
int64_t *i64ptr;
double *dblptr;
} ; } ;
union { union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
char *defstrval; char *defstrval;
char **defstrlistval; char **defstrlistval;
uint32_t defuintval; uint32_t defuintval;
int defintval; int defintval;
uint64_t defint64val; uint64_t defint64val;
int *defintarrayval; int *defintarrayval;
double defdblval;
} ; } ;
char type; char type; /* parameter value type, as listed below as TYPE_XXXX macro */
int numelt; int numelt; /* number of elements in a list or array parameters or max size of string value */
} paramdef_t; } paramdef_t;
#define TYPE_INT TYPE_INT32
#define TYPE_UINT TYPE_UINT32
#define TYPE_STRING 1 #define TYPE_STRING 1
#define TYPE_INT 2 #define TYPE_INT8 2
#define TYPE_UINT 3 #define TYPE_UINT8 3
#define TYPE_INT64 4 #define TYPE_INT16 4
#define TYPE_UINT64 5 #define TYPE_UINT16 5
#define TYPE_INT32 6
#define TYPE_UINT32 7
#define TYPE_INT64 8
#define TYPE_UINT64 9
#define TYPE_MASK 10
#define TYPE_DOUBLE 16
#define TYPE_IPV4ADDR 20 #define TYPE_IPV4ADDR 20
...@@ -94,7 +107,7 @@ typedef struct paramdef ...@@ -94,7 +107,7 @@ typedef struct paramdef
#define TYPE_INTARRAY 51 #define TYPE_INTARRAY 51
#define TYPE_UINTARRAY 52 #define TYPE_UINTARRAY 52
#define TYPE_LIST 55 #define TYPE_LIST 55
#define NO_UINTDEFAULT ((int)(-1))
#define ANY_IPV4ADDR_STRING "0.0.0.0" #define ANY_IPV4ADDR_STRING "0.0.0.0"
typedef struct paramlist_def { typedef struct paramlist_def {
......
...@@ -47,7 +47,7 @@ configmodule_interface_t *config_get_if(void) ...@@ -47,7 +47,7 @@ configmodule_interface_t *config_get_if(void)
return cfgptr; return cfgptr;
} }
char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length) char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
{ {
printf_ptrs("-- %s 0x%08lx %i\n",cfgoptions->optname,(uintptr_t)(*ptr),length); printf_ptrs("-- %s 0x%08lx %i\n",cfgoptions->optname,(uintptr_t)(*ptr),length);
...@@ -60,13 +60,54 @@ char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ...@@ -60,13 +60,54 @@ char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
config_get_if()->numptrs++; config_get_if()->numptrs++;
} }
} else { } else {
fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__); fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1); exit(-1);
} }
} }
return *ptr; return *ptr;
} }
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val)
{
int tmpval=val;
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >1) {
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_printhelp(paramdef_t *params,int numparams) void config_printhelp(paramdef_t *params,int numparams)
{ {
for (int i=0 ; i<numparams ; i++) { for (int i=0 ; i<numparams ; i++) {
...@@ -80,12 +121,21 @@ int config_get(paramdef_t *params,int numparams, char *prefix) ...@@ -80,12 +121,21 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
{ {
int ret= -1; int ret= -1;
configmodule_interface_t *cfgif = config_get_if(); configmodule_interface_t *cfgif = config_get_if();
if (cfgif != NULL) { if (cfgif != NULL) {
ret = config_get_if()->get(params, numparams,prefix); ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) { if (ret >= 0) {
config_process_cmdline(params,numparams,prefix); config_process_cmdline(params,numparams,prefix);
} }
return ret;
}
return ret; return ret;
} }
return ret;
int config_isparamset(paramdef_t *params,int paramidx)
{
if ((params[paramidx].paramflags & PARAMFLAG_PARAMSET) != 0) {
return 1;
} else {
return 0;
}
} }
...@@ -38,12 +38,19 @@ ...@@ -38,12 +38,19 @@
extern "C" extern "C"
{ {
#endif #endif
#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))
extern configmodule_interface_t *config_get_if(void); extern configmodule_interface_t *config_get_if(void);
extern char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ; extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern void config_printhelp(paramdef_t *,int numparams); extern void config_printhelp(paramdef_t *,int numparams);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix); 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_get(paramdef_t *params,int numparams, char *prefix);
extern int config_isparamset(paramdef_t *params,int paramidx);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix);
#define config_getlist config_get_if()->getlist #define config_getlist config_get_if()->getlist
......
...@@ -58,16 +58,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -58,16 +58,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_setting_t *setting; config_setting_t *setting;
const char *str; char *str;
int i,u; int i,u;
long long int llu; long long int llu;
double dbl;
int rst; int rst;
int status=0; int status=0;
int notfound; int notfound;
int defval;
int fatalerror=0; int fatalerror=0;
char *cfgpath; /* listname.[listindex].paramname */ char *cfgpath; /* listname.[listindex].paramname */
int defvals=0; int numdefvals=0;
i = (prefix ==NULL) ? 0 : strlen(prefix); i = (prefix ==NULL) ? 0 : strlen(prefix);
cfgpath = malloc( i+ MAX_OPTNAME_SIZE +1); cfgpath = malloc( i+ MAX_OPTNAME_SIZE +1);
if (cfgpath == NULL) { if (cfgpath == NULL) {
...@@ -87,20 +89,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -87,20 +89,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
continue; continue;
} }
notfound=0; notfound=0;
defval=0;
switch(cfgoptions[i].type) switch(cfgoptions[i].type)
{ {
case TYPE_STRING: case TYPE_STRING:
if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, &str)) { if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
cfgpath,str,cfgoptions[i].numelt);
str[strlen(str)-1] = 0;
}
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); 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 { } else {
if( cfgoptions[i].defstrval != NULL) { if( cfgoptions[i].defstrval != NULL) {
defvals++; defval=1;
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1); config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); 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 { } else {
...@@ -114,8 +122,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -114,8 +122,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
read_strlist(&cfgoptions[i],setting,cfgpath); read_strlist(&cfgoptions[i],setting,cfgpath);
} else { } else {
if( cfgoptions[i].defstrlistval != NULL) { if( cfgoptions[i].defstrlistval != NULL) {
cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval; cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval;
defvals++; defval=1;
for(int j=0; j<cfgoptions[i].numelt; j++) for(int j=0; j<cfgoptions[i].numelt; j++)
printf_params("[LIBCONFIG] %s%i set to default value %s\n", cfgpath,j, cfgoptions[i].strlistptr[j]); printf_params("[LIBCONFIG] %s%i set to default value %s\n", cfgpath,j, cfgoptions[i].strlistptr[j]);
} else { } else {
...@@ -123,23 +131,21 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -123,23 +131,21 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
} }
} }
break; break;
case TYPE_UINT8:
case TYPE_UINT: case TYPE_INT8:
case TYPE_INT: case TYPE_UINT16:
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int)); case TYPE_INT16:
case TYPE_UINT32:
case TYPE_INT32:
case TYPE_MASK:
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) { if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
if(cfgoptions[i].type==TYPE_UINT) { config_assign_int(&(cfgoptions[i]),cfgpath,u);
*(cfgoptions[i].uptr) = (unsigned int)u;
printf_params("[LIBCONFIG] %s: %u\n", cfgpath,*(cfgoptions[i].uptr) );
} else {
*(cfgoptions[i].iptr) = u;
printf_params("[LIBCONFIG] %s: %i\n", cfgpath,*(cfgoptions[i].iptr) );
}
} else { } else {
if( cfgoptions[i].defuintval != NO_UINTDEFAULT) { if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions[i].uptr)=cfgoptions[i].defuintval; config_assign_int(&(cfgoptions[i]),cfgpath,cfgoptions[i].defintval);
defvals++; defval=1;
printf_params("[LIBCONFIG] %s set to default value %i\n", cfgpath, (int32_t)(*(cfgoptions[i].uptr))); printf_params("[LIBCONFIG] %s set to default value\n", cfgpath);
} else { } else {
notfound=1; notfound=1;
} }
...@@ -147,7 +153,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -147,7 +153,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
break; break;
case TYPE_UINT64: case TYPE_UINT64:
case TYPE_INT64: case TYPE_INT64:
check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) { if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
if(cfgoptions[i].type==TYPE_UINT64) { if(cfgoptions[i].type==TYPE_UINT64) {
*(cfgoptions[i].u64ptr) = (uint64_t)llu; *(cfgoptions[i].u64ptr) = (uint64_t)llu;
...@@ -157,9 +163,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -157,9 +163,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
} }
} else { } else {
if( cfgoptions[i].defuintval != NO_UINTDEFAULT) { if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions[i].u64ptr)=cfgoptions[i].defuintval; *(cfgoptions[i].u64ptr)=cfgoptions[i].defuintval;
defvals++; defval=1;
printf_params("[LIBCONFIG] %s set to default value %llu\n", cfgpath, (long long unsigned)(*(cfgoptions[i].u64ptr))); printf_params("[LIBCONFIG] %s set to default value %llu\n", cfgpath, (long long unsigned)(*(cfgoptions[i].u64ptr)));
} else { } else {
notfound=1; notfound=1;
...@@ -173,9 +179,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -173,9 +179,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
read_intarray(&cfgoptions[i],setting,cfgpath); read_intarray(&cfgoptions[i],setting,cfgpath);
} else { } else {
if( cfgoptions[i].defintarrayval != NULL) { if( cfgoptions[i].defintarrayval != NULL) {
check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t)); config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t));
cfgoptions[i].iptr=cfgoptions[i].defintarrayval; cfgoptions[i].iptr=cfgoptions[i].defintarrayval;
defvals++; defval=1;
for (int j=0; j<cfgoptions[i].numelt ; j++) { for (int j=0; j<cfgoptions[i].numelt ; j++) {
printf_params("[LIBCONFIG] %s[%i] set to default value %i\n", cfgpath,j,(int)cfgoptions[i].iptr[j]); printf_params("[LIBCONFIG] %s[%i] set to default value %i\n", cfgpath,j,(int)cfgoptions[i].iptr[j]);
} }
...@@ -184,11 +190,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -184,11 +190,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
} }
} }
break; break;
case TYPE_DOUBLE:
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
*(cfgoptions[i].dblptr) = dbl;
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
} else {
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions[i].u64ptr)=cfgoptions[i].defdblval;
defval=1;
printf_params("[LIBCONFIG] %s set to default value %lf\n", cfgpath, *(cfgoptions[i].dblptr));
} else {
notfound=1;
}
}
break;
case TYPE_IPV4ADDR: case TYPE_IPV4ADDR:
check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int)); config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int));
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, &str)) { if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
str=cfgoptions[i].defstrval; str=cfgoptions[i].defstrval;
defvals++; defval=1;
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, str); printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, str);
} }
if (str != NULL) { if (str != NULL) {
...@@ -231,12 +252,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) ...@@ -231,12 +252,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
printf("\n"); printf("\n");
} }
} else { } else {
if (defval == 1) {
numdefvals++;
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
} else {
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET;
}
status++; status++;
} }
} /* for loop on options */ } /* for loop on options */
printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n", printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n",
((prefix == NULL)?"(root)":prefix), ((prefix == NULL)?"(root)":prefix),
status,numoptions,defvals ); status,numoptions,numdefvals );
if (fatalerror == 1) { if (fatalerror == 1) {
fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile ); fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
config_libconfig_end(); config_libconfig_end();
...@@ -310,13 +337,13 @@ int config_libconfig_init(char *cfgP[], int numP) ...@@ -310,13 +337,13 @@ int config_libconfig_init(char *cfgP[], int numP)
config_init(&(libconfig_privdata.cfg)); config_init(&(libconfig_privdata.cfg));
libconfig_privdata.configfile = strdup((char *)cfgP[0]); libconfig_privdata.configfile = strdup((char *)cfgP[0]);
config_get_if()->numptrs=0; config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS); memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
/* Read the file. If there is an error, report it and exit. */ /* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) { if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
fprintf(stderr,"[LIBCONFIG] %s:%d - %s\n", config_error_file(&(libconfig_privdata.cfg)), fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__,
config_error_line(&(libconfig_privdata.cfg)), config_error_text(&(libconfig_privdata.cfg))); libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
config_error_text(&(libconfig_privdata.cfg)));
config_destroy(&(libconfig_privdata.cfg)); config_destroy(&(libconfig_privdata.cfg));
printf( "\n"); printf( "\n");
return -1; return -1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* \warning * \warning
*/ */
#include "lte-softmodem.h"
#include "T.h" #include "T.h"
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "common/config/config_userapi.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
...@@ -95,7 +96,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -95,7 +96,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "PHY/TOOLS/lte_phy_scope.h" #include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h" #include "stats.h"
#endif #endif
#include "lte-softmodem.h"
#ifdef XFORMS #ifdef XFORMS
...@@ -623,14 +624,125 @@ void *l2l1_task(void *arg) { ...@@ -623,14 +624,125 @@ void *l2l1_task(void *arg) {
} }
#endif #endif
static void get_options(void) {
int CC_id;
int clock_src;
int tddflag;
char *loopfile=NULL;
int dumpframe;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
if (tddflag > 0) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
frame_parms[CC_id]->frame_type = TDD;
}
if (strlen(in_path) > 0) {
opt_type = OPT_PCAP;
opt_enabled=1;
printf("Enabling OPT for PCAP with the following file %s \n",in_path);
}
if (strlen(in_ip) > 0) {
opt_enabled=1;
opt_type = OPT_WIRESHARK;
printf("Enabling OPT for wireshark for local interface");
}
if (UE_flag > 0) {
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);
if (loopfile != NULL) {
printf("Input file for hardware emulation: %s",loopfile);
mode=loop_through_memory;
input_fd = fopen(loopfile,"r");
AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
}
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach;
if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect;
if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx;
if (dumpframe > 0) mode = rx_dump_frame;
if ( downlink_frequency[0][0] > 0) {
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
downlink_frequency[CC_id][1] = downlink_frequency[0][0];
downlink_frequency[CC_id][2] = downlink_frequency[0][0];
downlink_frequency[CC_id][3] = downlink_frequency[0][0];
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
}
UE_scan=0;
}
if (frame_parms[0]->N_RB_DL !=0) {
if ( frame_parms[0]->N_RB_DL < 6 ) {
frame_parms[0]->N_RB_DL = 6;
printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 100 ) {
frame_parms[0]->N_RB_DL = 100;
printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) {
frame_parms[0]->N_RB_DL = 50;
printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) {
frame_parms[0]->N_RB_DL = 25;
printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL);
}
UE_scan = 0;
frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL;
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id]->N_RB_DL=frame_parms[0]->N_RB_DL;
frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL;
}
}
for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++) {
tx_max_power[CC_id]=tx_max_power[0];
rx_gain[0][CC_id] = rx_gain[0][0];
tx_gain[0][CC_id] = tx_gain[0][0];
}
} /* UE_flag > 0 */
#if T_TRACER
paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);
#endif
if (UE_flag == 0) {
memset((void*)&RC,0,sizeof(RC));
/* Read RC configuration file */
RCConfig(NULL);
NB_eNB_INST = RC.nb_inst;
NB_RU = RC.nb_RU;
printf("Configuration: nb_inst %d, nb_ru %d\n",NB_eNB_INST,NB_RU);
} else if (UE_flag == 1) {
if (conf_config_file_name != NULL) {
// Here the configuration file is the XER encoded UE capabilities
// Read it in and store in asn1c data structures
strcpy(uecap_xer,conf_config_file_name);
uecap_xer_in=1;
static void get_options (int argc, char **argv) { }
}
}
static void old_get_options (int argc, char **argv) {
int c; int c;
// char line[1000]; // char line[1000];
// int l; // int l;
int k,i;//,j,k; int i;
#if defined(OAI_USRP) || defined(CPRIGW) #if defined(OAI_USRP) || defined(CPRIGW)
int clock_src; int clock_src;
#endif #endif
...@@ -1233,7 +1345,7 @@ void init_openair0() { ...@@ -1233,7 +1345,7 @@ void init_openair0() {
} }
void wait_RUs() { void wait_RUs(void) {
LOG_I(PHY,"Waiting for RUs to be configured ...\n"); LOG_I(PHY,"Waiting for RUs to be configured ...\n");
...@@ -1249,7 +1361,7 @@ void wait_RUs() { ...@@ -1249,7 +1361,7 @@ void wait_RUs() {
LOG_I(PHY,"RUs configured\n"); LOG_I(PHY,"RUs configured\n");
} }
void wait_eNBs() { void wait_eNBs(void) {
int i,j; int i,j;
int waiting=1; int waiting=1;
...@@ -1271,12 +1383,11 @@ void wait_eNBs() { ...@@ -1271,12 +1383,11 @@ void wait_eNBs() {
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
int i,j,k,aa,re; int i;
#if defined (XFORMS) #if defined (XFORMS)
void *status; void *status;
#endif #endif
int inst;
int CC_id; int CC_id;
int ru_id; int ru_id;
uint8_t abstraction_flag=0; uint8_t abstraction_flag=0;
...@@ -1287,7 +1398,11 @@ int main( int argc, char **argv ) ...@@ -1287,7 +1398,11 @@ int main( int argc, char **argv )
#endif #endif
start_background_system(); start_background_system();
if ( load_configmodule(argc,argv) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
#ifdef DEBUG_CONSOLE #ifdef DEBUG_CONSOLE
setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0);
...@@ -1310,8 +1425,15 @@ int main( int argc, char **argv ) ...@@ -1310,8 +1425,15 @@ int main( int argc, char **argv )
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
// get options and fill parameters from configuration file // get options and fill parameters from configuration file
get_options (argc, argv); //Command-line options, enb_properties // temporary test to allow legacy config or config module */
if ( CONFIG_ISFLAGSET(CONFIG_LEGACY) == 0) {
printf("configuration via the configuration module \n");
get_options (); //Command-line options, enb_properties
} else {
printf("Legacy configuration mode \n");
old_get_options (argc,argv);
}
#if T_TRACER #if T_TRACER
...@@ -1738,7 +1860,7 @@ int main( int argc, char **argv ) ...@@ -1738,7 +1860,7 @@ int main( int argc, char **argv )
sync_var=0; sync_var=0;
pthread_cond_broadcast(&sync_cond); pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex); pthread_mutex_unlock(&sync_mutex);
end_configmodule();
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
......
...@@ -40,6 +40,131 @@ ...@@ -40,6 +40,131 @@
#endif #endif
#endif #endif
/* help strings definition for command line options */
#define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n"
#define CONFIG_HLP_ULMAXE "set the eNodeB max ULSCH erros\n"
#define CONFIG_HLP_CALUER "set UE RX calibration\n"
#define CONFIG_HLP_CALUERM ""
#define CONFIG_HLP_CALUERB ""
#define CONFIG_HLP_DBGUEPR "UE run normal prach power ramping, but don't continue random-access\n"
#define CONFIG_HLP_CALPRACH "UE run normal prach with maximum power, but don't continue random-access\n"
#define CONFIG_HLP_NOL2CN "bypass L2 and upper layers\n"
#define CONFIG_HLP_UERXG "set UE RX gain\n"
#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n"
#define CONFIG_HLP_UETXG "set UE TX gain\n"
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use an external clock reference\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset"
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
#define CONFIG_HLP_FLOG "Enable PDCP RCP online log file\n"
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
#define CONFIG_HLP_TPORT "tracer port\n"
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
/* command line options definitions */
#define CMDLINE_CALIBUERX_IDX 0
#define CMDLINE_CALIBUERXMED_IDX 1
#define CMDLINE_CALIBUERXBYP_IDX 2
#define CMDLINE_DEBUGUEPRACH_IDX 3
#define CMDLINE_NOL2CONNECT_IDX 4
#define CMDLINE_CALIBPRACHTX_IDX 5
#define CMDLINE_MEMLOOP_IDX 6
#define CMDLINE_UEMODEPARAMS_DESC { \
{"calib-ue-rx", "", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"calib-ue-rx-med", "", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"calib-ue-rx-byp", "", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"debug-ue-prach", "", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"no-L2-connect", "", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"calib-prach-tx", "", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"loop-memory", "", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
{"ue-dump-frame", "", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
}
#define CMDLINE_UEPARAMS_DESC { \
{"ue-rxgain", "", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-rxgain-off", "", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-txgain", "", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-nb-ant-rx", "", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-nb-ant-tx", "", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", "", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
{"ue-max-power", "", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"" , "r", CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:0, TYPE_UINT8, 0}, \
}
extern int16_t dlsch_demod_shift;
#define CMDLINE_PARAMS_DESC { \
{"rf-config-file", "", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)}, \
{"ulsch-max-errors", "", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", "", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", "", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", "", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", "", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", "", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable","", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"threadIQ", "", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
{"threadOddSubframe", "", NULL, 0, iptr:&(threads.odd), defintval:1, TYPE_INT, 0}, \
{"threadEvenSubframe", "", NULL, 0, iptr:&(threads.even), defintval:1, TYPE_INT, 0}, \
{"dlsch-demod-shift", "", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"" , "A", CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"" , "C", CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
{"" , "a", CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"" , "d", CONFIG_HLP_SOFTS, 0, i8ptr:&do_forms, defintval:0, TYPE_INT8, 0}, \
{"" , "E", CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"" , "K", CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"" , "U", CONFIG_HLP_UE, PARAMFLAG_BOOL, i8ptr:&UE_flag, defintval:0, TYPE_INT8, 0}, \
{"" , "m", CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"" , "t", CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"" , "W", CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
{"" , "P", CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \
{"" , "V", CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \
{"" , "q", CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"" , "R", CONFIG_HLP_FLOG, PARAMFLAG_BOOL, iptr:&online_log_messages, defintval:0, TYPE_INT, 0}, \
{"" , "g", CONFIG_HLP_LOGL, 0, i16ptr:&glog_level, defintval:1, TYPE_INT16, 0}, \
{"" , "G", CONFIG_HLP_LOGV, 0, i16ptr:&glog_verbosity, defintval:0, TYPE_INT16, 0}, \
{"" , "S", CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"" , "T", CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0} \
}
extern int T_port;
extern int T_wait;
extern int T_dont_fork;
#define CMDLINE_TTRACEPARAMS_DESC { \
{"T_port", "", CONFIG_HLP_TPORT, 0, uptr:&T_port, defuintval:0, TYPE_UINT, 0}, \
{"T_nowait", "", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, uptr:&T_nowait, defuintval:0, TYPE_UINT, 0}, \
{"T_dont_fork", "", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, uptr:&T_dont_fork, defuintval:1, TYPE_UINT, 0}, \
}
/* */
extern pthread_cond_t sync_cond; extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex; extern pthread_mutex_t sync_mutex;
extern int sync_var; extern int sync_var;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment