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
zzha zzha
OpenXG-RAN
Commits
8d74ea38
Commit
8d74ea38
authored
Apr 06, 2022
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backend implementation of variable modifications
parent
a3ac83a1
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
96 deletions
+146
-96
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+49
-35
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+1
-0
common/utils/websrv/websrv.c
common/utils/websrv/websrv.c
+96
-61
No files found.
common/utils/telnetsrv/telnetsrv.c
View file @
8d74ea38
...
@@ -389,6 +389,54 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex) {
...
@@ -389,6 +389,54 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex) {
return
val
;
return
val
;
}
}
int
telnet_setvarvalue
(
telnetshell_vardef_t
*
var
,
char
*
strval
,
telnet_printfunc_t
prnt
)
{
int
st
=
0
;
switch
(
var
->
vartype
)
{
case
TELNET_VARTYPE_INT32
:
*
(
int
*
)(
var
->
varvalptr
)
=
(
int
)
strtol
(
strval
,
NULL
,
0
);
if
(
prnt
!=
NULL
)
prnt
(
"%i
\n
"
,
*
(
int
*
)(
var
->
varvalptr
));
break
;
case
TELNET_VARTYPE_INT16
:
*
(
short
*
)(
var
->
varvalptr
)
=
(
short
)
strtol
(
strval
,
NULL
,
0
);
if
(
prnt
!=
NULL
)
prnt
(
"%hi
\n
"
,
*
(
short
*
)(
var
->
varvalptr
));
break
;
case
TELNET_VARTYPE_INT8
:
*
(
char
*
)(
var
->
varvalptr
)
=
(
char
)
strtol
(
strval
,
NULL
,
0
);
if
(
prnt
!=
NULL
)
prnt
(
"%i
\n
"
,
*
(
int
*
)(
var
->
varvalptr
));
break
;
case
TELNET_VARTYPE_UINT
:
*
(
unsigned
int
*
)(
var
->
varvalptr
)
=
(
unsigned
int
)
strtol
(
strval
,
NULL
,
0
);
if
(
prnt
!=
NULL
)
prnt
(
"%u
\n
"
,
*
(
unsigned
int
*
)(
var
->
varvalptr
));
break
;
case
TELNET_VARTYPE_DOUBLE
:
*
(
double
*
)(
var
->
varvalptr
)
=
strtod
(
strval
,
NULL
);
if
(
prnt
!=
NULL
)
prnt
(
"%g
\n
"
,
*
(
double
*
)(
var
->
varvalptr
));
break
;
case
TELNET_VARTYPE_STRING
:
sprintf
(
*
(
char
**
)(
var
->
varvalptr
),
"%s"
,
strval
);
if
(
prnt
!=
NULL
)
prnt
(
"
\"
%s
\"\n
"
,
*
(
char
**
)(
var
->
varvalptr
));
break
;
default:
if
(
prnt
!=
NULL
)
prnt
(
"unknown type
\n
"
);
st
=-
1
;
break
;
}
return
st
;
}
int
setgetvar
(
int
moduleindex
,
char
getorset
,
char
*
params
)
{
int
setgetvar
(
int
moduleindex
,
char
getorset
,
char
*
params
)
{
int
n
,
i
;
int
n
,
i
;
char
varname
[
TELNET_CMD_MAXSIZE
];
char
varname
[
TELNET_CMD_MAXSIZE
];
...
@@ -408,42 +456,8 @@ int setgetvar(int moduleindex,char getorset,char *params) {
...
@@ -408,42 +456,8 @@ int setgetvar(int moduleindex,char getorset,char *params) {
if
(
n
>
1
&&
(
getorset
==
's'
||
getorset
==
'S'
))
{
if
(
n
>
1
&&
(
getorset
==
's'
||
getorset
==
'S'
))
{
client_printf
(
"%s, %s set to
\n
"
,
telnetparams
.
CmdParsers
[
moduleindex
].
module
,
client_printf
(
"%s, %s set to
\n
"
,
telnetparams
.
CmdParsers
[
moduleindex
].
module
,
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varname
);
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varname
);
telnet_setvarvalue
(
&
(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
]),
varval
,
client_printf
);
switch
(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
vartype
)
{
case
TELNET_VARTYPE_INT32
:
*
(
int
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
)
=
(
int
)
strtol
(
varval
,
NULL
,
0
);
client_printf
(
"%i
\n
"
,
*
(
int
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
case
TELNET_VARTYPE_INT16
:
*
(
short
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
)
=
(
short
)
strtol
(
varval
,
NULL
,
0
);
client_printf
(
"%hi
\n
"
,
*
(
short
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
case
TELNET_VARTYPE_INT8
:
*
(
char
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
)
=
(
char
)
strtol
(
varval
,
NULL
,
0
);
client_printf
(
"%i
\n
"
,
*
(
int
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
case
TELNET_VARTYPE_UINT
:
*
(
unsigned
int
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
)
=
(
unsigned
int
)
strtol
(
varval
,
NULL
,
0
);
client_printf
(
"%u
\n
"
,
*
(
unsigned
int
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
case
TELNET_VARTYPE_DOUBLE
:
*
(
double
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
)
=
strtod
(
varval
,
NULL
);
client_printf
(
"%g
\n
"
,
*
(
double
*
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
case
TELNET_VARTYPE_STRING
:
sprintf
(
*
(
char
**
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
),
"%s"
,
varval
);
client_printf
(
"
\"
%s
\"\n
"
,
*
(
char
**
)(
telnetparams
.
CmdParsers
[
moduleindex
].
var
[
i
].
varvalptr
));
break
;
default:
client_printf
(
"unknown type
\n
"
);
break
;
}
}
}
}
}
}
}
...
...
common/utils/telnetsrv/telnetsrv.h
View file @
8d74ea38
...
@@ -163,5 +163,6 @@ extern int get_phybsize(void);
...
@@ -163,5 +163,6 @@ extern int get_phybsize(void);
#ifdef WEBSERVERCODE
#ifdef WEBSERVERCODE
extern
telnetsrv_params_t
*
get_telnetsrv_params
(
void
);
extern
telnetsrv_params_t
*
get_telnetsrv_params
(
void
);
extern
char
*
telnet_getvarvalue
(
telnetshell_vardef_t
*
var
,
int
varindex
);
extern
char
*
telnet_getvarvalue
(
telnetshell_vardef_t
*
var
,
int
varindex
);
extern
int
telnet_setvarvalue
(
telnetshell_vardef_t
*
var
,
char
*
strval
,
telnet_printfunc_t
prnt
)
;
#endif
#endif
#endif
#endif
common/utils/websrv/websrv.c
View file @
8d74ea38
This diff is collapsed.
Click to expand it.
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