forked from acouzens/open5gs
continue to move new s1ap library
This commit is contained in:
parent
e10d358a2b
commit
d40bf0463d
|
@ -19,9 +19,9 @@ CORE_DECLARE(status_t) s1ap_build_setup_rsp(pkbuf_t **pkbuf);
|
|||
CORE_DECLARE(status_t) s1ap_build_setup_failure(
|
||||
pkbuf_t **pkbuf, S1AP_Cause_PR group, long cause, long time_to_wait);
|
||||
|
||||
#if 0
|
||||
CORE_DECLARE(status_t) s1ap_build_downlink_nas_transport(
|
||||
pkbuf_t **s1apbuf, enb_ue_t *enb_ue, pkbuf_t *emmbuf);
|
||||
#if 0
|
||||
CORE_DECLARE(status_t) s1ap_build_initial_context_setup_request(
|
||||
pkbuf_t **s1apbuf, mme_ue_t *mme_ue, pkbuf_t *emmbuf);
|
||||
CORE_DECLARE(status_t) s1ap_build_e_rab_setup_request(
|
||||
|
|
|
@ -184,38 +184,82 @@ status_t s1ap_build_setup_failure(
|
|||
status_t s1ap_build_downlink_nas_transport(
|
||||
pkbuf_t **s1apbuf, enb_ue_t *enb_ue, pkbuf_t *emmbuf)
|
||||
{
|
||||
#if 0
|
||||
int encoded;
|
||||
s1ap_message_t message;
|
||||
S1AP_DownlinkNASTransport_IEs_t *ies =
|
||||
&message.s1ap_DownlinkNASTransport_IEs;
|
||||
S1AP_NAS_PDU_t *nasPdu = &ies->nas_pdu;
|
||||
status_t rv;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_DownlinkNASTransport_t *DownlinkNASTransport = NULL;
|
||||
|
||||
S1AP_DownlinkNASTransport_IEs_t *ie = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_NAS_PDU_t *NAS_PDU = NULL;
|
||||
|
||||
d_assert(emmbuf, return CORE_ERROR, "Null param");
|
||||
d_assert(enb_ue, return CORE_ERROR, "Null param");
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
|
||||
d_trace(3, "[MME] Downlink NAS transport\n");
|
||||
d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
ies->mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id;
|
||||
ies->eNB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage =
|
||||
core_calloc(1, sizeof(S1AP_InitiatingMessage_t));
|
||||
|
||||
nasPdu->size = emmbuf->len;
|
||||
nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t));
|
||||
memcpy(nasPdu->buf, emmbuf->payload, nasPdu->size);
|
||||
initiatingMessage = pdu.choice.initiatingMessage;
|
||||
initiatingMessage->procedureCode =
|
||||
S1AP_ProcedureCode_id_downlinkNASTransport;
|
||||
initiatingMessage->criticality = S1AP_Criticality_ignore;
|
||||
initiatingMessage->value.present =
|
||||
S1AP_InitiatingMessage__value_PR_DownlinkNASTransport;
|
||||
|
||||
message.procedureCode = S1AP_ProcedureCode_id_downlinkNASTransport;
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
DownlinkNASTransport =
|
||||
&initiatingMessage->value.choice.DownlinkNASTransport;
|
||||
|
||||
encoded = s1ap_encode_pdu(s1apbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t));
|
||||
ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie);
|
||||
|
||||
d_assert(s1apbuf && encoded >= 0,return CORE_ERROR,);
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_DownlinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID;
|
||||
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t));
|
||||
ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_DownlinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID;
|
||||
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t));
|
||||
ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_DownlinkNASTransport_IEs__value_PR_NAS_PDU;
|
||||
|
||||
NAS_PDU = &ie->value.choice.NAS_PDU;
|
||||
|
||||
*MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id;
|
||||
*ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||
|
||||
NAS_PDU->size = emmbuf->len;
|
||||
NAS_PDU->buf = core_calloc(NAS_PDU->size, sizeof(c_uint8_t));
|
||||
memcpy(NAS_PDU->buf, emmbuf->payload, NAS_PDU->size);
|
||||
|
||||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
pkbuf_free(emmbuf);
|
||||
#endif
|
||||
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s1ap_encode_pdu() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -17,56 +17,84 @@
|
|||
#include "mme_path.h"
|
||||
#include "mme_sm.h"
|
||||
|
||||
#if 0
|
||||
void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
S1ap_S1SetupRequestIEs_t *ies = NULL;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_S1SetupRequest_t *S1SetupRequest = NULL;
|
||||
|
||||
S1AP_S1SetupRequestIEs_t *ie = NULL;
|
||||
S1AP_Global_ENB_ID_t *Global_ENB_ID = NULL;
|
||||
S1AP_SupportedTAs_t *SupportedTAs = NULL;
|
||||
S1AP_PagingDRX_t *PagingDRX = NULL;
|
||||
|
||||
pkbuf_t *s1apbuf = NULL;
|
||||
c_uint32_t enb_id;
|
||||
int i, j;
|
||||
S1ap_Cause_PR group = S1ap_Cause_PR_NOTHING;
|
||||
S1AP_Cause_PR group = S1AP_Cause_PR_NOTHING;
|
||||
long cause = 0;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
d_assert(enb->sock, return, "Null param");
|
||||
d_assert(message, return, "Null param");
|
||||
d_assert(enb, return,);
|
||||
d_assert(enb->sock, return,);
|
||||
|
||||
ies = &message->s1ap_S1SetupRequestIEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
d_assert(message, return,);
|
||||
initiatingMessage = message->choice.initiatingMessage;
|
||||
d_assert(initiatingMessage, return,);
|
||||
S1SetupRequest = &initiatingMessage->value.choice.S1SetupRequest;
|
||||
d_assert(S1SetupRequest, return,);
|
||||
|
||||
d_trace(3, "[MME] S1-Setup request\n");
|
||||
|
||||
s1ap_ENB_ID_to_uint32(&ies->global_ENB_ID.eNB_ID, &enb_id);
|
||||
for (i = 0; i < S1SetupRequest->protocolIEs.list.count; i++)
|
||||
{
|
||||
ie = S1SetupRequest->protocolIEs.list.array[i];
|
||||
switch(ie->id)
|
||||
{
|
||||
case S1AP_ProtocolIE_ID_id_Global_ENB_ID:
|
||||
Global_ENB_ID = &ie->value.choice.Global_ENB_ID;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_SupportedTAs:
|
||||
SupportedTAs = &ie->value.choice.SupportedTAs;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_DefaultPagingDRX:
|
||||
PagingDRX = &ie->value.choice.PagingDRX;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
s1ap_ENB_ID_to_uint32(&Global_ENB_ID->eNB_ID, &enb_id);
|
||||
d_trace(5, " IP[%s] ENB_ID[%d]\n", CORE_ADDR(enb->addr, buf), enb_id);
|
||||
|
||||
mme_enb_set_enb_id(enb, enb_id);
|
||||
|
||||
/* Parse Supported TA */
|
||||
enb->num_of_supported_ta_list = 0;
|
||||
for (i = 0; i < ies->supportedTAs.list.count; i++)
|
||||
for (i = 0; i < SupportedTAs->list.count; i++)
|
||||
{
|
||||
S1ap_SupportedTAs_Item_t *tai = NULL;
|
||||
S1ap_TAC_t *tAC;
|
||||
S1AP_SupportedTAs_Item_t *SupportedTAs_Item = NULL;
|
||||
S1AP_TAC_t *TAC = NULL;
|
||||
|
||||
tai = (S1ap_SupportedTAs_Item_t *)ies->supportedTAs.list.array[i];
|
||||
tAC = &tai->tAC;
|
||||
SupportedTAs_Item =
|
||||
(S1AP_SupportedTAs_Item_t *)SupportedTAs->list.array[i];
|
||||
TAC = &SupportedTAs_Item->tAC;
|
||||
|
||||
for (j = 0; j < tai->broadcastPLMNs.list.count; j++)
|
||||
for (j = 0; j < SupportedTAs_Item->broadcastPLMNs.list.count; j++)
|
||||
{
|
||||
S1ap_PLMNidentity_t *pLMNidentity = NULL;
|
||||
pLMNidentity =
|
||||
(S1ap_PLMNidentity_t *)tai->broadcastPLMNs.list.array[j];
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
PLMNidentity = (S1AP_PLMNidentity_t *)
|
||||
SupportedTAs_Item->broadcastPLMNs.list.array[j];
|
||||
|
||||
memcpy(&enb->supported_ta_list[enb->num_of_supported_ta_list].tac,
|
||||
tAC->buf, sizeof(c_uint16_t));
|
||||
TAC->buf, sizeof(c_uint16_t));
|
||||
enb->supported_ta_list[enb->num_of_supported_ta_list].tac =
|
||||
ntohs(enb->supported_ta_list
|
||||
[enb->num_of_supported_ta_list].tac);
|
||||
memcpy(&enb->supported_ta_list
|
||||
[enb->num_of_supported_ta_list].plmn_id,
|
||||
pLMNidentity->buf, sizeof(plmn_id_t));
|
||||
PLMNidentity->buf, sizeof(plmn_id_t));
|
||||
d_trace(5, " PLMN_ID[MCC:%d MNC:%d] TAC[%d]\n",
|
||||
plmn_id_mcc(&enb->supported_ta_list
|
||||
[enb->num_of_supported_ta_list].plmn_id),
|
||||
|
@ -81,8 +109,8 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
{
|
||||
d_warn("S1-Setup failure:");
|
||||
d_warn(" No supported TA exist in S1-Setup request");
|
||||
group = S1ap_Cause_PR_misc;
|
||||
cause = S1ap_CauseMisc_unspecified;
|
||||
group = S1AP_Cause_PR_misc;
|
||||
cause = S1AP_CauseMisc_unspecified;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -103,12 +131,12 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
{
|
||||
d_warn("S1-Setup failure:");
|
||||
d_warn(" Cannot find Served TAI. Check 'mme.tai' configuration");
|
||||
group = S1ap_Cause_PR_misc;
|
||||
cause = S1ap_CauseMisc_unknown_PLMN;
|
||||
group = S1AP_Cause_PR_misc;
|
||||
cause = S1AP_CauseMisc_unknown_PLMN;
|
||||
}
|
||||
}
|
||||
|
||||
if (group == S1ap_Cause_PR_NOTHING)
|
||||
if (group == S1AP_Cause_PR_NOTHING)
|
||||
{
|
||||
d_trace(3, "[MME] S1-Setup response\n");
|
||||
d_assert(s1ap_build_setup_rsp(&s1apbuf) == CORE_OK,
|
||||
|
@ -118,7 +146,7 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
{
|
||||
d_trace(3, "[MME] S1-Setup failure\n");
|
||||
d_assert(s1ap_build_setup_failure(
|
||||
&s1apbuf, group, cause, S1ap_TimeToWait_v10s) == CORE_OK,
|
||||
&s1apbuf, group, cause, S1AP_TimeToWait_v10s) == CORE_OK,
|
||||
return, "s1ap_build_setup_failure() failed");
|
||||
}
|
||||
|
||||
|
@ -126,18 +154,19 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
"s1ap_send_to_enb() failed");
|
||||
}
|
||||
|
||||
#if 0
|
||||
void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
status_t rv;
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_InitialUEMessage_IEs_t *ies = NULL;
|
||||
S1ap_TAI_t *tai = NULL;
|
||||
S1ap_PLMNidentity_t *pLMNidentity = NULL;
|
||||
S1ap_TAC_t *tAC = NULL;
|
||||
S1ap_EUTRAN_CGI_t *eutran_cgi = NULL;
|
||||
S1ap_CellIdentity_t *cell_ID = NULL;
|
||||
S1AP_InitialUEMessage_IEs_t *ies = NULL;
|
||||
S1AP_TAI_t *tai = NULL;
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
S1AP_TAC_t *tAC = NULL;
|
||||
S1AP_EUTRAN_CGI_t *eutran_cgi = NULL;
|
||||
S1AP_CellIdentity_t *cell_ID = NULL;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
d_assert(enb->sock, return, "Null param");
|
||||
|
@ -160,7 +189,7 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message)
|
|||
/* Find MME_UE if s_tmsi included */
|
||||
if (ies->presenceMask & S1AP_INITIALUEMESSAGE_IES_S_TMSI_PRESENT)
|
||||
{
|
||||
S1ap_S_TMSI_t *s_tmsi = &ies->s_tmsi;
|
||||
S1AP_S_TMSI_t *s_tmsi = &ies->s_tmsi;
|
||||
served_gummei_t *served_gummei = &mme_self()->served_gummei[0];
|
||||
guti_t guti;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
@ -231,23 +260,23 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message)
|
|||
|
||||
tai = &ies->tai;
|
||||
d_assert(tai, return,);
|
||||
pLMNidentity = &tai->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &tai->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
tAC = &tai->tAC;
|
||||
d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,);
|
||||
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, PLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.tai.plmn_id));
|
||||
memcpy(&enb_ue->nas.tai.tac, tAC->buf, sizeof(enb_ue->nas.tai.tac));
|
||||
enb_ue->nas.tai.tac = ntohs(enb_ue->nas.tai.tac);
|
||||
|
||||
eutran_cgi = &ies->eutran_cgi;
|
||||
d_assert(eutran_cgi, return,);
|
||||
pLMNidentity = &eutran_cgi->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &eutran_cgi->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
cell_ID = &eutran_cgi->cell_ID;
|
||||
d_assert(cell_ID, return,);
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, PLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.plmn_id));
|
||||
memcpy(&enb_ue->nas.e_cgi.cell_id, cell_ID->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.cell_id));
|
||||
|
@ -257,7 +286,7 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message)
|
|||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id, enb_ue->nas.tai.tac);
|
||||
|
||||
d_assert(s1ap_send_to_nas(enb_ue,
|
||||
S1ap_ProcedureCode_id_initialUEMessage, &ies->nas_pdu) == CORE_OK,,
|
||||
S1AP_ProcedureCode_id_initialUEMessage, &ies->nas_pdu) == CORE_OK,,
|
||||
"s1ap_send_to_nas failed");
|
||||
}
|
||||
|
||||
|
@ -267,7 +296,7 @@ void s1ap_handle_uplink_nas_transport(
|
|||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_UplinkNASTransport_IEs_t *ies = NULL;
|
||||
S1AP_UplinkNASTransport_IEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_UplinkNASTransport_IEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
@ -284,7 +313,7 @@ void s1ap_handle_uplink_nas_transport(
|
|||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
d_assert(s1ap_send_to_nas(enb_ue,
|
||||
S1ap_ProcedureCode_id_uplinkNASTransport, &ies->nas_pdu) == CORE_OK,,
|
||||
S1AP_ProcedureCode_id_uplinkNASTransport, &ies->nas_pdu) == CORE_OK,,
|
||||
"s1ap_send_to_nas failed");
|
||||
}
|
||||
|
||||
|
@ -294,7 +323,7 @@ void s1ap_handle_ue_capability_info_indication(
|
|||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_UECapabilityInfoIndicationIEs_t *ies = NULL;
|
||||
S1AP_UECapabilityInfoIndicationIEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_UECapabilityInfoIndicationIEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
@ -311,8 +340,8 @@ void s1ap_handle_ue_capability_info_indication(
|
|||
|
||||
if (enb_ue->mme_ue)
|
||||
{
|
||||
S1ap_UERadioCapability_t *ue_radio_capa = NULL;
|
||||
S1ap_UERadioCapability_t *radio_capa = NULL;
|
||||
S1AP_UERadioCapability_t *ue_radio_capa = NULL;
|
||||
S1AP_UERadioCapability_t *radio_capa = NULL;
|
||||
mme_ue_t *mme_ue = enb_ue->mme_ue;
|
||||
|
||||
ue_radio_capa = &ies->ueRadioCapability;
|
||||
|
@ -320,15 +349,15 @@ void s1ap_handle_ue_capability_info_indication(
|
|||
/* Release the previous one */
|
||||
if (mme_ue->radio_capa)
|
||||
{
|
||||
radio_capa = (S1ap_UERadioCapability_t *)mme_ue->radio_capa;
|
||||
radio_capa = (S1AP_UERadioCapability_t *)mme_ue->radio_capa;
|
||||
|
||||
if (radio_capa->buf)
|
||||
CORE_FREE(radio_capa->buf);
|
||||
CORE_FREE(mme_ue->radio_capa);
|
||||
}
|
||||
/* Save UE radio capability */
|
||||
mme_ue->radio_capa = core_calloc(1, sizeof(S1ap_UERadioCapability_t));
|
||||
radio_capa = (S1ap_UERadioCapability_t *)mme_ue->radio_capa;
|
||||
mme_ue->radio_capa = core_calloc(1, sizeof(S1AP_UERadioCapability_t));
|
||||
radio_capa = (S1AP_UERadioCapability_t *)mme_ue->radio_capa;
|
||||
d_assert(radio_capa,return,"core_calloc Error");
|
||||
|
||||
radio_capa->size = ue_radio_capa->size;
|
||||
|
@ -349,7 +378,7 @@ void s1ap_handle_initial_context_setup_response(
|
|||
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_InitialContextSetupResponseIEs_t *ies = NULL;
|
||||
S1AP_InitialContextSetupResponseIEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_InitialContextSetupResponseIEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
@ -371,9 +400,9 @@ void s1ap_handle_initial_context_setup_response(
|
|||
{
|
||||
mme_sess_t *sess = NULL;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
S1ap_E_RABSetupItemCtxtSURes_t *e_rab = NULL;
|
||||
S1AP_E_RABSetupItemCtxtSURes_t *e_rab = NULL;
|
||||
|
||||
e_rab = (S1ap_E_RABSetupItemCtxtSURes_t *)
|
||||
e_rab = (S1AP_E_RABSetupItemCtxtSURes_t *)
|
||||
ies->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes.array[i];
|
||||
d_assert(e_rab, return, "Null param");
|
||||
|
||||
|
@ -414,7 +443,7 @@ void s1ap_handle_initial_context_setup_failure(
|
|||
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_InitialContextSetupFailureIEs_t *ies = NULL;
|
||||
S1AP_InitialContextSetupFailureIEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_InitialContextSetupFailureIEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
@ -460,11 +489,11 @@ void s1ap_handle_initial_context_setup_failure(
|
|||
|
||||
d_trace(5, " Explicit Release\n");
|
||||
rv = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1ap_Cause_PR_nas,
|
||||
S1AP_Cause_PR_nas,
|
||||
#if 1 /* NAS Cause: Normal Relase */
|
||||
S1ap_CauseNas_normal_release,
|
||||
S1AP_CauseNas_normal_release,
|
||||
#else /* NAS Cause : Detach */
|
||||
S1ap_CauseNas_detach,
|
||||
S1AP_CauseNas_detach,
|
||||
#endif
|
||||
S1AP_UE_CTX_REL_UNLINK_MME_UE_CONTEXT, 0);
|
||||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
|
@ -500,7 +529,7 @@ void s1ap_handle_e_rab_setup_response(
|
|||
int i;
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
S1ap_E_RABSetupResponseIEs_t *ies = NULL;
|
||||
S1AP_E_RABSetupResponseIEs_t *ies = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
|
@ -525,9 +554,9 @@ void s1ap_handle_e_rab_setup_response(
|
|||
s1ap_E_RABSetupItemBearerSURes.count; i++)
|
||||
{
|
||||
mme_bearer_t *bearer = NULL;
|
||||
S1ap_E_RABSetupItemBearerSURes_t *e_rab = NULL;
|
||||
S1AP_E_RABSetupItemBearerSURes_t *e_rab = NULL;
|
||||
|
||||
e_rab = (S1ap_E_RABSetupItemBearerSURes_t *)ies->
|
||||
e_rab = (S1AP_E_RABSetupItemBearerSURes_t *)ies->
|
||||
e_RABSetupListBearerSURes.s1ap_E_RABSetupItemBearerSURes.array[i];
|
||||
d_assert(e_rab, return, "Null param");
|
||||
|
||||
|
@ -574,7 +603,7 @@ void s1ap_handle_ue_context_release_request(
|
|||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
S1ap_UEContextReleaseRequest_IEs_t *ies = NULL;
|
||||
S1AP_UEContextReleaseRequest_IEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
d_assert(message, return,);
|
||||
|
@ -596,8 +625,8 @@ void s1ap_handle_ue_context_release_request(
|
|||
S1AP_ERRORINDICATIONIES_CAUSE_PRESENT,
|
||||
ies->eNB_UE_S1AP_ID,
|
||||
ies->mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR_radioNetwork,
|
||||
S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
S1AP_Cause_PR_radioNetwork,
|
||||
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
d_assert(rv == CORE_OK, return, "s1ap send error");
|
||||
return;
|
||||
}
|
||||
|
@ -609,12 +638,12 @@ void s1ap_handle_ue_context_release_request(
|
|||
|
||||
switch(ies->cause.present)
|
||||
{
|
||||
case S1ap_Cause_PR_radioNetwork:
|
||||
case S1ap_Cause_PR_transport:
|
||||
case S1ap_Cause_PR_protocol:
|
||||
case S1ap_Cause_PR_misc:
|
||||
case S1AP_Cause_PR_radioNetwork:
|
||||
case S1AP_Cause_PR_transport:
|
||||
case S1AP_Cause_PR_protocol:
|
||||
case S1AP_Cause_PR_misc:
|
||||
break;
|
||||
case S1ap_Cause_PR_nas:
|
||||
case S1AP_Cause_PR_nas:
|
||||
d_warn("NAS-Cause[%d]", ies->cause.choice.nas);
|
||||
default:
|
||||
d_warn("Invalid cause group[%d]", ies->cause.present);
|
||||
|
@ -644,7 +673,7 @@ void s1ap_handle_ue_context_release_request(
|
|||
{
|
||||
d_trace(5, " S1 Context Not Associated\n");
|
||||
rv = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1ap_Cause_PR_nas, S1ap_CauseNas_normal_release,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_NO_ACTION, 0);
|
||||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
}
|
||||
|
@ -658,7 +687,7 @@ void s1ap_handle_ue_context_release_complete(
|
|||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
S1ap_UEContextReleaseComplete_IEs_t *ies = NULL;
|
||||
S1AP_UEContextReleaseComplete_IEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_UEContextReleaseComplete_IEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
@ -793,15 +822,15 @@ void s1ap_handle_path_switch_request(
|
|||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
S1ap_PathSwitchRequestIEs_t *ies = NULL;
|
||||
S1ap_EUTRAN_CGI_t *eutran_cgi;
|
||||
S1ap_PLMNidentity_t *pLMNidentity = NULL;
|
||||
S1ap_CellIdentity_t *cell_ID = NULL;
|
||||
S1ap_TAI_t *tai;
|
||||
S1ap_TAC_t *tAC = NULL;
|
||||
S1ap_UESecurityCapabilities_t *ueSecurityCapabilities = NULL;
|
||||
S1ap_EncryptionAlgorithms_t *encryptionAlgorithms = NULL;
|
||||
S1ap_IntegrityProtectionAlgorithms_t *integrityProtectionAlgorithms = NULL;
|
||||
S1AP_PathSwitchRequestIEs_t *ies = NULL;
|
||||
S1AP_EUTRAN_CGI_t *eutran_cgi;
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
S1AP_CellIdentity_t *cell_ID = NULL;
|
||||
S1AP_TAI_t *tai;
|
||||
S1AP_TAC_t *tAC = NULL;
|
||||
S1AP_UESecurityCapabilities_t *ueSecurityCapabilities = NULL;
|
||||
S1AP_EncryptionAlgorithms_t *encryptionAlgorithms = NULL;
|
||||
S1AP_IntegrityProtectionAlgorithms_t *integrityProtectionAlgorithms = NULL;
|
||||
c_uint16_t eea = 0, eia = 0;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
|
@ -815,15 +844,15 @@ void s1ap_handle_path_switch_request(
|
|||
|
||||
eutran_cgi = &ies->eutran_cgi;
|
||||
d_assert(eutran_cgi, return,);
|
||||
pLMNidentity = &eutran_cgi->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &eutran_cgi->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
cell_ID = &eutran_cgi->cell_ID;
|
||||
d_assert(cell_ID, return,);
|
||||
|
||||
tai = &ies->tai;
|
||||
d_assert(tai, return,);
|
||||
pLMNidentity = &tai->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &tai->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
tAC = &tai->tAC;
|
||||
d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,);
|
||||
|
||||
|
@ -843,8 +872,8 @@ void s1ap_handle_path_switch_request(
|
|||
|
||||
s1ap_send_path_switch_failure(enb, ies->eNB_UE_S1AP_ID,
|
||||
ies->sourceMME_UE_S1AP_ID,
|
||||
S1ap_Cause_PR_radioNetwork,
|
||||
S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
S1AP_Cause_PR_radioNetwork,
|
||||
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -863,18 +892,18 @@ void s1ap_handle_path_switch_request(
|
|||
{
|
||||
s1ap_send_path_switch_failure(enb, ies->eNB_UE_S1AP_ID,
|
||||
ies->sourceMME_UE_S1AP_ID,
|
||||
S1ap_Cause_PR_nas, S1ap_CauseNas_authentication_failure);
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure);
|
||||
return;
|
||||
}
|
||||
|
||||
enb_ue->enb_ue_s1ap_id = ies->eNB_UE_S1AP_ID;
|
||||
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, PLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.tai.plmn_id));
|
||||
memcpy(&enb_ue->nas.tai.tac, tAC->buf, sizeof(enb_ue->nas.tai.tac));
|
||||
enb_ue->nas.tai.tac = ntohs(enb_ue->nas.tai.tac);
|
||||
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, PLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.plmn_id));
|
||||
memcpy(&enb_ue->nas.e_cgi.cell_id, cell_ID->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.cell_id));
|
||||
|
@ -909,9 +938,9 @@ void s1ap_handle_path_switch_request(
|
|||
status_t rv;
|
||||
|
||||
mme_bearer_t *bearer = NULL;
|
||||
S1ap_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
|
||||
e_rab = (S1ap_E_RABToBeSwitchedDLItem_t *)ies->e_RABToBeSwitchedDLList.
|
||||
e_rab = (S1AP_E_RABToBeSwitchedDLItem_t *)ies->e_RABToBeSwitchedDLList.
|
||||
s1ap_E_RABToBeSwitchedDLItem.array[i];
|
||||
d_assert(e_rab, return, "Null param");
|
||||
|
||||
|
@ -944,7 +973,7 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message)
|
|||
enb_ue_t *source_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
S1ap_HandoverRequiredIEs_t *ies = NULL;
|
||||
S1AP_HandoverRequiredIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -999,7 +1028,7 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message)
|
|||
enb_ue_t *target_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
S1ap_HandoverRequestAcknowledgeIEs_t *ies = NULL;
|
||||
S1AP_HandoverRequestAcknowledgeIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -1031,9 +1060,9 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message)
|
|||
for (i = 0; i < ies->e_RABAdmittedList.s1ap_E_RABAdmittedItem.count; i++)
|
||||
{
|
||||
mme_bearer_t *bearer = NULL;
|
||||
S1ap_E_RABAdmittedItem_t *e_rab = NULL;
|
||||
S1AP_E_RABAdmittedItem_t *e_rab = NULL;
|
||||
|
||||
e_rab = (S1ap_E_RABAdmittedItem_t *)ies->e_RABAdmittedList.
|
||||
e_rab = (S1AP_E_RABAdmittedItem_t *)ies->e_RABAdmittedList.
|
||||
s1ap_E_RABAdmittedItem.array[i];
|
||||
d_assert(e_rab, return, "Null param");
|
||||
|
||||
|
@ -1059,15 +1088,15 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message)
|
|||
d_assert(rv == CORE_OK, return,);
|
||||
}
|
||||
|
||||
if (e_rab->uL_S1ap_TransportLayerAddress && e_rab->uL_S1ap_GTP_TEID)
|
||||
if (e_rab->uL_S1AP_TransportLayerAddress && e_rab->uL_S1AP_GTP_TEID)
|
||||
{
|
||||
d_assert(e_rab->uL_S1ap_GTP_TEID->buf, return,);
|
||||
d_assert(e_rab->uL_S1ap_TransportLayerAddress->buf, return,);
|
||||
memcpy(&bearer->enb_ul_teid, e_rab->uL_S1ap_GTP_TEID->buf,
|
||||
d_assert(e_rab->uL_S1AP_GTP_TEID->buf, return,);
|
||||
d_assert(e_rab->uL_S1AP_TransportLayerAddress->buf, return,);
|
||||
memcpy(&bearer->enb_ul_teid, e_rab->uL_S1AP_GTP_TEID->buf,
|
||||
sizeof(bearer->enb_ul_teid));
|
||||
bearer->enb_ul_teid = ntohl(bearer->enb_ul_teid);
|
||||
rv = s1ap_BIT_STRING_to_ip(
|
||||
e_rab->uL_S1ap_TransportLayerAddress, &bearer->enb_ul_ip);
|
||||
e_rab->uL_S1AP_TransportLayerAddress, &bearer->enb_ul_ip);
|
||||
d_assert(rv == CORE_OK, return,);
|
||||
}
|
||||
}
|
||||
|
@ -1093,7 +1122,7 @@ void s1ap_handle_handover_failure(mme_enb_t *enb, s1ap_message_t *message)
|
|||
status_t rv;
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
S1ap_HandoverFailureIEs_t *ies = NULL;
|
||||
S1AP_HandoverFailureIEs_t *ies = NULL;
|
||||
enb_ue_t *target_ue = NULL;
|
||||
enb_ue_t *source_ue = NULL;
|
||||
|
||||
|
@ -1124,8 +1153,8 @@ void s1ap_handle_handover_failure(mme_enb_t *enb, s1ap_message_t *message)
|
|||
d_assert(rv == CORE_OK, return, "s1ap send error");
|
||||
|
||||
rv = s1ap_send_ue_context_release_command(
|
||||
target_ue, S1ap_Cause_PR_radioNetwork,
|
||||
S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system,
|
||||
target_ue, S1AP_Cause_PR_radioNetwork,
|
||||
S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system,
|
||||
S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 0);
|
||||
d_assert(rv == CORE_OK, return, "s1ap send error");
|
||||
}
|
||||
|
@ -1138,7 +1167,7 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, s1ap_message_t *message)
|
|||
enb_ue_t *source_ue = NULL;
|
||||
enb_ue_t *target_ue = NULL;
|
||||
|
||||
S1ap_HandoverCancelIEs_t *ies = NULL;
|
||||
S1AP_HandoverCancelIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -1170,8 +1199,8 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, s1ap_message_t *message)
|
|||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
|
||||
rv = s1ap_send_ue_context_release_command(
|
||||
target_ue, S1ap_Cause_PR_radioNetwork,
|
||||
S1ap_CauseRadioNetwork_handover_cancelled,
|
||||
target_ue, S1AP_Cause_PR_radioNetwork,
|
||||
S1AP_CauseRadioNetwork_handover_cancelled,
|
||||
S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 300);
|
||||
d_assert(rv == CORE_OK, return, "s1ap send error");
|
||||
|
||||
|
@ -1188,7 +1217,7 @@ void s1ap_handle_enb_status_transfer(mme_enb_t *enb, s1ap_message_t *message)
|
|||
|
||||
enb_ue_t *source_ue = NULL, *target_ue = NULL;
|
||||
|
||||
S1ap_ENBStatusTransferIEs_t *ies = NULL;
|
||||
S1AP_ENBStatusTransferIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -1226,7 +1255,7 @@ void s1ap_handle_enb_configuration_transfer(
|
|||
status_t rv;
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
S1ap_ENBConfigurationTransferIEs_t *ies = NULL;
|
||||
S1AP_ENBConfigurationTransferIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -1240,37 +1269,37 @@ void s1ap_handle_enb_configuration_transfer(
|
|||
if (ies->presenceMask &
|
||||
S1AP_ENBCONFIGURATIONTRANSFERIES_SONCONFIGURATIONTRANSFERECT_PRESENT)
|
||||
{
|
||||
S1ap_SONConfigurationTransfer_t *transfer =
|
||||
S1AP_SONConfigurationTransfer_t *transfer =
|
||||
&ies->sonConfigurationTransferECT;
|
||||
mme_enb_t *target_enb = NULL;
|
||||
c_uint32_t source_enb_id, target_enb_id;
|
||||
c_uint16_t source_tac, target_tac;
|
||||
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->sourceeNB_ID.global_S1ap_ENB_ID.eNB_ID,
|
||||
&transfer->sourceeNB_ID.global_S1AP_ENB_ID.eNB_ID,
|
||||
&source_enb_id);
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->targeteNB_ID.global_S1ap_ENB_ID.eNB_ID,
|
||||
&transfer->targeteNB_ID.global_S1AP_ENB_ID.eNB_ID,
|
||||
&target_enb_id);
|
||||
|
||||
memcpy(&source_tac, transfer->sourceeNB_ID.selected_S1ap_TAI.tAC.buf,
|
||||
memcpy(&source_tac, transfer->sourceeNB_ID.selected_S1AP_TAI.tAC.buf,
|
||||
sizeof(source_tac));
|
||||
source_tac = ntohs(source_tac);
|
||||
memcpy(&target_tac, transfer->targeteNB_ID.selected_S1ap_TAI.tAC.buf,
|
||||
memcpy(&target_tac, transfer->targeteNB_ID.selected_S1AP_TAI.tAC.buf,
|
||||
sizeof(target_tac));
|
||||
target_tac = ntohs(target_tac);
|
||||
|
||||
d_trace(5, " Source : ENB_ID[%s:%d], TAC[%d]\n",
|
||||
transfer->sourceeNB_ID.global_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->sourceeNB_ID.global_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
transfer->sourceeNB_ID.global_S1AP_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->sourceeNB_ID.global_S1AP_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
source_enb_id, source_tac);
|
||||
d_trace(5, " Target : ENB_ID[%s:%d], TAC[%d]\n",
|
||||
transfer->targeteNB_ID.global_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->targeteNB_ID.global_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
transfer->targeteNB_ID.global_S1AP_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->targeteNB_ID.global_S1AP_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
target_enb_id, target_tac);
|
||||
|
||||
target_enb = mme_enb_find_by_enb_id(target_enb_id);
|
||||
|
@ -1293,12 +1322,12 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message)
|
|||
mme_sess_t *sess = NULL;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
||||
S1ap_HandoverNotifyIEs_t *ies = NULL;
|
||||
S1ap_EUTRAN_CGI_t *eutran_cgi;
|
||||
S1ap_PLMNidentity_t *pLMNidentity = NULL;
|
||||
S1ap_CellIdentity_t *cell_ID = NULL;
|
||||
S1ap_TAI_t *tai;
|
||||
S1ap_TAC_t *tAC = NULL;
|
||||
S1AP_HandoverNotifyIEs_t *ies = NULL;
|
||||
S1AP_EUTRAN_CGI_t *eutran_cgi;
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
S1AP_CellIdentity_t *cell_ID = NULL;
|
||||
S1AP_TAI_t *tai;
|
||||
S1AP_TAC_t *tAC = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
|
@ -1311,15 +1340,15 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message)
|
|||
|
||||
eutran_cgi = &ies->eutran_cgi;
|
||||
d_assert(eutran_cgi, return,);
|
||||
pLMNidentity = &eutran_cgi->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &eutran_cgi->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
cell_ID = &eutran_cgi->cell_ID;
|
||||
d_assert(cell_ID, return,);
|
||||
|
||||
tai = &ies->tai;
|
||||
d_assert(tai, return,);
|
||||
pLMNidentity = &tai->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
PLMNidentity = &tai->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
tAC = &tai->tAC;
|
||||
d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,);
|
||||
|
||||
|
@ -1344,12 +1373,12 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message)
|
|||
|
||||
mme_ue_associate_enb_ue(mme_ue, target_ue);
|
||||
|
||||
memcpy(&target_ue->nas.tai.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&target_ue->nas.tai.plmn_id, PLMNidentity->buf,
|
||||
sizeof(target_ue->nas.tai.plmn_id));
|
||||
memcpy(&target_ue->nas.tai.tac, tAC->buf, sizeof(target_ue->nas.tai.tac));
|
||||
target_ue->nas.tai.tac = ntohs(target_ue->nas.tai.tac);
|
||||
|
||||
memcpy(&target_ue->nas.e_cgi.plmn_id, pLMNidentity->buf,
|
||||
memcpy(&target_ue->nas.e_cgi.plmn_id, PLMNidentity->buf,
|
||||
sizeof(target_ue->nas.e_cgi.plmn_id));
|
||||
memcpy(&target_ue->nas.e_cgi.cell_id, cell_ID->buf,
|
||||
sizeof(target_ue->nas.e_cgi.cell_id));
|
||||
|
|
|
@ -64,12 +64,12 @@ void s1ap_state_operational(fsm_t *s, event_t *e)
|
|||
|
||||
switch(initiatingMessage->procedureCode)
|
||||
{
|
||||
#if 0
|
||||
case S1AP_ProcedureCode_id_S1Setup :
|
||||
{
|
||||
s1ap_handle_s1_setup_request(enb, pdu);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case S1AP_ProcedureCode_id_initialUEMessage :
|
||||
{
|
||||
s1ap_handle_initial_ue_message(enb, pdu);
|
||||
|
|
|
@ -115,7 +115,6 @@ static void s1ap_message_test4(abts_case *tc, void *data)
|
|||
pkbuf_free(pkbuf);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void s1ap_message_test5(abts_case *tc, void *data)
|
||||
{
|
||||
s1ap_message_t message;
|
||||
|
@ -123,7 +122,7 @@ static void s1ap_message_test5(abts_case *tc, void *data)
|
|||
pkbuf_t *pkbuf;
|
||||
int result;
|
||||
|
||||
rv = tests1ap_build_setup_req(&pkbuf, S1ap_ENB_ID_PR_macroENB_ID, 0x54f64);
|
||||
rv = tests1ap_build_setup_req(&pkbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64);
|
||||
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
ABTS_PTR_NOTNULL(tc, pkbuf);
|
||||
|
@ -139,12 +138,11 @@ static void s1ap_message_test5(abts_case *tc, void *data)
|
|||
|
||||
static void s1ap_message_test6(abts_case *tc, void *data)
|
||||
{
|
||||
pkbuf_t *s1apbuf = NULL;
|
||||
status_t rv;
|
||||
pkbuf_t *s1apbuf = NULL, *emmbuf = NULL;
|
||||
enb_ue_t enb_ue;
|
||||
int i;
|
||||
s1ap_message_t message;
|
||||
S1ap_DownlinkNASTransport_IEs_t *ies =
|
||||
&message.s1ap_DownlinkNASTransport_IEs;
|
||||
S1ap_NAS_PDU_t *nasPdu = &ies->nas_pdu;
|
||||
char buffer[1024];
|
||||
char *_result =
|
||||
"000b4080 8c000003 00000002 00010008 00020001 001a0079 78efefef efefefef"
|
||||
|
@ -153,27 +151,18 @@ static void s1ap_message_test6(abts_case *tc, void *data)
|
|||
"efefefef efefefef efefefef efefefef efefefef efefefef efefefef efefefef"
|
||||
"efefefef efefefef efefefef efefefef ef";
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
enb_ue.mme_ue_s1ap_id = 1;
|
||||
enb_ue.enb_ue_s1ap_id = 1;
|
||||
|
||||
ies->mme_ue_s1ap_id = 1;
|
||||
ies->eNB_UE_S1AP_ID = 1;
|
||||
emmbuf = pkbuf_alloc(0, 120);
|
||||
for (i = 0; i < emmbuf->len; i++)
|
||||
((char *)emmbuf->payload)[i] = 0xef;
|
||||
|
||||
nasPdu->size = 120;
|
||||
nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t));
|
||||
for (i = 0; i < nasPdu->size; i++)
|
||||
nasPdu->buf[i] = 0xef;
|
||||
|
||||
message.procedureCode = S1ap_ProcedureCode_id_downlinkNASTransport;
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
|
||||
s1ap_encode_pdu(&s1apbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
rv = s1ap_build_downlink_nas_transport(&s1apbuf, &enb_ue, emmbuf);
|
||||
ABTS_TRUE(tc, memcmp(CORE_HEX(_result, strlen(_result), buffer),
|
||||
s1apbuf->payload, s1apbuf->len) == 0);
|
||||
|
||||
pkbuf_free(s1apbuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
abts_suite *test_s1ap_message(abts_suite *suite)
|
||||
{
|
||||
|
@ -183,10 +172,8 @@ abts_suite *test_s1ap_message(abts_suite *suite)
|
|||
abts_run_test(suite, s1ap_message_test2, NULL);
|
||||
abts_run_test(suite, s1ap_message_test3, NULL);
|
||||
abts_run_test(suite, s1ap_message_test4, NULL);
|
||||
#if 0
|
||||
abts_run_test(suite, s1ap_message_test5, NULL);
|
||||
abts_run_test(suite, s1ap_message_test6, NULL);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#define NUM_OF_TEST_DUPLICATED_ENB 4
|
||||
|
||||
#if 0
|
||||
static void s1setup_test1(abts_case *tc, void *data)
|
||||
{
|
||||
status_t rv;
|
||||
|
@ -101,16 +100,13 @@ static void s1setup_test2(abts_case *tc, void *data)
|
|||
|
||||
core_sleep(time_from_sec(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
abts_suite *test_s1setup(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
#if 0
|
||||
abts_run_test(suite, s1setup_test1, NULL);
|
||||
abts_run_test(suite, s1setup_test2, NULL);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -117,57 +117,93 @@ status_t tests1ap_enb_send(sock_id id, pkbuf_t *sendbuf)
|
|||
return s1ap_send(id, sendbuf, NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
status_t tests1ap_build_setup_req(
|
||||
pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, c_uint32_t enb_id)
|
||||
{
|
||||
int erval = -1;
|
||||
status_t rv;
|
||||
|
||||
int tac = 12345;
|
||||
plmn_id_t plmn_id;
|
||||
|
||||
s1ap_message_t message;
|
||||
S1AP_S1SetupRequestIEs_t *ies;
|
||||
S1AP_PLMNidentity_t *plmnIdentity;
|
||||
S1AP_SupportedTAs_Item_t *supportedTA;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_S1SetupRequest_t *S1SetupRequest = NULL;
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
S1AP_S1SetupRequestIEs_t *ie = NULL;
|
||||
S1AP_Global_ENB_ID_t *Global_ENB_ID = NULL;
|
||||
S1AP_SupportedTAs_t *SupportedTAs = NULL;
|
||||
S1AP_SupportedTAs_Item_t *SupportedTAs_Item = NULL;
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
S1AP_PagingDRX_t *PagingDRX = NULL;
|
||||
|
||||
ies = &message.s1ap_S1SetupRequestIEs;
|
||||
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage =
|
||||
core_calloc(1, sizeof(S1AP_InitiatingMessage_t));
|
||||
|
||||
initiatingMessage = pdu.choice.initiatingMessage;
|
||||
initiatingMessage->procedureCode = S1AP_ProcedureCode_id_S1Setup;
|
||||
initiatingMessage->criticality = S1AP_Criticality_reject;
|
||||
initiatingMessage->value.present =
|
||||
S1AP_InitiatingMessage__value_PR_S1SetupRequest;
|
||||
|
||||
S1SetupRequest = &initiatingMessage->value.choice.S1SetupRequest;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID;
|
||||
|
||||
Global_ENB_ID = &ie->value.choice.Global_ENB_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs;
|
||||
|
||||
SupportedTAs = &ie->value.choice.SupportedTAs;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX;
|
||||
|
||||
PagingDRX = &ie->value.choice.PagingDRX;
|
||||
|
||||
plmn_id_build(&plmn_id, 1, 1, 2);
|
||||
|
||||
s1ap_uint32_to_ENB_ID(present, enb_id, &ies->global_ENB_ID.eNB_ID);
|
||||
s1ap_uint32_to_ENB_ID(present, enb_id, &Global_ENB_ID->eNB_ID);
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&plmn_id, PLMN_ID_LEN, &ies->global_ENB_ID.pLMNidentity);
|
||||
&plmn_id, PLMN_ID_LEN, &Global_ENB_ID->pLMNidentity);
|
||||
|
||||
supportedTA = (S1AP_SupportedTAs_Item_t *)
|
||||
SupportedTAs_Item = (S1AP_SupportedTAs_Item_t *)
|
||||
core_calloc(1, sizeof(S1AP_SupportedTAs_Item_t));
|
||||
s1ap_uint16_to_OCTET_STRING(tac, &supportedTA->tAC);
|
||||
plmnIdentity = (S1AP_PLMNidentity_t *)
|
||||
s1ap_uint16_to_OCTET_STRING(tac, &SupportedTAs_Item->tAC);
|
||||
PLMNidentity = (S1AP_PLMNidentity_t *)
|
||||
core_calloc(1, sizeof(S1AP_PLMNidentity_t));
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&plmn_id, PLMN_ID_LEN, plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&supportedTA->broadcastPLMNs, plmnIdentity);
|
||||
&plmn_id, PLMN_ID_LEN, PLMNidentity);
|
||||
ASN_SEQUENCE_ADD(&SupportedTAs_Item->broadcastPLMNs.list, PLMNidentity);
|
||||
|
||||
ASN_SEQUENCE_ADD(&ies->supportedTAs, supportedTA);
|
||||
ASN_SEQUENCE_ADD(&SupportedTAs->list, SupportedTAs_Item);
|
||||
|
||||
ies->defaultPagingDRX = S1AP_PagingDRX_v64;
|
||||
rv = s1ap_encode_pdu(pkbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
message.procedureCode = S1AP_ProcedureCode_id_S1Setup;
|
||||
|
||||
erval = s1ap_encode_pdu(pkbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
|
||||
if (erval < 0)
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s1ap_encode_error : (%d)", erval);
|
||||
d_error("s1ap_encode_pdu() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TESTS1AP_MAX_MESSAGE 32
|
||||
|
||||
|
|
Loading…
Reference in New Issue