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
3ccfa74b
Commit
3ccfa74b
authored
Aug 20, 2022
by
Tien Thinh NGUYEN
Committed by
sagar arora
Aug 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initializing bstring variables
parent
77ee5653
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
156 additions
and
162 deletions
+156
-162
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+6
-6
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+66
-66
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+49
-40
src/common/conversions.cpp
src/common/conversions.cpp
+2
-1
src/common/conversions.hpp
src/common/conversions.hpp
+3
-2
src/itti/msgs/itti_msg_n1.hpp
src/itti/msgs/itti_msg_n1.hpp
+3
-3
src/itti/msgs/itti_msg_n2.hpp
src/itti/msgs/itti_msg_n2.hpp
+10
-10
src/nas/ies/DNN.cpp
src/nas/ies/DNN.cpp
+0
-2
src/ngap/ngapMsgs/NgapMessage.cpp
src/ngap/ngapMsgs/NgapMessage.cpp
+2
-2
src/ngap/ngapMsgs/NgapMessage.hpp
src/ngap/ngapMsgs/NgapMessage.hpp
+1
-1
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+14
-29
No files found.
src/amf-app/amf_app.cpp
View file @
3ccfa74b
...
...
@@ -327,22 +327,21 @@ void amf_app::handle_itti_message(
dl
->
setHeader
(
PLAIN_5GS_MSG
);
dl
->
setPayload_Container_Type
(
N1_SM_INFORMATION
);
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
(
uint8_t
*
)
bdata
(
bstrcpy
(
itti_msg
.
n1sm
)
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPDUSessionId
(
itti_msg
.
pdu_session_id
);
uint8_t
nas
[
BUFFER_SIZE_1024
];
int
encoded_size
=
dl
->
encode2buffer
(
nas
,
BUFFER_SIZE_1024
);
comUt
::
print_buffer
(
"amf_app"
,
"n1n2 transfer"
,
nas
,
encoded_size
);
bstring
dl_nas
=
blk2bstr
(
nas
,
encoded_size
);
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
dl_msg
=
std
::
make_shared
<
itti_downlink_nas_transfer
>
(
TASK_AMF_APP
,
TASK_AMF_N1
);
dl_msg
->
dl_nas
=
dl_nas
;
dl_msg
->
dl_nas
=
blk2bstr
(
nas
,
encoded_size
)
;
if
(
!
itti_msg
.
is_n2sm_set
)
{
dl_msg
->
is_n2sm_set
=
false
;
}
else
{
dl_msg
->
n2sm
=
itti_msg
.
n2sm
;
dl_msg
->
n2sm
=
bstrcpy
(
itti_msg
.
n2sm
)
;
dl_msg
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
dl_msg
->
is_n2sm_set
=
true
;
dl_msg
->
n2sm_info_type
=
itti_msg
.
n2sm_info_type
;
...
...
@@ -454,7 +453,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
// Get NAS message (RegistrationRequest, this message included
// in N1 Message Notify is actually is RegistrationRequest from UE to the
// initial AMF)
bstring
n1sm
;
bstring
n1sm
=
nullptr
;
conv
::
msg_str_2_msg_hex
(
itti_msg
.
n1sm
,
n1sm
);
// get RegistrationContextContainer including gNB info
...
...
@@ -625,7 +624,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
itti_n1_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_n1_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_n1_msg
->
is_nas_signalling_estab_req
=
true
;
itti_n1_msg
->
nas_msg
=
n1sm
;
itti_n1_msg
->
nas_msg
=
bstrcpy
(
n1sm
)
;
itti_n1_msg
->
mcc
=
ran_node_id
.
getPlmnId
().
getMcc
();
itti_n1_msg
->
mnc
=
ran_node_id
.
getPlmnId
().
getMnc
();
itti_n1_msg
->
is_guti_valid
=
false
;
...
...
@@ -637,6 +636,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
itti_n1_msg
->
get_msg_name
());
}
bdestroy_wrapper
(
&
n1sm
);
return
;
}
...
...
src/amf-app/amf_n1.cpp
View file @
3ccfa74b
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n2.cpp
View file @
3ccfa74b
This diff is collapsed.
Click to expand it.
src/common/conversions.cpp
View file @
3ccfa74b
...
...
@@ -233,7 +233,8 @@ char* conv::bstring2charString(bstring b) {
uint8_t
*
value
=
(
uint8_t
*
)
bdata
(
b
);
for
(
int
i
=
0
;
i
<
blength
(
b
);
i
++
)
buf
[
i
]
=
(
char
)
value
[
i
];
buf
[
blength
(
b
)]
=
'\0'
;
free_wrapper
((
void
**
)
&
value
);
// free_wrapper((void**) &value);
value
=
nullptr
;
return
buf
;
}
...
...
src/common/conversions.hpp
View file @
3ccfa74b
...
...
@@ -64,8 +64,9 @@ class conv {
static
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
static
void
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
);
void
octet_string_2_bstring
(
const
OCTET_STRING_t
&
octet_str
,
bstring
&
b_str
);
void
bstring_2_octet_string
(
bstring
&
b_str
,
OCTET_STRING_t
&
octet_str
);
static
void
octet_string_2_bstring
(
const
OCTET_STRING_t
&
octet_str
,
bstring
&
b_str
);
static
void
bstring_2_octet_string
(
bstring
&
b_str
,
OCTET_STRING_t
&
octet_str
);
static
void
sd_string_to_int
(
const
std
::
string
&
sd_str
,
uint32_t
&
sd
);
};
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
src/itti/msgs/itti_msg_n1.hpp
View file @
3ccfa74b
...
...
@@ -59,7 +59,7 @@ class itti_uplink_nas_data_ind : public itti_msg_n1 {
guti
=
{};
}
itti_uplink_nas_data_ind
(
const
itti_uplink_nas_data_ind
&
i
)
:
itti_msg_n1
(
i
)
{
nas_msg
=
i
.
nas_msg
;
nas_msg
=
bstrcpy
(
i
.
nas_msg
)
;
mcc
=
i
.
mcc
;
mnc
=
i
.
mnc
;
is_guti_valid
=
i
.
is_guti_valid
;
...
...
@@ -88,8 +88,8 @@ class itti_downlink_nas_transfer : public itti_msg_n1 {
}
itti_downlink_nas_transfer
(
const
itti_downlink_nas_transfer
&
i
)
:
itti_msg_n1
(
i
)
{
dl_nas
=
i
.
dl_nas
;
n2sm
=
i
.
n2sm
;
dl_nas
=
bstrcpy
(
i
.
dl_nas
)
;
n2sm
=
bstrcpy
(
i
.
n2sm
)
;
is_n2sm_set
=
i
.
is_n2sm_set
;
pdu_session_id
=
i
.
pdu_session_id
;
n2sm_info_type
=
i
.
n2sm_info_type
;
...
...
src/itti/msgs/itti_msg_n2.hpp
View file @
3ccfa74b
...
...
@@ -138,7 +138,7 @@ class itti_dl_nas_transport : public itti_msg_n2 {
itti_dl_nas_transport
(
const
itti_dl_nas_transport
&
i
)
:
itti_msg_n2
(
i
)
{
ran_ue_ngap_id
=
i
.
ran_ue_ngap_id
;
amf_ue_ngap_id
=
i
.
amf_ue_ngap_id
;
nas
=
i
.
nas
;
nas
=
bstrcpy
(
i
.
nas
)
;
}
virtual
~
itti_dl_nas_transport
()
{
bdestroy_wrapper
(
&
nas
);
}
...
...
@@ -168,10 +168,10 @@ class itti_initial_context_setup_request : public itti_msg_n2 {
:
itti_msg_n2
(
i
)
{
ran_ue_ngap_id
=
i
.
ran_ue_ngap_id
;
amf_ue_ngap_id
=
i
.
amf_ue_ngap_id
;
kgnb
=
i
.
kgnb
;
nas
=
i
.
nas
;
kgnb
=
bstrcpy
(
i
.
kgnb
)
;
nas
=
bstrcpy
(
i
.
nas
)
;
is_sr
=
i
.
is_sr
;
n2sm
=
i
.
n2sm
;
n2sm
=
bstrcpy
(
i
.
n2sm
)
;
pdu_session_id
=
i
.
pdu_session_id
;
is_pdu_exist
=
i
.
is_pdu_exist
;
is_n2sm_avaliable
=
i
.
is_n2sm_avaliable
;
...
...
@@ -207,8 +207,8 @@ class itti_pdu_session_resource_setup_request : public itti_msg_n2 {
itti_pdu_session_resource_setup_request
(
const
itti_pdu_session_resource_setup_request
&
i
)
:
itti_msg_n2
(
i
)
{
nas
=
i
.
nas
;
n2sm
=
i
.
n2sm
;
nas
=
bstrcpy
(
i
.
nas
)
;
n2sm
=
bstrcpy
(
i
.
n2sm
)
;
ran_ue_ngap_id
=
i
.
ran_ue_ngap_id
;
amf_ue_ngap_id
=
i
.
amf_ue_ngap_id
;
pdu_session_id
=
i
.
pdu_session_id
;
...
...
@@ -240,8 +240,8 @@ class itti_pdu_session_resource_modify_request : public itti_msg_n2 {
itti_pdu_session_resource_modify_request
(
const
itti_pdu_session_resource_modify_request
&
i
)
:
itti_msg_n2
(
i
)
{
nas
=
i
.
nas
;
n2sm
=
i
.
n2sm
;
nas
=
bstrcpy
(
i
.
nas
)
;
n2sm
=
bstrcpy
(
i
.
n2sm
)
;
ran_ue_ngap_id
=
i
.
ran_ue_ngap_id
;
amf_ue_ngap_id
=
i
.
amf_ue_ngap_id
;
pdu_session_id
=
i
.
pdu_session_id
;
...
...
@@ -274,8 +274,8 @@ class itti_pdu_session_resource_release_command : public itti_msg_n2 {
itti_pdu_session_resource_release_command
(
const
itti_pdu_session_resource_release_command
&
i
)
:
itti_msg_n2
(
i
)
{
nas
=
i
.
nas
;
n2sm
=
i
.
n2sm
;
nas
=
bstrcpy
(
i
.
nas
)
;
n2sm
=
bstrcpy
(
i
.
n2sm
)
;
ran_ue_ngap_id
=
i
.
ran_ue_ngap_id
;
amf_ue_ngap_id
=
i
.
amf_ue_ngap_id
;
pdu_session_id
=
i
.
pdu_session_id
;
...
...
src/nas/ies/DNN.cpp
View file @
3ccfa74b
...
...
@@ -52,8 +52,6 @@ DNN::~DNN() {}
//------------------------------------------------------------------------------
void
DNN
::
getValue
(
bstring
&
dnn
)
{
// dnn = _DNN;
// dnn = bstrcpy(_DNN);
dnn
=
blk2bstr
((
uint8_t
*
)
bdata
(
_DNN
)
+
1
,
blength
(
_DNN
)
-
1
);
}
...
...
src/ngap/ngapMsgs/NgapMessage.cpp
View file @
3ccfa74b
...
...
@@ -469,10 +469,10 @@ int NgapMessage::encode2Buffer(uint8_t* buf, int bufSize) {
}
//------------------------------------------------------------------------------
void
NgapMessage
::
encode2NewBuffer
(
uint8_t
*
&
buf
,
int
&
encoded_size
)
{
void
NgapMessage
::
encode2NewBuffer
(
uint8_t
*
*
buf
,
int
&
encoded_size
)
{
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngapPdu
);
encoded_size
=
aper_encode_to_new_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngapPdu
,
(
void
**
)
&
buf
);
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngapPdu
,
(
void
**
)
buf
);
Logger
::
ngap
().
debug
(
"Encoded message size ( %d )"
,
encoded_size
);
return
;
}
...
...
src/ngap/ngapMsgs/NgapMessage.hpp
View file @
3ccfa74b
...
...
@@ -126,7 +126,7 @@ class NgapMessage {
void
setMessageType
(
NgapMessageType
messageType
);
virtual
bool
decodeFromPdu
(
Ngap_NGAP_PDU_t
*
msgPdu
)
=
0
;
int
encode2Buffer
(
uint8_t
*
buf
,
int
bufSize
);
void
encode2NewBuffer
(
uint8_t
*
&
buf
,
int
&
encoded_size
);
void
encode2NewBuffer
(
uint8_t
*
*
buf
,
int
&
encoded_size
);
protected:
Ngap_NGAP_PDU_t
*
ngapPdu
;
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
3ccfa74b
...
...
@@ -185,19 +185,14 @@ int ngap_amf_handle_initial_context_setup_response(
return
0
;
}
uint8_t
transferIe
[
BUFFER_SIZE_512
];
memcpy
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
Logger
::
ngap
().
debug
(
"Sending ITTI Initial Context Setup Response to TASK_AMF_SBI"
);
auto
itti_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_update_sm_context
>
(
TASK_NGAP
,
TASK_AMF_SBI
);
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
itti_msg
->
n2sm
=
blk2bstr
(
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
n2sm_info_type
=
"PDU_RES_SETUP_RSP"
;
itti_msg
->
amf_ue_ngap_id
=
initCtxResp
->
getAmfUeNgapId
();
...
...
@@ -350,12 +345,6 @@ int ngap_amf_handle_pdu_session_resource_release_response(
}
// TODO: add the full list
uint8_t
transferIe
[
BUFFER_SIZE_512
];
memcpy
(
transferIe
,
list
[
0
].
pduSessionResourceReleaseResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceReleaseResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
transferIe
,
list
[
0
].
pduSessionResourceReleaseResponseTransfer
.
size
);
Logger
::
ngap
().
debug
(
"Sending ITTI PDUSessionResourceReleaseResponse to TASK_AMF_SBI"
);
...
...
@@ -363,7 +352,10 @@ int ngap_amf_handle_pdu_session_resource_release_response(
TASK_NGAP
,
TASK_AMF_SBI
);
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
itti_msg
->
n2sm
=
blk2bstr
(
list
[
0
].
pduSessionResourceReleaseResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceReleaseResponseTransfer
.
size
);
;
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
n2sm_info_type
=
"PDU_RES_REL_RSP"
;
itti_msg
->
amf_ue_ngap_id
=
pduresp
->
getAmfUeNgapId
();
...
...
@@ -409,12 +401,6 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
// return RETURNerror;
}
else
{
// TODO: for multiple PDU Sessions
uint8_t
transferIe
[
BUFFER_SIZE_512
];
memcpy
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
itti_nsmf_pdusession_update_sm_context
*
itti_msg
=
new
itti_nsmf_pdusession_update_sm_context
(
TASK_NGAP
,
TASK_AMF_SBI
);
long
amf_ue_ngap_id
=
pduresp
->
getAmfUeNgapId
();
...
...
@@ -426,7 +412,10 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
}
itti_msg
->
supi
=
"imsi-"
+
nct
.
get
()
->
imsi
;
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
itti_msg
->
n2sm
=
blk2bstr
(
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
;
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
n2sm_info_type
=
"PDU_RES_SETUP_RSP"
;
itti_msg
->
amf_ue_ngap_id
=
pduresp
->
getAmfUeNgapId
();
...
...
@@ -554,12 +543,6 @@ int ngap_amf_handle_pdu_session_resource_modify_response(
}
for
(
auto
response_item
:
list
)
{
uint8_t
buf
[
BUFFER_SIZE_512
];
memcpy
(
buf
,
response_item
.
pduSessionResourceModifyResponseTransfer
.
buf
,
response_item
.
pduSessionResourceModifyResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
buf
,
response_item
.
pduSessionResourceModifyResponseTransfer
.
size
);
Logger
::
ngap
().
debug
(
"Sending ITTI PDUSessionResourceModifyResponseTransfer to "
"TASK_AMF_SBI"
);
...
...
@@ -567,7 +550,9 @@ int ngap_amf_handle_pdu_session_resource_modify_response(
auto
itti_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_update_sm_context
>
(
TASK_NGAP
,
TASK_AMF_SBI
);
itti_msg
->
pdu_session_id
=
response_item
.
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
itti_msg
->
n2sm
=
blk2bstr
(
response_item
.
pduSessionResourceModifyResponseTransfer
.
buf
,
response_item
.
pduSessionResourceModifyResponseTransfer
.
size
);
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
n2sm_info_type
=
"PDU_RES_MOD_RSP"
;
itti_msg
->
amf_ue_ngap_id
=
response_msg
->
getAmfUeNgapId
();
...
...
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