Commit 65b399fc authored by laurent's avatar laurent

fix bugs in config module and config usage

fix bug from this MR

fix bug from this MR

stupid-mistake
parent 61312ca6
...@@ -53,13 +53,15 @@ int parse_stringlist(paramdef_t *cfgoptions, char *val) { ...@@ -53,13 +53,15 @@ int parse_stringlist(paramdef_t *cfgoptions, char *val) {
} }
free(tmpval); free(tmpval);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
AssertFatal(MAX_LIST_SIZE > numelt, "");
config_check_valptr(cfgoptions, sizeof(char*), numelt);
cfgoptions->numelt=numelt; cfgoptions->numelt=numelt;
atoken=strtok_r(val, ",",&tokctx); atoken=strtok_r(val, ",",&tokctx);
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) { for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1); snprintf(cfgoptions->strlistptr[i],DEFAULT_EXTRA_SZ,"%s",atoken);
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]); printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
atoken=strtok_r(NULL, ",",&tokctx); atoken=strtok_r(NULL, ",",&tokctx);
} }
...@@ -84,13 +86,14 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -84,13 +86,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
char *charptr; char *charptr;
case TYPE_STRING: case TYPE_STRING:
if (cfgoptions->numelt == 0 ) { if (cfgoptions->numelt == 0 )
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1); config_check_valptr(cfgoptions, 1,
sprintf(*(cfgoptions->strptr), "%s",tmpval); strlen(tmpval)+1);
} else { if (cfgoptions->numelt < (strlen(tmpval)+1)) {
sprintf( (char *)(cfgoptions->strptr), "%s",tmpval); 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("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
optisset=1; optisset=1;
break; break;
...@@ -105,7 +108,7 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -105,7 +108,7 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_INT16: case TYPE_INT16:
case TYPE_UINT8: case TYPE_UINT8:
case TYPE_INT8: case TYPE_INT8:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0)); config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
if( *charptr != 0) { if( *charptr != 0) {
...@@ -117,14 +120,14 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -117,14 +120,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_UINT64: case TYPE_UINT64:
case TYPE_INT64: case TYPE_INT64:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
*(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0); *(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
if( *charptr != 0) { if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname); 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("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*cfgoptions->i64ptr);
optisset=1; optisset=1;
break; break;
...@@ -133,8 +136,8 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -133,8 +136,8 @@ int processoption(paramdef_t *cfgoptions, char *value) {
break; break;
case TYPE_DOUBLE: case TYPE_DOUBLE:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
*(cfgoptions->dblptr) = strtof(tmpval,&charptr); *cfgoptions->dblptr = strtof(tmpval,&charptr);
if( *charptr != 0) { if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname); CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
......
...@@ -336,17 +336,18 @@ void end_configmodule(void) { ...@@ -336,17 +336,18 @@ void end_configmodule(void) {
cfgptr->end(); cfgptr->end();
} }
pthread_mutex_lock(&cfgptr->memBlocks_mutex);
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs); 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 && cfgptr->ptrsAllocated[i] == true) { if (cfgptr->oneBlock[i].ptrs != NULL && cfgptr->oneBlock[i].ptrsAllocated== true && cfgptr->oneBlock[i].toFree) {
free(cfgptr->ptrs[i]); free(cfgptr->oneBlock[i].ptrs);
cfgptr->ptrs[i]=NULL; memset(&cfgptr->oneBlock[i], 0, sizeof(cfgptr->oneBlock[i]));
cfgptr->ptrsAllocated[i] = false;
} }
} }
cfgptr->numptrs=0; cfgptr->numptrs=0;
pthread_mutex_unlock(&cfgptr->memBlocks_mutex);
} }
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "common/config/config_paramdesc.h" #include "common/config/config_paramdesc.h"
#include "common/utils/T/T.h" #include "common/utils/T/T.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 allocated in the config module #define CONFIG_MAX_ALLOCATEDPTRS 2048 // maximum number of parameters that can be dynamicaly allocated in the config module
/* default values for configuration module parameters */ /* default values for configuration module parameters */
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file #define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
...@@ -62,6 +62,14 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); ...@@ -62,6 +62,14 @@ 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 oneBlock_s{
void *ptrs;
int sz;
bool toFree;
bool ptrsAllocated;
} oneBlock_t;
typedef struct configmodule_interface { typedef struct configmodule_interface {
int argc; int argc;
char **argv; char **argv;
...@@ -73,10 +81,10 @@ typedef struct configmodule_interface { ...@@ -73,10 +81,10 @@ typedef struct configmodule_interface {
configmodule_getfunc_t get; configmodule_getfunc_t get;
configmodule_getlistfunc_t getlist; configmodule_getlistfunc_t getlist;
configmodule_endfunc_t end; configmodule_endfunc_t end;
pthread_mutex_t memBlocks_mutex;
uint32_t numptrs; uint32_t numptrs;
uint32_t rtflags; uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; oneBlock_t oneBlock[CONFIG_MAX_ALLOCATEDPTRS];
bool ptrsAllocated[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t; } configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN #ifdef CONFIG_LOADCONFIG_MAIN
......
...@@ -96,11 +96,13 @@ typedef union checkedparam { ...@@ -96,11 +96,13 @@ typedef union checkedparam {
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */ /* 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 */ /* config apis used to retrieve parameters values */
#define MAX_LIST_SIZE 32
#define DEFAULT_EXTRA_SZ 256
typedef struct paramdef { typedef struct paramdef {
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */ char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char *helpstr; /* help string */ char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */ unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */ union { /* pointer to the parameter value, completed by the config module */
char **strptr; char **strptr;
char **strlistptr; char **strlistptr;
uint8_t *u8ptr; uint8_t *u8ptr;
......
...@@ -52,59 +52,95 @@ configmodule_interface_t *config_get_if(void) { ...@@ -52,59 +52,95 @@ configmodule_interface_t *config_get_if(void) {
return cfgptr; return cfgptr;
} }
char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { static int managed_ptr_sz(void* ptr) {
if (ptr == NULL ) { configmodule_interface_t * cfg=config_get_if();
ptr = malloc(sizeof(char *)); AssertFatal(cfg->numptrs < CONFIG_MAX_ALLOCATEDPTRS,"");
int i;
if (ptr != NULL) { pthread_mutex_lock(&cfg->memBlocks_mutex);
*ptr=NULL; int numptrs=cfg->numptrs;
cfgoptions->strptr=ptr; for (i=0; i<numptrs; i++ )
if (cfg->oneBlock[i].ptrs == ptr)
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { break;
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr; pthread_mutex_unlock(&cfg->memBlocks_mutex);
config_get_if()->ptrsAllocated[config_get_if()->numptrs] = true; if ( i == numptrs )
config_get_if()->numptrs++; return -1;
} else
} else { return cfg->oneBlock[i].sz;
CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, cannot allocate pointer: %s \n", }
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
}
}
printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length); void *config_allocate_new(int sz, bool autoFree) {
void *ptr = calloc(sz,1);
if (ptr != NULL) {
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);
} else
AssertFatal(false, "calloc fails\n");
return ptr;
}
if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */ void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt) {
if (*ptr != NULL) {
return *ptr; const bool toFree=!(cfgoptions->paramflags & PARAMFLAG_NOFREE);
} else {
CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n", // let's see if the value has been read
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt); // 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 (*ptr == NULL) { if (cfgoptions->voidptr == NULL ) {
// LTS: dummy fix, waiting Francois full fix in 4G branch if (cfgoptions->type == TYPE_STRING) {
// the issue is we don't know at this point the size we will get // difficult datamodel
// for parmeters on the command line, cfgoptions->strptr = config_allocate_new(sizeof(*cfgoptions->strptr), toFree);
// The length sould probably managed, in a later version } else if ( cfgoptions->type == TYPE_STRINGLIST) {
// 100 is a very large value for a string parameter of today OAI AssertFatal(nb_elt<MAX_LIST_SIZE, "");
if (length<100) cfgoptions->strlistptr= config_allocate_new(sizeof(char*)*MAX_LIST_SIZE, toFree);
length=100; for (int i=0; i<MAX_LIST_SIZE; i++)
*ptr = malloc(length); cfgoptions->strlistptr[i]= config_allocate_new(DEFAULT_EXTRA_SZ, toFree);
if ( *ptr != NULL) {
memset(*ptr,0,length);
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
config_get_if()->numptrs++;
}
} else { } else {
CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); 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);
} }
} }
return *ptr; 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) { void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
...@@ -156,7 +192,7 @@ void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) { ...@@ -156,7 +192,7 @@ void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
} }
} }
void config_assign_processedint(paramdef_t *cfgoption, int val) { void config_assign_processedint(paramdef_t *cfgoption, int val) {
cfgoption->processedvalue = malloc(sizeof(int)); cfgoption->processedvalue = config_allocate_new(sizeof(int),!(cfgoption->paramflags & PARAMFLAG_NOFREE));
if ( cfgoption->processedvalue != NULL) { if ( cfgoption->processedvalue != NULL) {
*(cfgoption->processedvalue) = val; *(cfgoption->processedvalue) = val;
...@@ -172,7 +208,7 @@ int config_get_processedint(paramdef_t *cfgoption) { ...@@ -172,7 +208,7 @@ int config_get_processedint(paramdef_t *cfgoption) {
ret=*(cfgoption->processedvalue); ret=*(cfgoption->processedvalue);
free( cfgoption->processedvalue); free( cfgoption->processedvalue);
cfgoption->processedvalue=NULL; cfgoption->processedvalue=NULL;
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret); printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *cfgoption->strptr, ret);
} else { } else {
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname); fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
ret=0; ret=0;
...@@ -344,7 +380,7 @@ int config_check_intrange(paramdef_t *param) { ...@@ -344,7 +380,7 @@ int config_check_intrange(paramdef_t *param) {
void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) { void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ", fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
fname,param->optname, *(param->strptr)); fname,param->optname, *param->strptr);
for ( int i=0; i<numokval ; i++) { for ( int i=0; i<numokval ; i++) {
fprintf(stderr, " %s",okval[i]); fprintf(stderr, " %s",okval[i]);
...@@ -360,7 +396,7 @@ int config_check_strval(paramdef_t *param) { ...@@ -360,7 +396,7 @@ int config_check_strval(paramdef_t *param) {
} }
for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) { for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) { if( strcasecmp(*param->strptr,param->chkPptr->s3.okstrval[i] ) == 0) {
return 0; return 0;
} }
} }
...@@ -371,7 +407,7 @@ int config_check_strval(paramdef_t *param) { ...@@ -371,7 +407,7 @@ int config_check_strval(paramdef_t *param) {
int config_checkstr_assign_integer(paramdef_t *param) { int config_checkstr_assign_integer(paramdef_t *param) {
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) { for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) { if (strcasecmp(*param->strptr,param->chkPptr->s3a.okstrval[i] ) == 0) {
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]); config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
return 0; return 0;
} }
...@@ -393,14 +429,14 @@ int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) { ...@@ -393,14 +429,14 @@ int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
if( cfgoptions->defstrval != NULL) { if( cfgoptions->defstrval != NULL) {
status=1; status=1;
if (cfgoptions->numelt == 0 ) { if (cfgoptions->numelt == 0 )
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1); config_check_valptr(cfgoptions, 1, strlen(cfgoptions->defstrval)+1);
sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval); if ( cfgoptions->numelt < strlen(cfgoptions->defstrval)+1 ) {
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr)); CONFIG_PRINTF_ERROR("[CONFIG] %s size too small\n", cfgoptions->optname);
} else {
sprintf((char *)(cfgoptions->strptr), "%s",cfgoptions->defstrval);
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)(cfgoptions->strptr));
} }
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; return status;
...@@ -422,7 +458,7 @@ int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) { ...@@ -422,7 +458,7 @@ int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) {
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) { int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
int status = 0; int status = 0;
config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval); config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
...@@ -435,7 +471,7 @@ int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) { ...@@ -435,7 +471,7 @@ int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) { int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) {
int status = 0; int status = 0;
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->u64ptr)=cfgoptions->defuintval; *(cfgoptions->u64ptr)=cfgoptions->defuintval;
...@@ -450,7 +486,7 @@ int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) { ...@@ -450,7 +486,7 @@ int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
int status = 0; int status = 0;
if( cfgoptions->defintarrayval != NULL) { if( cfgoptions->defintarrayval != NULL) {
config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t *)); config_check_valptr(cfgoptions, sizeof(cfgoptions->iptr), cfgoptions->numelt);
cfgoptions->iptr=cfgoptions->defintarrayval; cfgoptions->iptr=cfgoptions->defintarrayval;
status=1; status=1;
...@@ -464,7 +500,7 @@ int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) { ...@@ -464,7 +500,7 @@ int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) { int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
int status = 0; int status = 0;
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->dblptr)=cfgoptions->defdblval; *(cfgoptions->dblptr)=cfgoptions->defdblval;
...@@ -476,7 +512,7 @@ int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) { ...@@ -476,7 +512,7 @@ int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
} }
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) { int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int)); config_check_valptr(cfgoptions, sizeof(*cfgoptions->uptr), 1);
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr ); int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
if (rst == 1 && *(cfgoptions->uptr) > 0) { if (rst == 1 && *(cfgoptions->uptr) > 0) {
......
...@@ -51,7 +51,7 @@ extern int config_paramidx_fromname(paramdef_t *params,int numparams, char *name ...@@ -51,7 +51,7 @@ extern int config_paramidx_fromname(paramdef_t *params,int numparams, char *name
/* utility functions, to be used by configuration module and/or configuration libraries */ /* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void); extern configmodule_interface_t *config_get_if(void);
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ; void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt);
extern void config_printhelp(paramdef_t *,int numparams, char *prefix); extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
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 void config_assign_processedint(paramdef_t *cfgoption, int val); extern void config_assign_processedint(paramdef_t *cfgoption, int val);
...@@ -86,7 +86,7 @@ extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix); ...@@ -86,7 +86,7 @@ extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_intlist(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_double(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_ipv4addr(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]) #define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* \warning * \warning
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
#include <pthread.h>
#include <libconfig.h> #include <libconfig.h>
#include <string.h> #include <string.h>
...@@ -41,6 +42,7 @@ ...@@ -41,6 +42,7 @@
#include "config_libconfig_private.h" #include "config_libconfig_private.h"
#include "../config_userapi.h" #include "../config_userapi.h"
#include "errno.h" #include "errno.h"
#include "assertions.h"
#if ( LIBCONFIG_VER_MAJOR == 1 && LIBCONFIG_VER_MINOR < 5) #if ( LIBCONFIG_VER_MAJOR == 1 && LIBCONFIG_VER_MINOR < 5)
#define config_setting_lookup config_lookup_from #define config_setting_lookup config_lookup_from
...@@ -53,17 +55,16 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath ...@@ -53,17 +55,16 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
int st; int st;
int numelt; int numelt;
numelt=config_setting_length(setting); numelt=config_setting_length(setting);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt); config_check_valptr(cfgoptions, sizeof(char *), numelt);
st=0; st=0;
AssertFatal(MAX_LIST_SIZE > numelt, "");
for (int i=0; i< numelt ; i++) { for (int i=0; i< numelt ; i++) {
str=config_setting_get_string_elem(setting,i); str=config_setting_get_string_elem(setting,i);
if (str==NULL) { if (str==NULL) {
printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i); printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i);
} else { } else {
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1); snprintf(cfgoptions->strlistptr[i], DEFAULT_EXTRA_SZ, "%s",str);
sprintf(cfgoptions->strlistptr[i],"%s",str);
st++; st++;
printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]); printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
} }
...@@ -77,7 +78,8 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat ...@@ -77,7 +78,8 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat
cfgoptions->numelt=config_setting_length(setting); cfgoptions->numelt=config_setting_length(setting);
if (cfgoptions->numelt > 0) { if (cfgoptions->numelt > 0) {
cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt)); cfgoptions->iptr=config_allocate_new(cfgoptions->numelt*sizeof(*cfgoptions->iptr),
!(cfgoptions->paramflags & PARAMFLAG_NOFREE) );
for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) { for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i); cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
...@@ -123,23 +125,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { ...@@ -123,23 +125,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
switch(cfgoptions[i].type) { switch(cfgoptions[i].type) {
case TYPE_STRING: case TYPE_STRING:
if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, (const char**)&str)) { if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, (const char**)&str)) {
if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { config_check_valptr(&(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", fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
cfgpath,str,cfgoptions[i].numelt); cfgpath,str,cfgoptions[i].numelt);
str[strlen(str)-1] = 0; snprintf( *cfgoptions[i].strptr , cfgoptions[i].numelt, "%s", str);
} printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath, *cfgoptions[i].strptr);
if (cfgoptions[i].numelt == 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);
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 );
}
} else { } else {
defval=config_setdefault_string(&(cfgoptions[i]),prefix); defval=config_setdefault_string(&cfgoptions[i],prefix);
} }
break; break;
...@@ -163,7 +156,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { ...@@ -163,7 +156,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
case TYPE_INT32: case TYPE_INT32:
case TYPE_MASK: case TYPE_MASK:
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) { if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t)); config_check_valptr(&(cfgoptions[i]), sizeof(*cfgoptions[i].iptr), 1);
config_assign_int(&(cfgoptions[i]),cfgpath,u); config_assign_int(&(cfgoptions[i]),cfgpath,u);
} else { } else {
defval=config_setdefault_int(&(cfgoptions[i]),prefix); defval=config_setdefault_int(&(cfgoptions[i]),prefix);
...@@ -174,14 +167,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { ...@@ -174,14 +167,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
case TYPE_UINT64: case TYPE_UINT64:
case TYPE_INT64: case TYPE_INT64:
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) { if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); config_check_valptr(&cfgoptions[i], sizeof(*cfgoptions[i].i64ptr), 1);
if(cfgoptions[i].type==TYPE_UINT64) { if(cfgoptions[i].type==TYPE_UINT64) {
*(cfgoptions[i].u64ptr) = (uint64_t)llu; *(cfgoptions[i].u64ptr) = (uint64_t)llu;
printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) ); printf_params("[LIBCONFIG] %s: %lu\n", cfgpath,*cfgoptions[i].u64ptr);
} else { } else {
*(cfgoptions[i].i64ptr) = llu; *(cfgoptions[i].i64ptr) = llu;
printf_params("[LIBCONFIG] %s: %lld\n", cfgpath,(long long)(*(cfgoptions[i].i64ptr)) ); printf_params("[LIBCONFIG] %s: %ld\n", cfgpath,*cfgoptions[i].i64ptr);
} }
} else { } else {
defval=config_setdefault_int64(&(cfgoptions[i]),prefix); defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
...@@ -203,8 +196,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { ...@@ -203,8 +196,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
case TYPE_DOUBLE: case TYPE_DOUBLE:
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) { if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double)); config_check_valptr(&cfgoptions[i],sizeof(*cfgoptions[i].dblptr), 1);
*(cfgoptions[i].dblptr) = dbl; *cfgoptions[i].dblptr = dbl;
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) ); printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
} else { } else {
defval=config_setdefault_double(&(cfgoptions[i]),prefix); defval=config_setdefault_double(&(cfgoptions[i]),prefix);
...@@ -304,27 +297,10 @@ int config_libconfig_getlist(paramlist_def_t *ParamList, ...@@ -304,27 +297,10 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
} }
if (ParamList->numelt > 0 && params != NULL) { if (ParamList->numelt > 0 && params != NULL) {
ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *)); ParamList->paramarray = config_allocate_new(ParamList->numelt * sizeof(paramdef_t *), true);
if ( ParamList->paramarray != NULL) {
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray);
config_get_if()->numptrs++;
} else {
fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
}
for (i=0 ; i < ParamList->numelt ; i++) { for (i=0 ; i < ParamList->numelt ; i++) {
ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t)); ParamList->paramarray[i] = config_allocate_new(numparams * sizeof(paramdef_t), true);
if ( ParamList->paramarray[i] != NULL) {
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]);
config_get_if()->numptrs++;
} else {
fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
}
memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams); memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
for (j=0; j<numparams; j++) { for (j=0; j<numparams; j++) {
...@@ -346,8 +322,8 @@ int config_libconfig_init(char *cfgP[], int numP) { ...@@ -346,8 +322,8 @@ 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); pthread_mutex_init(&config_get_if()->memBlocks_mutex, NULL);
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated)); memset(config_get_if()->oneBlock,0,sizeof(config_get_if()->oneBlock));
/* search for include path parameter and set config file include path accordingly */ /* search for include path parameter and set config file include path accordingly */
for (int i=0; i<numP; i++) { for (int i=0; i<numP; i++) {
if (strncmp(cfgP[i],"incp",4) == 0) { if (strncmp(cfgP[i],"incp",4) == 0) {
......
...@@ -325,6 +325,7 @@ void log_getconfig(log_t *g_log) ...@@ -325,6 +325,7 @@ void log_getconfig(log_t *g_log)
logparams_logfile[i].numelt = 0; logparams_logfile[i].numelt = 0;
logparams_level[i].numelt = 0; logparams_level[i].numelt = 0;
logparams_level[i].type = TYPE_STRING; logparams_level[i].type = TYPE_STRING;
logparams_level[i].defstrval= "error";
logparams_logfile[i].type = TYPE_UINT; logparams_logfile[i].type = TYPE_UINT;
logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL; logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
} }
......
...@@ -393,7 +393,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -393,7 +393,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* optname help paramflags XXXptr defXXXval type numelt */ /* optname help paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOG_GLOBALPARAMS_DESC { \ #define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[3].name, TYPE_STRING, 0}, \ {LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:&gloglevel, defstrval:log_level_names[3].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \ {LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST, 0} \ {LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST, 0} \
} }
......
...@@ -79,8 +79,8 @@ loader_data_t loader_data; ...@@ -79,8 +79,8 @@ loader_data_t loader_data;
/* optname helpstr paramflags XXXptr defXXXval type numelt check func*/ /* optname helpstr paramflags XXXptr defXXXval type numelt check func*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOADER_PARAMS_DESC { \ #define LOADER_PARAMS_DESC { \
{"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0, NULL},\ {"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:&loader_data.shlibpath, defstrval:DEFAULT_PATH, TYPE_STRING, 0, NULL},\
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0, NULL}\ {"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs),defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0, NULL}\
} }
/*-------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------*/
......
...@@ -181,21 +181,6 @@ nssai_sd=1; ...@@ -181,21 +181,6 @@ nssai_sd=1;
} }
``` ```
Alternatively, the values can be hardcoded/edited in source file ***openair3/UICC/usim_interface.c*** through the following lines:
```bash
#define UICC_PARAMS_DESC {\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
{"dnn", "UE dnn (apn)\n", 0, strptr:&(uicc->dnnStr), defstrval:"oai", TYPE_STRING, 0 },\
{"nssai_sst", "UE nssai\n", 0, iptr:&(uicc->nssai_sst), defintval:1, TYPE_INT, 0 }, \
{"nssai_sd", "UE nssai\n", 0, iptr:&(uicc->nssai_sd), defintval:1, TYPE_INT, 0 }, \
};
```
For interoperability with OAI or other CNs, it should be ensured that the configuration of the aforementioned parameters match the configuration of the corresponding subscribed user at the core network. For interoperability with OAI or other CNs, it should be ensured that the configuration of the aforementioned parameters match the configuration of the corresponding subscribed user at the core network.
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
{"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:(char **)&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
} }
......
...@@ -29,15 +29,15 @@ ...@@ -29,15 +29,15 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_NRUEPARAMS_DESC { \ #define CMDLINE_NRUEPARAMS_DESC { \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, u8ptr:&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, u8ptr:&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \
{"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:&nrUE_params.ofdm_offset_divisor, defuintval:8, TYPE_UINT32, 0}, \ {"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:&nrUE_params.ofdm_offset_divisor, defuintval:8, TYPE_UINT32, 0}, \
{"max-ldpc-iterations", CONFIG_HLP_MAX_LDPC_ITERATIONS, 0, u8ptr:&nrUE_params.max_ldpc_iterations, defuintval:5, TYPE_UINT8, 0}, \ {"max-ldpc-iterations", CONFIG_HLP_MAX_LDPC_ITERATIONS, 0, u8ptr:&nrUE_params.max_ldpc_iterations, defuintval:5, TYPE_UINT8, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \ {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:(char **)&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0}, \ {"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:&rrc_config_path, defstrval:"./", TYPE_STRING, 0}, \
{"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0} \ {"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0} \
} }
......
...@@ -137,9 +137,9 @@ extern "C" ...@@ -137,9 +137,9 @@ extern "C"
extern int usrp_tx_thread; extern int usrp_tx_thread;
#define CMDLINE_PARAMS_DESC { \ #define CMDLINE_PARAMS_DESC { \
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, 0},\
{"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)}, \ {"split73", CONFIG_HLP_SPLIT73, 0, strptr:&SPLIT73, defstrval:NULL, TYPE_STRING, 0}, \
{"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \ {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:&TP_CONFIG, defstrval:"n", TYPE_STRING, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \
{"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \ {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \
...@@ -157,8 +157,8 @@ extern int usrp_tx_thread; ...@@ -157,8 +157,8 @@ extern int usrp_tx_thread;
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:1, TYPE_INT, 0}, \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:1, TYPE_INT, 0}, \
{"band" , CONFIG_HLP_BAND, PARAMFLAG_BOOL, iptr:&BAND, defintval:78, TYPE_INT, 0}, \ {"band" , CONFIG_HLP_BAND, PARAMFLAG_BOOL, iptr:&BAND, defintval:78, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD, 0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD, 0, strptr:&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \ {"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
{"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \ {"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
...@@ -189,7 +189,7 @@ extern int usrp_tx_thread; ...@@ -189,7 +189,7 @@ extern int usrp_tx_thread;
{CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ {"log-mem", NULL, 0, strptr:&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
{"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \ {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \
} }
...@@ -242,9 +242,9 @@ extern int usrp_tx_thread; ...@@ -242,9 +242,9 @@ extern int usrp_tx_thread;
typedef struct { typedef struct {
uint64_t optmask; uint64_t optmask;
//THREAD_STRUCT thread_struct; //THREAD_STRUCT thread_struct;
char rf_config_file[1024]; char *rf_config_file;
char split73[1024]; char *split73;
char threadPoolConfig[1024]; char *threadPoolConfig;
int phy_test; int phy_test;
int do_ra; int do_ra;
int sa; int sa;
......
...@@ -62,7 +62,7 @@ static double snr_dB=25; ...@@ -62,7 +62,7 @@ static double snr_dB=25;
static double sinr_dB=0; static double sinr_dB=0;
static unsigned int max_chan; static unsigned int max_chan;
static channel_desc_t **defined_channels; static channel_desc_t **defined_channels;
static char modellist_name[MAX_OPTNAME_SIZE]= {0}; static char *modellist_name;
void fill_channel_desc(channel_desc_t *chan_desc, void fill_channel_desc(channel_desc_t *chan_desc,
......
...@@ -253,7 +253,7 @@ typedef enum { ...@@ -253,7 +253,7 @@ typedef enum {
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
{"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ {"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
{"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ {"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
{CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\ {CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 0},\
} }
/* parameters for one model */ /* parameters for one model */
......
...@@ -323,7 +323,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { ...@@ -323,7 +323,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
srb1_params_t srb1_params; srb1_params_t srb1_params;
memset((void *)&srb1_params,0,sizeof(srb1_params_t)); memset((void *)&srb1_params,0,sizeof(srb1_params_t));
paramdef_t SRB1Params[] = SRB1PARAMS_DESC(srb1_params); paramdef_t SRB1Params[] = SRB1PARAMS_DESC(srb1_params);
paramdef_t SLParams[] = CCPARAMS_SIDELINK_DESC(SLconfig); paramdef_t SLParams[] = CCPARAMS_SIDELINK_DESC(SLconfig);
/* map parameter checking array instances to parameter definition array instances */ /* 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< ( sizeof(CCsParams)/ sizeof(paramdef_t) ) ; I++) {
...@@ -2860,9 +2860,9 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { ...@@ -2860,9 +2860,9 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C = (uint32_t)*(NETParams[ENB_PORT_FOR_X2C_IDX].uptr); 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)) { if ((NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr == NULL) || (X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C == 0)) {
LOG_E(RRC,"Add eNB IPv4 address and/or port for X2C in the CONF file!\n"); LOG_E(RRC,"Add eNB IPv4 address and/or port for X2C in the CONF file!\n");
exit(1); exit(1);
} }
cidr = *(NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr); cidr = *(NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr);
address = strtok(cidr, "/"); address = strtok(cidr, "/");
......
...@@ -220,7 +220,7 @@ typedef struct ccparams_eMTC_s { ...@@ -220,7 +220,7 @@ typedef struct ccparams_eMTC_s {
{ENB_CONFIG_STRING_PCCH_DEFAULT_PAGING_CYCLE, NULL, 0, iptr:&eMTCconfig->ccparams.pcch_defaultPagingCycle, defintval:128, TYPE_INT, 0}, \ {ENB_CONFIG_STRING_PCCH_DEFAULT_PAGING_CYCLE, NULL, 0, iptr:&eMTCconfig->ccparams.pcch_defaultPagingCycle, defintval:128, TYPE_INT, 0}, \
{ENB_CONFIG_STRING_PCCH_NB, NULL, 0, strptr:&eMTCconfig->ccparams.pcch_nB, defstrval:"oneT", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_PCCH_NB, NULL, 0, strptr:&eMTCconfig->ccparams.pcch_nB, defstrval:"oneT", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_BCCH_MODIFICATIONPERIODCOEFF, NULL, 0, iptr:&eMTCconfig->ccparams.bcch_modificationPeriodCoeff, defintval:2, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_BCCH_MODIFICATIONPERIODCOEFF, NULL, 0, iptr:&eMTCconfig->ccparams.bcch_modificationPeriodCoeff, defintval:2, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RACH_PREAMBLESGROUPACONFIG, NULL, 0, strptr:&eMTCconfig->ccparams.rach_preamblesGroupAConfig, defstrval:"", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RACH_PREAMBLESGROUPACONFIG, NULL, 0, strptr:&eMTCconfig->ccparams.rach_preamblesGroupAConfig, defstrval:"DISABLE", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_UETIMERS_T300, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t300, defintval:1000, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_UETIMERS_T300, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t300, defintval:1000, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UETIMERS_T301, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t301, defintval:1000, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_UETIMERS_T301, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t301, defintval:1000, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UETIMERS_T310, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t310, defintval:1000, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_UETIMERS_T310, NULL, 0, iptr:&eMTCconfig->ccparams.ue_TimersAndConstants_t310, defintval:1000, TYPE_UINT, 0}, \
......
...@@ -119,15 +119,15 @@ typedef struct ccparams_sidelink_s { ...@@ -119,15 +119,15 @@ typedef struct ccparams_sidelink_s {
libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused; libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
//For discRxPoolPS //For discRxPoolPS
char *discRxPoolPS_cp_Len; char *discRxPoolPS_cp_Len;
const char *discRxPoolPS_discPeriod; char *discRxPoolPS_discPeriod;
libconfig_int discRxPoolPS_numRetx; libconfig_int discRxPoolPS_numRetx;
libconfig_int discRxPoolPS_numRepetition; libconfig_int discRxPoolPS_numRepetition;
libconfig_int discRxPoolPS_ResourceConfig_prb_Num; libconfig_int discRxPoolPS_ResourceConfig_prb_Num;
libconfig_int discRxPoolPS_ResourceConfig_prb_Start; libconfig_int discRxPoolPS_ResourceConfig_prb_Start;
libconfig_int discRxPoolPS_ResourceConfig_prb_End; libconfig_int discRxPoolPS_ResourceConfig_prb_End;
const char *discRxPoolPS_ResourceConfig_offsetIndicator_present; char *discRxPoolPS_ResourceConfig_offsetIndicator_present;
libconfig_int discRxPoolPS_ResourceConfig_offsetIndicator_choice; libconfig_int discRxPoolPS_ResourceConfig_offsetIndicator_choice;
const char *discRxPoolPS_ResourceConfig_subframeBitmap_present; char *discRxPoolPS_ResourceConfig_subframeBitmap_present;
char *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf; char *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf;
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size; libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size;
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused; libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
...@@ -139,44 +139,44 @@ typedef struct ccparams_sidelink_s { ...@@ -139,44 +139,44 @@ typedef struct ccparams_sidelink_s {
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CCPARAMS_SIDELINK_DESC(SLparams) { \ #define CCPARAMS_SIDELINK_DESC(SLparams) { \
{"sidelink_configured", NULL, 0, iptr:(int*)&SLparams.sidelink_configured, defintval:0, TYPE_UINT, 0}, \ {"sidelink_configured", NULL, 0, iptr:&SLparams.sidelink_configured, defintval:0, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_SC_CP_LEN, NULL, 0, strptr:(char **)&SLparams.rxPool_sc_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_SC_CP_LEN, NULL, 0, strptr:&SLparams.rxPool_sc_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_SC_PRIOD, NULL, 0, strptr:(char **)&SLparams.rxPool_sc_Period, defstrval:"sf40", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_SC_PRIOD, NULL, 0, strptr:&SLparams.rxPool_sc_Period, defstrval:"sf40", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_DATA_CP_LEN, NULL, 0, strptr:(char **)&SLparams.rxPool_data_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_DATA_CP_LEN, NULL, 0, strptr:&SLparams.rxPool_data_CP_Len, defstrval:"normal", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_PRB_NUM, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_PRB_NUM, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_PRB_START, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_PRB_START, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_PRB_END, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_PRB_END, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_PRESENT, NULL, 0, strptr:(char **)&SLparams.rxPool_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_PRESENT, NULL, 0, strptr:&SLparams.rxPool_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_CHOICE, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_CHOICE, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_PRESENT, NULL, 0, strptr:(char **)&SLparams.rxPool_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_PRESENT, NULL, 0, strptr:&SLparams.rxPool_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:(char **)&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED, NULL, 0, iptr:(int32_t *)&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED, NULL, 0, iptr:&SLparams.rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_CP_LEN, NULL, 0, strptr:(char **)&SLparams.discRxPool_cp_Len, defstrval:"normal", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_CP_LEN, NULL, 0, strptr:&SLparams.discRxPool_cp_Len, defstrval:"normal", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_DISCPERIOD, NULL, 0, strptr:(char **)&SLparams.discRxPool_discPeriod, defstrval:"rf32", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_DISCPERIOD, NULL, 0, strptr:&SLparams.discRxPool_discPeriod, defstrval:"rf32", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_NUMRETX, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_numRetx, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_NUMRETX, NULL, 0, iptr:&SLparams.discRxPool_numRetx, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_NUMREPETITION, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_numRepetition, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_NUMREPETITION, NULL, 0, iptr:&SLparams.discRxPool_numRepetition, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_NUM, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_NUM, NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_START, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_START, NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_END, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_END, NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_PRESENT, NULL, 0, strptr:(char **)&SLparams.discRxPool_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_PRESENT, NULL, 0, strptr:&SLparams.discRxPool_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_CHOICE, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_CHOICE, NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_PRESENT, NULL, 0, strptr:(char **)&SLparams.discRxPool_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_PRESENT, NULL, 0, strptr:&SLparams.discRxPool_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:(char **)&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL, 0, iptr:(int32_t *)&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL, 0, iptr:&SLparams.discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_CP_LEN, NULL, 0, strptr:(char **)&SLparams.discRxPoolPS_cp_Len, defstrval:"normal", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_CP_LEN, NULL, 0, strptr:&SLparams.discRxPoolPS_cp_Len, defstrval:"normal", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_DISCPERIOD, NULL, 0, strptr:(char **)&SLparams.discRxPoolPS_discPeriod, defstrval:"rf32", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_DISCPERIOD, NULL, 0, strptr:&SLparams.discRxPoolPS_discPeriod, defstrval:"rf32", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMRETX, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_numRetx, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_NUMRETX, NULL, 0, iptr:&SLparams.discRxPoolPS_numRetx, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMREPETITION, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_numRepetition, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_NUMREPETITION, NULL, 0, iptr:&SLparams.discRxPoolPS_numRepetition, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_NUM, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_NUM, NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_prb_Num, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_START, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_START, NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_prb_Start, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_END, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_END, NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_prb_End, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_PRESENT, NULL, 0, strptr:(char **)&SLparams.discRxPoolPS_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_PRESENT, NULL, 0, strptr:&SLparams.discRxPoolPS_ResourceConfig_offsetIndicator_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_CHOICE, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_CHOICE, NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_offsetIndicator_choice, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_PRESENT, NULL, 0, strptr:(char **)&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_PRESENT, NULL, 0, strptr:&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_present, defstrval:"prNothing", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:(char **)&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_BUF, NULL, 0, strptr:&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf, defstrval:"001001", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_SIZE, NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL, 0, iptr:(int32_t *)&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0} \ {ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL, 0, iptr:&SLparams.discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused, defintval:1, TYPE_UINT, 0} \
} }
#endif #endif
...@@ -238,8 +238,8 @@ void mac_top_init_gNB(ngran_node_t node_type) ...@@ -238,8 +238,8 @@ void mac_top_init_gNB(ngran_node_t node_type)
RC.nrmac[i]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(i, 0); RC.nrmac[i]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(i, 0);
} }
if (!IS_SOFTMODEM_NOSTATS_BIT) if (!IS_SOFTMODEM_NOSTATS_BIT)
pthread_create(&RC.nrmac[i]->stats_thread, NULL, nrmac_stats_thread, (void*)RC.nrmac[i]);
threadCreate(&RC.nrmac[i]->stats_thread, nrmac_stats_thread, (void*)RC.nrmac[i], "MAC_STATS", -1, sched_get_priority_min(SCHED_OAI)+1 );
mac_rrc_init(RC.nrmac[i], node_type); mac_rrc_init(RC.nrmac[i], node_type);
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
......
...@@ -56,7 +56,9 @@ char *broadcastAddr ; ...@@ -56,7 +56,9 @@ char *broadcastAddr ;
#define NASHLP_NETMASK "<NAS network mask>\n" #define NASHLP_NETMASK "<NAS network mask>\n"
#define NASHLP_BROADCASTADDR "<NAS network broadcast address>\n" #define NASHLP_BROADCASTADDR "<NAS network broadcast address>\n"
void nas_getparams(void) { void nas_getparams(void) {
paramdef_t nasoptions[] = { // this datamodel require this static because we partially keep data like baseNetAddress (malloc on a global)
// but we loose the opther attributes in nasoptions between two calls if is is not static !
static paramdef_t nasoptions[] = {
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* configuration parameters for netlink, includes network parameters when running in noS1 mode */ /* configuration parameters for netlink, includes network parameters when running in noS1 mode */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
......
...@@ -74,9 +74,9 @@ typedef guint8 gboolean; ...@@ -74,9 +74,9 @@ typedef guint8 gboolean;
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------*/
#define OPT_PARAMS_DESC { \ #define OPT_PARAMS_DESC { \
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:(char**)&in_type, defstrval:"none", TYPE_STRING, 0}, \ {"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ {"ip" , CONFIG_HLP_L2MONIP, 0, strptr:&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \ {"path" , CONFIG_HLP_L2MONPATH, 0, strptr:&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
} }
#define OPTTYPE_IDX 0 #define OPTTYPE_IDX 0
......
...@@ -540,9 +540,6 @@ void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsign ...@@ -540,9 +540,6 @@ void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsign
/*---------------------------------------------------*/ /*---------------------------------------------------*/
int init_opt(void) { int init_opt(void) {
in_type=malloc(200);
in_ip=malloc(200);
in_path=malloc(200);
paramdef_t opt_params[] = OPT_PARAMS_DESC ; paramdef_t opt_params[] = OPT_PARAMS_DESC ;
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC; checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
config_set_checkfunctions(opt_params, opt_checkParams, config_set_checkfunctions(opt_params, opt_checkParams,
......
...@@ -35,16 +35,16 @@ extern uint16_t NB_UE_INST; ...@@ -35,16 +35,16 @@ extern uint16_t NB_UE_INST;
/* configuration parameters for the rfsimulator device */ /* configuration parameters for the rfsimulator device */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define UICC_PARAMS_DESC {\ #define UICC_PARAMS_DESC { \
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\ {"imsi", "USIM IMSI\n", 0, strptr:&uicc->imsiStr, defstrval:"2089900007487", TYPE_STRING, 0 }, \
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\ {"nmc_size" "number of digits in NMC", 0, iptr:&uicc->nmc_size, defintval:2, TYPE_INT, 0 }, \
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\ {"key", "USIM Ki\n", 0, strptr:&uicc->keyStr, defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 }, \
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\ {"opc", "USIM OPc\n", 0, strptr:&uicc->opcStr, defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 }, \
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\ {"amf", "USIM amf\n", 0, strptr:&uicc->amfStr, defstrval:"8000", TYPE_STRING, 0 }, \
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\ {"sqn", "USIM sqn\n", 0, strptr:&uicc->sqnStr, defstrval:"000000", TYPE_STRING, 0 }, \
{"dnn", "UE dnn (apn)\n", 0, strptr:&(uicc->dnnStr), defstrval:"oai", TYPE_STRING, 0 },\ {"dnn", "UE dnn (apn)\n", 0, strptr:&uicc->dnnStr, defstrval:"oai", TYPE_STRING, 0 }, \
{"nssai_sst", "UE nssai\n", 0, iptr:&(uicc->nssai_sst), defintval:1, TYPE_INT, 0 }, \ {"nssai_sst", "UE nssai\n", 0, iptr:&uicc->nssai_sst, defintval:1, TYPE_INT, 0 }, \
{"nssai_sd", "UE nssai\n", 0, iptr:&(uicc->nssai_sd), defintval:1, TYPE_INT, 0 }, \ {"nssai_sd", "UE nssai\n", 0, iptr:&uicc->nssai_sd, defintval:1, TYPE_INT, 0 }, \
}; };
static uicc_t** uiccArray=NULL; static uicc_t** uiccArray=NULL;
......
...@@ -95,7 +95,7 @@ typedef struct { ...@@ -95,7 +95,7 @@ typedef struct {
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define DEVICE_RECPLAY_PARAMS_DESC { \ #define DEVICE_RECPLAY_PARAMS_DESC { \
{CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \ {CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:&((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 0}, \
{CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \
...@@ -105,7 +105,7 @@ typedef struct { ...@@ -105,7 +105,7 @@ typedef struct {
{CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \ {CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \
}/*! \brief Record Player Configuration and state */ }/*! \brief Record Player Configuration and state */
typedef struct { typedef struct {
char u_sf_filename[1024]; // subframes file path char *u_sf_filename; // subframes file path
unsigned int u_sf_max ; // max number of recorded subframes unsigned int u_sf_max ; // max number of recorded subframes
unsigned int u_sf_loops ; // number of loops in replay mode unsigned int u_sf_loops ; // number of loops in replay mode
unsigned int u_sf_read_delay; // read delay in replay mode unsigned int u_sf_read_delay; // read delay in replay mode
......
...@@ -77,11 +77,11 @@ ...@@ -77,11 +77,11 @@
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED
#define RFSIMULATOR_PARAMS_DESC { \ #define RFSIMULATOR_PARAMS_DESC { \
{"serveraddr", "<ip address to connect to>\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ {"serveraddr", "<ip address to connect to>\n", simOpt, strptr:&rfsimulator->ip, defstrval:"127.0.0.1", TYPE_STRING, 0 },\
{"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ {"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\
{"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ {"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&saveF, defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
{"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ {"modelname", "<channel model name>\n", simOpt, strptr:&modelname, defstrval:"AWGN", TYPE_STRING, 0 },\
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ {"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ {"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ {"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \ {"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \ {"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \
......
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