Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
c4cf67f0
Commit
c4cf67f0
authored
Apr 08, 2022
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify telnet server structure to support command execution from the webserver
parent
9dbcab30
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
193 additions
and
107 deletions
+193
-107
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+16
-4
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+2
-0
common/utils/telnetsrv/telnetsrv_enb_phycmd.c
common/utils/telnetsrv/telnetsrv_enb_phycmd.c
+2
-3
common/utils/websrv/websrv.c
common/utils/websrv/websrv.c
+163
-90
common/utils/websrv/websrv.h
common/utils/websrv/websrv.h
+1
-1
openair1/PHY/CODING/coding_load.c
openair1/PHY/CODING/coding_load.c
+2
-2
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+4
-4
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+3
-3
No files found.
common/utils/telnetsrv/telnetsrv.c
View file @
c4cf67f0
...
...
@@ -90,9 +90,12 @@ int get_phybsize(void) {
};
int
add_telnetcmd
(
char
*
modulename
,
telnetshell_vardef_t
*
var
,
telnetshell_cmddef_t
*
cmd
);
int
setoutput
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
int
wsetoutput
(
char
*
fname
,
...
);
int
setparam
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
int
wsetparam
(
char
*
pname
,
...
);
int
history_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
telnetshell_vardef_t
telnet_vardef
[]
=
{
{
"debug"
,
TELNET_VARTYPE_INT32
,
0
,
&
telnetparams
.
telnetdbg
},
{
"prio"
,
TELNET_VARTYPE_INT32
,
0
,
&
telnetparams
.
priority
},
...
...
@@ -105,10 +108,10 @@ telnetshell_vardef_t telnet_vardef[] = {
};
telnetshell_cmddef_t
telnet_cmdarray
[]
=
{
{
"redirlog"
,
"[here,file,off]"
,
setoutput
},
{
"param"
,
"[prio]"
,
setparam
},
{
"history"
,
"[list,reset]"
,
history_cmd
},
{
""
,
""
,
NULL
},
{
"redirlog"
,
"[here,file,off]"
,
setoutput
,
wsetoutput
,
0
,
NULL
},
{
"param"
,
"[prio]"
,
setparam
,
wsetparam
,
0
,
NULL
},
{
"history"
,
"[list,reset]"
,
history_cmd
,
NULL
,
0
,
NULL
},
{
""
,
""
,
NULL
,
NULL
,
0
,
NULL
},
};
...
...
@@ -245,6 +248,11 @@ void redirstd(char *newfname,telnet_printfunc_t prnt ) {
prnt
(
"ERROR: stderr redir to %s error %s"
,
strerror
(
errno
));
}
}
int
wsetoutput
(
char
*
fname
,
...
)
{
return
0
;
}
int
setoutput
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
)
{
char
cmds
[
TELNET_MAX_MSGLENGTH
/
TELNET_CMD_MAXSIZE
][
TELNET_CMD_MAXSIZE
];
char
*
logfname
;
...
...
@@ -281,6 +289,10 @@ int setoutput(char *buff, int debug, telnet_printfunc_t prnt) {
return
CMDSTATUS_FOUND
;
}
/* setoutput */
int
wsetparam
(
char
*
pname
,
...
)
{
return
0
;
}
int
setparam
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
)
{
char
cmds
[
TELNET_MAX_MSGLENGTH
/
TELNET_CMD_MAXSIZE
][
TELNET_CMD_MAXSIZE
];
memset
(
cmds
,
0
,
sizeof
(
cmds
));
...
...
common/utils/telnetsrv/telnetsrv.h
View file @
c4cf67f0
...
...
@@ -54,6 +54,7 @@
/* to add a set of new command to the telnet server shell */
typedef
void
(
*
telnet_printfunc_t
)(
const
char
*
format
,
...);
typedef
int
(
*
cmdfunc_t
)(
char
*
,
int
,
telnet_printfunc_t
prnt
);
typedef
int
(
*
webfunc_t
)(
char
*
exec
,
...
);
typedef
int
(
*
qcmdfunc_t
)(
char
*
,
int
,
telnet_printfunc_t
prnt
,
void
*
arg
);
#define TELNETSRV_CMDFLAG_PUSHINTPOOLQ (1<<0) // ask the telnet server to push the command in a thread pool queue
...
...
@@ -61,6 +62,7 @@ typedef struct cmddef {
char
cmdname
[
TELNET_CMD_MAXSIZE
];
char
helpstr
[
TELNET_HELPSTR_SIZE
];
cmdfunc_t
cmdfunc
;
webfunc_t
webfunc
;
unsigned
int
cmdflags
;
void
*
qptr
;
}
telnetshell_cmddef_t
;
...
...
common/utils/telnetsrv/telnetsrv_enb_phycmd.c
View file @
c4cf67f0
...
...
@@ -110,9 +110,8 @@ int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt) {
telnetshell_cmddef_t
phy_cmdarray
[]
=
{
{
"disp"
,
"[phycnt,uedump,uestat UE<x>]"
,
dump_phyvars
},
{
""
,
""
,
NULL
},
{
"disp"
,
"[phycnt,uedump,uestat UE<x>]"
,
dump_phyvars
,
NULL
,
0
,
NULL
},
{
""
,
""
,
NULL
,
NULL
,
0
,
NULL
},
};
...
...
common/utils/websrv/websrv.c
View file @
c4cf67f0
This diff is collapsed.
Click to expand it.
common/utils/websrv/websrv.h
View file @
c4cf67f0
...
...
@@ -41,7 +41,7 @@
/* websrv_params_t is an internal structure storing all the current parameters and */
/* global variables used by the web server */
typedef
struct
{
struct
_u_instance
*
instance
;
// ulfius (web server) instance
struct
_u_instance
instance
;
// ulfius (web server) instance
unsigned
int
dbglvl
;
// debug level of the server
int
priority
;
// server running priority
unsigned
int
listenport
;
// ip port the telnet server is listening on
...
...
openair1/PHY/CODING/coding_load.c
View file @
c4cf67f0
...
...
@@ -41,8 +41,8 @@
static
int
coding_setmod_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
static
telnetshell_cmddef_t
coding_cmdarray
[]
=
{
{
"mode"
,
"[sse,avx2,stdc,none]"
,
coding_setmod_cmd
},
{
""
,
""
,
NULL
},
{
"mode"
,
"[sse,avx2,stdc,none]"
,
coding_setmod_cmd
,
NULL
,
0
,
NULL
},
{
""
,
""
,
NULL
,
NULL
,
0
,
NULL
},
};
telnetshell_vardef_t
coding_vardef
[]
=
{
{
"maxiter"
,
TELNET_VARTYPE_INT32
,
0
,
&
max_turbo_iterations
},
...
...
openair1/SIMULATION/TOOLS/random_channel.c
View file @
c4cf67f0
...
...
@@ -48,10 +48,10 @@ static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt);
static
int
channelmod_modify_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
static
int
channelmod_print_help
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
static
telnetshell_cmddef_t
channelmod_cmdarray
[]
=
{
{
"help"
,
""
,
channelmod_print_help
},
{
"show"
,
"<predef,current>"
,
channelmod_show_cmd
},
{
"modify"
,
"<channelid> <param> <value>"
,
channelmod_modify_cmd
},
{
""
,
""
,
NULL
},
{
"help"
,
""
,
channelmod_print_help
,
NULL
,
0
,
NULL
},
{
"show"
,
"<predef,current>"
,
channelmod_show_cmd
,
NULL
,
0
,
NULL
},
{
"modify"
,
"<channelid> <param> <value>"
,
channelmod_modify_cmd
,
NULL
,
0
,
NULL
},
{
""
,
""
,
NULL
,
NULL
,
0
,
NULL
},
};
static
telnetshell_vardef_t
channelmod_vardef
[]
=
{
...
...
targets/ARCH/rfsimulator/simulator.c
View file @
c4cf67f0
...
...
@@ -91,12 +91,12 @@
static
int
rfsimu_setchanmod_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
,
void
*
arg
);
static
telnetshell_cmddef_t
rfsimu_cmdarray
[]
=
{
{
"setmodel"
,
"<model name> <model type>"
,(
cmdfunc_t
)
rfsimu_setchanmod_cmd
,
TELNETSRV_CMDFLAG_PUSHINTPOOLQ
},
{
""
,
""
,
NULL
},
{
"setmodel"
,
"<model name> <model type>"
,(
cmdfunc_t
)
rfsimu_setchanmod_cmd
,
NULL
,
TELNETSRV_CMDFLAG_PUSHINTPOOLQ
},
{
""
,
""
,
NULL
,
NULL
,
0
},
};
static
telnetshell_vardef_t
rfsimu_vardef
[]
=
{
{
""
,
0
,
NULL
}
{
""
,
0
,
0
,
NULL
}
};
pthread_mutex_t
Sockmutex
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment