Commit b77ecaf2 authored by yincong's avatar yincong

PDUSessionResourceSetupRequest

PDUSessionResourceSetupResponse
parent 15cd202d
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
#include "NGAP_PDUSessionResourceSetupUnsuccessfulTransfer.h" #include "NGAP_PDUSessionResourceSetupUnsuccessfulTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtRes.h" #include "NGAP_PDUSessionResourceSetupItemCxtRes.h"
#include "NGAP_PDUSessionResourceFailedToSetupItemCxtRes.h" #include "NGAP_PDUSessionResourceFailedToSetupItemCxtRes.h"
#include "NGAP_PDUSessionResourceSetupItemSUReq.h"
#include "NGAP_PDUSessionResourceSetupItemSURes.h"
#include "NGAP_PDUSessionResourceFailedToSetupItemSURes.h"
#include "NGAP_AssociatedQosFlowItem.h" #include "NGAP_AssociatedQosFlowItem.h"
#include "NGAP_PDUSessionResourceSetupRequestTransfer.h" #include "NGAP_PDUSessionResourceSetupRequestTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtReq.h" #include "NGAP_PDUSessionResourceSetupItemCxtReq.h"
......
...@@ -1201,49 +1201,48 @@ static ...@@ -1201,49 +1201,48 @@ static
int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
#if 0 // NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
int i; uint64_t amf_ue_ngap_id;
NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_PDUSESSIONSetupRequest_t *container; NGAP_PDUSessionResourceSetupRequest_t *container;
NGAP_PDUSESSIONSetupRequestIEs_t *ie; NGAP_PDUSessionResourceSetupRequestIEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONSetupRequest; container = &pdu->choice.initiatingMessage.value.choice.PDUSessionResourceSetupRequest;
if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { 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); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
/* id-AMF-UE-NGAP-ID */ /* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSessionResourceSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ 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 { } else {
return -1; return -1;
} }
/* id-gNB-UE-NGAP-ID */ /* id-gNB-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSessionResourceSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ 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 { } else {
return -1; return -1;
} }
if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { ran_ue_ngap_id)) == 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 UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
enb_ue_ngap_id); ran_ue_ngap_id);
return -1; return -1;
} }
...@@ -1255,6 +1254,7 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, ...@@ -1255,6 +1254,7 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
} }
ue_desc_p->rx_stream = stream; 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) { 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)", 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, ...@@ -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); 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).ue_initial_id = ue_desc_p->ue_initial_id;
NGAP_PDUSESSION_SETUP_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id; ue_desc_p->ue_initial_id = 0;
NGAP_PDUSESSION_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).amf_ue_ngap_id = ue_desc_p->amf_ue_ngap_id;
NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSetupListBearerSUReq, true);
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 */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_PDUSESSION_SETUP_REQ(message_p).nb_pdusessions_tosetup = 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 // check for the NAS PDU
if (item_p->nAS_PDU.size > 0 ) { if (item_p->pDUSessionNAS_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.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->nAS_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, 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]); // 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 { } else {
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = 0; 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, ...@@ -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"); NGAP_WARN("NAS PDU is not provided, generate a PDUSESSION_SETUP Failure (TBD) back to AMF \n");
} }
/* Set the transport layer address */ dec_rval = uper_decode(NULL,
memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer, &asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); (void **)&pdusessionTransfer_p,
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length = item_p->pDUSessionResourceSetupRequestTransfer.buf,
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; item_p->pDUSessionResourceSetupRequestTransfer.size, 0, 0);
/* 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, if(dec_rval.code != RC_OK) {
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length, NGAP_ERROR("could not decode PDUSessionResourceSetupRequestTransfer\n");
item_p->transportLayerAddress.size, i); return -1;
*/ }
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].gtp_teid); 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 */ /* Set the QOS informations */
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].qci = (uint8_t)qosFlowItem_p->qosFlowIdentifier;
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.priority_level =
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.priorityLevelARP;
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_capability =
NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.pre_emptionCapability;
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_vulnerability =
} /* for i... */ 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); 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; return -1;
} }
#endif
return 0; return 0;
} }
static static
int ngap_gNB_handle_paging(uint32_t assoc_id, int ngap_gNB_handle_paging(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
......
...@@ -951,15 +951,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -951,15 +951,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
ngap_pdusession_setup_resp_t *pdusession_setup_resp_p) ngap_pdusession_setup_resp_t *pdusession_setup_resp_p)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
#if 0
ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance_p = NULL;
struct ngap_gNB_ue_context_s *ue_context_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL;
NGAP_NGAP_PDU_t pdu; NGAP_NGAP_PDU_t pdu;
NGAP_PDUSESSIONSetupResponse_t *out; NGAP_PDUSessionResourceSetupResponse_t *out;
NGAP_PDUSESSIONSetupResponseIEs_t *ie; NGAP_PDUSessionResourceSetupResponseIEs_t *ie;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
uint32_t length; uint32_t length;
int i; int i;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
/* Retrieve the NGAP gNB instance associated with Mod_id */ /* Retrieve the NGAP gNB instance associated with Mod_id */
ngap_gNB_instance_p = ngap_gNB_get_instance(instance); ngap_gNB_instance_p = ngap_gNB_get_instance(instance);
DevAssert(pdusession_setup_resp_p != NULL); DevAssert(pdusession_setup_resp_p != NULL);
...@@ -987,96 +988,133 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -987,96 +988,133 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
/* Prepare the NGAP message to encode */ /* Prepare the NGAP message to encode */
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONModify; pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceSetup;
pdu.choice.successfulOutcome.criticality = NGAP_Criticality_reject; pdu.choice.successfulOutcome.criticality = NGAP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUSESSIONSetupResponse; pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceSetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.PDUSESSIONSetupResponse; out = &pdu.choice.successfulOutcome.value.choice.PDUSessionResourceSetupResponse;
/* mandatory */ /* mandatory */
ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie = (NGAP_PDUSessionResourceSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_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);
//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); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie = (NGAP_PDUSessionResourceSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_GNB_UE_NGAP_ID; ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_RAN_UE_NGAP_ID;
ie->value.choice.GNB_UE_NGAP_ID = pdusession_setup_resp_p->gNB_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); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */ /* optional */
if (pdusession_setup_resp_p->nb_of_pdusessions > 0) { if (pdusession_setup_resp_p->nb_of_pdusessions > 0) {
ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie = (NGAP_PDUSessionResourceSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupListBearerSURes; ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSURes;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_PDUSESSIONSetupListBearerSURes; ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceSetupListSURes;
for (i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions; i++) { 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 */ /* mandatory */
item = (NGAP_PDUSESSIONSetupItemBearerSUResIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupItemBearerSUResIEs_t)); item = (NGAP_PDUSessionResourceSetupItemSURes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupItemSURes_t));
item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupItemBearerSURes;
item->criticality = NGAP_Criticality_ignore; /* pDUSessionID */
item->value.present = NGAP_PDUSESSIONSetupItemBearerSUResIEs__value_PR_PDUSESSIONSetupItemBearerSURes; item->pDUSessionID = pdusession_setup_resp_p->pdusessions[i].pdusession_id;
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); /* dLQosFlowPerTNLInformation */
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); pdusessionTransfer_p = (NGAP_PDUSessionResourceSetupResponseTransfer_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseTransfer_t));
memcpy(item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf,
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.buffer,
pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); pdusession_setup_resp_p->pdusessions[i].gNB_addr.length);
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length; pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length;
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.bits_unused = 0; pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.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, NGAP_DEBUG("pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n",
pdusession_setup_resp_p->pdusessions[i].gtp_teid, item->pDUSessionID,
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[0], pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.buf[0],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[1], pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.buf[1],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[2], pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.buf[2],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[3], pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.buf[3],
item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size); pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel.transportLayerAddress.size);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONSetupListBearerSURes.list, item);
/* 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); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
} }
/* optional */ /* optional */
if (pdusession_setup_resp_p->nb_of_pdusessions_failed > 0) { if (pdusession_setup_resp_p->nb_of_pdusessions_failed > 0) {
ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie = (NGAP_PDUSessionResourceFailedToSetupListSURes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceFailedToSetupListSURes_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONFailedToSetupListBearerSURes; ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceFailedToSetupListSURes;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_PDUSESSIONList; ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListSURes;
for (i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions_failed; i++) { for (i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions_failed; i++) {
NGAP_PDUSESSIONItemIEs_t *item; NGAP_PDUSessionResourceFailedToSetupItemSURes_t *item;
item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t)); NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t *pdusessionUnTransfer_p = NULL;
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;
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: 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; break;
case NGAP_Cause_PR_transport: 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; break;
case NGAP_Cause_PR_nas: 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; break;
case NGAP_Cause_PR_protocol: 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; break;
case NGAP_Cause_PR_misc: 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; break;
case NGAP_Cause_PR_NOTHING: case NGAP_Cause_PR_NOTHING:
...@@ -1084,8 +1122,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -1084,8 +1122,16 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
break; break;
} }
NGAP_DEBUG("pdusession_modify_resp: failed pdusession ID %ld\n", item->value.choice.PDUSESSIONItem.e_RAB_ID); NGAP_DEBUG("pdusession setup response: failed pdusession ID %ld\n", item->pDUSessionID);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item);
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); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
...@@ -1093,10 +1139,10 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -1093,10 +1139,10 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
/* optional */ /* optional */
if (0) { if (0) {
ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie = (NGAP_PDUSessionResourceSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_CriticalityDiagnostics; ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_CriticalityDiagnostics;
// ie->value.choice.CriticalityDiagnostics = ; // ie->value.choice.CriticalityDiagnostics = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
} }
...@@ -1128,7 +1174,6 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -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, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance,
ue_context_p->amf_ref->assoc_id, buffer, ue_context_p->amf_ref->assoc_id, buffer,
length, ue_context_p->tx_stream); length, ue_context_p->tx_stream);
#endif
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment