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
eeb44860
Commit
eeb44860
authored
Aug 16, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(conf2uedata): move emm_data funcions in conf_emm.[c|h]
parent
ef2dee59
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
77 deletions
+94
-77
cmake_targets/nas_sim_tools/CMakeLists.txt
cmake_targets/nas_sim_tools/CMakeLists.txt
+2
-0
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+2
-73
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+0
-4
openair3/NAS/TOOLS/conf_emm.c
openair3/NAS/TOOLS/conf_emm.c
+80
-0
openair3/NAS/TOOLS/conf_emm.h
openair3/NAS/TOOLS/conf_emm.h
+10
-0
No files found.
cmake_targets/nas_sim_tools/CMakeLists.txt
View file @
eeb44860
...
...
@@ -17,6 +17,7 @@ set(OPENAIR3_DIR $ENV{OPENAIR_DIR}/openair3)
set
(
conf2uedata_SRC
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf2uedata.c
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_emm.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
...
...
@@ -30,6 +31,7 @@ set(conf2uedata_SRC
set
(
conf2uedata_HDR
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf2uedata.h
${
OPENAIR_DIR
}
/openair3/NAS/TOOLS/conf_emm.h
${
OPENAIR_DIR
}
/openair3/NAS/UE/API/USIM/usim_api.h
${
OPENAIR_DIR
}
/openair3/NAS/UE/API/USIM/aka_functions.h
${
OPENAIR_DIR
}
/openair3/NAS/COMMON/UTIL/memory.h
...
...
openair3/NAS/TOOLS/conf2uedata.c
View file @
eeb44860
...
...
@@ -10,6 +10,7 @@
#include "utils.h"
#include "display.h"
#include "fs.h"
#include "conf_emm.h"
const
char
*
msin
=
NULL
;
const
char
*
usim_api_k
=
NULL
;
...
...
@@ -138,7 +139,7 @@ int parse_config_file(const char *output_dir, const char *conf_filename) {
if
(
rc
!=
EXIT_SUCCESS
)
{
return
EXIT_FAILURE
;
}
gen_emm_data
(
i
,
&
emm_data
);
gen_emm_data
(
&
emm_data
);
write_emm_data
(
output_dir
,
i
,
&
emm_data
);
gen_usim_data
(
&
usim_data
);
...
...
@@ -427,70 +428,6 @@ int write_usim_data(const char *directory, int user_id, usim_data_t *usim_data){
}
void
gen_emm_data
(
int
user_id
,
emm_nvdata_t
*
emm_data
)
{
hplmn_index
=
get_plmn_index
(
hplmn
);
memset
(
emm_data
,
0
,
sizeof
(
emm_nvdata_t
));
int
hplmn_index
=
get_plmn_index
(
hplmn
);
emm_data
->
imsi
.
length
=
8
;
emm_data
->
imsi
.
u
.
num
.
parity
=
get_msin_parity
(
msin
);
emm_data
->
imsi
.
u
.
num
.
digit1
=
user_plmn_list
[
hplmn_index
].
mcc
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit2
=
user_plmn_list
[
hplmn_index
].
mcc
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit3
=
user_plmn_list
[
hplmn_index
].
mcc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit4
=
user_plmn_list
[
hplmn_index
].
mnc
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit5
=
user_plmn_list
[
hplmn_index
].
mnc
[
1
];
if
(
strlen
(
user_plmn_list
[
hplmn_index
].
mnc
)
==
3
)
{
emm_data
->
rplmn
.
MNCdigit3
=
user_plmn_list
[
hplmn_index
].
mnc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit6
=
user_plmn_list
[
hplmn_index
].
mnc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit7
=
msin
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit8
=
msin
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit9
=
msin
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit10
=
msin
[
3
];
emm_data
->
imsi
.
u
.
num
.
digit11
=
msin
[
4
];
emm_data
->
imsi
.
u
.
num
.
digit12
=
msin
[
5
];
emm_data
->
imsi
.
u
.
num
.
digit13
=
msin
[
6
];
emm_data
->
imsi
.
u
.
num
.
digit14
=
msin
[
7
];
emm_data
->
imsi
.
u
.
num
.
digit15
=
msin
[
8
];
}
else
{
emm_data
->
rplmn
.
MNCdigit3
=
0xf
;
emm_data
->
imsi
.
u
.
num
.
digit6
=
msin
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit7
=
msin
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit8
=
msin
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit9
=
msin
[
3
];
emm_data
->
imsi
.
u
.
num
.
digit10
=
msin
[
4
];
emm_data
->
imsi
.
u
.
num
.
digit11
=
msin
[
5
];
emm_data
->
imsi
.
u
.
num
.
digit12
=
msin
[
6
];
emm_data
->
imsi
.
u
.
num
.
digit13
=
msin
[
7
];
emm_data
->
imsi
.
u
.
num
.
digit14
=
msin
[
8
];
emm_data
->
imsi
.
u
.
num
.
digit15
=
msin
[
9
];
}
emm_data
->
rplmn
.
MCCdigit1
=
user_plmn_list
[
hplmn_index
].
mcc
[
0
];
emm_data
->
rplmn
.
MCCdigit2
=
user_plmn_list
[
hplmn_index
].
mcc
[
1
];
emm_data
->
rplmn
.
MCCdigit3
=
user_plmn_list
[
hplmn_index
].
mcc
[
2
];
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_nb
;
}
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
)
{
int
rc
;
char
*
filename
=
make_filename
(
directory
,
EMM_NVRAM_FILENAME
,
user_id
);
rc
=
memory_write
(
filename
,
emm_data
,
sizeof
(
emm_nvdata_t
));
free
(
filename
);
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: memory_write() failed"
);
exit
(
EXIT_FAILURE
);
}
return
(
EXIT_SUCCESS
);
}
int
parse_plmn_param
(
config_setting_t
*
plmn_setting
,
int
index
)
{
int
rc
=
0
;
rc
=
config_setting_lookup_string
(
plmn_setting
,
...
...
@@ -827,14 +764,6 @@ int get_plmn_index(const char * mccmnc) {
return
-
1
;
}
int
get_msin_parity
(
const
char
*
msin
)
{
int
imsi_size
=
strlen
(
msin
)
+
strlen
(
user_plmn_list
[
hplmn_index
].
mcc
)
+
strlen
(
user_plmn_list
[
hplmn_index
].
mnc
);
int
result
=
(
imsi_size
%
2
==
0
)
?
0
:
1
;
return
result
;
}
void
fill_network_record_list
()
{
for
(
int
i
=
0
;
i
<
plmn_nb
;
i
++
)
{
strcpy
(
user_network_record_list
[
i
].
fullname
,
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
eeb44860
...
...
@@ -3,7 +3,6 @@
#include <libconfig.h>
#include "emmData.h"
#include "usim_api.h"
#include "userDef.h"
...
...
@@ -100,12 +99,10 @@ 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
);
void
gen_emm_data
(
int
user_id
,
emm_nvdata_t
*
emm_data
);
void
fill_network_record_list
(
void
);
int
parse_ue_user_param
(
config_setting_t
*
ue_setting
,
int
user_id
,
user_nvdata_t
*
user_data
);
void
write_user_data
(
const
char
*
directory
,
int
user_id
,
user_nvdata_t
*
data
);
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
);
int
write_usim_data
(
const
char
*
directory
,
int
user_id
,
usim_data_t
*
usim_data
);
void
gen_usim_data
(
usim_data_t
*
usim_data
);
...
...
@@ -115,7 +112,6 @@ int _luhn(const char* cc);
int
parse_ue_sim_param
(
config_setting_t
*
ue_setting
,
int
user_id
);
int
parse_plmn_param
(
config_setting_t
*
plmn_setting
,
int
index
);
int
parse_plmns
(
config_setting_t
*
all_plmn_setting
);
int
get_msin_parity
(
const
char
*
msin
);
int
get_plmn_index
(
const
char
*
mccmnc
);
int
parse_ue_plmn_param
(
config_setting_t
*
ue_setting
,
int
user_id
);
int
fill_ucplmn
(
config_setting_t
*
setting
,
int
use_id
);
...
...
openair3/NAS/TOOLS/conf_emm.c
0 → 100644
View file @
eeb44860
#include <string.h>
#include "conf2uedata.h"
#include "memory.h"
#include "conf_emm.h"
#include "fs.h"
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
)
{
hplmn_index
=
get_plmn_index
(
hplmn
);
memset
(
emm_data
,
0
,
sizeof
(
emm_nvdata_t
));
int
hplmn_index
=
get_plmn_index
(
hplmn
);
emm_data
->
imsi
.
length
=
8
;
emm_data
->
imsi
.
u
.
num
.
parity
=
get_msin_parity
(
msin
);
emm_data
->
imsi
.
u
.
num
.
digit1
=
user_plmn_list
[
hplmn_index
].
mcc
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit2
=
user_plmn_list
[
hplmn_index
].
mcc
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit3
=
user_plmn_list
[
hplmn_index
].
mcc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit4
=
user_plmn_list
[
hplmn_index
].
mnc
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit5
=
user_plmn_list
[
hplmn_index
].
mnc
[
1
];
if
(
strlen
(
user_plmn_list
[
hplmn_index
].
mnc
)
==
3
)
{
emm_data
->
rplmn
.
MNCdigit3
=
user_plmn_list
[
hplmn_index
].
mnc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit6
=
user_plmn_list
[
hplmn_index
].
mnc
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit7
=
msin
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit8
=
msin
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit9
=
msin
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit10
=
msin
[
3
];
emm_data
->
imsi
.
u
.
num
.
digit11
=
msin
[
4
];
emm_data
->
imsi
.
u
.
num
.
digit12
=
msin
[
5
];
emm_data
->
imsi
.
u
.
num
.
digit13
=
msin
[
6
];
emm_data
->
imsi
.
u
.
num
.
digit14
=
msin
[
7
];
emm_data
->
imsi
.
u
.
num
.
digit15
=
msin
[
8
];
}
else
{
emm_data
->
rplmn
.
MNCdigit3
=
0xf
;
emm_data
->
imsi
.
u
.
num
.
digit6
=
msin
[
0
];
emm_data
->
imsi
.
u
.
num
.
digit7
=
msin
[
1
];
emm_data
->
imsi
.
u
.
num
.
digit8
=
msin
[
2
];
emm_data
->
imsi
.
u
.
num
.
digit9
=
msin
[
3
];
emm_data
->
imsi
.
u
.
num
.
digit10
=
msin
[
4
];
emm_data
->
imsi
.
u
.
num
.
digit11
=
msin
[
5
];
emm_data
->
imsi
.
u
.
num
.
digit12
=
msin
[
6
];
emm_data
->
imsi
.
u
.
num
.
digit13
=
msin
[
7
];
emm_data
->
imsi
.
u
.
num
.
digit14
=
msin
[
8
];
emm_data
->
imsi
.
u
.
num
.
digit15
=
msin
[
9
];
}
emm_data
->
rplmn
.
MCCdigit1
=
user_plmn_list
[
hplmn_index
].
mcc
[
0
];
emm_data
->
rplmn
.
MCCdigit2
=
user_plmn_list
[
hplmn_index
].
mcc
[
1
];
emm_data
->
rplmn
.
MCCdigit3
=
user_plmn_list
[
hplmn_index
].
mcc
[
2
];
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_nb
;
}
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
)
{
int
rc
;
char
*
filename
=
make_filename
(
directory
,
EMM_NVRAM_FILENAME
,
user_id
);
rc
=
memory_write
(
filename
,
emm_data
,
sizeof
(
emm_nvdata_t
));
free
(
filename
);
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: memory_write() failed"
);
exit
(
EXIT_FAILURE
);
}
return
(
EXIT_SUCCESS
);
}
int
get_msin_parity
(
const
char
*
msin
)
{
int
imsi_size
=
strlen
(
msin
)
+
strlen
(
user_plmn_list
[
hplmn_index
].
mcc
)
+
strlen
(
user_plmn_list
[
hplmn_index
].
mnc
);
int
result
=
(
imsi_size
%
2
==
0
)
?
0
:
1
;
return
result
;
}
openair3/NAS/TOOLS/conf_emm.h
0 → 100644
View file @
eeb44860
#ifndef _CONF_EMM_H
#define _CONF_EMM_H
#include "emmData.h"
void
gen_emm_data
(
emm_nvdata_t
*
emm_data
);
int
write_emm_data
(
const
char
*
directory
,
int
user_id
,
emm_nvdata_t
*
emm_data
);
int
get_msin_parity
(
const
char
*
msin
);
#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