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
wangwenhui
OpenXG-RAN
Commits
8ae72d1c
Commit
8ae72d1c
authored
Aug 16, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(conf2uedata): put display out of build
parent
e2dc453b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
25 deletions
+65
-25
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+55
-21
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+10
-4
No files found.
openair3/NAS/TOOLS/conf2uedata.c
View file @
8ae72d1c
...
...
@@ -69,6 +69,8 @@ int main(int argc, char**argv) {
exit
(
EXIT_FAILURE
);
}
display_data_from_directory
(
output_dir
);
exit
(
EXIT_SUCCESS
);
}
...
...
@@ -116,7 +118,6 @@ int parse_config_file(const char *filename) {
printf
(
"Problem in USER section for UE%d. EXITING...
\n
"
,
i
);
return
EXIT_FAILURE
;
}
_display_ue_data
(
i
);
rc
=
parse_ue_sim_param
(
ue_setting
,
i
);
if
(
rc
!=
EXIT_SUCCESS
)
{
...
...
@@ -129,10 +130,7 @@ int parse_config_file(const char *filename) {
return
EXIT_FAILURE
;
}
gen_emm_data
(
i
);
_display_emm_data
(
i
);
gen_usim_data
(
i
);
_display_usim_data
(
i
);
}
config_destroy
(
&
cfg
);
return
(
EXIT_SUCCESS
);
...
...
@@ -854,17 +852,12 @@ int _luhn(const char* cc) {
return
10
-
(
sum
%
10
);
}
void
_display_usim_data
(
int
user_id
)
{
void
display_usim_data
(
const
char
*
filename
)
{
int
rc
;
usim_data_t
data
=
{
};
/*
* Read USIM application data
*/
memset
(
&
data
,
0
,
sizeof
(
usim_data_t
));
char
*
path
=
make_filename
(
output_dir
,
USIM_API_NVRAM_FILENAME
,
user_id
);
rc
=
usim_api_read
(
path
,
&
data
);
free
(
path
);
rc
=
usim_api_read
(
filename
,
&
data
);
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: usim_api_read() failed"
);
...
...
@@ -1046,16 +1039,14 @@ void _display_usim_data(int user_id) {
}
void
_display_ue_data
(
int
user_id
)
{
void
display_ue_data
(
const
char
*
filename
)
{
user_nvdata_t
data
;
int
rc
;
char
*
path
=
make_filename
(
output_dir
,
USER_NVRAM_FILENAME
,
user_id
);
/*
* Read UE's non-volatile data
*/
memset
(
&
data
,
0
,
sizeof
(
user_nvdata_t
));
rc
=
memory_read
(
path
,
&
data
,
sizeof
(
user_nvdata_t
));
free
(
path
);
rc
=
memory_read
(
filename
,
&
data
,
sizeof
(
user_nvdata_t
));
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: memory_read() failed"
);
...
...
@@ -1075,18 +1066,16 @@ void _display_ue_data(int user_id) {
/*
* Displays UE's non-volatile EMM data
*/
void
_display_emm_data
(
int
user_id
)
{
void
display_emm_data
(
const
char
*
filename
)
{
int
rc
;
emm_nvdata_t
data
;
char
*
path
=
make_filename
(
output_dir
,
EMM_NVRAM_FILENAME
,
user_id
);
/*
* Read EMM non-volatile data
*/
memset
(
&
data
,
0
,
sizeof
(
emm_nvdata_t
));
rc
=
memory_read
(
path
,
&
data
,
sizeof
(
emm_nvdata_t
));
free
(
path
);
rc
=
memory_read
(
filename
,
&
data
,
sizeof
(
emm_nvdata_t
));
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: memory_read() failed "
);
exit
(
EXIT_FAILURE
);
...
...
@@ -1166,8 +1155,53 @@ void _display_usage(void) {
fprintf
(
stderr
,
"
\t
[-h]
\t
Display this usage
\n
"
);
}
void
display_data_from_directory
(
const
char
*
directory
)
{
int
user_id
=
0
;
char
*
filename
;
filename
=
get_ue_filename
(
directory
,
user_id
);
while
(
file_exist_and_is_readable
(
filename
)
)
{
display_ue_data
(
filename
);
free
(
filename
);
filename
=
get_emm_filename
(
directory
,
user_id
);
display_emm_data
(
filename
);
free
(
filename
);
filename
=
get_usim_filename
(
directory
,
user_id
);
display_usim_data
(
filename
);
free
(
filename
);
user_id
+=
1
;
filename
=
get_ue_filename
(
directory
,
user_id
);
}
free
(
filename
);
}
bool
file_exist_and_is_readable
(
const
char
*
filename
)
{
FILE
*
file
;
file
=
fopen
(
filename
,
"r"
);
if
(
file
==
NULL
)
return
false
;
fclose
(
file
);
return
true
;
}
char
*
get_ue_filename
(
const
char
*
output_dir
,
int
user_id
)
{
return
make_filename
(
output_dir
,
USER_NVRAM_FILENAME
,
user_id
);
}
char
*
get_emm_filename
(
const
char
*
output_dir
,
int
user_id
)
{
return
make_filename
(
output_dir
,
EMM_NVRAM_FILENAME
,
user_id
);
}
char
*
get_usim_filename
(
const
char
*
output_dir
,
int
user_id
)
{
return
make_filename
(
output_dir
,
USIM_API_NVRAM_FILENAME
,
user_id
);
}
char
*
make_filename
(
const
char
*
output_dir
,
const
char
*
filename
,
int
ueid
)
{
char
*
make_filename
(
const
char
*
output_dir
,
const
char
*
filename
,
int
ueid
)
{
size_t
size
;
char
*
str_ueid
,
*
str
;
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
8ae72d1c
...
...
@@ -119,11 +119,9 @@ extern int ehplmn_nb;
extern
plmn_conf_param_t
*
user_plmn_list
;
extern
network_record_t
*
user_network_record_list
;
char
*
make_filename
(
const
char
*
output_dir
,
const
char
*
filename
,
int
ueid
);
int
get_config_from_file
(
const
char
*
filename
,
config_t
*
config
);
int
parse_config_file
(
const
char
*
filename
);
void
_display_usim_data
(
int
user_id
);
void
_display_usage
(
void
);
void
gen_emm_data
(
int
user_id
)
;
...
...
@@ -132,9 +130,17 @@ void fill_network_record_list(void);
int
_luhn
(
const
char
*
cc
);
void
_display_ue_data
(
int
user_id
);
void
display_data_from_directory
(
const
char
*
directory
);
void
display_ue_data
(
const
char
*
filename
);
void
display_emm_data
(
const
char
*
filename
);
void
display_usim_data
(
const
char
*
filename
);
bool
file_exist_and_is_readable
(
const
char
*
filename
);
char
*
get_ue_filename
(
const
char
*
output_dir
,
int
user_id
);
char
*
get_emm_filename
(
const
char
*
output_dir
,
int
user_id
);
char
*
get_usim_filename
(
const
char
*
output_dir
,
int
user_id
);
char
*
make_filename
(
const
char
*
output_dir
,
const
char
*
filename
,
int
ueid
);
void
_display_emm_data
(
int
user_id
);
int
parse_ue_user_param
(
config_setting_t
*
ue_setting
,
int
user_id
);
int
parse_ue_sim_param
(
config_setting_t
*
ue_setting
,
int
user_id
);
int
parse_plmn_param
(
config_setting_t
*
plmn_setting
,
int
index
);
...
...
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