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
15250bad
Commit
15250bad
authored
Mar 16, 2021
by
luhan Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work with CPE
parent
ed2d8fc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
7 deletions
+60
-7
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+55
-4
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+2
-0
src/nas/ies/PDU_Session_Status.cpp
src/nas/ies/PDU_Session_Status.cpp
+2
-2
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
15250bad
...
@@ -434,6 +434,7 @@ void amf_n1::uplink_nas_msg_handle(
...
@@ -434,6 +434,7 @@ void amf_n1::uplink_nas_msg_handle(
case
REGISTRATION_COMPLETE
:
{
case
REGISTRATION_COMPLETE
:
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Received registration complete message, handling..."
);
"Received registration complete message, handling..."
);
registration_complete_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
// TODO
// TODO
}
break
;
}
break
;
default:
{
default:
{
...
@@ -486,6 +487,7 @@ void amf_n1::uplink_nas_msg_handle(
...
@@ -486,6 +487,7 @@ void amf_n1::uplink_nas_msg_handle(
case
REGISTRATION_COMPLETE
:
{
case
REGISTRATION_COMPLETE
:
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Received registration complete message, handling..."
);
"Received registration complete message, handling..."
);
registration_complete_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
// TODO
// TODO
}
break
;
}
break
;
default:
{
default:
{
...
@@ -613,7 +615,7 @@ void amf_n1::service_request_handle(
...
@@ -613,7 +615,7 @@ void amf_n1::service_request_handle(
nullptr
,
(
uint8_t
*
)
bdata
(
nas_container
),
blength
(
nas_container
));
nullptr
,
(
uint8_t
*
)
bdata
(
nas_container
),
blength
(
nas_container
));
pdu_session_status
=
tmp
->
getPduSessionStatus
();
pdu_session_status
=
tmp
->
getPduSessionStatus
();
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Get pdu-session-status value: 0x%x"
,
pdu_session_status
);
"Get pdu-session-status value: 0x%
02
x"
,
pdu_session_status
);
}
}
ServiceAccept
*
serApt
=
new
ServiceAccept
();
ServiceAccept
*
serApt
=
new
ServiceAccept
();
serApt
->
setHeader
(
PLAIN_5GS_MSG
);
serApt
->
setHeader
(
PLAIN_5GS_MSG
);
...
@@ -678,11 +680,11 @@ void amf_n1::service_request_handle(
...
@@ -678,11 +680,11 @@ void amf_n1::service_request_handle(
delete
serReq
;
delete
serReq
;
return
;
return
;
}
}
if
(
pdu_session_status
==
0x00
)
{
if
(
pdu_session_status
==
0x00
00
)
{
serApt
->
setPDU_session_status
(
0x0000
);
serApt
->
setPDU_session_status
(
0x0000
);
}
else
{
}
else
{
serApt
->
setPDU_session_status
(
htonl
(
pdu_session_status
)
);
serApt
->
setPDU_session_status
(
pdu_session_status
);
Logger
::
amf_n1
().
debug
(
"setting pdu session status 0x%x"
,
htonl
(
pdu_session_status
));
Logger
::
amf_n1
().
debug
(
"setting pdu session status 0x%
02
x"
,
htonl
(
pdu_session_status
));
//serApt->setPDU_session_status(0x2000);
//serApt->setPDU_session_status(0x2000);
}
}
serApt
->
setPDU_session_reactivation_result
(
0x0000
);
serApt
->
setPDU_session_reactivation_result
(
0x0000
);
...
@@ -2119,6 +2121,55 @@ void amf_n1::security_mode_reject_handle(
...
@@ -2119,6 +2121,55 @@ void amf_n1::security_mode_reject_handle(
"Receiving security mode reject message, handling ..."
);
"Receiving security mode reject message, handling ..."
);
}
}
void
amf_n1
::
registration_complete_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
)
{
Logger
::
amf_n1
().
debug
(
"receiving registration complete, encoding Configuration Update Command"
);
time_t
tt
;
time
(
&
tt
);
tt
=
tt
+
8
*
3600
;
// transform the time zone
tm
*
t
=
gmtime
(
&
tt
);
uint8_t
conf
[
45
]
=
{
0
};
uint8_t
header
[
3
]
=
{
0x7e
,
0x00
,
0x54
};
uint8_t
full_name
[
18
]
=
{
0x43
,
0x10
,
0x81
,
0xc1
,
0x76
,
0x58
,
0x9e
,
0x9e
,
0xbf
,
0xcd
,
0x74
,
0x90
,
0xb3
,
0x4c
,
0xbf
,
0xbf
,
0xe5
,
0x6b
};
uint8_t
short_name
[
11
]
=
{
0x45
,
0x09
,
0x81
,
0xc1
,
0x76
,
0x58
,
0x9e
,
0x9e
,
0xbf
,
0xcd
,
0x74
};
uint8_t
time_zone
[
2
]
=
{
0x46
,
0x23
};
uint8_t
time
[
8
]
=
{
0
};
time
[
0
]
=
0x47
;
time
[
1
]
=
0x12
;
time
[
2
]
=
((
t
->
tm_mon
+
1
)
&
0x0f
)
<<
4
|
((
t
->
tm_mon
+
1
)
&
0xf0
)
>>
4
;
time
[
3
]
=
((
t
->
tm_mday
+
1
)
&
0x0f
)
<<
4
|
((
t
->
tm_mday
+
1
)
&
0xf0
)
>>
4
;
time
[
4
]
=
((
t
->
tm_hour
+
1
)
&
0x0f
)
<<
4
|
((
t
->
tm_hour
+
1
)
&
0xf0
)
>>
4
;
time
[
5
]
=
((
t
->
tm_min
+
1
)
&
0x0f
)
<<
4
|
((
t
->
tm_min
+
1
)
&
0xf0
)
>>
4
;
time
[
6
]
=
((
t
->
tm_sec
+
1
)
&
0x0f
)
<<
4
|
((
t
->
tm_sec
+
1
)
&
0xf0
)
>>
4
;
time
[
7
]
=
0x23
;
uint8_t
daylight
[
3
]
=
{
0x49
,
0x01
,
0x00
};
memcpy
(
conf
,
header
,
3
);
memcpy
(
conf
+
3
,
full_name
,
18
);
memcpy
(
conf
+
21
,
short_name
,
11
);
memcpy
(
conf
+
32
,
time_zone
,
2
);
memcpy
(
conf
+
34
,
time
,
8
);
memcpy
(
conf
+
42
,
daylight
,
3
);
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
nc
=
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
Logger
::
amf_n1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
return
;
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
// protect nas message
bstring
protectedNas
;
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
conf
,
45
,
protectedNas
);
itti_send_dl_nas_buffer_to_task_n2
(
protectedNas
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n1
::
encode_nas_message_protected
(
void
amf_n1
::
encode_nas_message_protected
(
nas_secu_ctx
*
nsc
,
bool
is_secu_ctx_new
,
uint8_t
security_header_type
,
nas_secu_ctx
*
nsc
,
bool
is_secu_ctx_new
,
uint8_t
security_header_type
,
...
...
src/amf-app/amf_n1.hpp
View file @
15250bad
...
@@ -177,6 +177,8 @@ class amf_n1 {
...
@@ -177,6 +177,8 @@ class amf_n1 {
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
ul_nas_transport_handle
(
void
ul_nas_transport_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
);
void
registration_complete_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
);
void
sha256
(
unsigned
char
*
message
,
int
msg_len
,
unsigned
char
*
output
);
void
sha256
(
unsigned
char
*
message
,
int
msg_len
,
unsigned
char
*
output
);
void
service_request_handle
(
void
service_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
...
...
src/nas/ies/PDU_Session_Status.cpp
View file @
15250bad
...
@@ -72,10 +72,10 @@ int PDU_Session_Status::encode2buffer(uint8_t* buf, int len) {
...
@@ -72,10 +72,10 @@ int PDU_Session_Status::encode2buffer(uint8_t* buf, int len) {
encoded_size
++
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
length
-
2
;
*
(
buf
+
encoded_size
)
=
length
-
2
;
encoded_size
++
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
(
_value
&
0xff00
)
>>
8
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
(
_value
&
0x00ff
);
*
(
buf
+
encoded_size
)
=
(
_value
&
0x00ff
);
encoded_size
++
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
(
_value
&
0xff00
)
>>
8
;
encoded_size
++
;
}
else
{
}
else
{
//*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
...
...
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
View file @
15250bad
...
@@ -137,7 +137,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
...
@@ -137,7 +137,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if
(
pdu
->
choice
.
initiatingMessage
&&
if
(
pdu
->
choice
.
initiatingMessage
&&
pdu
->
choice
.
initiatingMessage
->
procedureCode
==
pdu
->
choice
.
initiatingMessage
->
procedureCode
==
Ngap_ProcedureCode_id_UEContextReleaseRequest
&&
Ngap_ProcedureCode_id_UEContextReleaseRequest
&&
pdu
->
choice
.
initiatingMessage
->
criticality
==
Ngap_Criticality_ignore
&&
/*pdu->choice.initiatingMessage->criticality == Ngap_Criticality_reject &&*/
pdu
->
choice
.
initiatingMessage
->
value
.
present
==
pdu
->
choice
.
initiatingMessage
->
value
.
present
==
Ngap_InitiatingMessage__value_PR_UEContextReleaseRequest
)
{
Ngap_InitiatingMessage__value_PR_UEContextReleaseRequest
)
{
ies
=
ies
=
...
...
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