Merge branch 'issue394_fix_cppcheck' into develop_integration_2019_w07_v2
--> openair2/LAYER2/MAC/eNB_scheduler_primitives.c is still old (not from issue394_fix_cppcheck branch) Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
@@ -77,17 +77,17 @@ paramdef_t telnetoptions[] = {
|
||||
/* configuration parameters for telnet utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{"listenaddr", "<listen ip address>\n", 0, uptr:&telnetparams.listenaddr, defstrval:"0.0.0.0", TYPE_IPV4ADDR, 0 },
|
||||
{"listenport", "<local port>\n", 0, uptr:&(telnetparams.listenport), defuintval:9090, TYPE_UINT, 0 },
|
||||
{"priority", "<scheduling policy (0-99)\n", 0, iptr:&telnetparams.priority, defuintval:0, TYPE_INT, 0 },
|
||||
{"debug", "<debug level>\n", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0 },
|
||||
{"loopcount", "<loop command iterations>\n", 0, uptr:&(telnetparams.loopcount), defuintval:10, TYPE_UINT, 0 },
|
||||
{"loopdelay", "<loop command delay (ms)>\n", 0, uptr:&(telnetparams.loopdelay), defuintval:5000, TYPE_UINT, 0 },
|
||||
{"histfile", "<history file name>\n", PARAMFLAG_NOFREE, strptr:&(telnetparams.histfile), defstrval:"oaitelnet.history", TYPE_STRING, 0 },
|
||||
{"histsize", "<history sizes>\n", 0, iptr:&(telnetparams.histsize), defuintval:50, TYPE_INT, 0 },
|
||||
{"phypbsize", "<phy dump buff size (bytes)>\n",0, uptr:&(telnetparams.phyprntbuff_size),defuintval:65000, TYPE_UINT, 0 },
|
||||
{"staticmod", "<static modules selection>\n", 0, strlistptr:NULL, defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,(sizeof(telnet_defstatmod)/sizeof(char *))},
|
||||
{"shrmod", "<dynamic modules selection>\n", 0, strlistptr:NULL, defstrlistval:NULL,TYPE_STRINGLIST,0 }
|
||||
{"listenaddr", "<listen ip address>", 0, uptr:&telnetparams.listenaddr, defstrval:"0.0.0.0", TYPE_IPV4ADDR, 0 },
|
||||
{"listenport", "<local port>", 0, uptr:&(telnetparams.listenport), defuintval:9090, TYPE_UINT, 0 },
|
||||
{"priority", "<scheduling policy (0-99)", 0, iptr:&telnetparams.priority, defuintval:0, TYPE_INT, 0 },
|
||||
{"debug", "<debug level>", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0 },
|
||||
{"loopcount", "<loop command iterations>", 0, uptr:&(telnetparams.loopcount), defuintval:10, TYPE_UINT, 0 },
|
||||
{"loopdelay", "<loop command delay (ms)>", 0, uptr:&(telnetparams.loopdelay), defuintval:5000, TYPE_UINT, 0 },
|
||||
{"histfile", "<history file name>", PARAMFLAG_NOFREE, strptr:&(telnetparams.histfile), defstrval:"oaitelnet.history", TYPE_STRING, 0 },
|
||||
{"histsize", "<history sizes>", 0, iptr:&(telnetparams.histsize), defuintval:50, TYPE_INT, 0 },
|
||||
{"phypbsize", "<phy dump buff size (bytes)>",0, uptr:&(telnetparams.phyprntbuff_size),defuintval:65000, TYPE_UINT, 0 },
|
||||
{"staticmod", "<static modules selection>", 0, strlistptr:NULL, defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,(sizeof(telnet_defstatmod)/sizeof(char *))},
|
||||
{"shrmod", "<dynamic modules selection>", 0, strlistptr:NULL, defstrlistval:NULL,TYPE_STRINGLIST,0 }
|
||||
};
|
||||
|
||||
int get_phybsize(void) {
|
||||
@@ -355,7 +355,7 @@ int setgetvar(int moduleindex,char getorset,char *params) {
|
||||
char varname[TELNET_CMD_MAXSIZE];
|
||||
char *varval=NULL;
|
||||
memset(varname,0,sizeof(varname));
|
||||
n = sscanf(params,"%s %ms",varname,&varval);
|
||||
n = sscanf(params,"%19s %ms",varname,&varval);
|
||||
|
||||
for ( i=0 ; telnetparams.CmdParsers[moduleindex].var[i].varvalptr != NULL ; i++) {
|
||||
if ( strncasecmp(telnetparams.CmdParsers[moduleindex].var[i].varname,varname,strlen(telnetparams.CmdParsers[moduleindex].var[i].varname)) == 0) {
|
||||
@@ -475,7 +475,7 @@ int process_command(char *buf) {
|
||||
memset(cmdb,0,sizeof(cmdb));
|
||||
bufbck=strdup(buf);
|
||||
rt=CMDSTATUS_NOTFOUND;
|
||||
j = sscanf(buf,"%9s %9s %[^\t\n]",modulename,cmd,cmdb);
|
||||
j = sscanf(buf,"%9s %9s %2000[^\t\n]",modulename,cmd,cmdb);
|
||||
|
||||
if (telnetparams.telnetdbg > 0)
|
||||
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -39,104 +39,88 @@
|
||||
#define TELNETSRV_PHYCMD_MAIN
|
||||
#include "telnetsrv_phycmd.h"
|
||||
char *prnbuff;
|
||||
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
|
||||
extern int dump_eNB_l2_stats(char *buffer, int length);
|
||||
|
||||
void init_phytelnet(void)
|
||||
{
|
||||
prnbuff=malloc(get_phybsize() );
|
||||
if (prnbuff == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
|
||||
}
|
||||
void init_phytelnet(void) {
|
||||
prnbuff=malloc(get_phybsize() );
|
||||
|
||||
if (prnbuff == NULL) {
|
||||
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
void display_uestatshead( telnet_printfunc_t prnt)
|
||||
{
|
||||
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
|
||||
void display_uestatshead( telnet_printfunc_t prnt) {
|
||||
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
|
||||
}
|
||||
|
||||
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag)
|
||||
{
|
||||
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag) {
|
||||
int p;
|
||||
prnbuff=malloc(20480);
|
||||
p=dump_eNB_l2_stats( prnbuff, 20480);
|
||||
|
||||
int p;
|
||||
|
||||
p=dump_eNB_l2_stats( prnbuff, 0);
|
||||
if(prntflag>=1)
|
||||
prnt("%s\n",prnbuff);
|
||||
if(debug>=1)
|
||||
prnt("%i bytes printed\n",p);
|
||||
if(prntflag>=1)
|
||||
prnt("%s\n",prnbuff);
|
||||
|
||||
if(debug>=1)
|
||||
prnt("%i bytes printed\n",p);
|
||||
|
||||
free(prnbuff);
|
||||
}
|
||||
|
||||
void display_uestats(int debug, telnet_printfunc_t prnt, int ue)
|
||||
{
|
||||
for (int cc=0; cc<1 ; cc++)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
void display_uestats(int debug, telnet_printfunc_t prnt, int ue) {
|
||||
for (int cc=0; cc<1 ; cc++) {
|
||||
}
|
||||
}
|
||||
|
||||
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
prnt(" DLSCH kb DLSCH kb/s\n");
|
||||
|
||||
dump_uestats(debug, prnt,0);
|
||||
|
||||
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
prnt(" DLSCH kb DLSCH kb/s\n");
|
||||
dump_uestats(debug, prnt,0);
|
||||
}
|
||||
|
||||
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
|
||||
|
||||
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
if (debug > 0)
|
||||
prnt("phy interface module received %s\n",buf);
|
||||
|
||||
if (debug > 0)
|
||||
prnt("phy interface module received %s\n",buf);
|
||||
if (strcasestr(buf,"phycnt") != NULL)
|
||||
{
|
||||
display_phycounters(buf, debug, prnt);
|
||||
}
|
||||
if (strcasestr(buf,"uestat") != NULL)
|
||||
{
|
||||
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
|
||||
display_uestatshead(prnt);
|
||||
if (cptr != NULL)
|
||||
{
|
||||
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
|
||||
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0)
|
||||
{
|
||||
display_uestats(debug, prnt,ueidx);
|
||||
}
|
||||
} /* if cptr != NULL */
|
||||
else
|
||||
{
|
||||
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++)
|
||||
{
|
||||
display_uestats(debug, prnt,ue);
|
||||
}
|
||||
} /* else cptr != NULL */
|
||||
} /* uestat */
|
||||
if (strcasestr(buf,"uedump") != NULL)
|
||||
{
|
||||
dump_uestats(debug, prnt,1);
|
||||
}
|
||||
return 0;
|
||||
if (strcasestr(buf,"phycnt") != NULL) {
|
||||
display_phycounters(buf, debug, prnt);
|
||||
}
|
||||
|
||||
if (strcasestr(buf,"uestat") != NULL) {
|
||||
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
|
||||
display_uestatshead(prnt);
|
||||
|
||||
if (cptr != NULL) {
|
||||
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
|
||||
|
||||
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0) {
|
||||
display_uestats(debug, prnt,ueidx);
|
||||
}
|
||||
} /* if cptr != NULL */
|
||||
else {
|
||||
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++) {
|
||||
display_uestats(debug, prnt,ue);
|
||||
}
|
||||
} /* else cptr != NULL */
|
||||
} /* uestat */
|
||||
|
||||
if (strcasestr(buf,"uedump") != NULL) {
|
||||
dump_uestats(debug, prnt,1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
telnetshell_cmddef_t phy_cmdarray[] = {
|
||||
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
|
||||
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
|
||||
|
||||
{"","",NULL},
|
||||
{"","",NULL},
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
void add_phy_cmds(void)
|
||||
{
|
||||
|
||||
init_phytelnet();
|
||||
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
|
||||
void add_phy_cmds(void) {
|
||||
init_phytelnet();
|
||||
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user