Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Worker.N
openairinterface5G
Commits
804595d4
Commit
804595d4
authored
8 years ago
by
FredericLeroy
Browse files
Options
Downloads
Patches
Plain Diff
style(conf2uedata.c): rewrite main() for readability
parent
33b2d11f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openair3/NAS/TOOLS/conf2uedata.c
+57
-44
57 additions, 44 deletions
openair3/NAS/TOOLS/conf2uedata.c
with
57 additions
and
44 deletions
openair3/NAS/TOOLS/conf2uedata.c
+
57
−
44
View file @
804595d4
...
...
@@ -13,7 +13,8 @@ int main(int argc, char**argv) {
int
rc
=
EXIT_SUCCESS
;
int
option
;
const
char
*
conf_file
=
NULL
;
while
((
option
=
getopt
(
argc
,
argv
,
options
))
!=
-
1
)
{
while
((
option
=
getopt
(
argc
,
argv
,
options
))
!=
-
1
)
{
switch
(
option
)
{
case
'c'
:
parse_data
=
TRUE
;
...
...
@@ -31,19 +32,26 @@ int main(int argc, char**argv) {
break
;
}
}
if
(
output
==
FALSE
&&
parse_data
==
TRUE
)
{
printf
(
"No output option found
\n
"
);
_display_usage
();
return
EXIT_FAILURE
;
}
else
if
(
output
==
TRUE
&&
parse_data
==
FALSE
)
{
}
if
(
output
==
TRUE
&&
parse_data
==
FALSE
)
{
printf
(
"No Configuration file is given
\n
"
);
_display_usage
();
return
EXIT_FAILURE
;
}
else
if
(
parse_data
==
FALSE
&&
print_data
==
FALSE
)
{
}
if
(
parse_data
==
FALSE
&&
print_data
==
FALSE
)
{
printf
(
"No options found
\n
"
);
_display_usage
();
return
EXIT_FAILURE
;
}
else
if
(
parse_data
)
{
}
if
(
parse_data
)
{
int
ret
;
int
ue_nb
=
0
;
config_setting_t
*
root_setting
=
NULL
;
...
...
@@ -51,55 +59,60 @@ int main(int argc, char**argv) {
config_setting_t
*
all_plmn_setting
=
NULL
;
char
user
[
10
];
config_t
cfg
;
ret
=
get_config_from_file
(
conf_file
,
&
cfg
);
if
(
ret
==
EXIT_FAILURE
)
{
exit
(
1
);
}
root_setting
=
config_root_setting
(
&
cfg
);
ue_nb
=
config_setting_length
(
root_setting
)
-
1
;
all_plmn_setting
=
config_setting_get_member
(
root_setting
,
PLMN
);
if
(
all_plmn_setting
!=
NULL
)
{
rc
=
parse_plmns
(
all_plmn_setting
);
if
(
rc
==
EXIT_FAILURE
)
{
return
rc
;
}
fill_network_record_list
();
for
(
int
i
=
0
;
i
<
ue_nb
;
i
++
)
{
sprintf
(
user
,
"%s%d"
,
UE
,
i
);
ue_setting
=
config_setting_get_member
(
root_setting
,
user
);
if
(
ue_setting
!=
NULL
)
{
rc
=
parse_ue_user_param
(
ue_setting
,
i
);
if
(
rc
!=
EXIT_SUCCESS
)
{
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
)
{
printf
(
"Problem in SIM section for UE%d. EXITING...
\n
"
,
i
);
return
EXIT_FAILURE
;
}
rc
=
parse_ue_plmn_param
(
ue_setting
,
i
);
if
(
rc
!=
EXIT_SUCCESS
)
{
return
EXIT_FAILURE
;
}
gen_emm_data
(
i
);
_display_emm_data
(
i
);
gen_usim_data
(
i
);
_display_usim_data
(
i
);
}
else
{
printf
(
"Check UE%d settings
\n
"
,
i
);
return
EXIT_FAILURE
;
}
}
config_destroy
(
&
cfg
);
}
else
{
all_plmn_setting
=
config_setting_get_member
(
root_setting
,
PLMN
);
if
(
all_plmn_setting
==
NULL
)
{
printf
(
"NO PLMN SECTION...EXITING...
\n
"
);
return
(
EXIT_FAILURE
);
}
}
rc
=
parse_plmns
(
all_plmn_setting
);
if
(
rc
==
EXIT_FAILURE
)
{
return
rc
;
}
fill_network_record_list
();
for
(
int
i
=
0
;
i
<
ue_nb
;
i
++
)
{
sprintf
(
user
,
"%s%d"
,
UE
,
i
);
ue_setting
=
config_setting_get_member
(
root_setting
,
user
);
if
(
ue_setting
==
NULL
)
{
printf
(
"Check UE%d settings
\n
"
,
i
);
return
EXIT_FAILURE
;
}
rc
=
parse_ue_user_param
(
ue_setting
,
i
);
if
(
rc
!=
EXIT_SUCCESS
)
{
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
)
{
printf
(
"Problem in SIM section for UE%d. EXITING...
\n
"
,
i
);
return
EXIT_FAILURE
;
}
rc
=
parse_ue_plmn_param
(
ue_setting
,
i
);
if
(
rc
!=
EXIT_SUCCESS
)
{
return
EXIT_FAILURE
;
}
gen_emm_data
(
i
);
_display_emm_data
(
i
);
gen_usim_data
(
i
);
_display_usim_data
(
i
);
}
config_destroy
(
&
cfg
);
}
exit
(
EXIT_SUCCESS
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment