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
canghaiwuhen
OpenXG-RAN
Commits
576bbd25
Commit
576bbd25
authored
Jul 13, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/EMM: move _usim_data to nas_user_t
parent
7340b5e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
70 deletions
+64
-70
openair3/NAS/UE/EMM/emm_main.c
openair3/NAS/UE/EMM/emm_main.c
+57
-65
openair3/NAS/UE/EMM/emm_main.h
openair3/NAS/UE/EMM/emm_main.h
+1
-1
openair3/NAS/UE/nas_proc.c
openair3/NAS/UE/nas_proc.c
+2
-2
openair3/NAS/UE/nas_proc.h
openair3/NAS/UE/nas_proc.h
+1
-1
openair3/NAS/UE/nas_user.c
openair3/NAS/UE/nas_user.c
+1
-1
openair3/NAS/UE/user_defs.h
openair3/NAS/UE/user_defs.h
+2
-0
No files found.
openair3/NAS/UE/EMM/emm_main.c
View file @
576bbd25
...
...
@@ -68,11 +68,6 @@ static const char *_emm_main_get_plmn(emm_plmn_list_t *emm_plmn_list, const plmn
static
int
_emm_main_get_plmn_index
(
emm_plmn_list_t
*
emm_plmn_list
,
const
char
*
plmn
,
int
format
);
/*
* USIM application data
*/
static
usim_data_t
_usim_data
;
/*
* Callback executed whenever a change in the network has to be notified
* to the user application
...
...
@@ -93,7 +88,6 @@ static int _emm_main_callback(emm_data_t *emm_data, int);
** Inputs: cb: The user notification callback **
** imei: The IMEI read from the UE's non-volatile **
** memory **
** Others: _usim_data **
** **
** Outputs: None **
** Return: None **
...
...
@@ -165,8 +159,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/*
* Get USIM application data
*/
_usim_data
.
usimtestmode
=
usim_test
;
if
(
usim_api_read
(
&
_usim_data
)
!=
RETURNok
)
{
if
(
usim_api_read
(
&
user
->
usim_data
)
!=
RETURNok
)
{
/* The USIM application may not be present or not valid */
LOG_TRACE
(
WARNING
,
"EMM-MAIN - Failed to read USIM application data"
);
}
else
{
...
...
@@ -177,54 +170,54 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
user
->
emm_data
->
usim_is_valid
=
TRUE
;
/* Get the Home PLMN derived from the IMSI */
user
->
emm_data
->
hplmn
.
MCCdigit1
=
_
usim_data
.
imsi
.
u
.
num
.
digit1
;
user
->
emm_data
->
hplmn
.
MCCdigit2
=
_
usim_data
.
imsi
.
u
.
num
.
digit2
;
user
->
emm_data
->
hplmn
.
MCCdigit3
=
_
usim_data
.
imsi
.
u
.
num
.
digit3
;
user
->
emm_data
->
hplmn
.
MNCdigit1
=
_
usim_data
.
imsi
.
u
.
num
.
digit4
;
user
->
emm_data
->
hplmn
.
MNCdigit2
=
_
usim_data
.
imsi
.
u
.
num
.
digit5
;
user
->
emm_data
->
hplmn
.
MNCdigit3
=
_
usim_data
.
imsi
.
u
.
num
.
digit6
;
user
->
emm_data
->
hplmn
.
MCCdigit1
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit1
;
user
->
emm_data
->
hplmn
.
MCCdigit2
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit2
;
user
->
emm_data
->
hplmn
.
MCCdigit3
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit3
;
user
->
emm_data
->
hplmn
.
MNCdigit1
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit4
;
user
->
emm_data
->
hplmn
.
MNCdigit2
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit5
;
user
->
emm_data
->
hplmn
.
MNCdigit3
=
user
->
usim_data
.
imsi
.
u
.
num
.
digit6
;
/* Get the list of forbidden PLMNs */
for
(
i
=
0
;
(
i
<
EMM_DATA_FPLMN_MAX
)
&&
(
i
<
USIM_FPLMN_MAX
);
i
++
)
{
if
(
PLMN_IS_VALID
(
_
usim_data
.
fplmn
[
i
])
)
{
user
->
emm_data
->
fplmn
.
plmn
[
i
]
=
_
usim_data
.
fplmn
[
i
];
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
fplmn
[
i
])
)
{
user
->
emm_data
->
fplmn
.
plmn
[
i
]
=
user
->
usim_data
.
fplmn
[
i
];
user
->
emm_data
->
fplmn
.
n_plmns
+=
1
;
}
}
/* Get the list of Equivalent HPLMNs */
for
(
i
=
0
;
(
i
<
EMM_DATA_EHPLMN_MAX
)
&&
(
i
<
USIM_EHPLMN_MAX
);
i
++
)
{
if
(
PLMN_IS_VALID
(
_
usim_data
.
ehplmn
[
i
])
)
{
user
->
emm_data
->
ehplmn
.
plmn
[
i
]
=
_
usim_data
.
ehplmn
[
i
];
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
ehplmn
[
i
])
)
{
user
->
emm_data
->
ehplmn
.
plmn
[
i
]
=
user
->
usim_data
.
ehplmn
[
i
];
user
->
emm_data
->
ehplmn
.
n_plmns
+=
1
;
}
}
/* Get the list of User controlled PLMN Selector */
for
(
i
=
0
;
(
i
<
EMM_DATA_PLMN_MAX
)
&&
(
i
<
USIM_PLMN_MAX
);
i
++
)
{
if
(
PLMN_IS_VALID
(
_
usim_data
.
plmn
[
i
].
plmn
)
)
{
user
->
emm_data
->
plmn
.
plmn
[
i
]
=
_
usim_data
.
plmn
[
i
].
plmn
;
user
->
emm_data
->
userAcT
[
i
]
=
_
usim_data
.
plmn
[
i
].
AcT
;
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
plmn
[
i
].
plmn
)
)
{
user
->
emm_data
->
plmn
.
plmn
[
i
]
=
user
->
usim_data
.
plmn
[
i
].
plmn
;
user
->
emm_data
->
userAcT
[
i
]
=
user
->
usim_data
.
plmn
[
i
].
AcT
;
user
->
emm_data
->
plmn
.
n_plmns
+=
1
;
}
}
/* Get the list of Operator controlled PLMN Selector */
for
(
i
=
0
;
(
i
<
EMM_DATA_OPLMN_MAX
)
&&
(
i
<
USIM_OPLMN_MAX
);
i
++
)
{
if
(
PLMN_IS_VALID
(
_
usim_data
.
oplmn
[
i
].
plmn
)
)
{
user
->
emm_data
->
oplmn
.
plmn
[
i
]
=
_
usim_data
.
oplmn
[
i
].
plmn
;
user
->
emm_data
->
operAcT
[
i
]
=
_
usim_data
.
oplmn
[
i
].
AcT
;
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
oplmn
[
i
].
plmn
)
)
{
user
->
emm_data
->
oplmn
.
plmn
[
i
]
=
user
->
usim_data
.
oplmn
[
i
].
plmn
;
user
->
emm_data
->
operAcT
[
i
]
=
user
->
usim_data
.
oplmn
[
i
].
AcT
;
user
->
emm_data
->
oplmn
.
n_plmns
+=
1
;
}
}
/* Get the list of Operator network name records */
for
(
i
=
0
;
(
i
<
EMM_DATA_OPNN_MAX
)
&&
(
i
<
USIM_OPL_MAX
);
i
++
)
{
if
(
PLMN_IS_VALID
(
_
usim_data
.
opl
[
i
].
plmn
)
)
{
int
pnn_id
=
_
usim_data
.
opl
[
i
].
record_id
;
user
->
emm_data
->
opnn
[
i
].
plmn
=
&
_
usim_data
.
opl
[
i
].
plmn
;
user
->
emm_data
->
opnn
[
i
].
fullname
=
(
char
*
)
_
usim_data
.
pnn
[
pnn_id
].
fullname
.
value
;
user
->
emm_data
->
opnn
[
i
].
shortname
=
(
char
*
)
_
usim_data
.
pnn
[
pnn_id
].
shortname
.
value
;
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
opl
[
i
].
plmn
)
)
{
int
pnn_id
=
user
->
usim_data
.
opl
[
i
].
record_id
;
user
->
emm_data
->
opnn
[
i
].
plmn
=
&
user
->
usim_data
.
opl
[
i
].
plmn
;
user
->
emm_data
->
opnn
[
i
].
fullname
=
(
char
*
)
user
->
usim_data
.
pnn
[
pnn_id
].
fullname
.
value
;
user
->
emm_data
->
opnn
[
i
].
shortname
=
(
char
*
)
user
->
usim_data
.
pnn
[
pnn_id
].
shortname
.
value
;
user
->
emm_data
->
n_opnns
+=
1
;
}
}
...
...
@@ -232,27 +225,27 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/* TODO: Get the Higher Priority PLMN search period parameter */
/* Get the EPS location information */
if
(
PLMN_IS_VALID
(
_
usim_data
.
epsloci
.
guti
.
gummei
.
plmn
))
{
user
->
emm_data
->
guti
=
&
_
usim_data
.
epsloci
.
guti
;
if
(
PLMN_IS_VALID
(
user
->
usim_data
.
epsloci
.
guti
.
gummei
.
plmn
))
{
user
->
emm_data
->
guti
=
&
user
->
usim_data
.
epsloci
.
guti
;
}
if
(
TAI_IS_VALID
(
_
usim_data
.
epsloci
.
tai
))
{
user
->
emm_data
->
tai
=
&
_
usim_data
.
epsloci
.
tai
;
if
(
TAI_IS_VALID
(
user
->
usim_data
.
epsloci
.
tai
))
{
user
->
emm_data
->
tai
=
&
user
->
usim_data
.
epsloci
.
tai
;
}
user
->
emm_data
->
status
=
_
usim_data
.
epsloci
.
status
;
user
->
emm_data
->
status
=
user
->
usim_data
.
epsloci
.
status
;
/* Get NAS configuration parameters */
user
->
emm_data
->
NAS_SignallingPriority
=
_
usim_data
.
nasconfig
.
NAS_SignallingPriority
.
value
[
0
];
user
->
emm_data
->
NMO_I_Behaviour
=
_
usim_data
.
nasconfig
.
NMO_I_Behaviour
.
value
[
0
];
user
->
emm_data
->
AttachWithImsi
=
_
usim_data
.
nasconfig
.
AttachWithImsi
.
value
[
0
];
user
->
usim_data
.
nasconfig
.
NAS_SignallingPriority
.
value
[
0
];
user
->
emm_data
->
NMO_I_Behaviour
=
user
->
usim_data
.
nasconfig
.
NMO_I_Behaviour
.
value
[
0
];
user
->
emm_data
->
AttachWithImsi
=
user
->
usim_data
.
nasconfig
.
AttachWithImsi
.
value
[
0
];
user
->
emm_data
->
MinimumPeriodicSearchTimer
=
_
usim_data
.
nasconfig
.
MinimumPeriodicSearchTimer
.
value
[
0
];
user
->
usim_data
.
nasconfig
.
MinimumPeriodicSearchTimer
.
value
[
0
];
user
->
emm_data
->
ExtendedAccessBarring
=
_
usim_data
.
nasconfig
.
ExtendedAccessBarring
.
value
[
0
];
user
->
usim_data
.
nasconfig
.
ExtendedAccessBarring
.
value
[
0
];
user
->
emm_data
->
Timer_T3245_Behaviour
=
_
usim_data
.
nasconfig
.
Timer_T3245_Behaviour
.
value
[
0
];
user
->
usim_data
.
nasconfig
.
Timer_T3245_Behaviour
.
value
[
0
];
/*
* Get EPS NAS security context
...
...
@@ -265,7 +258,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
memset
(
user
->
emm_data
->
security
,
0
,
sizeof
(
emm_security_context_t
));
/* Type of security context */
if
(
_
usim_data
.
securityctx
.
KSIasme
.
value
[
0
]
!=
if
(
user
->
usim_data
.
securityctx
.
KSIasme
.
value
[
0
]
!=
USIM_KSI_NOT_AVAILABLE
)
{
user
->
emm_data
->
security
->
type
=
EMM_KSI_NATIVE
;
}
else
{
...
...
@@ -273,39 +266,39 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
}
/* EPS key set identifier */
user
->
emm_data
->
security
->
eksi
=
_
usim_data
.
securityctx
.
KSIasme
.
value
[
0
];
user
->
emm_data
->
security
->
eksi
=
user
->
usim_data
.
securityctx
.
KSIasme
.
value
[
0
];
/* ASME security key */
user
->
emm_data
->
security
->
kasme
.
length
=
_
usim_data
.
securityctx
.
Kasme
.
length
;
user
->
usim_data
.
securityctx
.
Kasme
.
length
;
user
->
emm_data
->
security
->
kasme
.
value
=
(
uint8_t
*
)
malloc
(
user
->
emm_data
->
security
->
kasme
.
length
);
if
(
user
->
emm_data
->
security
->
kasme
.
value
)
{
memcpy
(
user
->
emm_data
->
security
->
kasme
.
value
,
_
usim_data
.
securityctx
.
Kasme
.
value
,
user
->
usim_data
.
securityctx
.
Kasme
.
value
,
user
->
emm_data
->
security
->
kasme
.
length
);
}
/* Downlink count parameter */
if
(
_
usim_data
.
securityctx
.
dlNAScount
.
length
<=
sizeof
(
uint32_t
))
{
if
(
user
->
usim_data
.
securityctx
.
dlNAScount
.
length
<=
sizeof
(
uint32_t
))
{
memcpy
(
&
user
->
emm_data
->
security
->
dl_count
,
_
usim_data
.
securityctx
.
dlNAScount
.
value
,
_
usim_data
.
securityctx
.
dlNAScount
.
length
);
user
->
usim_data
.
securityctx
.
dlNAScount
.
value
,
user
->
usim_data
.
securityctx
.
dlNAScount
.
length
);
}
/* Uplink count parameter */
if
(
_
usim_data
.
securityctx
.
ulNAScount
.
length
<=
sizeof
(
uint32_t
))
{
if
(
user
->
usim_data
.
securityctx
.
ulNAScount
.
length
<=
sizeof
(
uint32_t
))
{
memcpy
(
&
user
->
emm_data
->
security
->
ul_count
,
_
usim_data
.
securityctx
.
ulNAScount
.
value
,
_
usim_data
.
securityctx
.
ulNAScount
.
length
);
user
->
usim_data
.
securityctx
.
ulNAScount
.
value
,
user
->
usim_data
.
securityctx
.
ulNAScount
.
length
);
}
/* Ciphering algorithm */
user
->
emm_data
->
security
->
capability
.
eps_encryption
=
((
_
usim_data
.
securityctx
.
algorithmID
.
value
[
0
]
>>
4
)
&
0xf
);
((
user
->
usim_data
.
securityctx
.
algorithmID
.
value
[
0
]
>>
4
)
&
0xf
);
/* Identity protection algorithm */
user
->
emm_data
->
security
->
capability
.
eps_integrity
=
(
_
usim_data
.
securityctx
.
algorithmID
.
value
[
0
]
&
0xf
);
(
user
->
usim_data
.
securityctx
.
algorithmID
.
value
[
0
]
&
0xf
);
/* NAS integrity and cyphering keys are not available */
}
else
{
LOG_TRACE
(
WARNING
,
...
...
@@ -331,9 +324,9 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
}
else
{
/* Check the IMSI */
LOG_TRACE
(
INFO
,
"EMM-MAIN - EMM data successfully read"
);
user
->
emm_data
->
imsi
=
&
_
usim_data
.
imsi
;
user
->
emm_data
->
imsi
=
&
user
->
usim_data
.
imsi
;
int
imsi_ok
=
_emm_main_imsi_cmp
(
&
user
->
emm_data
->
nvdata
.
imsi
,
&
_
usim_data
.
imsi
);
&
user
->
usim_data
.
imsi
);
if
(
!
imsi_ok
)
{
LOG_TRACE
(
WARNING
,
"EMM-MAIN - IMSI checking failed nvram: "
...
...
@@ -347,14 +340,14 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
user
->
emm_data
->
nvdata
.
imsi
.
u
.
value
[
5
],
user
->
emm_data
->
nvdata
.
imsi
.
u
.
value
[
6
],
user
->
emm_data
->
nvdata
.
imsi
.
u
.
value
[
7
],
_
usim_data
.
imsi
.
u
.
value
[
0
],
_
usim_data
.
imsi
.
u
.
value
[
1
],
_
usim_data
.
imsi
.
u
.
value
[
2
],
_
usim_data
.
imsi
.
u
.
value
[
3
],
_
usim_data
.
imsi
.
u
.
value
[
4
],
_
usim_data
.
imsi
.
u
.
value
[
5
],
_
usim_data
.
imsi
.
u
.
value
[
6
],
_
usim_data
.
imsi
.
u
.
value
[
7
]);
user
->
usim_data
.
imsi
.
u
.
value
[
0
],
user
->
usim_data
.
imsi
.
u
.
value
[
1
],
user
->
usim_data
.
imsi
.
u
.
value
[
2
],
user
->
usim_data
.
imsi
.
u
.
value
[
3
],
user
->
usim_data
.
imsi
.
u
.
value
[
4
],
user
->
usim_data
.
imsi
.
u
.
value
[
5
],
user
->
usim_data
.
imsi
.
u
.
value
[
6
],
user
->
usim_data
.
imsi
.
u
.
value
[
7
]);
memset
(
&
user
->
emm_data
->
nvdata
.
rplmn
,
0xFF
,
sizeof
(
plmn_t
));
user
->
emm_data
->
nvdata
.
eplmn
.
n_plmns
=
0
;
}
...
...
@@ -504,17 +497,16 @@ const imsi_t *emm_main_get_imsi(emm_data_t *emm_data)
** Description: Get the Mobile Subscriber Dialing Number from the USIM **
** **
** Inputs: None **
** Others: _usim_data **
** **
** Outputs: None **
** Return: Pointer to the subscriber dialing number **
** Others: None **
** **
***************************************************************************/
const
msisdn_t
*
emm_main_get_msisdn
(
void
)
const
msisdn_t
*
emm_main_get_msisdn
(
nas_user_t
*
user
)
{
LOG_FUNC_IN
;
LOG_FUNC_RETURN
(
&
_
usim_data
.
msisdn
.
number
);
LOG_FUNC_RETURN
(
&
user
->
usim_data
.
msisdn
.
number
);
}
/****************************************************************************
...
...
openair3/NAS/UE/EMM/emm_main.h
View file @
576bbd25
...
...
@@ -77,7 +77,7 @@ void emm_main_cleanup(emm_data_t *emm_data);
const
imsi_t
*
emm_main_get_imsi
(
emm_data_t
*
emm_data
);
/* User's getter of the subscriber dialing number */
const
msisdn_t
*
emm_main_get_msisdn
(
void
);
const
msisdn_t
*
emm_main_get_msisdn
(
nas_user_t
*
user
);
/* User's getter/setter for network selection */
int
emm_main_set_plmn_selection_mode
(
nas_user_t
*
user
,
int
mode
,
int
format
,
...
...
openair3/NAS/UE/nas_proc.c
View file @
576bbd25
...
...
@@ -299,11 +299,11 @@ int nas_proc_get_imsi(emm_data_t *emm_data, char *imsi_str)
** Others: None **
** **
***************************************************************************/
int
nas_proc_get_msisdn
(
char
*
msisdn_str
,
int
*
ton_npi
)
int
nas_proc_get_msisdn
(
nas_user_t
*
user
,
char
*
msisdn_str
,
int
*
ton_npi
)
{
LOG_FUNC_IN
;
const
msisdn_t
*
msisdn
=
emm_main_get_msisdn
();
const
msisdn_t
*
msisdn
=
emm_main_get_msisdn
(
user
);
if
(
msisdn
!=
NULL
)
{
union
{
...
...
openair3/NAS/UE/nas_proc.h
View file @
576bbd25
...
...
@@ -77,7 +77,7 @@ int nas_proc_disable_s1_mode(nas_user_t *user);
int
nas_proc_get_eps
(
nas_user_t
*
user
,
int
*
stat
);
int
nas_proc_get_imsi
(
emm_data_t
*
emm_data
,
char
*
imsi_str
);
int
nas_proc_get_msisdn
(
char
*
msisdn_str
,
int
*
ton_npi
);
int
nas_proc_get_msisdn
(
nas_user_t
*
user
,
char
*
msisdn_str
,
int
*
ton_npi
);
int
nas_proc_get_signal_quality
(
nas_user_t
*
user
,
int
*
rsrq
,
int
*
rsrp
);
...
...
openair3/NAS/UE/nas_user.c
View file @
576bbd25
...
...
@@ -2587,7 +2587,7 @@ static int _nas_user_proc_cnum(nas_user_t *user, const at_command_t *data)
}
/* Get the International Mobile Subscriber Identity (IMSI) */
ret_code
=
nas_proc_get_msisdn
(
cnum
->
number
,
&
cnum
->
type
);
ret_code
=
nas_proc_get_msisdn
(
user
,
cnum
->
number
,
&
cnum
->
type
);
if
(
ret_code
!=
RETURNok
)
{
LOG_TRACE
(
ERROR
,
"USR-MAIN - Failed to get MS dialing number"
);
...
...
openair3/NAS/UE/user_defs.h
View file @
576bbd25
...
...
@@ -51,6 +51,7 @@ Description NAS type definition to manage a user equipment
#include "EMM/emm_fsm_defs.h"
#include "EMM/emmData.h"
#include "EMM/IdleMode_defs.h"
#include "API/USIM/usim_api.h"
typedef
struct
{
int
fd
;
...
...
@@ -61,6 +62,7 @@ typedef struct {
emm_fsm_state_t
emm_fsm_status
;
// Current EPS Mobility Management status
emm_data_t
*
emm_data
;
// EPS mobility management data
emm_plmn_list_t
*
emm_plmn_list
;
// list of PLMN identities
usim_data_t
usim_data
;
// USIM application data
}
nas_user_t
;
#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