Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
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
spbro
OpenXG-RAN
Commits
b77ecaf2
Commit
b77ecaf2
authored
Sep 15, 2020
by
yincong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDUSessionResourceSetupRequest
PDUSessionResourceSetupResponse
parent
15cd202d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
260 additions
and
135 deletions
+260
-135
openair3/NGAP/ngap_common.h
openair3/NGAP/ngap_common.h
+3
-0
openair3/NGAP/ngap_gNB_handlers.c
openair3/NGAP/ngap_gNB_handlers.c
+139
-62
openair3/NGAP/ngap_gNB_nas_procedures.c
openair3/NGAP/ngap_gNB_nas_procedures.c
+118
-73
No files found.
openair3/NGAP/ngap_common.h
View file @
b77ecaf2
...
...
@@ -62,6 +62,9 @@
#include "NGAP_PDUSessionResourceSetupUnsuccessfulTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtRes.h"
#include "NGAP_PDUSessionResourceFailedToSetupItemCxtRes.h"
#include "NGAP_PDUSessionResourceSetupItemSUReq.h"
#include "NGAP_PDUSessionResourceSetupItemSURes.h"
#include "NGAP_PDUSessionResourceFailedToSetupItemSURes.h"
#include "NGAP_AssociatedQosFlowItem.h"
#include "NGAP_PDUSessionResourceSetupRequestTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtReq.h"
...
...
openair3/NGAP/ngap_gNB_handlers.c
View file @
b77ecaf2
...
...
@@ -1201,49 +1201,48 @@ static
int
ngap_gNB_handle_pdusession_setup_request
(
uint32_t
assoc_id
,
uint32_t
stream
,
NGAP_NGAP_PDU_t
*
pdu
)
{
#if 0
int i;
NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
// NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
uint64_t
amf_ue_ngap_id
;
NGAP_RAN_UE_NGAP_ID_t
ran_ue_ngap_id
;
ngap_gNB_amf_data_t
*
amf_desc_p
=
NULL
;
ngap_gNB_ue_context_t
*
ue_desc_p
=
NULL
;
MessageDef
*
message_p
=
NULL
;
NGAP_PDUS
ESSION
SetupRequest_t *container;
NGAP_PDUS
ESSION
SetupRequestIEs_t *ie;
NGAP_PDUS
essionResource
SetupRequest_t
*
container
;
NGAP_PDUS
essionResource
SetupRequestIEs_t
*
ie
;
DevAssert
(
pdu
!=
NULL
);
container = &pdu->choice.initiatingMessage.value.choice.PDUS
ESSION
SetupRequest;
container
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
PDUS
essionResource
SetupRequest
;
if
((
amf_desc_p
=
ngap_gNB_get_AMF
(
NULL
,
assoc_id
,
0
))
==
NULL
)
{
NGAP_ERROR("[SCTP %d] Received
initial context
setup request for non "
NGAP_ERROR
(
"[SCTP %d] Received
pdu session resource
setup request for non "
"existing AMF context
\n
"
,
assoc_id
);
return
-
1
;
}
/* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUS
ESSION
SetupRequestIEs_t, ie, container,
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_PDUS
essionResource
SetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID
;
asn_INTEGER2ulong
(
&
(
ie
->
value
.
choice
.
AMF_UE_NGAP_ID
),
&
amf_ue_ngap_id
)
;
}
else
{
return
-
1
;
}
/* id-gNB-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUS
ESSION
SetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB
_UE_NGAP_ID, true);
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_PDUS
essionResource
SetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_RAN
_UE_NGAP_ID
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
enb_ue_ngap_id = ie->value.choice.GNB
_UE_NGAP_ID;
ran_ue_ngap_id
=
ie
->
value
.
choice
.
RAN
_UE_NGAP_ID
;
}
else
{
return
-
1
;
}
if
((
ue_desc_p
=
ngap_gNB_get_ue_context
(
amf_desc_p
->
ngap_gNB_instance
,
enb
_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received
initial context
setup request for non "
ran
_ue_ngap_id
))
==
NULL
)
{
NGAP_ERROR
(
"[SCTP %d] Received
pdu session resource
setup request for non "
"existing UE context 0x%06lx
\n
"
,
assoc_id
,
enb
_ue_ngap_id);
ran
_ue_ngap_id
);
return
-
1
;
}
...
...
@@ -1255,6 +1254,7 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
}
ue_desc_p
->
rx_stream
=
stream
;
ue_desc_p
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
if
(
ue_desc_p
->
amf_ue_ngap_id
!=
amf_ue_ngap_id
)
{
NGAP_WARN
(
"UE context amf_ue_ngap_id is different form that of the message (%d != %ld)"
,
...
...
@@ -1263,26 +1263,33 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
message_p
=
itti_alloc_new_message
(
TASK_NGAP
,
NGAP_PDUSESSION_SETUP_REQ
);
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
ue_initial_id
=
ue_desc_p
->
ue_initial_id
;
NGAP_PDUSESSION_SETUP_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id;
NGAP_PDUSESSION_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSetupListBearerSUReq, true);
ue_desc_p
->
ue_initial_id
=
0
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
gNB_ue_ngap_id
=
ue_desc_p
->
gNB_ue_ngap_id
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
amf_ue_ngap_id
=
ue_desc_p
->
amf_ue_ngap_id
;
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_PDUSessionResourceSetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSUReq
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
nb_pdusessions_tosetup
=
ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count;
ie
->
value
.
choice
.
PDUSessionResourceSetupListSUReq
.
list
.
count
;
for
(
int
i
=
0
;
i
<
ie
->
value
.
choice
.
PDUSessionResourceSetupListSUReq
.
list
.
count
;
i
++
)
{
NGAP_PDUSessionResourceSetupItemSUReq_t
*
item_p
;
asn_dec_rval_t
dec_rval
;
NGAP_PDUSessionResourceSetupRequestTransfer_t
*
pdusessionTransfer_p
=
NULL
;
NGAP_PDUSessionResourceSetupRequestTransferIEs_t
*
pdusessionTransfer_ies
=
NULL
;
item_p
=
(
NGAP_PDUSessionResourceSetupItemSUReq_t
*
)
ie
->
value
.
choice
.
PDUSessionResourceSetupListSUReq
.
list
.
array
[
i
];
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
pdusession_setup_params
[
i
].
pdusession_id
=
item_p
->
pDUSessionID
;
for (i = 0; i < ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count; i++) {
NGAP_PDUSESSIONToBeSetupItemBearerSUReq_t *item_p;
item_p = &(((NGAP_PDUSESSIONToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.array[i])->value.choice.PDUSESSIONToBeSetupItemBearerSUReq);
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].pdusession_id = item_p->e_RAB_ID;
// check for the NAS PDU
if (item_p->nAS_PDU.
size > 0 ) {
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = item_p->nAS_PDU.
size;
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.
size);
if
(
item_p
->
pDUSessionNAS_PDU
->
size
>
0
)
{
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
pdusession_setup_params
[
i
].
nas_pdu
.
length
=
item_p
->
pDUSessionNAS_PDU
->
size
;
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
pdusession_setup_params
[
i
].
nas_pdu
.
buffer
=
malloc
(
sizeof
(
uint8_t
)
*
item_p
->
pDUSessionNAS_PDU
->
size
);
memcpy
(
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
pdusession_setup_params
[
i
].
nas_pdu
.
buffer
,
item_p->nAS_PDU.buf, item_p->nAS_PDU.
size);
item_p
->
pDUSessionNAS_PDU
->
buf
,
item_p
->
pDUSessionNAS_PDU
->
size
);
// NGAP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]);
}
else
{
NGAP_PDUSESSION_SETUP_REQ
(
message_p
).
pdusession_setup_params
[
i
].
nas_pdu
.
length
=
0
;
...
...
@@ -1290,36 +1297,106 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
NGAP_WARN
(
"NAS PDU is not provided, generate a PDUSESSION_SETUP Failure (TBD) back to AMF
\n
"
);
}
/* Set the transport layer address */
memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length =
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
/* NGAP_INFO("sgw addr %s len: %d (size %d, index %d)\n",
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer,
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length,
item_p->transportLayerAddress.size, i);
*/
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].gtp_teid);
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer
,
(
void
**
)
&
pdusessionTransfer_p
,
item_p
->
pDUSessionResourceSetupRequestTransfer
.
buf
,
item_p
->
pDUSessionResourceSetupRequestTransfer
.
size
,
0
,
0
);
if
(
dec_rval
.
code
!=
RC_OK
)
{
NGAP_ERROR
(
"could not decode PDUSessionResourceSetupRequestTransfer
\n
"
);
return
-
1
;
}
for
(
int
j
=
0
;
j
<
pdusessionTransfer_p
->
protocolIEs
.
list
.
count
;
j
++
)
{
pdusessionTransfer_ies
=
pdusessionTransfer_p
->
protocolIEs
.
list
.
array
[
j
];
switch
(
pdusessionTransfer_ies
->
id
)
{
/* optional PDUSessionAggregateMaximumBitRate */
case
NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate
:
break
;
/* mandatory UL-NGU-UP-TNLInformation */
case
NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLInformation
:
{
NGAP_GTPTunnel_t
*
gTPTunnel_p
;
gTPTunnel_p
=
&
pdusessionTransfer_ies
->
value
.
choice
.
UPTransportLayerInformation
.
choice
.
gTPTunnel
;
/* The transport layer address for the IP packets */
OCTET_STRING_TO_INT32
(
&
gTPTunnel_p
->
gTP_TEID
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
gtp_teid
);
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
upf_addr
.
length
=
gTPTunnel_p
->
transportLayerAddress
.
size
*
8
-
gTPTunnel_p
->
transportLayerAddress
.
bits_unused
;
memcpy
(
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
upf_addr
.
buffer
,
gTPTunnel_p
->
transportLayerAddress
.
buf
,
gTPTunnel_p
->
transportLayerAddress
.
size
);
}
break
;
/* optional AdditionalUL-NGU-UP-TNLInformation */
case
NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation
:
break
;
/* optional DataForwardingNotPossible */
case
NGAP_ProtocolIE_ID_id_DataForwardingNotPossible
:
break
;
/* mandatory PDUSessionType */
case
NGAP_ProtocolIE_ID_id_PDUSessionType
:
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
upf_addr
.
pdu_session_type
=
(
uint8_t
)
pdusessionTransfer_ies
->
value
.
choice
.
PDUSessionType
;
break
;
/* optional SecurityIndication */
case
NGAP_ProtocolIE_ID_id_SecurityIndication
:
break
;
/* optional NetworkInstance */
case
NGAP_ProtocolIE_ID_id_NetworkInstance
:
break
;
/* mandatory QosFlowSetupRequestList */
case
NGAP_ProtocolIE_ID_id_QosFlowSetupRequestList
:
{
NGAP_QosFlowSetupRequestItem_t
*
qosFlowItem_p
;
NGAP_DEBUG
(
"servedGUAMIs.list.count %d
\n
"
,
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
count
);
DevAssert
(
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
count
>
0
);
DevAssert
(
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
count
<=
NGAP_maxnoofQosFlows
);
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
nb_qos
=
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
count
;
for
(
int
qosIdx
=
0
;
qosIdx
<
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
count
;
qosIdx
++
){
qosFlowItem_p
=
pdusessionTransfer_ies
->
value
.
choice
.
QosFlowSetupRequestList
.
list
.
array
[
qosIdx
];
/* Set the QOS informations */
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_capability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
} /* for i... */
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
qos
[
qosIdx
].
qci
=
(
uint8_t
)
qosFlowItem_p
->
qosFlowIdentifier
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
qos
[
qosIdx
].
allocation_retention_priority
.
priority_level
=
qosFlowItem_p
->
qosFlowLevelQosParameters
.
allocationAndRetentionPriority
.
priorityLevelARP
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
qos
[
qosIdx
].
allocation_retention_priority
.
pre_emp_capability
=
qosFlowItem_p
->
qosFlowLevelQosParameters
.
allocationAndRetentionPriority
.
pre_emptionCapability
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
pdusession_param
[
i
].
qos
[
qosIdx
].
allocation_retention_priority
.
pre_emp_vulnerability
=
qosFlowItem_p
->
qosFlowLevelQosParameters
.
allocationAndRetentionPriority
.
pre_emptionVulnerability
;
}
}
break
;
/* optional CommonNetworkInstance */
case
NGAP_ProtocolIE_ID_id_CommonNetworkInstance
:
break
;
default:
NGAP_ERROR
(
"could not found protocolIEs id %ld
\n
"
,
pdusessionTransfer_ies
->
id
);
return
-
1
;
}
}
/* for j... */
}
/* for i... */
itti_send_msg_to_task
(
TASK_RRC_GNB
,
ue_desc_p
->
gNB_instance
->
instance
,
message_p
);
} else {
}
else
{
/* ie == NULL */
NGAP_ERROR
(
"could not found NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSUReq
\n
"
);
return
-
1
;
}
#endif
return
0
;
}
static
int
ngap_gNB_handle_paging
(
uint32_t
assoc_id
,
uint32_t
stream
,
...
...
openair3/NGAP/ngap_gNB_nas_procedures.c
View file @
b77ecaf2
...
...
@@ -951,15 +951,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
ngap_pdusession_setup_resp_t
*
pdusession_setup_resp_p
)
//------------------------------------------------------------------------------
{
#if 0
ngap_gNB_instance_t
*
ngap_gNB_instance_p
=
NULL
;
struct
ngap_gNB_ue_context_s
*
ue_context_p
=
NULL
;
NGAP_NGAP_PDU_t
pdu
;
NGAP_PDUS
ESSION
SetupResponse_t *out;
NGAP_PDUS
ESSION
SetupResponseIEs_t *ie;
NGAP_PDUS
essionResource
SetupResponse_t
*
out
;
NGAP_PDUS
essionResource
SetupResponseIEs_t
*
ie
;
uint8_t
*
buffer
=
NULL
;
uint32_t
length
;
int
i
;
asn_encode_to_new_buffer_result_t
res
=
{
NULL
,
{
0
,
NULL
,
NULL
}
};
/* Retrieve the NGAP gNB instance associated with Mod_id */
ngap_gNB_instance_p
=
ngap_gNB_get_instance
(
instance
);
DevAssert
(
pdusession_setup_resp_p
!=
NULL
);
...
...
@@ -987,96 +988,133 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
/* Prepare the NGAP message to encode */
memset
(
&
pdu
,
0
,
sizeof
(
pdu
));
pdu
.
present
=
NGAP_NGAP_PDU_PR_successfulOutcome
;
pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUS
ESSIONModify
;
pdu
.
choice
.
successfulOutcome
.
procedureCode
=
NGAP_ProcedureCode_id_PDUS
essionResourceSetup
;
pdu
.
choice
.
successfulOutcome
.
criticality
=
NGAP_Criticality_reject
;
pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUS
ESSION
SetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.PDUS
ESSION
SetupResponse;
pdu
.
choice
.
successfulOutcome
.
value
.
present
=
NGAP_SuccessfulOutcome__value_PR_PDUS
essionResource
SetupResponse
;
out
=
&
pdu
.
choice
.
successfulOutcome
.
value
.
choice
.
PDUS
essionResource
SetupResponse
;
/* mandatory */
ie = (NGAP_PDUS
ESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSION
SetupResponseIEs_t));
ie
=
(
NGAP_PDUS
essionResourceSetupResponseIEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResource
SetupResponseIEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_AMF_UE_NGAP_ID;
ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id;
ie
->
value
.
present
=
NGAP_PDUSessionResourceSetupResponseIEs__value_PR_AMF_UE_NGAP_ID
;
asn_uint642INTEGER
(
&
ie
->
value
.
choice
.
AMF_UE_NGAP_ID
,
ue_context_p
->
amf_ue_ngap_id
);
//ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id;
asn_uint642INTEGER
(
&
ie
->
value
.
choice
.
AMF_UE_NGAP_ID
,
ue_context_p
->
amf_ue_ngap_id
);
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* mandatory */
ie = (NGAP_PDUS
ESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSION
SetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_
gNB
_UE_NGAP_ID;
ie
=
(
NGAP_PDUS
essionResourceSetupResponseIEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResource
SetupResponseIEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_
RAN
_UE_NGAP_ID
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie->value.present = NGAP_PDUS
ESSIONSetupResponseIEs__value_PR_GNB
_UE_NGAP_ID;
ie->value.choice.
GNB
_UE_NGAP_ID = pdusession_setup_resp_p->gNB_ue_ngap_id;
ie
->
value
.
present
=
NGAP_PDUS
essionResourceSetupResponseIEs__value_PR_RAN
_UE_NGAP_ID
;
ie
->
value
.
choice
.
RAN
_UE_NGAP_ID
=
pdusession_setup_resp_p
->
gNB_ue_ngap_id
;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* optional */
if
(
pdusession_setup_resp_p
->
nb_of_pdusessions
>
0
)
{
ie = (NGAP_PDUS
ESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSION
SetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUS
ESSIONSetupListBearer
SURes;
ie
=
(
NGAP_PDUS
essionResourceSetupResponseIEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResource
SetupResponseIEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_PDUS
essionResourceSetupList
SURes
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie->value.present = NGAP_PDUS
ESSIONSetupResponseIEs__value_PR_PDUSESSIONSetupListBearer
SURes;
ie
->
value
.
present
=
NGAP_PDUS
essionResourceSetupResponseIEs__value_PR_PDUSessionResourceSetupList
SURes
;
for
(
i
=
0
;
i
<
pdusession_setup_resp_p
->
nb_of_pdusessions
;
i
++
)
{
NGAP_PDUSESSIONSetupItemBearerSUResIEs_t *item;
NGAP_PDUSessionResourceSetupItemSURes_t
*
item
;
NGAP_PDUSessionResourceSetupResponseTransfer_t
*
pdusessionTransfer_p
=
NULL
;
/* mandatory */
item = (NGAP_PDUSESSIONSetupItemBearerSUResIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupItemBearerSUResIEs_t));
item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupItemBearerSURes;
item->criticality = NGAP_Criticality_ignore;
item->value.present = NGAP_PDUSESSIONSetupItemBearerSUResIEs__value_PR_PDUSESSIONSetupItemBearerSURes;
item->value.choice.PDUSESSIONSetupItemBearerSURes.e_RAB_ID = pdusession_setup_resp_p->pdusessions[i].pdusession_id;
GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &item->value.choice.PDUSESSIONSetupItemBearerSURes.gTP_TEID);
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length);
memcpy(item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf,
item
=
(
NGAP_PDUSessionResourceSetupItemSURes_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResourceSetupItemSURes_t
));
/* pDUSessionID */
item
->
pDUSessionID
=
pdusession_setup_resp_p
->
pdusessions
[
i
].
pdusession_id
;
/* dLQosFlowPerTNLInformation */
pdusessionTransfer_p
=
(
NGAP_PDUSessionResourceSetupResponseTransfer_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResourceSetupResponseTransfer_t
));
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
present
=
NGAP_UPTransportLayerInformation_PR_gTPTunnel
;
GTP_TEID_TO_ASN1
(
pdusession_setup_resp_p
->
pdusessions
[
i
].
gtp_teid
,
&
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
gTP_TEID
);
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
=
malloc
(
pdusession_setup_resp_p
->
pdusessions
[
i
].
gNB_addr
.
length
);
memcpy
(
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
,
pdusession_setup_resp_p
->
pdusessions
[
i
].
gNB_addr
.
buffer
,
pdusession_setup_resp_p
->
pdusessions
[
i
].
gNB_addr
.
length
);
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length;
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.bits_unused = 0;
NGAP_DEBUG("pdusession_setup_resp: pdusession ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %ld\n",
item->value.choice.PDUSESSIONSetupItemBearerSURes.e_RAB_ID,
pdusession_setup_resp_p->pdusessions[i].gtp_teid,
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[0],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[1],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[2],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[3],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONSetupListBearerSURes.list, item);
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
size
=
pdusession_setup_resp_p
->
pdusessions
[
i
].
gNB_addr
.
length
;
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
bits_unused
=
0
;
NGAP_DEBUG
(
"pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld
\n
"
,
item
->
pDUSessionID
,
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
[
0
],
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
[
1
],
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
[
2
],
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
buf
[
3
],
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
.
transportLayerAddress
.
size
);
/* associatedQosFlowList. number of 1? */
for
(
int
j
=
0
;
j
<
pdusession_setup_resp_p
->
pdusessions
[
i
].
nb_of_qos_flow
;
j
++
)
{
NGAP_AssociatedQosFlowItem_t
*
ass_qos_item_p
;
ass_qos_item_p
=
(
NGAP_AssociatedQosFlowItem_t
*
)
calloc
(
1
,
sizeof
(
NGAP_AssociatedQosFlowItem_t
));
/* qosFlowIdentifier */
ass_qos_item_p
->
qosFlowIdentifier
=
pdusession_setup_resp_p
->
pdusessions
[
i
].
associated_qos_flows
[
j
].
qci
;
/* qosFlowMappingIndication */
if
(
pdusession_setup_resp_p
->
pdusessions
[
i
].
associated_qos_flows
[
j
].
qos_flow_mapping_ind
!=
QOSFLOW_MAPPING_INDICATION_NON
)
{
ass_qos_item_p
->
qosFlowMappingIndication
=
malloc
(
sizeof
(
*
ass_qos_item_p
->
qosFlowMappingIndication
));
*
ass_qos_item_p
->
qosFlowMappingIndication
=
pdusession_setup_resp_p
->
pdusessions
[
i
].
associated_qos_flows
[
j
].
qos_flow_mapping_ind
;
}
ASN_SEQUENCE_ADD
(
&
pdusessionTransfer_p
->
dLQosFlowPerTNLInformation
.
associatedQosFlowList
.
list
,
ass_qos_item_p
);
}
memset
(
&
res
,
0
,
sizeof
(
res
));
res
=
asn_encode_to_new_buffer
(
NULL
,
ATS_ALIGNED_CANONICAL_PER
,
&
asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer
,
pdusessionTransfer_p
);
item
->
pDUSessionResourceSetupResponseTransfer
.
buf
=
res
.
buffer
;
item
->
pDUSessionResourceSetupResponseTransfer
.
size
=
res
.
result
.
encoded
;
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer
,
pdusessionTransfer_p
);
ASN_SEQUENCE_ADD
(
&
ie
->
value
.
choice
.
PDUSessionResourceSetupListSURes
.
list
,
item
);
}
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
}
/* optional */
if
(
pdusession_setup_resp_p
->
nb_of_pdusessions_failed
>
0
)
{
ie = (NGAP_PDUS
ESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIE
s_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUS
ESSIONFailedToSetupListBearer
SURes;
ie
=
(
NGAP_PDUS
essionResourceFailedToSetupListSURes_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResourceFailedToSetupListSURe
s_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_PDUS
essionResourceFailedToSetupList
SURes
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie->value.present = NGAP_PDUS
ESSIONSetupResponseIEs__value_PR_PDUSESSIONList
;
ie
->
value
.
present
=
NGAP_PDUS
essionResourceSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListSURes
;
for
(
i
=
0
;
i
<
pdusession_setup_resp_p
->
nb_of_pdusessions_failed
;
i
++
)
{
NGAP_PDUSESSIONItemIEs_t *item;
item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t));
item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONItem;
item->criticality = NGAP_Criticality_ignore;
item->value.present = NGAP_PDUSESSIONItemIEs__value_PR_PDUSESSIONItem;
item->value.choice.PDUSESSIONItem.e_RAB_ID = pdusession_setup_resp_p->pdusessions_failed[i].pdusession_id;
item->value.choice.PDUSESSIONItem.cause.present = pdusession_setup_resp_p->pdusessions_failed[i].cause;
NGAP_PDUSessionResourceFailedToSetupItemSURes_t
*
item
;
NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t
*
pdusessionUnTransfer_p
=
NULL
;
switch(item->value.choice.PDUSESSIONItem.cause.present) {
/* mandatory */
item
=
(
NGAP_PDUSessionResourceFailedToSetupItemSURes_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResourceFailedToSetupItemSURes_t
));
/* pDUSessionID */
item
->
pDUSessionID
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
pdusession_id
;
/* cause */
pdusessionUnTransfer_p
=
(
NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t
));
pdusessionUnTransfer_p
->
cause
.
present
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause
;
switch
(
pdusessionUnTransfer_p
->
cause
.
present
)
{
case
NGAP_Cause_PR_radioNetwork
:
item->value.choice.PDUSESSIONItem.
cause.choice.radioNetwork = pdusession_setup_resp_p->pdusessions_failed[i].cause_value;
pdusessionUnTransfer_p
->
cause
.
choice
.
radioNetwork
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause_value
;
break
;
case
NGAP_Cause_PR_transport
:
item->value.choice.PDUSESSIONItem.
cause.choice.transport = pdusession_setup_resp_p->pdusessions_failed[i].cause_value;
pdusessionUnTransfer_p
->
cause
.
choice
.
transport
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause_value
;
break
;
case
NGAP_Cause_PR_nas
:
item->value.choice.PDUSESSIONItem.
cause.choice.nas = pdusession_setup_resp_p->pdusessions_failed[i].cause_value;
pdusessionUnTransfer_p
->
cause
.
choice
.
nas
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause_value
;
break
;
case
NGAP_Cause_PR_protocol
:
item->value.choice.PDUSESSIONItem.
cause.choice.protocol = pdusession_setup_resp_p->pdusessions_failed[i].cause_value;
pdusessionUnTransfer_p
->
cause
.
choice
.
protocol
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause_value
;
break
;
case
NGAP_Cause_PR_misc
:
item->value.choice.PDUSESSIONItem.
cause.choice.misc = pdusession_setup_resp_p->pdusessions_failed[i].cause_value;
pdusessionUnTransfer_p
->
cause
.
choice
.
misc
=
pdusession_setup_resp_p
->
pdusessions_failed
[
i
].
cause_value
;
break
;
case
NGAP_Cause_PR_NOTHING
:
...
...
@@ -1084,8 +1122,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
break
;
}
NGAP_DEBUG("pdusession_modify_resp: failed pdusession ID %ld\n", item->value.choice.PDUSESSIONItem.e_RAB_ID);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item);
NGAP_DEBUG
(
"pdusession setup response: failed pdusession ID %ld
\n
"
,
item
->
pDUSessionID
);
memset
(
&
res
,
0
,
sizeof
(
res
));
res
=
asn_encode_to_new_buffer
(
NULL
,
ATS_ALIGNED_CANONICAL_PER
,
&
asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer
,
pdusessionUnTransfer_p
);
item
->
pDUSessionResourceSetupUnsuccessfulTransfer
.
buf
=
res
.
buffer
;
item
->
pDUSessionResourceSetupUnsuccessfulTransfer
.
size
=
res
.
result
.
encoded
;
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer
,
pdusessionUnTransfer_p
);
ASN_SEQUENCE_ADD
(
&
ie
->
value
.
choice
.
PDUSessionResourceFailedToSetupListSURes
.
list
,
item
);
}
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
...
...
@@ -1093,10 +1139,10 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
/* optional */
if
(
0
)
{
ie = (NGAP_PDUS
ESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSION
SetupResponseIEs_t));
ie
=
(
NGAP_PDUS
essionResourceSetupResponseIEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_PDUSessionResource
SetupResponseIEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_CriticalityDiagnostics
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie->value.present = NGAP_PDUS
ESSION
SetupResponseIEs__value_PR_CriticalityDiagnostics;
ie
->
value
.
present
=
NGAP_PDUS
essionResource
SetupResponseIEs__value_PR_CriticalityDiagnostics
;
// ie->value.choice.CriticalityDiagnostics = ;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
}
...
...
@@ -1128,7 +1174,6 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
ngap_gNB_itti_send_sctp_data_req
(
ngap_gNB_instance_p
->
instance
,
ue_context_p
->
amf_ref
->
assoc_id
,
buffer
,
length
,
ue_context_p
->
tx_stream
);
#endif
return
0
;
}
...
...
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