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-Simple
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
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
CommunityXG
OpenXG-AMF-Simple
Commits
058c666e
Commit
058c666e
authored
Sep 28, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply Google style format
parent
7b5b106a
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
831 additions
and
391 deletions
+831
-391
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+514
-240
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+81
-34
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+111
-52
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+16
-6
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+41
-19
src/amf-app/amf_statistics.hpp
src/amf-app/amf_statistics.hpp
+2
-3
src/nas/ies/_5GSDeregistrationType.cpp
src/nas/ies/_5GSDeregistrationType.cpp
+6
-4
src/nas/ies/_5GSDeregistrationType.hpp
src/nas/ies/_5GSDeregistrationType.hpp
+6
-7
src/nas/msgs/DeregistrationRequest.cpp
src/nas/msgs/DeregistrationRequest.cpp
+44
-21
src/nas/msgs/DeregistrationRequest.hpp
src/nas/msgs/DeregistrationRequest.hpp
+10
-5
No files found.
src/amf-app/amf_n1.cpp
View file @
058c666e
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n1.hpp
View file @
058c666e
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.cpp
View file @
058c666e
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.hpp
View file @
058c666e
...
@@ -44,24 +44,34 @@ class amf_n11 {
...
@@ -44,24 +44,34 @@ class amf_n11 {
~
amf_n11
();
~
amf_n11
();
void
handle_itti_message
(
itti_smf_services_consumer
&
);
void
handle_itti_message
(
itti_smf_services_consumer
&
);
void
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
void
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
send_pdu_session_update_sm_context_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
void
send_pdu_session_update_sm_context_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
pdu_session_context
>>
supi2pdu
;
// amf ue ngap id
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
pdu_session_context
>>
supi2pdu
;
// amf ue ngap id
mutable
std
::
shared_mutex
m_supi2pdu
;
mutable
std
::
shared_mutex
m_supi2pdu
;
bool
is_supi_to_pdu_ctx
(
const
std
::
string
&
supi
)
const
;
bool
is_supi_to_pdu_ctx
(
const
std
::
string
&
supi
)
const
;
std
::
shared_ptr
<
pdu_session_context
>
supi_to_pdu_ctx
(
const
std
::
string
&
supi
)
const
;
std
::
shared_ptr
<
pdu_session_context
>
supi_to_pdu_ctx
(
void
set_supi_to_pdu_ctx
(
const
std
::
string
&
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
);
const
std
::
string
&
supi
)
const
;
void
set_supi_to_pdu_ctx
(
const
std
::
string
&
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
);
std
::
map
<
uint8_t
,
std
::
string
>
pduid2supi
;
std
::
map
<
uint8_t
,
std
::
string
>
pduid2supi
;
bool
smf_selection_from_configuration
(
std
::
string
&
smf_addr
);
bool
smf_selection_from_configuration
(
std
::
string
&
smf_addr
);
bool
smf_selection_from_context
(
std
::
string
&
smf_addr
);
bool
smf_selection_from_context
(
std
::
string
&
smf_addr
);
void
handle_post_sm_context_response_error_400
();
void
handle_post_sm_context_response_error_400
();
void
handle_post_sm_context_response_error
(
long
code
,
std
::
string
cause
,
bstring
n1sm
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
void
handle_post_sm_context_response_error
(
long
code
,
std
::
string
cause
,
bstring
n1sm
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
void
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
void
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
};
};
}
}
...
...
src/amf-app/amf_statistics.cpp
View file @
058c666e
...
@@ -40,30 +40,47 @@ void statistics::display() {
...
@@ -40,30 +40,47 @@ void statistics::display() {
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("| %d | %d | %d |",gNB_connected,UE_connected,UE_registred);
//Logger::amf_app().info("| %d | %d | %d |",gNB_connected,UE_connected,UE_registred);
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("--------------------------------------------------");
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
Logger
::
amf_app
().
info
(
"|----------------------------------------------------gNBs' information-------------------------------------------|"
);
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC) |"
);
Logger
::
amf_app
().
info
(
if
(
gnbs
.
size
()
==
0
)
{
"|----------------------------------------------------gNBs' information-------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| - | - | - | - | - |"
);
Logger
::
amf_app
().
info
(
"| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC) |"
);
if
(
gnbs
.
size
()
==
0
)
{
Logger
::
amf_app
().
info
(
"| - | - | - | - | - |"
);
}
}
//TODO: Show the list of common PLMNs
//TODO: Show the list of common PLMNs
for
(
int
i
=
0
;
i
<
gnbs
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
gnbs
.
size
();
i
++
)
{
Logger
::
amf_app
().
info
(
"| %d | Connected | 0x%x | %s | %s, %d | "
,
i
+
1
,
gnbs
[
i
].
gnb_id
,
gnbs
[
i
].
gnb_name
.
c_str
(),
(
gnbs
[
i
].
mcc
+
gnbs
[
i
].
mnc
).
c_str
(),
gnbs
[
i
].
tac
);
Logger
::
amf_app
().
info
(
}
"| %d | Connected | 0x%x | %s | %s, %d | "
,
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
i
+
1
,
gnbs
[
i
].
gnb_id
,
gnbs
[
i
].
gnb_name
.
c_str
(),
(
gnbs
[
i
].
mcc
+
gnbs
[
i
].
mnc
).
c_str
(),
gnbs
[
i
].
tac
);
}
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
""
);
Logger
::
amf_app
().
info
(
""
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
Logger
::
amf_app
().
info
(
"|----------------------------------------------------UEs' information--------------------------------------------|"
);
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | 5GMM state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID | PLMN |Cell ID|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------UEs' information--------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | 5GMM state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID | PLMN |Cell ID|"
);
int
i
=
0
;
int
i
=
0
;
for
(
auto
const
&
ue
:
ue_infos
)
{
for
(
auto
const
&
ue
:
ue_infos
)
{
Logger
::
amf_app
().
info
(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|"
,
i
+
1
,
ue
.
second
.
registerStatus
.
c_str
(),
ue
.
second
.
imsi
.
c_str
(),
ue
.
second
.
guti
.
c_str
(),
ue
.
second
.
ranid
,
ue
.
second
.
amfid
,
(
ue
.
second
.
mcc
+
ue
.
second
.
mnc
).
c_str
(),
ue
.
second
.
cellId
);
Logger
::
amf_app
().
info
(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|"
,
i
+
1
,
ue
.
second
.
registerStatus
.
c_str
(),
ue
.
second
.
imsi
.
c_str
(),
ue
.
second
.
guti
.
c_str
(),
ue
.
second
.
ranid
,
ue
.
second
.
amfid
,
(
ue
.
second
.
mcc
+
ue
.
second
.
mnc
).
c_str
(),
ue
.
second
.
cellId
);
i
++
;
i
++
;
}
}
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
""
);
Logger
::
amf_app
().
info
(
""
);
}
}
...
@@ -75,7 +92,7 @@ statistics::statistics() {
...
@@ -75,7 +92,7 @@ statistics::statistics() {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
statistics
::
update_ue_info
(
const
ue_info_t
&
ue_info
)
{
void
statistics
::
update_ue_info
(
const
ue_info_t
&
ue_info
)
{
if
(
!
(
ue_info
.
imsi
.
size
()
>
0
))
{
if
(
!
(
ue_info
.
imsi
.
size
()
>
0
))
{
Logger
::
amf_app
().
warn
(
"Update UE Info with invalid IMSI"
);
Logger
::
amf_app
().
warn
(
"Update UE Info with invalid IMSI"
);
}
}
...
@@ -83,23 +100,28 @@ void statistics::update_ue_info(const ue_info_t& ue_info) {
...
@@ -83,23 +100,28 @@ void statistics::update_ue_info(const ue_info_t& ue_info) {
if
(
ue_infos
.
count
(
ue_info
.
imsi
)
>
0
)
{
if
(
ue_infos
.
count
(
ue_info
.
imsi
)
>
0
)
{
ue_infos
.
erase
(
ue_info
.
imsi
);
ue_infos
.
erase
(
ue_info
.
imsi
);
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
ue_info
.
imsi
,
ue_info
));
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
ue_info
.
imsi
,
ue_info
));
Logger
::
amf_app
().
debug
(
"Update UE Info (IMSI %s) success"
,
ue_info
.
imsi
.
c_str
());
Logger
::
amf_app
().
debug
(
"Update UE Info (IMSI %s) success"
,
ue_info
.
imsi
.
c_str
());
}
else
{
}
else
{
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
ue_info
.
imsi
,
ue_info
));
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
ue_info
.
imsi
,
ue_info
));
Logger
::
amf_app
().
debug
(
"Add UE Info (IMSI %s) success"
,
ue_info
.
imsi
.
c_str
());
Logger
::
amf_app
().
debug
(
"Add UE Info (IMSI %s) success"
,
ue_info
.
imsi
.
c_str
());
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
statistics
::
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
)
{
void
statistics
::
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
)
{
if
(
ue_infos
.
count
(
imsi
)
>
0
)
{
if
(
ue_infos
.
count
(
imsi
)
>
0
)
{
ue_info_t
ue_info
=
ue_infos
.
at
(
imsi
);
ue_info_t
ue_info
=
ue_infos
.
at
(
imsi
);
ue_info
.
registerStatus
=
state
;
ue_info
.
registerStatus
=
state
;
ue_infos
.
erase
(
ue_info
.
imsi
);
ue_infos
.
erase
(
ue_info
.
imsi
);
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
imsi
,
ue_info
));
ue_infos
.
insert
(
std
::
pair
<
std
::
string
,
ue_info_t
>
(
imsi
,
ue_info
));
Logger
::
amf_app
().
debug
(
"Update UE State (IMSI %s, State %s) success"
,
imsi
.
c_str
(),
state
.
c_str
());
Logger
::
amf_app
().
debug
(
"Update UE State (IMSI %s, State %s) success"
,
imsi
.
c_str
(),
state
.
c_str
());
}
else
{
}
else
{
Logger
::
amf_app
().
warn
(
"Update UE State (IMSI %s), UE does not exist!"
,
imsi
.
c_str
());
Logger
::
amf_app
().
warn
(
"Update UE State (IMSI %s), UE does not exist!"
,
imsi
.
c_str
());
}
}
}
}
...
...
src/amf-app/amf_statistics.hpp
View file @
058c666e
...
@@ -61,14 +61,13 @@ typedef struct ue_info_s {
...
@@ -61,14 +61,13 @@ typedef struct ue_info_s {
uint32_t
cellId
;
uint32_t
cellId
;
}
ue_info_t
;
}
ue_info_t
;
class
statistics
{
class
statistics
{
public:
public:
void
display
();
void
display
();
statistics
();
statistics
();
~
statistics
();
~
statistics
();
void
update_ue_info
(
const
ue_info_t
&
ue_info
);
void
update_ue_info
(
const
ue_info_t
&
ue_info
);
void
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
);
void
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
);
public:
public:
uint32_t
gNB_connected
;
uint32_t
gNB_connected
;
uint32_t
UE_connected
;
uint32_t
UE_connected
;
...
...
src/nas/ies/_5GSDeregistrationType.cpp
View file @
058c666e
...
@@ -42,7 +42,8 @@ _5GSDeregistrationType::_5GSDeregistrationType(uint8_t type) {
...
@@ -42,7 +42,8 @@ _5GSDeregistrationType::_5GSDeregistrationType(uint8_t type) {
u1
.
b
=
type
;
u1
.
b
=
type
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
_5GSDeregistrationType
::
_5GSDeregistrationType
(
_5gs_deregistration_type_t
type
)
{
_5GSDeregistrationType
::
_5GSDeregistrationType
(
_5gs_deregistration_type_t
type
)
{
u1
.
b
=
0
;
u1
.
b
=
0
;
u1
.
bf
.
switch_off
=
type
.
switch_off
;
u1
.
bf
.
switch_off
=
type
.
switch_off
;
u1
.
bf
.
dereg_required
=
type
.
dereg_required
;
u1
.
bf
.
dereg_required
=
type
.
dereg_required
;
...
@@ -64,7 +65,7 @@ void _5GSDeregistrationType::set(_5gs_deregistration_type_t type) {
...
@@ -64,7 +65,7 @@ void _5GSDeregistrationType::set(_5gs_deregistration_type_t type) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
_5GSDeregistrationType
::
get
(
_5gs_deregistration_type_t
&
type
)
{
void
_5GSDeregistrationType
::
get
(
_5gs_deregistration_type_t
&
type
)
{
type
.
switch_off
=
u1
.
bf
.
switch_off
;
type
.
switch_off
=
u1
.
bf
.
switch_off
;
type
.
dereg_required
=
u1
.
bf
.
dereg_required
;
type
.
dereg_required
=
u1
.
bf
.
dereg_required
;
type
.
access_type
=
u1
.
bf
.
access_type
;
type
.
access_type
=
u1
.
bf
.
access_type
;
...
@@ -77,7 +78,7 @@ void _5GSDeregistrationType::set(uint8_t type) {
...
@@ -77,7 +78,7 @@ void _5GSDeregistrationType::set(uint8_t type) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
_5GSDeregistrationType
::
get
(
uint8_t
&
type
)
{
void
_5GSDeregistrationType
::
get
(
uint8_t
&
type
)
{
type
=
u1
.
b
;
type
=
u1
.
b
;
}
}
...
@@ -85,7 +86,8 @@ void _5GSDeregistrationType::get(uint8_t& type) {
...
@@ -85,7 +86,8 @@ void _5GSDeregistrationType::get(uint8_t& type) {
int
_5GSDeregistrationType
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
int
_5GSDeregistrationType
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
error
(
"Encoding 5GSDeregistrationType IE"
);
Logger
::
nas_mm
().
error
(
"Encoding 5GSDeregistrationType IE"
);
if
(
len
<
1
)
{
if
(
len
<
1
)
{
Logger
::
nas_mm
().
error
(
"encoding 5GSDeregistrationType error(len is less than one)"
);
Logger
::
nas_mm
().
error
(
"encoding 5GSDeregistrationType error(len is less than one)"
);
return
-
1
;
return
-
1
;
}
}
*
buf
=
u1
.
b
;
*
buf
=
u1
.
b
;
...
...
src/nas/ies/_5GSDeregistrationType.hpp
View file @
058c666e
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
namespace
nas
{
namespace
nas
{
typedef
struct
_5gs_deregistration_type_s
{
typedef
struct
_5gs_deregistration_type_s
{
uint8_t
iei
:
4
;
uint8_t
iei
:
4
;
uint8_t
switch_off
:
1
;
uint8_t
switch_off
:
1
;
uint8_t
dereg_required
:
1
;
uint8_t
dereg_required
:
1
;
uint8_t
access_type
:
2
;
uint8_t
access_type
:
2
;
}
_5gs_deregistration_type_t
;
}
_5gs_deregistration_type_t
;
...
@@ -49,22 +49,21 @@ class _5GSDeregistrationType {
...
@@ -49,22 +49,21 @@ class _5GSDeregistrationType {
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
void
set
(
_5gs_deregistration_type_t
type
);
void
set
(
_5gs_deregistration_type_t
type
);
void
get
(
_5gs_deregistration_type_t
&
type
);
void
get
(
_5gs_deregistration_type_t
&
type
);
void
set
(
uint8_t
type
);
void
set
(
uint8_t
type
);
void
get
(
uint8_t
&
type
);
void
get
(
uint8_t
&
type
);
public:
public:
union
{
union
{
struct
{
struct
{
uint8_t
iei
:
4
;
uint8_t
iei
:
4
;
uint8_t
switch_off
:
1
;
uint8_t
switch_off
:
1
;
uint8_t
dereg_required
:
1
;
uint8_t
dereg_required
:
1
;
uint8_t
access_type
:
2
;
uint8_t
access_type
:
2
;
}
bf
;
}
bf
;
uint8_t
b
;
uint8_t
b
;
}
u1
;
}
u1
;
};
};
}
}
...
...
src/nas/msgs/DeregistrationRequest.cpp
View file @
058c666e
...
@@ -48,7 +48,8 @@ DeregistrationRequest::~DeregistrationRequest() {
...
@@ -48,7 +48,8 @@ DeregistrationRequest::~DeregistrationRequest() {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
setHeader
(
uint8_t
security_header_type
)
{
void
DeregistrationRequest
::
setHeader
(
uint8_t
security_header_type
)
{
plain_header
=
new
NasMmPlainHeader
();
plain_header
=
new
NasMmPlainHeader
();
plain_header
->
setHeader
(
EPD_5GS_MM_MSG
,
security_header_type
,
DEREGISTRATION_REQUEST_UE_ORIGINATING
);
plain_header
->
setHeader
(
EPD_5GS_MM_MSG
,
security_header_type
,
DEREGISTRATION_REQUEST_UE_ORIGINATING
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -57,7 +58,8 @@ void DeregistrationRequest::setDeregistrationType(uint8_t dereg_type) {
...
@@ -57,7 +58,8 @@ void DeregistrationRequest::setDeregistrationType(uint8_t dereg_type) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
setDeregistrationType
(
_5gs_deregistration_type_t
type
)
{
void
DeregistrationRequest
::
setDeregistrationType
(
_5gs_deregistration_type_t
type
)
{
ie_deregistrationtype
=
new
_5GSDeregistrationType
(
type
);
ie_deregistrationtype
=
new
_5GSDeregistrationType
(
type
);
}
}
...
@@ -68,35 +70,43 @@ void DeregistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
...
@@ -68,35 +70,43 @@ void DeregistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getDeregistrationType
(
uint8_t
&
dereg_type
)
{
void
DeregistrationRequest
::
getDeregistrationType
(
uint8_t
&
dereg_type
)
{
ie_deregistrationtype
->
get
(
dereg_type
);
ie_deregistrationtype
->
get
(
dereg_type
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
{
void
DeregistrationRequest
::
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
{
ie_deregistrationtype
->
get
(
type
);
ie_deregistrationtype
->
get
(
type
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getngKSI
(
uint8_t
&
ng_ksi
)
{
void
DeregistrationRequest
::
getngKSI
(
uint8_t
&
ng_ksi
)
{
if
(
ie_ngKSI
)
{
if
(
ie_ngKSI
)
{
ng_ksi
=
(
ie_ngKSI
->
getTypeOfSecurityContext
())
|
ie_ngKSI
->
getasKeyIdentifier
();
ng_ksi
=
(
ie_ngKSI
->
getTypeOfSecurityContext
())
|
ie_ngKSI
->
getasKeyIdentifier
();
}
else
{
}
else
{
ng_ksi
=
0
;
ng_ksi
=
0
;
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
const
string
msin
)
{
void
DeregistrationRequest
::
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
const
string
msin
)
{
if
(
protection_sch_id
!=
NULL_SCHEME
)
{
if
(
protection_sch_id
!=
NULL_SCHEME
)
{
Logger
::
nas_mm
().
error
(
"encoding suci and supi format for imsi error, please choose right interface"
);
Logger
::
nas_mm
().
error
(
"encoding suci and supi format for imsi error, please choose right interface"
);
return
;
return
;
}
else
{
}
else
{
ie_5gs_mobility_id
=
new
_5GSMobilityIdentity
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
ie_5gs_mobility_id
=
new
_5GSMobilityIdentity
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getMobilityIdentityType
(
uint8_t
&
type
)
{
void
DeregistrationRequest
::
getMobilityIdentityType
(
uint8_t
&
type
)
{
if
(
ie_5gs_mobility_id
)
{
if
(
ie_5gs_mobility_id
)
{
type
=
ie_5gs_mobility_id
->
gettypeOfIdentity
();
type
=
ie_5gs_mobility_id
->
gettypeOfIdentity
();
}
else
{
}
else
{
...
@@ -119,7 +129,7 @@ std::string DeregistrationRequest::get_5g_guti() {
...
@@ -119,7 +129,7 @@ std::string DeregistrationRequest::get_5g_guti() {
if
(
ie_5gs_mobility_id
)
{
if
(
ie_5gs_mobility_id
)
{
nas
::
_5G_GUTI_t
guti
;
nas
::
_5G_GUTI_t
guti
;
ie_5gs_mobility_id
->
get5GGUTI
(
guti
);
ie_5gs_mobility_id
->
get5GGUTI
(
guti
);
std
::
string
str
;
//= guti.toString();
std
::
string
str
;
//= guti.toString();
return
str
;
return
str
;
}
else
{
}
else
{
return
"error"
;
return
"error"
;
...
@@ -127,7 +137,12 @@ std::string DeregistrationRequest::get_5g_guti() {
...
@@ -127,7 +137,12 @@ std::string DeregistrationRequest::get_5g_guti() {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
)
{
void
DeregistrationRequest
::
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
)
{
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -165,7 +180,8 @@ int DeregistrationRequest::encode2buffer(uint8_t *buf, int len) {
...
@@ -165,7 +180,8 @@ int DeregistrationRequest::encode2buffer(uint8_t *buf, int len) {
if
(
!
(
plain_header
->
encode2buffer
(
buf
,
len
)))
if
(
!
(
plain_header
->
encode2buffer
(
buf
,
len
)))
return
0
;
return
0
;
encoded_size
+=
3
;
encoded_size
+=
3
;
if
(
!
(
ie_deregistrationtype
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)))
{
if
(
!
(
ie_deregistrationtype
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)))
{
if
(
!
(
ie_ngKSI
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)))
{
if
(
!
(
ie_ngKSI
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)))
{
encoded_size
+=
1
;
encoded_size
+=
1
;
}
else
{
}
else
{
...
@@ -176,30 +192,37 @@ int DeregistrationRequest::encode2buffer(uint8_t *buf, int len) {
...
@@ -176,30 +192,37 @@ int DeregistrationRequest::encode2buffer(uint8_t *buf, int len) {
Logger
::
nas_mm
().
error
(
"Encoding IE Deregistrationt Type error"
);
Logger
::
nas_mm
().
error
(
"Encoding IE Deregistrationt Type error"
);
return
0
;
return
0
;
}
}
if
(
int
size
=
ie_5gs_mobility_id
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
if
(
int
size
=
ie_5gs_mobility_id
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding IE ie_5gs_mobility_id error"
);
Logger
::
nas_mm
().
error
(
"Encoding IE ie_5gs_mobility_id error"
);
return
0
;
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"Encoded DeregistrationRequest message len (%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded DeregistrationRequest message len (%d)"
,
encoded_size
);
return
1
;
return
1
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
DeregistrationRequest
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
int
DeregistrationRequest
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"****Decoding DeregistrationRequest message****"
);
Logger
::
nas_mm
().
debug
(
"****Decoding DeregistrationRequest message****"
);
int
decoded_size
=
3
;
int
decoded_size
=
3
;
plain_header
=
header
;
plain_header
=
header
;
ie_deregistrationtype
=
new
_5GSDeregistrationType
();
ie_deregistrationtype
=
new
_5GSDeregistrationType
();
decoded_size
+=
ie_deregistrationtype
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
);
decoded_size
+=
ie_deregistrationtype
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
);
ie_ngKSI
=
new
NasKeySetIdentifier
();
ie_ngKSI
=
new
NasKeySetIdentifier
();
decoded_size
+=
ie_ngKSI
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
true
);
decoded_size
+=
ie_ngKSI
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
true
);
decoded_size
++
;
decoded_size
++
;
ie_5gs_mobility_id
=
new
_5GSMobilityIdentity
();
ie_5gs_mobility_id
=
new
_5GSMobilityIdentity
();
decoded_size
+=
ie_5gs_mobility_id
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
decoded_size
+=
ie_5gs_mobility_id
->
decodefrombuffer
(
buf
+
decoded_size
,
Logger
::
nas_mm
().
debug
(
"****Decoded DeregistrationRequest message (len %d)****"
,
decoded_size
);
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"****Decoded DeregistrationRequest message (len %d)****"
,
decoded_size
);
}
}
src/nas/msgs/DeregistrationRequest.hpp
View file @
058c666e
...
@@ -46,16 +46,21 @@ class DeregistrationRequest {
...
@@ -46,16 +46,21 @@ class DeregistrationRequest {
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setMobilityIdentityType
(
uint8_t
type
);
void
setMobilityIdentityType
(
uint8_t
type
);
void
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
const
string
msin
);
void
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
void
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
);
const
string
routingInd
,
uint8_t
protection_sch_id
,
const
string
msin
);
void
setSUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
);
void
set5G_GUTI
();
void
set5G_GUTI
();
void
setIMEI_IMEISV
();
void
setIMEI_IMEISV
();
void
set5G_S_TMSI
();
void
set5G_S_TMSI
();
void
getDeregistrationType
(
uint8_t
&
dereg_type
);
void
getDeregistrationType
(
uint8_t
&
dereg_type
);
void
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
);
void
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
);
void
getngKSI
(
uint8_t
&
ng_ksi
);
void
getngKSI
(
uint8_t
&
ng_ksi
);
void
getMobilityIdentityType
(
uint8_t
&
type
);
void
getMobilityIdentityType
(
uint8_t
&
type
);
std
::
string
get_5g_guti
();
std
::
string
get_5g_guti
();
bool
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
);
bool
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
);
...
...
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