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
spbro
OpenXG-RAN
Commits
fcb857e5
Commit
fcb857e5
authored
Aug 23, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(conf2uedata): add parse_Xplmn() to read *plmns
parent
5c8410c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
143 deletions
+37
-143
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+34
-138
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+3
-5
No files found.
openair3/NAS/TOOLS/conf2uedata.c
View file @
fcb857e5
...
...
@@ -227,11 +227,10 @@ int parse_plmns(config_setting_t *all_plmn_setting) {
}
int
parse_ue_plmn_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
const
char
**
h
)
{
int
rc
=
EXIT_SUCCESS
;
int
nb_errors
=
0
;
const
char
*
hplmn
;
config_setting_t
*
setting
=
NULL
;
rc
=
config_setting_lookup_string
(
ue_setting
,
HPLMN
,
h
);
if
(
rc
!=
1
)
{
if
(
config_setting_lookup_string
(
ue_setting
,
HPLMN
,
h
)
!=
1
)
{
printf
(
"Check HPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
...
...
@@ -241,147 +240,41 @@ int parse_ue_plmn_param(config_setting_t *ue_setting, int user_id, const char **
user_id
);
return
EXIT_FAILURE
;
}
setting
=
config_setting_get_member
(
ue_setting
,
UCPLMN
);
if
(
setting
==
NULL
)
{
printf
(
"Check UCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
fill_ucplmn
(
setting
,
user_id
);
if
(
rc
!=
EXIT_SUCCESS
)
{
printf
(
"Check UCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
setting
=
config_setting_get_member
(
ue_setting
,
OPLMN
);
if
(
setting
==
NULL
)
{
printf
(
"Check OPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
fill_oplmn
(
setting
,
user_id
);
if
(
rc
!=
EXIT_SUCCESS
)
{
printf
(
"Check OPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
setting
=
config_setting_get_member
(
ue_setting
,
OCPLMN
);
if
(
setting
==
NULL
)
{
printf
(
"Check OCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
fill_ocplmn
(
setting
,
user_id
);
if
(
rc
!=
EXIT_SUCCESS
)
{
printf
(
"Check OCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
setting
=
config_setting_get_member
(
ue_setting
,
FPLMN
);
if
(
setting
==
NULL
)
{
printf
(
"Check FPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
fill_fplmn
(
setting
,
user_id
);
if
(
rc
!=
EXIT_SUCCESS
)
{
printf
(
"Check FPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
setting
=
config_setting_get_member
(
ue_setting
,
EHPLMN
);
if
(
setting
==
NULL
)
{
printf
(
"Check EHPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
fill_ehplmn
(
setting
,
user_id
);
if
(
rc
!=
EXIT_SUCCESS
)
{
printf
(
"Check EHPLMN section for UE%d. Exiting
\n
"
,
user_id
);
if
(
parse_Xplmn
(
ue_setting
,
UCPLMN
,
user_id
,
&
ucplmn_nb
,
&
ucplmn
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OPLMN
,
user_id
,
&
oplmn_nb
,
&
oplmn
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OCPLMN
,
user_id
,
&
ocplmn_nb
,
&
ocplmn
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
FPLMN
,
user_id
,
&
fplmn_nb
,
&
fplmn
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
EHPLMN
,
user_id
,
&
ehplmn_nb
,
&
ehplmn
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
nb_errors
>
0
)
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
int
fill_ucplmn
(
config_setting_t
*
setting
,
int
user_id
)
{
int
rc
;
ucplmn_nb
=
config_setting_length
(
setting
);
ucplmn
=
malloc
(
ucplmn_nb
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
ucplmn_nb
;
i
++
)
{
const
char
*
mccmnc
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
mccmnc
==
NULL
)
{
printf
(
"Check UCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
return
EXIT_FAILURE
;
}
ucplmn
[
i
]
=
rc
;
}
return
EXIT_SUCCESS
;
}
int
fill_oplmn
(
config_setting_t
*
setting
,
int
user_id
)
{
int
rc
;
oplmn_nb
=
config_setting_length
(
setting
);
oplmn
=
malloc
(
oplmn_nb
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
oplmn_nb
;
i
++
)
{
const
char
*
mccmnc
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
mccmnc
==
NULL
)
{
printf
(
"Check OPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
return
EXIT_FAILURE
;
}
oplmn
[
i
]
=
rc
;
}
return
EXIT_SUCCESS
;
}
int
fill_ocplmn
(
config_setting_t
*
setting
,
int
user_id
)
{
int
rc
;
ocplmn_nb
=
config_setting_length
(
setting
);
ocplmn
=
malloc
(
ocplmn_nb
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
ocplmn_nb
;
i
++
)
{
const
char
*
mccmnc
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
mccmnc
==
NULL
)
{
printf
(
"Check OCPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
return
EXIT_FAILURE
;
}
ocplmn
[
i
]
=
rc
;
}
return
EXIT_SUCCESS
;
}
int
fill_fplmn
(
config_setting_t
*
setting
,
int
user_id
)
{
int
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
int
*
plmns_count
,
int
**
plmns
)
{
int
rc
;
fplmn_nb
=
config_setting_length
(
setting
);
fplmn
=
malloc
(
fplmn_nb
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
fplmn_nb
;
i
++
)
{
const
char
*
mccmnc
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
mccmnc
==
NULL
)
{
printf
(
"Check FPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
return
EXIT_FAILURE
;
}
fplmn
[
i
]
=
rc
;
int
item_count
;
config_setting_t
*
setting
;
setting
=
config_setting_get_member
(
ue_setting
,
section
);
if
(
setting
==
NULL
)
{
printf
(
"Check %s section for UE%d. Exiting
\n
"
,
section
,
user_id
);
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
int
fill_ehplmn
(
config_setting_t
*
setting
,
int
user_id
)
{
int
rc
;
ehplmn_nb
=
config_setting_length
(
setting
);
ehplmn
=
malloc
(
ehplmn_nb
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
ehplmn_nb
;
i
++
)
{
item_count
=
config_setting_length
(
setting
);
int
*
datas
=
malloc
(
item_count
*
sizeof
(
int
));
for
(
int
i
=
0
;
i
<
item_count
;
i
++
)
{
const
char
*
mccmnc
=
config_setting_get_string_elem
(
setting
,
i
);
if
(
mccmnc
==
NULL
)
{
printf
(
"Check
EHPLMN section for UE%d. Exiting
\n
"
,
user_id
);
printf
(
"Check
%s section for UE%d. Exiting
\n
"
,
section
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
);
...
...
@@ -390,8 +283,11 @@ int fill_ehplmn(config_setting_t* setting, int user_id) {
mccmnc
);
return
EXIT_FAILURE
;
}
ehplmn
[
i
]
=
rc
;
datas
[
i
]
=
rc
;
}
*
plmns_count
=
item_count
;
*
plmns
=
datas
;
return
EXIT_SUCCESS
;
}
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
fcb857e5
...
...
@@ -69,10 +69,8 @@ int parse_plmn_param(config_setting_t *plmn_setting, int index);
int
parse_plmns
(
config_setting_t
*
all_plmn_setting
);
int
get_plmn_index
(
const
char
*
mccmnc
);
int
parse_ue_plmn_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
const
char
**
hplmn
);
int
fill_ucplmn
(
config_setting_t
*
setting
,
int
use_id
);
int
fill_oplmn
(
config_setting_t
*
setting
,
int
use_id
);
int
fill_ocplmn
(
config_setting_t
*
setting
,
int
use_id
);
int
fill_fplmn
(
config_setting_t
*
setting
,
int
use_id
);
int
fill_ehplmn
(
config_setting_t
*
setting
,
int
use_id
);
int
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
int
*
plmns_count
,
int
**
plmns
);
#endif // _CONF2UEDATA_H
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