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
常顺宇
OpenXG-RAN
Commits
459a6ec3
Commit
459a6ec3
authored
Aug 23, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(conf2uedata): use user_plmns struct to store plmns lists
This remove the old static lists
parent
c86b437e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
44 deletions
+47
-44
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+12
-15
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+9
-6
openair3/NAS/TOOLS/conf_emm.c
openair3/NAS/TOOLS/conf_emm.c
+2
-2
openair3/NAS/TOOLS/conf_emm.h
openair3/NAS/TOOLS/conf_emm.h
+2
-1
openair3/NAS/TOOLS/conf_usim.c
openair3/NAS/TOOLS/conf_usim.c
+20
-19
openair3/NAS/TOOLS/conf_usim.h
openair3/NAS/TOOLS/conf_usim.h
+2
-1
No files found.
openair3/NAS/TOOLS/conf2uedata.c
View file @
459a6ec3
...
...
@@ -12,12 +12,6 @@
#include "conf_user_data.h"
#include "conf_usim.h"
plmns_list
ucplmns
;
plmns_list
oplmns
;
plmns_list
ocplmns
;
plmns_list
fplmns
;
plmns_list
ehplmns
;
int
plmn_nb
=
0
;
plmn_conf_param_t
*
user_plmn_list
=
NULL
;
...
...
@@ -106,6 +100,8 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
usim_data_t
usim_data
;
usim_data_conf_t
usim_data_conf
;
user_plmns_t
user_plmns
;
sprintf
(
user
,
"%s%d"
,
UE
,
i
);
ue_setting
=
config_setting_get_member
(
root_setting
,
user
);
...
...
@@ -114,7 +110,7 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
return
EXIT_FAILURE
;
}
rc
=
parse_u
e_plmn_param
(
ue_setting
,
i
,
&
usim_data_conf
.
hplmn
);
rc
=
parse_u
ser_plmns_conf
(
ue_setting
,
i
,
&
user_plmns
,
&
usim_data_conf
.
hplmn
);
if
(
rc
!=
EXIT_SUCCESS
)
{
return
EXIT_FAILURE
;
}
...
...
@@ -132,10 +128,10 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
printf
(
"Problem in SIM section for UE%d. EXITING...
\n
"
,
i
);
return
EXIT_FAILURE
;
}
gen_usim_data
(
&
usim_data_conf
,
&
usim_data
);
gen_usim_data
(
&
usim_data_conf
,
&
usim_data
,
&
user_plmns
);
write_usim_data
(
output_dir
,
i
,
&
usim_data
);
gen_emm_data
(
&
emm_data
,
usim_data_conf
.
hplmn
,
usim_data_conf
.
msin
);
gen_emm_data
(
&
emm_data
,
usim_data_conf
.
hplmn
,
usim_data_conf
.
msin
,
user_plmns
.
equivalents_home
.
size
);
write_emm_data
(
output_dir
,
i
,
&
emm_data
);
}
...
...
@@ -221,7 +217,8 @@ int parse_plmns(config_setting_t *all_plmn_setting) {
return
rc
;
}
int
parse_ue_plmn_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
const
char
**
h
)
{
int
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
)
{
int
nb_errors
=
0
;
const
char
*
hplmn
;
...
...
@@ -236,15 +233,15 @@ int parse_ue_plmn_param(config_setting_t *ue_setting, int user_id, const char **
return
EXIT_FAILURE
;
}
if
(
parse_Xplmn
(
ue_setting
,
UCPLMN
,
user_id
,
&
u
cplmns
)
==
EXIT_FAILURE
)
if
(
parse_Xplmn
(
ue_setting
,
UCPLMN
,
user_id
,
&
u
ser_plmns
->
users_controlled
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OPLMN
,
user_id
,
&
oplmn
s
)
==
EXIT_FAILURE
)
if
(
parse_Xplmn
(
ue_setting
,
OPLMN
,
user_id
,
&
user_plmns
->
operator
s
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
OCPLMN
,
user_id
,
&
ocplmns
)
==
EXIT_FAILURE
)
if
(
parse_Xplmn
(
ue_setting
,
OCPLMN
,
user_id
,
&
user_plmns
->
operators_controlled
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
FPLMN
,
user_id
,
&
fplm
ns
)
==
EXIT_FAILURE
)
if
(
parse_Xplmn
(
ue_setting
,
FPLMN
,
user_id
,
&
user_plmns
->
forbidde
ns
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
parse_Xplmn
(
ue_setting
,
EHPLMN
,
user_id
,
&
ehplmns
)
==
EXIT_FAILURE
)
if
(
parse_Xplmn
(
ue_setting
,
EHPLMN
,
user_id
,
&
user_plmns
->
equivalents_home
)
==
EXIT_FAILURE
)
nb_errors
++
;
if
(
nb_errors
>
0
)
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
459a6ec3
...
...
@@ -48,11 +48,13 @@ typedef struct {
int
*
items
;
}
plmns_list
;
extern
plmns_list
ucplmns
;
extern
plmns_list
oplmns
;
extern
plmns_list
ocplmns
;
extern
plmns_list
fplmns
;
extern
plmns_list
ehplmns
;
typedef
struct
{
plmns_list
users_controlled
;
plmns_list
operators
;
plmns_list
operators_controlled
;
plmns_list
forbiddens
;
plmns_list
equivalents_home
;
}
user_plmns_t
;
extern
int
plmn_nb
;
...
...
@@ -68,7 +70,8 @@ void fill_network_record_list(void);
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
parse_user_plmns_conf
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_plmns_t
*
user_plmns
,
const
char
**
h
);
int
parse_Xplmn
(
config_setting_t
*
ue_setting
,
const
char
*
section
,
int
user_id
,
plmns_list
*
plmns
);
...
...
openair3/NAS/TOOLS/conf_emm.c
View file @
459a6ec3
...
...
@@ -5,7 +5,7 @@
#include "conf_emm.h"
#include "fs.h"
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
,
const
char
*
hplmn
,
const
char
*
msin
)
{
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
,
const
char
*
hplmn
,
const
char
*
msin
,
int
ehplmn_count
)
{
memset
(
emm_data
,
0
,
sizeof
(
emm_nvdata_t
));
int
hplmn_index
=
get_plmn_index
(
hplmn
);
emm_data
->
imsi
.
length
=
8
;
...
...
@@ -53,7 +53,7 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin) {
emm_data
->
rplmn
.
MNCdigit1
=
user_plmn_list
[
hplmn_index
].
mnc
[
0
];
emm_data
->
rplmn
.
MNCdigit2
=
user_plmn_list
[
hplmn_index
].
mnc
[
1
];
emm_data
->
eplmn
.
n_plmns
=
ehplmn
s
.
size
;
emm_data
->
eplmn
.
n_plmns
=
ehplmn
_count
;
}
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
)
{
...
...
openair3/NAS/TOOLS/conf_emm.h
View file @
459a6ec3
...
...
@@ -3,7 +3,8 @@
#include "emmData.h"
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
,
const
char
*
hplmn
,
const
char
*
msin
);
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
,
const
char
*
hplmn
,
const
char
*
msin
,
int
ehplmn_count
);
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
);
int
get_msin_parity
(
const
char
*
msin
,
const
char
*
mcc
,
const
char
*
mnc
);
...
...
openair3/NAS/TOOLS/conf_usim.c
View file @
459a6ec3
...
...
@@ -5,8 +5,8 @@
#include "utils.h"
#include "conf_emm.h"
#include "fs.h"
#include "conf_usim.h"
#include "conf2uedata.h"
#include "conf_usim.h"
int
parse_ue_sim_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
usim_data_conf_t
*
u
)
{
int
rc
=
EXIT_SUCCESS
;
...
...
@@ -40,7 +40,8 @@ int parse_ue_sim_param(config_setting_t *ue_setting, int user_id, usim_data_conf
return
EXIT_SUCCESS
;
}
void
gen_usim_data
(
usim_data_conf_t
*
u
,
usim_data_t
*
usim_data
)
{
void
gen_usim_data
(
usim_data_conf_t
*
u
,
usim_data_t
*
usim_data
,
const
user_plmns_t
*
user_plmns
)
{
int
hplmn_index
=
get_plmn_index
(
u
->
hplmn
);
memset
(
usim_data
,
0
,
sizeof
(
usim_data_t
));
usim_data
->
imsi
.
length
=
8
;
...
...
@@ -96,9 +97,9 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
for
(
int
i
=
0
;
i
<
USIM_FPLMN_MAX
;
i
++
)
{
memset
(
&
usim_data
->
fplmn
[
i
],
0xff
,
sizeof
(
plmn_t
));
}
if
(
fplm
ns
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
fplm
ns
.
size
;
i
++
)
{
usim_data
->
fplmn
[
i
]
=
user_network_record_list
[
fplm
ns
.
items
[
i
]].
plmn
;
if
(
user_plmns
->
forbidde
ns
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
user_plmns
->
forbidde
ns
.
size
;
i
++
)
{
usim_data
->
fplmn
[
i
]
=
user_network_record_list
[
user_plmns
->
forbidde
ns
.
items
[
i
]].
plmn
;
}
}
...
...
@@ -183,8 +184,8 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
/*
* PLMN Network Name and Operator PLMN List
*/
for
(
int
i
=
0
;
i
<
oplmn
s
.
size
;
i
++
)
{
network_record_t
record
=
user_network_record_list
[
oplmn
s
.
items
[
i
]];
for
(
int
i
=
0
;
i
<
user_plmns
->
operator
s
.
size
;
i
++
)
{
network_record_t
record
=
user_network_record_list
[
user_plmns
->
operator
s
.
items
[
i
]];
usim_data
->
pnn
[
i
].
fullname
.
type
=
USIM_PNN_FULLNAME_TAG
;
usim_data
->
pnn
[
i
].
fullname
.
length
=
strlen
(
record
.
fullname
);
strncpy
((
char
*
)
usim_data
->
pnn
[
i
].
fullname
.
value
,
record
.
fullname
,
...
...
@@ -198,8 +199,8 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
usim_data
->
opl
[
i
].
end
=
record
.
tac_end
;
usim_data
->
opl
[
i
].
record_id
=
i
;
}
if
(
oplmn
s
.
size
<
USIM_OPL_MAX
)
{
for
(
int
i
=
oplmn
s
.
size
;
i
<
USIM_OPL_MAX
;
i
++
)
{
if
(
user_plmns
->
operator
s
.
size
<
USIM_OPL_MAX
)
{
for
(
int
i
=
user_plmns
->
operator
s
.
size
;
i
<
USIM_OPL_MAX
;
i
++
)
{
memset
(
&
usim_data
->
opl
[
i
].
plmn
,
0xff
,
sizeof
(
plmn_t
));
}
}
...
...
@@ -207,11 +208,11 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
/*
* List of Equivalent HPLMNs
*/
for
(
int
i
=
0
;
i
<
ehplmns
.
size
;
i
++
)
{
usim_data
->
ehplmn
[
i
]
=
user_network_record_list
[
ehplmns
.
items
[
i
]].
plmn
;
for
(
int
i
=
0
;
i
<
user_plmns
->
equivalents_home
.
size
;
i
++
)
{
usim_data
->
ehplmn
[
i
]
=
user_network_record_list
[
user_plmns
->
equivalents_home
.
items
[
i
]].
plmn
;
}
if
(
ehplmns
.
size
<
USIM_EHPLMN_MAX
)
{
for
(
int
i
=
ehplmns
.
size
;
i
<
USIM_EHPLMN_MAX
;
i
++
)
{
if
(
user_plmns
->
equivalents_home
.
size
<
USIM_EHPLMN_MAX
)
{
for
(
int
i
=
user_plmns
->
equivalents_home
.
size
;
i
<
USIM_EHPLMN_MAX
;
i
++
)
{
memset
(
&
usim_data
->
ehplmn
[
i
],
0xff
,
sizeof
(
plmn_t
));
}
}
...
...
@@ -227,9 +228,9 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
for
(
int
i
=
0
;
i
<
USIM_PLMN_MAX
;
i
++
)
{
memset
(
&
usim_data
->
plmn
[
i
],
0xff
,
sizeof
(
plmn_t
));
}
if
(
u
cplmns
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
u
cplmns
.
size
;
i
++
)
{
usim_data
->
plmn
[
i
].
plmn
=
user_network_record_list
[
u
cplmns
.
items
[
i
]].
plmn
;
if
(
u
ser_plmns
->
users_controlled
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
u
ser_plmns
->
users_controlled
.
size
;
i
++
)
{
usim_data
->
plmn
[
i
].
plmn
=
user_network_record_list
[
u
ser_plmns
->
users_controlled
.
items
[
i
]].
plmn
;
}
}
...
...
@@ -238,9 +239,9 @@ void gen_usim_data(usim_data_conf_t *u, usim_data_t *usim_data) {
for
(
int
i
=
0
;
i
<
USIM_OPLMN_MAX
;
i
++
)
{
memset
(
&
usim_data
->
oplmn
[
i
],
0xff
,
sizeof
(
plmn_t
));
}
if
(
ocplmns
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
ocplmns
.
size
;
i
++
)
{
usim_data
->
oplmn
[
i
].
plmn
=
user_network_record_list
[
ocplmns
.
items
[
i
]].
plmn
;
if
(
user_plmns
->
operators_controlled
.
size
>
0
)
{
for
(
int
i
=
0
;
i
<
user_plmns
->
operators_controlled
.
size
;
i
++
)
{
usim_data
->
oplmn
[
i
].
plmn
=
user_network_record_list
[
user_plmns
->
operators_controlled
.
items
[
i
]].
plmn
;
usim_data
->
oplmn
[
i
].
AcT
=
(
USIM_ACT_GSM
|
USIM_ACT_UTRAN
|
USIM_ACT_EUTRAN
);
}
...
...
openair3/NAS/TOOLS/conf_usim.h
View file @
459a6ec3
...
...
@@ -40,6 +40,7 @@ typedef struct {
int
parse_ue_sim_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
usim_data_conf_t
*
u
);
int
write_usim_data
(
const
char
*
directory
,
int
user_id
,
usim_data_t
*
usim_data
);
void
gen_usim_data
(
usim_data_conf_t
*
u
,
usim_data_t
*
usim_data
);
void
gen_usim_data
(
usim_data_conf_t
*
u
,
usim_data_t
*
usim_data
,
const
user_plmns_t
*
user_plmns
);
#endif
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