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
42a0378f
Commit
42a0378f
authored
Sep 15, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactor for Handover Command
parent
bce3b607
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
517 additions
and
74 deletions
+517
-74
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+4
-5
src/ngap/ngapIEs/NgapIEsStruct.hpp
src/ngap/ngapIEs/NgapIEsStruct.hpp
+5
-4
src/ngap/ngapIEs/PDUSessionResourceHandoverList.cpp
src/ngap/ngapIEs/PDUSessionResourceHandoverList.cpp
+15
-19
src/ngap/ngapIEs/PDUSessionResourceHandoverList.hpp
src/ngap/ngapIEs/PDUSessionResourceHandoverList.hpp
+6
-10
src/ngap/ngapIEs/PDUSessionResourceItem.cpp
src/ngap/ngapIEs/PDUSessionResourceItem.cpp
+103
-0
src/ngap/ngapIEs/PDUSessionResourceItem.hpp
src/ngap/ngapIEs/PDUSessionResourceItem.hpp
+140
-0
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.cpp
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.hpp
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.hpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceSetupItemCxtReq.hpp
src/ngap/ngapIEs/PDUSessionResourceSetupItemCxtReq.hpp
+4
-5
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.cpp
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.cpp
+69
-0
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.hpp
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.hpp
+51
-0
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
+97
-14
src/ngap/ngapMsgs/HandoverCommandMsg.hpp
src/ngap/ngapMsgs/HandoverCommandMsg.hpp
+21
-15
No files found.
src/amf-app/amf_n2.cpp
View file @
42a0378f
...
...
@@ -1819,8 +1819,8 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
handovercommand
->
setHandoverType
(
Ngap_HandoverType_intra5gs
);
PDUSessionResourceHandoverList
handoverList
=
{};
std
::
vector
<
PDUSessionResource
Handover
Item
>
handoverItemList
;
PDUSessionResource
Handover
Item
handoverItem
=
{};
std
::
vector
<
PDUSessionResourceItem
>
handoverItemList
;
PDUSessionResourceItem
handoverItem
=
{};
// TODO: wait for response from SMF and transfer T-RAN N3 information/ or
// T-UPF to the source gNB
...
...
@@ -1847,10 +1847,9 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
pDUSessionID
.
set
(
pduSessionIDValue
);
OCTET_STRING_fromBuf
(
&
handoverCommandTransfer
,
n2_sm
.
c_str
(),
n2_sm
.
length
());
handoverItem
.
setPDUSessionResourceHandoverItem
(
pDUSessionID
,
handoverCommandTransfer
);
handoverItem
.
set
(
pDUSessionID
,
handoverCommandTransfer
);
handoverItemList
.
push_back
(
handoverItem
);
handoverList
.
set
PDUSessionResourceHandoverList
(
handoverItemList
);
handoverList
.
set
(
handoverItemList
);
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
if
(
amf_app_inst
->
find_pdu_session_context
(
...
...
src/ngap/ngapIEs/NgapIEsStruct.hpp
View file @
42a0378f
...
...
@@ -109,8 +109,6 @@ typedef struct Guami_s {
typedef
struct
{
uint8_t
pduSessionId
;
// uint8_t* pduSessionNAS_PDU;
// size_t sizeofpduSessionNAS_PDU;
bstring
nas_pdu
;
S_Nssai
s_nssai
;
OCTET_STRING_t
pduSessionResourceSetupRequestTransfer
;
...
...
@@ -118,8 +116,6 @@ typedef struct {
typedef
struct
{
uint8_t
pduSessionId
;
// uint8_t* pduSessionNAS_PDU;
// size_t sizeofpduSessionNAS_PDU;
bstring
nas_pdu
;
std
::
optional
<
S_Nssai
>
s_nssai
;
OCTET_STRING_t
pduSessionResourceModifyRequestTransfer
;
...
...
@@ -257,6 +253,11 @@ typedef struct gNBId_s {
uint8_t
bit_length
;
}
gNBId_t
;
// 22bits to 32bits
typedef
struct
{
uint8_t
pduSessionId
;
OCTET_STRING_t
HandoverCommandTransfer
;
}
PDUSessionResourceHandoverItem_t
;
}
// namespace ngap
#endif
src/ngap/ngapIEs/PDUSessionResourceHandoverList.cpp
View file @
42a0378f
...
...
@@ -30,30 +30,28 @@ PDUSessionResourceHandoverList::PDUSessionResourceHandoverList() {}
PDUSessionResourceHandoverList
::~
PDUSessionResourceHandoverList
()
{}
//------------------------------------------------------------------------------
void
PDUSessionResourceHandoverList
::
set
PDUSessionResourceHandoverList
(
const
std
::
vector
<
PDUSessionResource
Handover
Item
>&
list
)
{
handoverItemList
=
list
;
void
PDUSessionResourceHandoverList
::
set
(
const
std
::
vector
<
PDUSessionResourceItem
>&
list
)
{
item_list_
=
list
;
}
//------------------------------------------------------------------------------
void
PDUSessionResourceHandoverList
::
get
PDUSessionResourceHandoverList
(
std
::
vector
<
PDUSessionResource
Handover
Item
>&
list
)
{
list
=
handoverItemList
;
void
PDUSessionResourceHandoverList
::
get
(
std
::
vector
<
PDUSessionResourceItem
>&
list
)
{
list
=
item_list_
;
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceHandoverList
::
encode
(
Ngap_PDUSessionResourceHandoverList_t
&
pduSessionResourceHandoverL
ist
)
{
for
(
auto
&
item
:
handoverItemList
)
{
Ngap_PDUSessionResourceHandoverList_t
&
l
ist
)
{
for
(
auto
&
item
:
item_list_
)
{
Ngap_PDUSessionResourceHandoverItem_t
*
handoverItem
=
(
Ngap_PDUSessionResourceHandoverItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PDUSessionResourceHandoverItem_t
));
if
(
!
handoverItem
)
return
false
;
if
(
!
item
.
encode
(
*
handoverItem
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
pduSessionResourceHandoverList
.
list
,
handoverItem
)
!=
0
)
return
false
;
if
(
!
item
.
encode
(
handoverItem
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
list
.
list
,
handoverItem
)
!=
0
)
return
false
;
}
return
true
;
...
...
@@ -61,14 +59,12 @@ bool PDUSessionResourceHandoverList::encode(
//------------------------------------------------------------------------------
bool
PDUSessionResourceHandoverList
::
decode
(
const
Ngap_PDUSessionResourceHandoverList_t
&
pduSessionResourceHandoverList
)
{
for
(
int
i
=
0
;
i
<
pduSessionResourceHandoverList
.
list
.
count
;
i
++
)
{
PDUSessionResourceHandoverItem
item
=
{};
const
Ngap_PDUSessionResourceHandoverList_t
&
list
)
{
for
(
int
i
=
0
;
i
<
list
.
list
.
count
;
i
++
)
{
PDUSessionResourceItem
item
=
{};
if
(
!
item
.
decode
(
*
pduSessionResourceHandoverList
.
list
.
array
[
i
]))
return
false
;
handoverItemList
.
push_back
(
item
);
if
(
!
item
.
decode
(
list
.
list
.
array
[
i
]))
return
false
;
item_list_
.
push_back
(
item
);
}
return
true
;
}
...
...
src/ngap/ngapIEs/PDUSessionResourceHandoverList.hpp
View file @
42a0378f
...
...
@@ -22,7 +22,7 @@
#ifndef _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_
#define _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_
#include "PDUSessionResource
Handover
Item.hpp"
#include "PDUSessionResourceItem.hpp"
#include "vector"
extern
"C"
{
...
...
@@ -36,18 +36,14 @@ class PDUSessionResourceHandoverList {
PDUSessionResourceHandoverList
();
virtual
~
PDUSessionResourceHandoverList
();
void
setPDUSessionResourceHandoverList
(
const
std
::
vector
<
PDUSessionResourceHandoverItem
>&
list
);
void
getPDUSessionResourceHandoverList
(
std
::
vector
<
PDUSessionResourceHandoverItem
>&
list
);
void
set
(
const
std
::
vector
<
PDUSessionResourceItem
>&
list
);
void
get
(
std
::
vector
<
PDUSessionResourceItem
>&
list
);
bool
encode
(
Ngap_PDUSessionResourceHandoverList_t
&
pduSessionResourceHandoverList
);
bool
decode
(
const
Ngap_PDUSessionResourceHandoverList_t
&
pduSessionResourceHandoverList
);
bool
encode
(
Ngap_PDUSessionResourceHandoverList_t
&
list
);
bool
decode
(
const
Ngap_PDUSessionResourceHandoverList_t
&
list
);
private:
std
::
vector
<
PDUSessionResource
HandoverItem
>
handoverItemList
;
std
::
vector
<
PDUSessionResource
Item
>
item_list_
;
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/PDUSessionResourceItem.cpp
0 → 100644
View file @
42a0378f
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PDUSessionResourceItem.hpp"
#include "conversions.hpp"
namespace
ngap
{
//------------------------------------------------------------------------------
PDUSessionResourceItem
::
PDUSessionResourceItem
()
{}
//------------------------------------------------------------------------------
PDUSessionResourceItem
::~
PDUSessionResourceItem
()
{}
//------------------------------------------------------------------------------
void
PDUSessionResourceItem
::
set
(
const
PDUSessionID
&
pdu_session_id
,
const
OCTET_STRING_t
&
resource
)
{
pdu_session_id_
=
pdu_session_id
;
// resource_ = resource;
conv
::
octet_string_copy
(
resource_
,
resource
);
}
//------------------------------------------------------------------------------
void
PDUSessionResourceItem
::
get
(
PDUSessionID
&
pdu_session_id
,
OCTET_STRING_t
&
resource
)
const
{
pdu_session_id
=
pdu_session_id_
;
// resource = resource_;
conv
::
octet_string_copy
(
resource
,
resource_
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
encode
(
Ngap_PDUSessionID_t
&
pdu_session_id
,
OCTET_STRING_t
&
resource
)
const
{
if
(
!
pdu_session_id_
.
encode
(
pdu_session_id
))
return
false
;
return
conv
::
octet_string_copy
(
resource
,
resource_
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
decode
(
const
Ngap_PDUSessionID_t
&
pdu_session_id
,
const
OCTET_STRING_t
&
resource
)
{
if
(
!
pdu_session_id_
.
decode
(
pdu_session_id
))
return
false
;
return
conv
::
octet_string_copy
(
resource_
,
resource
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
encode
(
Ngap_PDUSessionResourceSetupItemCxtRes_t
*
item
)
const
{
return
encode
(
item
->
pDUSessionID
,
item
->
pDUSessionResourceSetupResponseTransfer
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
decode
(
const
Ngap_PDUSessionResourceSetupItemCxtRes_t
*
const
item
)
{
return
decode
(
item
->
pDUSessionID
,
item
->
pDUSessionResourceSetupResponseTransfer
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
encode
(
Ngap_PDUSessionResourceHandoverItem_t
*
item
)
const
{
return
encode
(
item
->
pDUSessionID
,
item
->
handoverCommandTransfer
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
decode
(
const
Ngap_PDUSessionResourceHandoverItem_t
*
const
item
)
{
return
decode
(
item
->
pDUSessionID
,
item
->
handoverCommandTransfer
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
encode
(
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
item
)
const
{
return
encode
(
item
->
pDUSessionID
,
item
->
handoverPreparationUnsuccessfulTransfer
);
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceItem
::
decode
(
const
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
const
item
)
{
return
decode
(
item
->
pDUSessionID
,
item
->
handoverPreparationUnsuccessfulTransfer
);
}
}
// namespace ngap
src/ngap/ngapIEs/PDUSessionResourceItem.hpp
0 → 100644
View file @
42a0378f
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_ITEM_H_
#define _PDU_SESSION_RESOURCE_ITEM_H_
#include "PDUSessionID.hpp"
extern
"C"
{
#include "Ngap_PDUSessionResourceSetupItemCxtRes.h"
#include "Ngap_PDUSessionResourceToReleaseItemHOCmd.h"
#include "Ngap_PDUSessionResourceHandoverItem.h"
}
namespace
ngap
{
class
PDUSessionResourceItem
{
public:
PDUSessionResourceItem
();
virtual
~
PDUSessionResourceItem
();
void
set
(
const
PDUSessionID
&
pdu_session_id
,
const
OCTET_STRING_t
&
resource
);
void
get
(
PDUSessionID
&
pdu_session_id
,
OCTET_STRING_t
&
resource
)
const
;
bool
encode
(
Ngap_PDUSessionID_t
&
pdu_session_id
,
OCTET_STRING_t
&
resource
)
const
;
bool
decode
(
const
Ngap_PDUSessionID_t
&
pdu_session_id
,
const
OCTET_STRING_t
&
resource
);
// PDU SESSION RESOURCE SETUP REQUEST
// For PDU Session Resource Setup Request Item (in child class)
// PDU SESSION RESOURCE SETUP RESPONSE
// For PDU Session Resource Setup Response Item
bool
encode
(
Ngap_PDUSessionResourceSetupItemCxtRes_t
*
pdu_session_resource_setup_item_cxt_res
)
const
;
bool
decode
(
const
Ngap_PDUSessionResourceSetupItemCxtRes_t
*
pdu_session_resource_setup_item_cxt_res
);
// TODO: For PDU Session Resource Failed to Setup Item
// PDU SESSION RESOURCE RELEASE COMMAND
// TODO: For PDU Session Resource to Release Item
// PDU SESSION RESOURCE RELEASE RESPONSE
// TODO: For PDU Session Resource Released Item
// PDU SESSION RESOURCE MODIFY REQUEST
// For PDU Session Resource Modify Request Item (in child class)
// PDU SESSION RESOURCE MODIFY RESPONSE
// TODO: For PDU Session Resource Modify Response Item
// TODO: For PDU Session Resource Failed to Modify Item
// PDU SESSION RESOURCE NOTIFY
// TODO: For PDU Session Resource Notify Item
// TODO: For PDU Session Resource Released Item
// PDU SESSION RESOURCE MODIFY INDICATION
// TODO: PDU Session Resource Modify Indication Item
// PDU SESSION RESOURCE MODIFY CONFIRM
// TODO: PDU Session Resource Modify Confirm Item
// TODO: PDU Session Resource Failed to Modify Item
// INITIAL CONTEXT SETUP REQUEST
// PDU Session Resource Setup Request Item (in child class)
// INITIAL CONTEXT SETUP RESPONSE
// TODO: PDU Session Resource Setup Response Item
// TODO: PDU Session Resource Failed to Setup Item
// INITIAL CONTEXT SETUP FAILURE
// TODO: PDU Session Resource Failed to Setup Item
// UE CONTEXT RELEASE REQUEST
// TODO: PDU Session Resource Item
// UE CONTEXT RELEASE COMPLETE
// TODO: PDU Session Resource Item
// HANDOVER REQUIRED
// TODO: PDU Session Resource Item
// HANDOVER COMMAND
// TODO: PDU Session Resource Handover Item
bool
encode
(
Ngap_PDUSessionResourceHandoverItem_t
*
item
)
const
;
bool
decode
(
const
Ngap_PDUSessionResourceHandoverItem_t
*
const
item
);
// TODO: PDU Session Resource to Release Item
bool
encode
(
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
item
)
const
;
bool
decode
(
const
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
const
item
);
// HANDOVER REQUEST
// PDU Session Resource Setup Item (in child class)
// HANDOVER REQUEST ACKNOWLEDGE
// TODO: PDU Session Resource Admitted Item
// TODO: PDU Session Resource Failed to Setup Item
// PATH SWITCH REQUEST
// TODO: PDU Session Resource to be Switched in Downlink Item
// TODO: PDU Session Resource Failed to Setup Item
// PATH SWITCH REQUEST ACKNOWLEDGE
// TODO: PDU Session Resource Switched Item
// TODO: PDU Session Resource Released Item
// PATH SWITCH REQUEST FAILURE
// TODO: PDU Session Resource Released Item
// SECONDARY RAT DATA USAGE REPORT
// TODO: PDU Session Resource Secondary RAT Usage Item
private:
PDUSessionID
pdu_session_id_
;
// Mandatory
OCTET_STRING_t
resource_
;
};
}
// namespace ngap
#endif
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.cpp
View file @
42a0378f
...
...
@@ -51,7 +51,7 @@ bool PDUSessionResourceItemCxtRelCpl::encode(
//------------------------------------------------------------------------------
bool
PDUSessionResourceItemCxtRelCpl
::
decode
(
Ngap_PDUSessionResourceItemCxtRelCpl_t
*
const
Ngap_PDUSessionResourceItemCxtRelCpl_t
*
const
pdu_session_resource_item_cxt_rel_cpl
)
{
pdu_session_id_
.
set
(
pdu_session_resource_item_cxt_rel_cpl
->
pDUSessionID
);
return
true
;
...
...
src/ngap/ngapIEs/PDUSessionResourceItemCxtRelCpl.hpp
View file @
42a0378f
...
...
@@ -40,7 +40,7 @@ class PDUSessionResourceItemCxtRelCpl {
bool
encode
(
Ngap_PDUSessionResourceItemCxtRelCpl_t
*
pdu_session_resource_item_cxt_rel_cpl
);
bool
decode
(
Ngap_PDUSessionResourceItemCxtRelCpl_t
*
bool
decode
(
const
Ngap_PDUSessionResourceItemCxtRelCpl_t
*
const
pdu_session_resource_item_cxt_rel_cpl
);
private:
...
...
src/ngap/ngapIEs/PDUSessionResourceSetupItemCxtReq.hpp
View file @
42a0378f
...
...
@@ -27,7 +27,6 @@
#include "S-NSSAI.hpp"
#include <optional>
#include <vector>
extern
"C"
{
#include "Ngap_PDUSessionResourceSetupItemCxtReq.h"
...
...
@@ -43,16 +42,16 @@ class PDUSessionResourceSetupItemCxtReq {
void
set
(
const
PDUSessionID
&
m_pDUSessionID
,
const
std
::
optional
<
NAS_PDU
>&
m_nAS_PDU
,
const
S_NSSAI
&
m_s_NSSAI
,
const
OCTET_STRING_t
&
m_pDUSessionResourceSetupRequestT
ransfer
);
const
OCTET_STRING_t
&
pdu_session_resource_setup_request_t
ransfer
);
void
get
(
PDUSessionID
&
m_pDUSessionID
,
std
::
optional
<
NAS_PDU
>&
m_nAS_PDU
,
S_NSSAI
&
m_s_NSSAI
,
OCTET_STRING_t
&
m_pDUSessionResourceSetupRequestT
ransfer
)
const
;
OCTET_STRING_t
&
pdu_session_resource_setup_request_t
ransfer
)
const
;
bool
encode
(
Ngap_PDUSessionResourceSetupItemCxtReq_t
*
pdu
SessionResourceSetupItemCxtR
eq
);
pdu
_session_resource_setup_item_cxt_r
eq
);
bool
decode
(
Ngap_PDUSessionResourceSetupItemCxtReq_t
*
pdu
SessionResourceSetupItemCxtR
eq
);
pdu
_session_resource_setup_item_cxt_r
eq
);
private:
PDUSessionID
pdu_session_id_
;
// Mandatory
...
...
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.cpp
0 → 100644
View file @
42a0378f
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PDUSessionResourceToReleaseListHOCmd.hpp"
namespace
ngap
{
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseListHOCmd
::
PDUSessionResourceToReleaseListHOCmd
()
{}
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseListHOCmd
::~
PDUSessionResourceToReleaseListHOCmd
()
{}
//------------------------------------------------------------------------------
void
PDUSessionResourceToReleaseListHOCmd
::
set
(
const
std
::
vector
<
PDUSessionResourceItem
>&
list
)
{
item_list_
=
list
;
}
//------------------------------------------------------------------------------
void
PDUSessionResourceToReleaseListHOCmd
::
get
(
std
::
vector
<
PDUSessionResourceItem
>&
list
)
{
list
=
item_list_
;
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceToReleaseListHOCmd
::
encode
(
Ngap_PDUSessionResourceToReleaseListHOCmd_t
&
list
)
const
{
for
(
auto
&
item
:
item_list_
)
{
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
rel
=
(
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PDUSessionResourceToReleaseItemHOCmd_t
));
if
(
!
rel
)
return
false
;
if
(
!
item
.
encode
(
rel
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
list
.
list
,
rel
)
!=
0
)
return
false
;
}
return
true
;
}
//------------------------------------------------------------------------------
bool
PDUSessionResourceToReleaseListHOCmd
::
decode
(
const
Ngap_PDUSessionResourceToReleaseListHOCmd_t
&
list
)
{
for
(
int
i
=
0
;
i
<
list
.
list
.
count
;
i
++
)
{
PDUSessionResourceItem
item
=
{};
if
(
!
item
.
decode
(
list
.
list
.
array
[
i
]))
return
false
;
item_list_
.
push_back
(
item
);
}
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/PDUSessionResourceToReleaseListHOCmd.hpp
0 → 100644
View file @
42a0378f
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_TO_RELEASE_LIST_HO_CMD_H_
#define _PDU_SESSION_RESOURCE_TO_RELEASE_LIST_HO_CMD_H_
#include "PDUSessionResourceItem.hpp"
#include <vector>
extern
"C"
{
#include "Ngap_PDUSessionResourceToReleaseListHOCmd.h"
}
namespace
ngap
{
class
PDUSessionResourceToReleaseListHOCmd
{
public:
PDUSessionResourceToReleaseListHOCmd
();
virtual
~
PDUSessionResourceToReleaseListHOCmd
();
void
set
(
const
std
::
vector
<
PDUSessionResourceItem
>&
list
);
void
get
(
std
::
vector
<
PDUSessionResourceItem
>&
list
);
bool
encode
(
Ngap_PDUSessionResourceToReleaseListHOCmd_t
&
list
)
const
;
bool
decode
(
const
Ngap_PDUSessionResourceToReleaseListHOCmd_t
&
list
);
private:
std
::
vector
<
PDUSessionResourceItem
>
item_list_
;
};
}
// namespace ngap
#endif
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
View file @
42a0378f
...
...
@@ -21,6 +21,7 @@
#include "HandoverCommandMsg.hpp"
#include "conversions.hpp"
#include "logger.hpp"
extern
"C"
{
...
...
@@ -34,11 +35,11 @@ namespace ngap {
//------------------------------------------------------------------------------
HandoverCommandMsg
::
HandoverCommandMsg
()
:
NgapUEMessage
()
{
nASSecurityParametersFromNGRAN
=
nullptr
;
pDUSessionResourceToReleaseListHOCmd
=
nullptr
;
nASSecurityParametersFromNGRAN
=
std
::
nullopt
;
pDUSessionResourceToReleaseListHOCmd
=
std
::
nullopt
;
pDUSessionResourceHandoverList
=
std
::
nullopt
;
criticalityDiagnostics
=
nullptr
;
handoverCommandIEs
=
nullptr
;
pDUSessionResourceHandoverListIsSet
=
false
;
setMessageType
(
NgapMessageType
::
HANDOVER_COMMAND
);
initialize
();
...
...
@@ -111,11 +112,43 @@ void HandoverCommandMsg::setHandoverType(const long& type) {
if
(
ret
!=
0
)
Logger
::
ngap
().
error
(
"Encode HandoverType IE error"
);
}
//------------------------------------------------------------------------------
void
HandoverCommandMsg
::
setNASSecurityParametersFromNGRAN
(
const
OCTET_STRING_t
&
nasSecurityParameters
)
{
Ngap_NASSecurityParametersFromNGRAN_t
tmp
=
{};
conv
::
octet_string_copy
(
tmp
,
nasSecurityParameters
);
nASSecurityParametersFromNGRAN
=
std
::
optional
<
Ngap_NASSecurityParametersFromNGRAN_t
>
(
tmp
);
Ngap_HandoverCommandIEs_t
*
ie
=
(
Ngap_HandoverCommandIEs_t
*
)
calloc
(
1
,
sizeof
(
Ngap_HandoverCommandIEs_t
));
ie
->
id
=
Ngap_ProtocolIE_ID_id_NASSecurityParametersFromNGRAN
;
ie
->
criticality
=
Ngap_Criticality_reject
;
ie
->
value
.
present
=
Ngap_HandoverCommandIEs__value_PR_NASSecurityParametersFromNGRAN
;
if
(
!
conv
::
octet_string_copy
(
ie
->
value
.
choice
.
NASSecurityParametersFromNGRAN
,
nASSecurityParametersFromNGRAN
.
value
()))
return
;
int
ret
=
ASN_SEQUENCE_ADD
(
&
handoverCommandIEs
->
protocolIEs
.
list
,
ie
);
if
(
ret
!=
0
)
Logger
::
ngap
().
error
(
"Encode NASSecurityParametersFromNGRAN IE error"
);
}
//------------------------------------------------------------------------------
bool
HandoverCommandMsg
::
getNASSecurityParametersFromNGRAN
(
OCTET_STRING_t
&
nasSecurityParameters
)
{
if
(
!
nASSecurityParametersFromNGRAN
.
has_value
())
return
false
;
return
conv
::
octet_string_copy
(
nasSecurityParameters
,
nASSecurityParametersFromNGRAN
.
value
());
}
//------------------------------------------------------------------------------
void
HandoverCommandMsg
::
setPduSessionResourceHandoverList
(
const
PDUSessionResourceHandoverList
&
list
)
{
pDUSessionResourceHandoverList
=
list
;
pDUSessionResourceHandoverListIsSet
=
true
;
pDUSessionResourceHandoverList
=
std
::
optional
<
PDUSessionResourceHandoverList
>
(
list
)
;
Ngap_HandoverCommandIEs_t
*
ie
=
(
Ngap_HandoverCommandIEs_t
*
)
calloc
(
1
,
sizeof
(
Ngap_HandoverCommandIEs_t
));
...
...
@@ -125,7 +158,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
ie
->
value
.
present
=
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList
;
if
(
!
pDUSessionResourceHandoverList
.
encode
(
if
(
!
pDUSessionResourceHandoverList
.
value
().
encode
(
ie
->
value
.
choice
.
PDUSessionResourceHandoverList
))
{
Logger
::
ngap
().
error
(
"Encode PDUSessionResourceHandoverListItem IE error"
);
free_wrapper
((
void
**
)
&
ie
);
...
...
@@ -138,11 +171,49 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
}
//------------------------------------------------------------------------------
void
HandoverCommandMsg
::
getPduSessionResourceHandoverList
(
bool
HandoverCommandMsg
::
getPduSessionResourceHandoverList
(
PDUSessionResourceHandoverList
&
list
)
{
if
(
pDUSessionResourceHandoverListIsSet
)
{
list
=
pDUSessionResourceHandoverList
;
if
(
pDUSessionResourceHandoverList
.
has_value
())
{
list
=
pDUSessionResourceHandoverList
.
value
();
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
void
HandoverCommandMsg
::
setPDUSessionResourceToReleaseListHOCmd
(
const
PDUSessionResourceToReleaseListHOCmd
&
list
)
{
pDUSessionResourceToReleaseListHOCmd
=
std
::
optional
<
PDUSessionResourceToReleaseListHOCmd
>
(
list
);
Ngap_HandoverCommandIEs_t
*
ie
=
(
Ngap_HandoverCommandIEs_t
*
)
calloc
(
1
,
sizeof
(
Ngap_HandoverCommandIEs_t
));
ie
->
id
=
Ngap_ProtocolIE_ID_id_PDUSessionResourceToReleaseListHOCmd
;
ie
->
criticality
=
Ngap_Criticality_ignore
;
ie
->
value
.
present
=
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd
;
if
(
!
pDUSessionResourceToReleaseListHOCmd
.
value
().
encode
(
ie
->
value
.
choice
.
PDUSessionResourceToReleaseListHOCmd
))
{
Logger
::
ngap
().
error
(
"Encode PDUSessionResourceToReleaseListHOCmd IE error"
);
free_wrapper
((
void
**
)
&
ie
);
return
;
}
int
ret
=
ASN_SEQUENCE_ADD
(
&
handoverCommandIEs
->
protocolIEs
.
list
,
ie
);
if
(
ret
!=
0
)
Logger
::
ngap
().
error
(
"Encode PDUSessionResourceToReleaseListHOCmd IE error"
);
}
//------------------------------------------------------------------------------
bool
HandoverCommandMsg
::
getPDUSessionResourceToReleaseListHOCmd
(
PDUSessionResourceToReleaseListHOCmd
&
list
)
{
if
(
!
pDUSessionResourceToReleaseListHOCmd
.
has_value
())
return
false
;
list
=
pDUSessionResourceToReleaseListHOCmd
.
value
();
return
true
;
}
//------------------------------------------------------------------------------
...
...
@@ -239,10 +310,11 @@ bool HandoverCommandMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
Ngap_Criticality_ignore
&&
handoverCommandIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList
)
{
if
(
pDUSessionResourceHandoverList
.
decode
(
handoverCommandIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
PDUSessionResourceHandoverList
))
{
pDUSessionResourceHandoverListIsSet
=
true
;
PDUSessionResourceHandoverList
tmp
=
{};
if
(
tmp
.
decode
(
handoverCommandIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
PDUSessionResourceHandoverList
))
{
pDUSessionResourceHandoverList
=
std
::
optional
<
PDUSessionResourceHandoverList
>
(
tmp
);
}
else
{
Logger
::
ngap
().
error
(
"Decoded NGAP PDUSessionResourceHandoverList IE error"
);
...
...
@@ -259,7 +331,18 @@ bool HandoverCommandMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
Ngap_Criticality_ignore
&&
handoverCommandIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd
)
{
// TODO:
PDUSessionResourceToReleaseListHOCmd
tmp
=
{};
if
(
tmp
.
decode
(
handoverCommandIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
PDUSessionResourceToReleaseListHOCmd
))
{
pDUSessionResourceToReleaseListHOCmd
=
std
::
optional
<
PDUSessionResourceToReleaseListHOCmd
>
(
tmp
);
}
else
{
Logger
::
ngap
().
error
(
"Decoded NGAP PDUSessionResourceToReleaseListHOCmd IE error"
);
return
false
;
}
}
else
{
Logger
::
ngap
().
error
(
"Decoded NGAP PDUSessionResourceToReleaseListHOCmd IE error"
);
...
...
src/ngap/ngapMsgs/HandoverCommandMsg.hpp
View file @
42a0378f
...
...
@@ -19,25 +19,22 @@
* contact@openairinterface.org
*/
#ifndef _HANDOVERCOMMAND_H_
#define _HANDOVERCOMMAND_H_
#ifndef _HANDOVER
_
COMMAND_H_
#define _HANDOVER
_
COMMAND_H_
#include "NgapUEMessage.hpp"
#include "PDUSessionResourceHandoverList.hpp"
#include "PDUSessionResourceToReleaseListHOCmd.hpp"
#include <optional>
extern
"C"
{
#include "Ngap_NGAP-PDU.h"
#include "Ngap_NGSetupRequest.h"
#include "Ngap_HandoverCommand.h"
}
namespace
ngap
{
typedef
struct
{
uint8_t
pduSessionId
;
OCTET_STRING_t
HandoverCommandTransfer
;
}
PDUSessionResourceHandoverItem_t
;
class
HandoverCommandMsg
:
public
NgapUEMessage
{
public:
HandoverCommandMsg
();
...
...
@@ -51,9 +48,18 @@ class HandoverCommandMsg : public NgapUEMessage {
void
setHandoverType
(
const
long
&
type
);
// void getHandoverType(Ngap_HandoverType_t &type);
void
setNASSecurityParametersFromNGRAN
(
const
OCTET_STRING_t
&
nasSecurityParameters
);
bool
getNASSecurityParametersFromNGRAN
(
OCTET_STRING_t
&
nasSecurityParameters
);
void
setPduSessionResourceHandoverList
(
const
PDUSessionResourceHandoverList
&
list
);
void
getPduSessionResourceHandoverList
(
PDUSessionResourceHandoverList
&
list
);
bool
getPduSessionResourceHandoverList
(
PDUSessionResourceHandoverList
&
list
);
void
setPDUSessionResourceToReleaseListHOCmd
(
const
PDUSessionResourceToReleaseListHOCmd
&
list
);
bool
getPDUSessionResourceToReleaseListHOCmd
(
PDUSessionResourceToReleaseListHOCmd
&
list
);
void
setTargetToSource_TransparentContainer
(
const
OCTET_STRING_t
&
targetTosource
);
...
...
@@ -65,14 +71,14 @@ class HandoverCommandMsg : public NgapUEMessage {
// AMF_UE_NGAP_ID (Mandatory)
// RAN_UE_NGAP_ID (Mandatory)
Ngap_HandoverType_t
handoverType
;
// Mandatory
Ngap_NASSecurityParametersFromNGRAN_t
*
std
::
optional
<
Ngap_NASSecurityParametersFromNGRAN_t
>
nASSecurityParametersFromNGRAN
;
// TODO: Conditional
PDUSessionResourceHandoverList
pDUSessionResourceHandoverList
;
// Optional
bool
pDUSessionResourceHandoverListIsSet
;
Ngap_PDUSessionResourceToReleaseListHOCmd_t
*
pDUSessionResourceToReleaseListHOCmd
;
// TODO: Optional
std
::
optional
<
PDUSessionResourceHandoverList
>
pDUSessionResourceHandoverList
;
// Optional
std
::
optional
<
PDUSessionResourceToReleaseListHOCmd
>
pDUSessionResourceToReleaseListHOCmd
;
Ngap_TargetToSource_TransparentContainer_t
targetToSource_TransparentContainer
;
// Mandatory
targetToSource_TransparentContainer
;
//
TODO:
Mandatory
Ngap_CriticalityDiagnostics_t
*
criticalityDiagnostics
;
// TODO: Optional
};
...
...
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