Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG-AMF
Commits
7aac5ad7
Commit
7aac5ad7
authored
Sep 30, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactor for Mobile Identity
parent
6c897504
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
140 deletions
+126
-140
src/nas/ies/5GSMobileIdentity.cpp
src/nas/ies/5GSMobileIdentity.cpp
+94
-104
src/nas/ies/5GSMobileIdentity.hpp
src/nas/ies/5GSMobileIdentity.hpp
+30
-35
src/nas/msgs/ServiceRequest.cpp
src/nas/msgs/ServiceRequest.cpp
+2
-1
No files found.
src/nas/ies/5GSMobileIdentity.cpp
View file @
7aac5ad7
This diff is collapsed.
Click to expand it.
src/nas/ies/5GSMobileIdentity.hpp
View file @
7aac5ad7
...
@@ -31,7 +31,6 @@ extern "C" {
...
@@ -31,7 +31,6 @@ extern "C" {
#include "TLVEncoder.h"
#include "TLVEncoder.h"
#include "bstrlib.h"
#include "bstrlib.h"
}
}
using
namespace
std
;
namespace
nas
{
namespace
nas
{
...
@@ -48,29 +47,29 @@ typedef struct _5G_GUTI_s {
...
@@ -48,29 +47,29 @@ typedef struct _5G_GUTI_s {
// IMEI or IMEISV
// IMEI or IMEISV
typedef
struct
IMEI_or_IMEISV_s
{
typedef
struct
IMEI_or_IMEISV_s
{
uint8_t
typeOfIdentity
:
3
;
uint8_t
typeOfIdentity
:
3
;
bool
odd_even_indic
;
// for imei, even means bits 5 to 8 of last octet is
bool
odd_even_indic
;
// for imei, even means bits 5 to 8 of last octet is
// "1111", for imeisv, bits 5 to 8 of last octet is
// "1111", for imeisv, bits 5 to 8 of last octet is
// "1111"
// "1111"
st
ring
identity
;
// "46011000001"
st
d
::
string
identity
;
// "46011000001"
}
IMEI_IMEISV_t
;
}
IMEI_IMEISV_t
;
// SUCI and SUPI format IMSI
// SUCI and SUPI format IMSI
typedef
struct
SUCI_imsi_s
{
typedef
struct
SUCI_imsi_s
{
uint8_t
supi_format
:
3
;
uint8_t
supi_format
:
3
;
string
mcc
;
st
d
::
st
ring
mcc
;
string
mnc
;
st
d
::
st
ring
mnc
;
st
ring
routingIndicator
;
//"1234"
st
d
::
optional
<
std
::
string
>
routingIndicator
;
//"1234"
uint8_t
protectionSchemeId
:
4
;
// 0000
uint8_t
protectionSchemeId
:
4
;
// 0000
uint8_t
homeNetworkPKI
;
// 00000000
uint8_t
homeNetworkPKI
;
// 00000000
st
ring
msin
;
// two types of coding; BCD & hexadecimal
st
d
::
string
msin
;
// two types of coding; BCD & hexadecimal
}
SUCI_imsi_t
;
// SUPI format "IMSI"
}
SUCI_imsi_t
;
// SUPI format "IMSI"
// TODO: SUCI and SUPI format "Network specific identifier"
// TODO: SUCI and SUPI format "Network specific identifier"
// 5G-S-TMSI
// 5G-S-TMSI
typedef
struct
_5G_S_TMSI_s
{
typedef
struct
_5G_S_TMSI_s
{
uint16_t
amf_set_id
;
uint16_t
amf_set_id
;
uint8_t
amf_pointer
;
uint8_t
amf_pointer
;
string
_5g_tmsi
;
st
d
::
st
ring
_5g_tmsi
;
}
_5G_S_TMSI_t
;
}
_5G_S_TMSI_t
;
// TODO: 5GS mobile identity information element for type of identity "MAC
// TODO: 5GS mobile identity information element for type of identity "MAC
...
@@ -78,18 +77,13 @@ typedef struct _5G_S_TMSI_s {
...
@@ -78,18 +77,13 @@ typedef struct _5G_S_TMSI_s {
class
_5GSMobileIdentity
{
class
_5GSMobileIdentity
{
public:
public:
_5GSMobileIdentity
(
uint8_t
_iei
,
const
uint16_t
amfSetId
,
const
uint8_t
amfPointer
,
const
string
tmsi
);
// 5G-S-TMSI
_5GSMobileIdentity
();
_5GSMobileIdentity
();
_5GSMobileIdentity
(
uint8_t
_iei
);
~
_5GSMobileIdentity
();
~
_5GSMobileIdentity
();
// Common
// Common
uint8_t
getTypeOfIdentity
()
const
{
return
typeOfIdentity
;
};
uint8_t
getTypeOfIdentity
()
const
{
return
typeOfIdentity
;
};
void
setIEI
(
uint8_t
_iei
);
void
setIEI
(
uint8_t
_iei
);
int
encode2Buffer
(
uint8_t
*
buf
,
int
len
);
int
encode2Buffer
(
uint8_t
*
buf
,
int
len
);
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
...
@@ -100,9 +94,9 @@ class _5GSMobileIdentity {
...
@@ -100,9 +94,9 @@ class _5GSMobileIdentity {
int
_5g_guti_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_guti_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_guti_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_guti_encode2buffer
(
uint8_t
*
buf
,
int
len
);
void
set5GGUTI
(
void
set5GGUTI
(
const
st
ring
&
mcc
,
const
string
&
mnc
,
const
uint8_t
&
amf_region_id
,
const
st
d
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
uint
16_t
&
amf_set_id
,
const
uint8_t
&
amf_pointer
,
const
uint
8_t
&
amf_region_id
,
const
uint16_t
&
amf_set_id
,
const
uint32_t
&
_5g_tmsi
);
const
uint
8_t
&
amf_pointer
,
const
uint
32_t
&
_5g_tmsi
);
void
get5GGUTI
(
std
::
optional
<
_5G_GUTI_t
>&
)
const
;
void
get5GGUTI
(
std
::
optional
<
_5G_GUTI_t
>&
)
const
;
// SUCI
// SUCI
...
@@ -110,27 +104,28 @@ class _5GSMobileIdentity {
...
@@ -110,27 +104,28 @@ class _5GSMobileIdentity {
int
suci_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
suci_encode2buffer
(
uint8_t
*
buf
,
int
len
);
void
setSuciWithSupiImsi
(
void
setSuciWithSupiImsi
(
const
st
ring
mcc
,
const
string
mnc
,
const
string
routingInd
,
const
st
d
::
string
&
mcc
,
const
std
::
string
&
mnc
,
uint8_t
protection_sch_id
,
const
std
::
string
&
routingInd
,
uint8_t
protection_sch_id
,
const
st
ring
msin
);
// TODO: SetSUCI, SUCI and SUPI format IMSI
const
st
d
::
string
&
msin
);
// TODO: SetSUCI, SUCI and SUPI format IMSI
void
setSuciWithSupiImsi
(
void
setSuciWithSupiImsi
(
const
string
&
mcc
,
const
string
&
mnc
,
const
string
&
routingInd
,
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
uint8_t
protecSchId
,
uint8_t
home_pki
,
const
string
&
msin_digits
);
const
std
::
string
&
routingInd
,
uint8_t
protecSchId
,
uint8_t
home_pki
,
/*
const
std
::
string
&
msin_digits
);
void setSuciWithSupiImsi(
const string& mcc, const string& mnc, const string& routingInd,
uint8_t protecSchId, const string& msin_digits);
*/
bool
getSuciWithSupiImsi
(
SUCI_imsi_t
&
);
bool
getSuciWithSupiImsi
(
SUCI_imsi_t
&
);
int
encodeRoutid2buffer
(
string
routid
,
uint8_t
*
buf
);
int
encodeRoutid2buffer
(
int
encodeMSIN2buffer
(
string
msinstr
,
uint8_t
*
buf
);
std
::
optional
<
std
::
string
>
routing_indicator
,
uint8_t
*
buf
);
int
encodeMSIN2buffer
(
std
::
string
msinstr
,
uint8_t
*
buf
);
// TMSI
// TMSI
int
_5g_s_tmsi_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_s_tmsi_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_s_tmsi_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_s_tmsi_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
bool
get5G_S_TMSI
(
uint16_t
&
amfSetId
,
uint8_t
&
amfPointer
,
string
&
tmsi
);
bool
get5G_S_TMSI
(
uint16_t
&
amfSetId
,
uint8_t
&
amfPointer
,
std
::
string
&
tmsi
);
void
set5G_S_TMSI
(
const
uint16_t
amfSetId
,
const
uint8_t
amfPointer
,
const
std
::
string
tmsi
);
// IMEISV
// IMEISV
int
imeisv_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
imeisv_encode2buffer
(
uint8_t
*
buf
,
int
len
);
...
...
src/nas/msgs/ServiceRequest.cpp
View file @
7aac5ad7
...
@@ -68,7 +68,8 @@ void ServiceRequest::setServiceType(uint8_t stp) {
...
@@ -68,7 +68,8 @@ void ServiceRequest::setServiceType(uint8_t stp) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
ServiceRequest
::
set5G_S_TMSI
(
void
ServiceRequest
::
set5G_S_TMSI
(
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
)
{
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
)
{
ie_5g_s_tmsi
=
new
_5GSMobileIdentity
(
0x00
,
amfSetId
,
amfPointer
,
tmsi
);
ie_5g_s_tmsi
=
new
_5GSMobileIdentity
(
0x00
);
ie_5g_s_tmsi
->
set5G_S_TMSI
(
amfSetId
,
amfPointer
,
tmsi
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
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