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
wangjie
OpenXG-RAN
Commits
86c8d0f9
Commit
86c8d0f9
authored
Aug 23, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(conf2uedata): move plmns functions to conf_user_plmn.[c|h]
parent
51c77535
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
97 deletions
+123
-97
cmake_targets/nas_sim_tools/CMakeLists.txt
cmake_targets/nas_sim_tools/CMakeLists.txt
+1
-0
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+3
-70
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+0
-27
openair3/NAS/TOOLS/conf_user_plmn.c
openair3/NAS/TOOLS/conf_user_plmn.c
+81
-0
openair3/NAS/TOOLS/conf_user_plmn.h
openair3/NAS/TOOLS/conf_user_plmn.h
+37
-0
openair3/NAS/TOOLS/conf_usim.h
openair3/NAS/TOOLS/conf_usim.h
+1
-0
No files found.
cmake_targets/nas_sim_tools/CMakeLists.txt
View file @
86c8d0f9
...
...
@@ -21,6 +21,7 @@ set(conf2uedata_SRC
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_user_data.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_usim.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_network.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_user_plmn.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/fs.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/display.c
${
OPENAIR_DIR
}
/openair3/NAS/UE/API/USIM/usim_api.c
...
...
openair3/NAS/TOOLS/conf2uedata.c
View file @
86c8d0f9
...
...
@@ -105,8 +105,7 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
return
EXIT_FAILURE
;
}
rc
=
parse_user_plmns_conf
(
ue_setting
,
i
,
&
user_plmns
,
&
usim_data_conf
.
hplmn
,
networks
);
if
(
rc
!=
EXIT_SUCCESS
)
{
if
(
parse_user_plmns_conf
(
ue_setting
,
i
,
&
user_plmns
,
&
usim_data_conf
.
hplmn
,
networks
)
==
false
)
{
return
EXIT_FAILURE
;
}
...
...
@@ -130,6 +129,8 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
user_plmns
.
equivalents_home
.
size
,
networks
);
write_emm_data
(
output_dir
,
i
,
&
emm_data
);
user_plmns_free
(
&
user_plmns
);
}
free
(
networks
.
items
);
networks
.
size
=
0
;
...
...
@@ -157,74 +158,6 @@ int get_config_from_file(const char *filename, config_t *config) {
return
EXIT_SUCCESS
;
}
int
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
,
const
networks_t
networks
)
{
int
nb_errors
=
0
;
const
char
*
hplmn
;
if
(
config_setting_lookup_string
(
ue_setting
,
HPLMN
,
h
)
!=
1
)
{
printf
(
"Check HPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
hplmn
=
*
h
;
if
(
get_plmn_index
(
hplmn
,
networks
)
==
-
1
)
{
printf
(
"HPLMN for UE%d is not defined in PLMN section. Exiting
\n
"
,
user_id
);
return
EXIT_FAILURE
;
}
if
(
parse_Xplmn
(
ue_setting
,
UCPLMN
,
user_id
,
&
user_plmns
->
users_controlled
,
networks
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OPLMN
,
user_id
,
&
user_plmns
->
operators
,
networks
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OCPLMN
,
user_id
,
&
user_plmns
->
operators_controlled
,
networks
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
FPLMN
,
user_id
,
&
user_plmns
->
forbiddens
,
networks
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
EHPLMN
,
user_id
,
&
user_plmns
->
equivalents_home
,
networks
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
nb_errors
>
0
)
return
EXIT_FAILURE
;
return
EXIT_SUCCESS
;
}
int
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
plmns_list
*
plmns
,
const
networks_t
networks
)
{
int
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
;
}
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 %s section for UE%d. Exiting
\n
"
,
section
,
user_id
);
return
EXIT_FAILURE
;
}
rc
=
get_plmn_index
(
mccmnc
,
networks
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
return
EXIT_FAILURE
;
}
datas
[
i
]
=
rc
;
}
plmns
->
size
=
item_count
;
plmns
->
items
=
datas
;
return
EXIT_SUCCESS
;
}
/*
* Displays command line usage
*/
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
86c8d0f9
...
...
@@ -8,36 +8,9 @@
#define UE "UE"
#define HPLMN "HPLMN"
#define UCPLMN "UCPLMN_LIST"
#define OPLMN "OPLMN_LIST"
#define OCPLMN "OCPLMN_LIST"
#define FPLMN "FPLMN_LIST"
#define EHPLMN "EHPLMN_LIST"
typedef
struct
{
int
size
;
int
*
items
;
}
plmns_list
;
typedef
struct
{
plmns_list
users_controlled
;
plmns_list
operators
;
plmns_list
operators_controlled
;
plmns_list
forbiddens
;
plmns_list
equivalents_home
;
}
user_plmns_t
;
int
get_config_from_file
(
const
char
*
filename
,
config_t
*
config
);
int
parse_config_file
(
const
char
*
output_dir
,
const
char
*
filename
);
void
_display_usage
(
void
);
int
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
,
const
networks_t
networks
);
int
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
plmns_list
*
plmns
,
const
networks_t
networks
);
#endif // _CONF2UEDATA_H
openair3/NAS/TOOLS/conf_user_plmn.c
0 → 100644
View file @
86c8d0f9
#include <stdlib.h>
#include <string.h>
#include "conf_user_plmn.h"
bool
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
,
const
networks_t
networks
)
{
int
nb_errors
=
0
;
const
char
*
hplmn
;
if
(
config_setting_lookup_string
(
ue_setting
,
HPLMN
,
h
)
!=
1
)
{
printf
(
"Check HPLMN section for UE%d. Exiting
\n
"
,
user_id
);
return
false
;
}
hplmn
=
*
h
;
if
(
get_plmn_index
(
hplmn
,
networks
)
==
-
1
)
{
printf
(
"HPLMN for UE%d is not defined in PLMN section. Exiting
\n
"
,
user_id
);
return
false
;
}
if
(
parse_Xplmn
(
ue_setting
,
UCPLMN
,
user_id
,
&
user_plmns
->
users_controlled
,
networks
)
==
false
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OPLMN
,
user_id
,
&
user_plmns
->
operators
,
networks
)
==
false
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OCPLMN
,
user_id
,
&
user_plmns
->
operators_controlled
,
networks
)
==
false
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
FPLMN
,
user_id
,
&
user_plmns
->
forbiddens
,
networks
)
==
false
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
EHPLMN
,
user_id
,
&
user_plmns
->
equivalents_home
,
networks
)
==
false
)
nb_errors
++
;
if
(
nb_errors
>
0
)
return
false
;
return
true
;
}
bool
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
plmns_list
*
plmns
,
const
networks_t
networks
)
{
int
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
false
;
}
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 %s section for UE%d. Exiting
\n
"
,
section
,
user_id
);
free
(
datas
);
return
false
;
}
rc
=
get_plmn_index
(
mccmnc
,
networks
);
if
(
rc
==
-
1
)
{
printf
(
"The PLMN %s is not defined in PLMN section. Exiting...
\n
"
,
mccmnc
);
free
(
datas
);
return
false
;
}
datas
[
i
]
=
rc
;
}
plmns
->
size
=
item_count
;
plmns
->
items
=
datas
;
return
true
;
}
void
user_plmns_free
(
user_plmns_t
*
user_plmns
)
{
free
(
user_plmns
->
users_controlled
.
items
);
free
(
user_plmns
->
operators
.
items
);
free
(
user_plmns
->
operators_controlled
.
items
);
free
(
user_plmns
->
forbiddens
.
items
);
free
(
user_plmns
->
equivalents_home
.
items
);
memset
(
user_plmns
,
0
,
sizeof
(
user_plmns_t
));
}
openair3/NAS/TOOLS/conf_user_plmn.h
0 → 100644
View file @
86c8d0f9
#ifndef _CONF_USER_H
#define _CONF_USER_H
#include <stdbool.h>
#include <libconfig.h>
#include "conf_network.h"
#define HPLMN "HPLMN"
#define UCPLMN "UCPLMN_LIST"
#define OPLMN "OPLMN_LIST"
#define OCPLMN "OCPLMN_LIST"
#define FPLMN "FPLMN_LIST"
#define EHPLMN "EHPLMN_LIST"
typedef
struct
{
int
size
;
int
*
items
;
}
plmns_list
;
typedef
struct
{
plmns_list
users_controlled
;
plmns_list
operators
;
plmns_list
operators_controlled
;
plmns_list
forbiddens
;
plmns_list
equivalents_home
;
}
user_plmns_t
;
bool
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
,
const
networks_t
networks
);
bool
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
plmns_list
*
plmns
,
const
networks_t
networks
);
void
user_plmns_free
(
user_plmns_t
*
user_plmns
);
#endif
openair3/NAS/TOOLS/conf_usim.h
View file @
86c8d0f9
...
...
@@ -3,6 +3,7 @@
#include <libconfig.h>
#include "usim_api.h"
#include "conf_user_plmn.h"
#define SIM "SIM"
#define MSIN "MSIN"
...
...
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