Move New Indentation with LINUX-style
This commit is contained in:
parent
aa0001c78b
commit
1f838c0f68
|
@ -1,11 +1,30 @@
|
|||
#ifndef __MME_FD_PATH_H__
|
||||
#define __MME_FD_PATH_H__
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MME_FD_PATH_H
|
||||
#define MME_FD_PATH_H
|
||||
|
||||
#include "mme-context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
int mme_fd_init(void);
|
||||
void mme_fd_final(void);
|
||||
|
@ -18,7 +37,7 @@ void mme_s6a_send_ulr(mme_ue_t *mme_ue);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __MME_FD_PATH_H__ */
|
||||
#endif /* MME_FD_PATH_H */
|
||||
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
#ifndef __MME_SM_H__
|
||||
#define __MME_SM_H__
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MME_SM_H
|
||||
#define MME_SM_H
|
||||
|
||||
#include "mme-event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
void mme_state_initial(ogs_fsm_t *s, mme_event_t *e);
|
||||
void mme_state_final(ogs_fsm_t *s, mme_event_t *e);
|
||||
|
@ -40,6 +59,6 @@ void esm_state_exception(ogs_fsm_t *s, mme_event_t *e);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* !__MME_SM_H__ */
|
||||
#endif /* MME_SM_H */
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
#include "fd/s6a/s6a-message.h"
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fd/s6a/s6a-message.h"
|
||||
#include "mme-context.h"
|
||||
|
||||
#include "mme-kdf.h"
|
||||
|
@ -50,15 +68,13 @@ int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf)
|
|||
|
||||
RelativeMMECapacity = &ie->value.choice.RelativeMMECapacity;
|
||||
|
||||
for (i = 0; i < mme_self()->max_num_of_served_gummei; i++)
|
||||
{
|
||||
for (i = 0; i < mme_self()->max_num_of_served_gummei; i++) {
|
||||
S1AP_ServedGUMMEIsItem_t *ServedGUMMEIsItem = NULL;
|
||||
ServedGUMMEIsItem = (S1AP_ServedGUMMEIsItem_t *)
|
||||
ogs_calloc(1, sizeof(S1AP_ServedGUMMEIsItem_t));
|
||||
|
||||
served_gummei_t *served_gummei = &mme_self()->served_gummei[i];
|
||||
for (j = 0; j < served_gummei->num_of_plmn_id; j++)
|
||||
{
|
||||
for (j = 0; j < served_gummei->num_of_plmn_id; j++) {
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
PLMNidentity = (S1AP_PLMNidentity_t *)
|
||||
ogs_calloc(1, sizeof(S1AP_PLMNidentity_t));
|
||||
|
@ -71,8 +87,7 @@ int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf)
|
|||
plmn_id_mnc(&served_gummei->plmn_id[j]));
|
||||
}
|
||||
|
||||
for (j = 0; j < served_gummei->num_of_mme_gid; j++)
|
||||
{
|
||||
for (j = 0; j < served_gummei->num_of_mme_gid; j++) {
|
||||
S1AP_MME_Group_ID_t *MME_Group_ID = NULL;
|
||||
MME_Group_ID = (S1AP_MME_Group_ID_t *)
|
||||
ogs_calloc(1, sizeof(S1AP_MME_Group_ID_t));
|
||||
|
@ -83,8 +98,7 @@ int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf)
|
|||
ogs_debug(" MME Group[%d]", served_gummei->mme_gid[j]);
|
||||
}
|
||||
|
||||
for (j = 0; j < served_gummei->num_of_mme_code; j++)
|
||||
{
|
||||
for (j = 0; j < served_gummei->num_of_mme_code; j++) {
|
||||
S1AP_MME_Code_t *MME_Code = NULL ;
|
||||
MME_Code = (S1AP_MME_Code_t *)
|
||||
ogs_calloc(1, sizeof(S1AP_MME_Code_t));
|
||||
|
@ -100,8 +114,7 @@ int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf)
|
|||
rv = s1ap_encode_pdu(pkbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -147,8 +160,7 @@ int s1ap_build_setup_failure(
|
|||
|
||||
Cause = &ie->value.choice.Cause;
|
||||
|
||||
if (time_to_wait > -1)
|
||||
{
|
||||
if (time_to_wait > -1) {
|
||||
ie = ogs_calloc(1, sizeof(S1AP_S1SetupFailureIEs_t));
|
||||
ASN_SEQUENCE_ADD(&S1SetupFailure->protocolIEs, ie);
|
||||
|
||||
|
@ -168,8 +180,7 @@ int s1ap_build_setup_failure(
|
|||
rv = s1ap_encode_pdu(pkbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -252,8 +263,7 @@ int s1ap_build_downlink_nas_transport(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -380,11 +390,9 @@ int s1ap_build_initial_context_setup_request(
|
|||
subscription_data->ambr.downlink);
|
||||
|
||||
sess = mme_sess_first(mme_ue);
|
||||
while(sess)
|
||||
{
|
||||
while (sess) {
|
||||
bearer = mme_bearer_first(sess);
|
||||
while(bearer)
|
||||
{
|
||||
while (bearer) {
|
||||
S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeSetupItemCtxtSUReq_t *e_rab = NULL;
|
||||
S1AP_GBR_QosInformation_t *gbrQosInformation = NULL;
|
||||
|
@ -416,8 +424,7 @@ int s1ap_build_initial_context_setup_request(
|
|||
!(bearer->qos.arp.pre_emption_vulnerability);
|
||||
|
||||
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink)
|
||||
{
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
|
||||
if (bearer->qos.mbr.downlink == 0)
|
||||
bearer->qos.mbr.downlink = MAX_BIT_RATE;
|
||||
if (bearer->qos.mbr.uplink == 0)
|
||||
|
@ -446,8 +453,7 @@ int s1ap_build_initial_context_setup_request(
|
|||
ogs_assert(rv == OGS_OK);
|
||||
s1ap_uint32_to_OCTET_STRING(bearer->sgw_s1u_teid, &e_rab->gTP_TEID);
|
||||
|
||||
if (emmbuf && emmbuf->len)
|
||||
{
|
||||
if (emmbuf && emmbuf->len) {
|
||||
nasPdu = (S1AP_NAS_PDU_t *)ogs_calloc(
|
||||
1, sizeof(S1AP_NAS_PDU_t));
|
||||
nasPdu->size = emmbuf->len;
|
||||
|
@ -485,8 +491,7 @@ int s1ap_build_initial_context_setup_request(
|
|||
memcpy(SecurityKey->buf, mme_ue->kenb, SecurityKey->size);
|
||||
|
||||
/* Set UeRadioCapability if exists */
|
||||
if (mme_ue->ueRadioCapability.buf && mme_ue->ueRadioCapability.size)
|
||||
{
|
||||
if (mme_ue->ueRadioCapability.buf && mme_ue->ueRadioCapability.size) {
|
||||
S1AP_UERadioCapability_t *UERadioCapability = NULL;
|
||||
|
||||
ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t));
|
||||
|
@ -508,8 +513,7 @@ int s1ap_build_initial_context_setup_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -617,8 +621,7 @@ int s1ap_build_e_rab_setup_request(
|
|||
pre_emptionVulnerability = !(bearer->qos.arp.pre_emption_vulnerability);
|
||||
|
||||
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink)
|
||||
{
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
|
||||
if (bearer->qos.mbr.downlink == 0)
|
||||
bearer->qos.mbr.downlink = MAX_BIT_RATE;
|
||||
if (bearer->qos.mbr.uplink == 0)
|
||||
|
@ -655,8 +658,7 @@ int s1ap_build_e_rab_setup_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -766,8 +768,7 @@ int s1ap_build_e_rab_modify_request(
|
|||
pre_emptionVulnerability = !(bearer->qos.arp.pre_emption_vulnerability);
|
||||
|
||||
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink)
|
||||
{
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
|
||||
if (bearer->qos.mbr.downlink == 0)
|
||||
bearer->qos.mbr.downlink = MAX_BIT_RATE;
|
||||
if (bearer->qos.mbr.uplink == 0)
|
||||
|
@ -799,8 +800,7 @@ int s1ap_build_e_rab_modify_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -940,8 +940,7 @@ int s1ap_build_e_rab_release_command(ogs_pkbuf_t **s1apbuf,
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -964,8 +963,7 @@ int s1ap_build_ue_context_release_command(
|
|||
|
||||
ogs_assert(enb_ue);
|
||||
|
||||
if (enb_ue->mme_ue_s1ap_id == 0)
|
||||
{
|
||||
if (enb_ue->mme_ue_s1ap_id == 0) {
|
||||
ogs_error("invalid mme ue s1ap id");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1002,13 +1000,10 @@ int s1ap_build_ue_context_release_command(
|
|||
|
||||
Cause = &ie->value.choice.Cause;
|
||||
|
||||
if (enb_ue->enb_ue_s1ap_id == INVALID_UE_S1AP_ID)
|
||||
{
|
||||
if (enb_ue->enb_ue_s1ap_id == INVALID_UE_S1AP_ID) {
|
||||
UE_S1AP_IDs->present = S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID;
|
||||
UE_S1AP_IDs->choice.mME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
UE_S1AP_IDs->present = S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair;
|
||||
UE_S1AP_IDs->choice.uE_S1AP_ID_pair =
|
||||
ogs_calloc(1, sizeof(S1AP_UE_S1AP_ID_pair_t));
|
||||
|
@ -1024,8 +1019,7 @@ int s1ap_build_ue_context_release_command(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1113,8 +1107,7 @@ int s1ap_build_paging(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
ogs_calloc(UEIdentityIndexValue->size, sizeof(uint8_t));
|
||||
|
||||
/* Conver string to value */
|
||||
for (i = 0; i < strlen(mme_ue->imsi_bcd); i++)
|
||||
{
|
||||
for (i = 0; i < strlen(mme_ue->imsi_bcd); i++) {
|
||||
ue_imsi_value = ue_imsi_value*10 + (mme_ue->imsi_bcd[i] - '0');
|
||||
}
|
||||
|
||||
|
@ -1155,8 +1148,7 @@ int s1ap_build_paging(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1214,8 +1206,7 @@ int s1ap_build_mme_configuration_transfer(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1306,8 +1297,7 @@ int s1ap_build_path_switch_ack(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1388,8 +1378,7 @@ int s1ap_build_path_switch_failure(ogs_pkbuf_t **s1apbuf,
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1472,20 +1461,16 @@ int s1ap_build_handover_command(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue)
|
|||
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
||||
|
||||
sess = mme_sess_first(mme_ue);
|
||||
while(sess)
|
||||
{
|
||||
while (sess) {
|
||||
bearer = mme_bearer_first(sess);
|
||||
while(bearer)
|
||||
{
|
||||
while (bearer) {
|
||||
S1AP_E_RABDataForwardingItem_t *e_rab = NULL;
|
||||
|
||||
if (MME_HAVE_SGW_DL_INDIRECT_TUNNEL(bearer) ||
|
||||
MME_HAVE_SGW_UL_INDIRECT_TUNNEL(bearer))
|
||||
{
|
||||
MME_HAVE_SGW_UL_INDIRECT_TUNNEL(bearer)) {
|
||||
S1AP_E_RABDataForwardingItemIEs_t *item = NULL;
|
||||
|
||||
if (E_RABSubjecttoDataForwardingList == NULL)
|
||||
{
|
||||
if (E_RABSubjecttoDataForwardingList == NULL) {
|
||||
ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t));
|
||||
ogs_assert(ie);
|
||||
ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie);
|
||||
|
@ -1516,8 +1501,7 @@ int s1ap_build_handover_command(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue)
|
|||
e_rab->e_RAB_ID = bearer->ebi;
|
||||
}
|
||||
|
||||
if (MME_HAVE_SGW_DL_INDIRECT_TUNNEL(bearer))
|
||||
{
|
||||
if (MME_HAVE_SGW_DL_INDIRECT_TUNNEL(bearer)) {
|
||||
ogs_assert(e_rab);
|
||||
e_rab->dL_transportLayerAddress =
|
||||
(S1AP_TransportLayerAddress_t *)
|
||||
|
@ -1533,8 +1517,7 @@ int s1ap_build_handover_command(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue)
|
|||
ogs_debug(" SGW-DL-TEID[%d]", bearer->sgw_dl_teid);
|
||||
}
|
||||
|
||||
if (MME_HAVE_SGW_UL_INDIRECT_TUNNEL(bearer))
|
||||
{
|
||||
if (MME_HAVE_SGW_UL_INDIRECT_TUNNEL(bearer)) {
|
||||
ogs_assert(e_rab);
|
||||
e_rab->uL_TransportLayerAddress =
|
||||
(S1AP_TransportLayerAddress_t *)
|
||||
|
@ -1572,8 +1555,7 @@ int s1ap_build_handover_command(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue)
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1658,8 +1640,7 @@ int s1ap_build_handover_preparation_failure(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1813,11 +1794,9 @@ int s1ap_build_handover_request(
|
|||
subscription_data->ambr.downlink);
|
||||
|
||||
sess = mme_sess_first(mme_ue);
|
||||
while(sess)
|
||||
{
|
||||
while (sess) {
|
||||
bearer = mme_bearer_first(sess);
|
||||
while(bearer)
|
||||
{
|
||||
while (bearer) {
|
||||
S1AP_E_RABToBeSetupItemHOReqIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeSetupItemHOReq_t *e_rab = NULL;
|
||||
S1AP_GBR_QosInformation_t *gbrQosInformation = NULL;
|
||||
|
@ -1845,8 +1824,7 @@ int s1ap_build_handover_request(
|
|||
!(bearer->qos.arp.pre_emption_vulnerability);
|
||||
|
||||
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink)
|
||||
{
|
||||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
|
||||
if (bearer->qos.mbr.downlink == 0)
|
||||
bearer->qos.mbr.downlink = MAX_BIT_RATE;
|
||||
if (bearer->qos.mbr.uplink == 0)
|
||||
|
@ -1914,8 +1892,7 @@ int s1ap_build_handover_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -1982,8 +1959,7 @@ int s1ap_build_handover_cancel_ack(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue)
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2070,8 +2046,7 @@ int s1ap_build_mme_status_transfer(ogs_pkbuf_t **s1apbuf,
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2111,8 +2086,7 @@ int s1ap_build_error_indication(
|
|||
|
||||
ErrorIndication = &initiatingMessage->value.choice.ErrorIndication;
|
||||
|
||||
if (mme_ue_s1ap_id)
|
||||
{
|
||||
if (mme_ue_s1ap_id) {
|
||||
ie = ogs_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t));
|
||||
ASN_SEQUENCE_ADD(&ErrorIndication->protocolIEs, ie);
|
||||
|
||||
|
@ -2126,8 +2100,7 @@ int s1ap_build_error_indication(
|
|||
ogs_debug(" MME_UE_S1AP_ID[%d]", (int)*mme_ue_s1ap_id);
|
||||
}
|
||||
|
||||
if (enb_ue_s1ap_id)
|
||||
{
|
||||
if (enb_ue_s1ap_id) {
|
||||
ie = ogs_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t));
|
||||
ASN_SEQUENCE_ADD(&ErrorIndication->protocolIEs, ie);
|
||||
|
||||
|
@ -2159,8 +2132,7 @@ int s1ap_build_error_indication(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2222,13 +2194,10 @@ int s1ap_build_s1_reset(
|
|||
ogs_debug(" Group[%d] Cause[%d] partOfS1_Interface[%p]",
|
||||
Cause->present, (int)Cause->choice.radioNetwork, partOfS1_Interface);
|
||||
|
||||
if (partOfS1_Interface)
|
||||
{
|
||||
if (partOfS1_Interface) {
|
||||
ResetType->present = S1AP_ResetType_PR_partOfS1_Interface;
|
||||
ResetType->choice.partOfS1_Interface = partOfS1_Interface;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ResetType->present = S1AP_ResetType_PR_s1_Interface;
|
||||
ResetType->choice.s1_Interface = S1AP_ResetAll_reset_all;
|
||||
}
|
||||
|
@ -2236,8 +2205,7 @@ int s1ap_build_s1_reset(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2301,8 +2269,7 @@ int s1ap_build_s1_reset_ack(
|
|||
|
||||
ResetAcknowledge = &successfulOutcome->value.choice.ResetAcknowledge;
|
||||
|
||||
if (partOfS1_Interface && partOfS1_Interface->list.count)
|
||||
{
|
||||
if (partOfS1_Interface && partOfS1_Interface->list.count) {
|
||||
int i = 0;
|
||||
S1AP_UE_associatedLogicalS1_ConnectionListResAck_t *list = NULL;
|
||||
|
||||
|
@ -2316,8 +2283,7 @@ int s1ap_build_s1_reset_ack(
|
|||
|
||||
list = &ie->value.choice.UE_associatedLogicalS1_ConnectionListResAck;
|
||||
|
||||
for (i = 0; i < partOfS1_Interface->list.count; i++)
|
||||
{
|
||||
for (i = 0; i < partOfS1_Interface->list.count; i++) {
|
||||
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie1 = NULL;
|
||||
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item1 = NULL;
|
||||
|
||||
|
@ -2331,8 +2297,8 @@ int s1ap_build_s1_reset_ack(
|
|||
item1 = &ie1->value.choice.UE_associatedLogicalS1_ConnectionItem;
|
||||
ogs_assert(item1);
|
||||
|
||||
if (item1->mME_UE_S1AP_ID == NULL && item1->eNB_UE_S1AP_ID == NULL)
|
||||
{
|
||||
if (item1->mME_UE_S1AP_ID == NULL &&
|
||||
item1->eNB_UE_S1AP_ID == NULL) {
|
||||
ogs_warn("No MME_UE_S1AP_ID & ENB_UE_S1AP_ID");
|
||||
continue;
|
||||
}
|
||||
|
@ -2350,16 +2316,14 @@ int s1ap_build_s1_reset_ack(
|
|||
item2 = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem;
|
||||
ogs_assert(item2);
|
||||
|
||||
if (item1->mME_UE_S1AP_ID)
|
||||
{
|
||||
if (item1->mME_UE_S1AP_ID) {
|
||||
item2->mME_UE_S1AP_ID = ogs_calloc(1,
|
||||
sizeof(S1AP_MME_UE_S1AP_ID_t));
|
||||
ogs_assert(item2->mME_UE_S1AP_ID);
|
||||
*item2->mME_UE_S1AP_ID = *item1->mME_UE_S1AP_ID;
|
||||
}
|
||||
|
||||
if (item1->eNB_UE_S1AP_ID)
|
||||
{
|
||||
if (item1->eNB_UE_S1AP_ID) {
|
||||
item2->eNB_UE_S1AP_ID = ogs_calloc(1,
|
||||
sizeof(S1AP_ENB_UE_S1AP_ID_t));
|
||||
ogs_assert(item2->eNB_UE_S1AP_ID);
|
||||
|
@ -2375,8 +2339,7 @@ int s1ap_build_s1_reset_ack(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2520,8 +2483,7 @@ int s1ap_build_write_replace_warning_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -2600,8 +2562,7 @@ int s1ap_build_kill_request(
|
|||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_encode_pdu() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __S1AP_BUILD_H__
|
||||
#define __S1AP_BUILD_H__
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef S1AP_BUILD_H
|
||||
#define S1AP_BUILD_H
|
||||
|
||||
#include "asn1c/s1ap-message.h"
|
||||
#include "mme-context.h"
|
||||
|
@ -8,7 +27,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf);
|
||||
int s1ap_build_setup_failure(
|
||||
|
@ -28,8 +47,8 @@ int s1ap_build_ue_context_release_command(
|
|||
int s1ap_build_paging(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue);
|
||||
|
||||
int s1ap_build_mme_configuration_transfer(
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_SONConfigurationTransfer_t *son_configuration_transfer);
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_SONConfigurationTransfer_t *son_configuration_transfer);
|
||||
|
||||
int s1ap_build_path_switch_ack(
|
||||
ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue);
|
||||
|
@ -38,56 +57,56 @@ int s1ap_build_path_switch_failure(ogs_pkbuf_t **s1apbuf,
|
|||
S1AP_Cause_PR group, long cause);
|
||||
|
||||
int s1ap_build_handover_command(
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue);
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue);
|
||||
int s1ap_build_handover_preparation_failure(
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause);
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause);
|
||||
|
||||
int s1ap_build_handover_request(
|
||||
ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_HandoverType_t *handovertype,
|
||||
S1AP_Cause_t *cause,
|
||||
S1AP_Source_ToTarget_TransparentContainer_t
|
||||
*source_totarget_transparentContainer);
|
||||
ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_HandoverType_t *handovertype,
|
||||
S1AP_Cause_t *cause,
|
||||
S1AP_Source_ToTarget_TransparentContainer_t
|
||||
*source_totarget_transparentContainer);
|
||||
|
||||
int s1ap_build_handover_cancel_ack(
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue);
|
||||
ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue);
|
||||
|
||||
int s1ap_build_mme_status_transfer(ogs_pkbuf_t **s1apbuf,
|
||||
enb_ue_t *target_ue,
|
||||
S1AP_ENB_StatusTransfer_TransparentContainer_t
|
||||
*enb_statustransfer_transparentContainer);
|
||||
enb_ue_t *target_ue,
|
||||
S1AP_ENB_StatusTransfer_TransparentContainer_t
|
||||
*enb_statustransfer_transparentContainer);
|
||||
|
||||
int s1ap_build_error_indication(
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
|
||||
S1AP_Cause_PR group, long cause);
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
|
||||
S1AP_Cause_PR group, long cause);
|
||||
|
||||
int s1ap_build_s1_reset(
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_Cause_PR group, long cause,
|
||||
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_Cause_PR group, long cause,
|
||||
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
|
||||
|
||||
int s1ap_build_s1_reset_partial(
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_Cause_PR group, long cause,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id);
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_Cause_PR group, long cause,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id);
|
||||
|
||||
int s1ap_build_s1_reset_ack(
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
|
||||
ogs_pkbuf_t **s1apbuf,
|
||||
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
|
||||
|
||||
int s1ap_build_write_replace_warning_request(
|
||||
ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws);
|
||||
ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws);
|
||||
|
||||
int s1ap_build_kill_request(
|
||||
ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws);
|
||||
ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __S1AP_BUILD_H__ */
|
||||
#endif /* S1AP_BUILD_H */
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "base/types.h"
|
||||
#include "s1ap-conv.h"
|
||||
|
||||
|
@ -44,8 +63,7 @@ void s1ap_uint32_to_ENB_ID(
|
|||
ogs_assert(eNB_ID);
|
||||
|
||||
eNB_ID->present = present;
|
||||
if (present == S1AP_ENB_ID_PR_macroENB_ID)
|
||||
{
|
||||
if (present == S1AP_ENB_ID_PR_macroENB_ID) {
|
||||
BIT_STRING_t *bit_string = &eNB_ID->choice.macroENB_ID;
|
||||
ogs_assert(bit_string);
|
||||
|
||||
|
@ -57,9 +75,7 @@ void s1ap_uint32_to_ENB_ID(
|
|||
bit_string->buf[2] = (enb_id & 0xf) << 4;
|
||||
|
||||
bit_string->bits_unused = 4;
|
||||
}
|
||||
else if (present == S1AP_ENB_ID_PR_homeENB_ID)
|
||||
{
|
||||
} else if (present == S1AP_ENB_ID_PR_homeENB_ID) {
|
||||
BIT_STRING_t *bit_string = &eNB_ID->choice.homeENB_ID;
|
||||
ogs_assert(bit_string);
|
||||
|
||||
|
@ -72,9 +88,7 @@ void s1ap_uint32_to_ENB_ID(
|
|||
bit_string->buf[3] = (enb_id & 0xf) << 4;
|
||||
|
||||
bit_string->bits_unused = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
|
@ -85,22 +99,17 @@ void s1ap_ENB_ID_to_uint32(S1AP_ENB_ID_t *eNB_ID, uint32_t *uint32)
|
|||
ogs_assert(uint32);
|
||||
ogs_assert(eNB_ID);
|
||||
|
||||
if (eNB_ID->present == S1AP_ENB_ID_PR_homeENB_ID)
|
||||
{
|
||||
if (eNB_ID->present == S1AP_ENB_ID_PR_homeENB_ID) {
|
||||
uint8_t *buf = eNB_ID->choice.homeENB_ID.buf;
|
||||
ogs_assert(buf);
|
||||
*uint32 = (buf[0] << 20) + (buf[1] << 12) + (buf[2] << 4) +
|
||||
((buf[3] & 0xf0) >> 4);
|
||||
|
||||
}
|
||||
else if (eNB_ID->present == S1AP_ENB_ID_PR_macroENB_ID)
|
||||
{
|
||||
} else if (eNB_ID->present == S1AP_ENB_ID_PR_macroENB_ID) {
|
||||
uint8_t *buf = eNB_ID->choice.macroENB_ID.buf;
|
||||
ogs_assert(buf);
|
||||
*uint32 = (buf[0] << 12) + (buf[1] << 4) + ((buf[2] & 0xf0) >> 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
}
|
||||
|
@ -112,28 +121,22 @@ int s1ap_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ip_t *ip)
|
|||
ogs_assert(bit_string);
|
||||
ogs_assert(ip);
|
||||
|
||||
if (bit_string->size == IPV4V6_LEN)
|
||||
{
|
||||
if (bit_string->size == IPV4V6_LEN) {
|
||||
ip->ipv4 = 1;
|
||||
ip->ipv6 = 1;
|
||||
memcpy(&ip->both.addr, bit_string->buf, IPV4_LEN);
|
||||
memcpy(&ip->both.addr6, bit_string->buf+IPV4_LEN, IPV6_LEN);
|
||||
ogs_debug(" IPv4[%s] IPv6[%s]",
|
||||
INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2));
|
||||
}
|
||||
else if (bit_string->size == IPV4_LEN)
|
||||
{
|
||||
} else if (bit_string->size == IPV4_LEN) {
|
||||
ip->ipv4 = 1;
|
||||
memcpy(&ip->addr, bit_string->buf, IPV4_LEN);
|
||||
ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf));
|
||||
}
|
||||
else if (bit_string->size == IPV6_LEN)
|
||||
{
|
||||
} else if (bit_string->size == IPV6_LEN) {
|
||||
ip->ipv6 = 1;
|
||||
memcpy(&ip->addr6, bit_string->buf, IPV6_LEN);
|
||||
ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf));
|
||||
}
|
||||
else
|
||||
} else
|
||||
ogs_assert_if_reached();
|
||||
|
||||
ip->len = bit_string->size;
|
||||
|
@ -147,30 +150,24 @@ int s1ap_ip_to_BIT_STRING(ip_t *ip, BIT_STRING_t *bit_string)
|
|||
ogs_assert(ip);
|
||||
ogs_assert(bit_string);
|
||||
|
||||
if (ip->ipv4 && ip->ipv6)
|
||||
{
|
||||
if (ip->ipv4 && ip->ipv6) {
|
||||
bit_string->size = IPV4V6_LEN;
|
||||
bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t));
|
||||
memcpy(bit_string->buf, &ip->both.addr, IPV4_LEN);
|
||||
memcpy(bit_string->buf+IPV4_LEN, &ip->both.addr6, IPV6_LEN);
|
||||
ogs_debug(" IPv4[%s] IPv6[%s]",
|
||||
INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2));
|
||||
}
|
||||
else if (ip->ipv4)
|
||||
{
|
||||
} else if (ip->ipv4) {
|
||||
bit_string->size = IPV4_LEN;
|
||||
bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t));
|
||||
memcpy(bit_string->buf, &ip->addr, IPV4_LEN);
|
||||
ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf));
|
||||
}
|
||||
else if (ip->ipv6)
|
||||
{
|
||||
} else if (ip->ipv6) {
|
||||
bit_string->size = IPV6_LEN;
|
||||
bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t));
|
||||
memcpy(bit_string->buf, &ip->addr6, IPV6_LEN);
|
||||
ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf));
|
||||
}
|
||||
else
|
||||
} else
|
||||
ogs_assert_if_reached();
|
||||
|
||||
return OGS_OK;
|
||||
|
@ -187,8 +184,7 @@ int s1ap_copy_ie(const asn_TYPE_descriptor_t *td, void *src, void *dst)
|
|||
ogs_assert(dst);
|
||||
|
||||
enc_ret = aper_encode_to_buffer(td, NULL, src, buffer, MAX_SDU_LEN);
|
||||
if (enc_ret.encoded < 0)
|
||||
{
|
||||
if (enc_ret.encoded < 0) {
|
||||
ogs_error("aper_encode_to_buffer() failed[%d]", (int)enc_ret.encoded);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -196,8 +192,7 @@ int s1ap_copy_ie(const asn_TYPE_descriptor_t *td, void *src, void *dst)
|
|||
dec_ret = aper_decode(NULL, td, (void **)&dst,
|
||||
buffer, (enc_ret.encoded >> 3), 0, 0);
|
||||
|
||||
if (dec_ret.code != RC_OK)
|
||||
{
|
||||
if (dec_ret.code != RC_OK) {
|
||||
ogs_error("aper_decode() failed[%d]", dec_ret.code);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
#ifndef __S1AP_CONV_H__
|
||||
#define __S1AP_CONV_H__
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef S1AP_CONV_H
|
||||
#define S1AP_CONV_H
|
||||
|
||||
#include "asn1c/s1ap-message.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
void s1ap_uint8_to_OCTET_STRING(
|
||||
uint8_t uint8, OCTET_STRING_t *octet_string);
|
||||
|
@ -32,7 +51,7 @@ int s1ap_copy_ie(
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __S1AP_CONV_H__ */
|
||||
#endif /* S1AP_CONV_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,24 @@
|
|||
#ifndef __S1AP_HANDLER_H__
|
||||
#define __S1AP_HANDLER_H__
|
||||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef S1AP_HANDLER_H
|
||||
#define S1AP_HANDLER_H
|
||||
|
||||
#include "asn1c/s1ap-message.h"
|
||||
|
||||
|
@ -7,7 +26,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
void s1ap_handle_s1_setup_request(
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
|
@ -58,8 +77,9 @@ void s1ap_handle_write_replace_warning_response(
|
|||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
void s1ap_handle_kill_response(
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __S1AP_HANDLER_H__ */
|
||||
#endif /* S1AP_HANDLER_H */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#define S1AP_NON_UE_SIGNALLING 0
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "nas/nas-message.h"
|
||||
#include "gtp/gtp-message.h"
|
||||
|
||||
|
@ -26,6 +45,12 @@ void s1ap_state_final(ogs_fsm_t *s, mme_event_t *e)
|
|||
void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
mme_enb_t *enb = NULL;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
||||
S1AP_S1AP_PDU_t *pdu = NULL;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
||||
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -36,209 +61,126 @@ void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
enb = e->enb;
|
||||
ogs_assert(enb);
|
||||
|
||||
switch (e->id)
|
||||
{
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case MME_EVT_S1AP_MESSAGE:
|
||||
{
|
||||
S1AP_S1AP_PDU_t *pdu = e->s1ap_message;
|
||||
ogs_assert(pdu);
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
break;
|
||||
case MME_EVT_S1AP_MESSAGE:
|
||||
pdu = e->s1ap_message;
|
||||
ogs_assert(pdu);
|
||||
|
||||
switch(pdu->present)
|
||||
{
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage :
|
||||
{
|
||||
S1AP_InitiatingMessage_t *initiatingMessage =
|
||||
pdu->choice.initiatingMessage;
|
||||
ogs_assert(initiatingMessage);
|
||||
switch (pdu->present) {
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage :
|
||||
initiatingMessage = pdu->choice.initiatingMessage;
|
||||
ogs_assert(initiatingMessage);
|
||||
|
||||
switch(initiatingMessage->procedureCode)
|
||||
{
|
||||
case S1AP_ProcedureCode_id_S1Setup :
|
||||
{
|
||||
s1ap_handle_s1_setup_request(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_initialUEMessage :
|
||||
{
|
||||
s1ap_handle_initial_ue_message(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport :
|
||||
{
|
||||
s1ap_handle_uplink_nas_transport(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication :
|
||||
{
|
||||
s1ap_handle_ue_capability_info_indication(
|
||||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
|
||||
{
|
||||
s1ap_handle_ue_context_release_request(
|
||||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
{
|
||||
s1ap_handle_path_switch_request(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
{
|
||||
ogs_pkbuf_t *pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
switch (initiatingMessage->procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup :
|
||||
s1ap_handle_s1_setup_request(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_initialUEMessage :
|
||||
s1ap_handle_initial_ue_message(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport :
|
||||
s1ap_handle_uplink_nas_transport(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication :
|
||||
s1ap_handle_ue_capability_info_indication( enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
|
||||
s1ap_handle_ue_context_release_request( enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
s1ap_handle_path_switch_request(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
s1ap_handle_enb_configuration_transfer(
|
||||
enb, pdu, pkbuf);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_HandoverPreparation:
|
||||
{
|
||||
s1ap_handle_handover_required(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_HandoverCancel:
|
||||
{
|
||||
s1ap_handle_handover_cancel(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_eNBStatusTransfer:
|
||||
{
|
||||
s1ap_handle_enb_status_transfer(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_HandoverNotification:
|
||||
{
|
||||
s1ap_handle_handover_notification(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_Reset:
|
||||
{
|
||||
s1ap_handle_s1_reset(enb, pdu);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present,
|
||||
(int)initiatingMessage->procedureCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome :
|
||||
{
|
||||
S1AP_SuccessfulOutcome_t *successfulOutcome =
|
||||
pdu->choice.successfulOutcome;
|
||||
ogs_assert(successfulOutcome);
|
||||
|
||||
switch(successfulOutcome->procedureCode)
|
||||
{
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup :
|
||||
{
|
||||
s1ap_handle_initial_context_setup_response(
|
||||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_E_RABSetup :
|
||||
{
|
||||
s1ap_handle_e_rab_setup_response(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_E_RABModify :
|
||||
{
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_E_RABRelease :
|
||||
{
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_UEContextRelease :
|
||||
{
|
||||
s1ap_handle_ue_context_release_complete(
|
||||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_HandoverResourceAllocation:
|
||||
{
|
||||
s1ap_handle_handover_request_ack(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_WriteReplaceWarning:
|
||||
{
|
||||
s1ap_handle_write_replace_warning_response(enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_Kill:
|
||||
{
|
||||
s1ap_handle_kill_response(enb, pdu);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present,
|
||||
(int)successfulOutcome->procedureCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome :
|
||||
{
|
||||
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome =
|
||||
pdu->choice.unsuccessfulOutcome;
|
||||
ogs_assert(unsuccessfulOutcome);
|
||||
|
||||
switch(unsuccessfulOutcome->procedureCode)
|
||||
{
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup :
|
||||
{
|
||||
s1ap_handle_initial_context_setup_failure(
|
||||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
case S1AP_ProcedureCode_id_HandoverResourceAllocation :
|
||||
{
|
||||
s1ap_handle_handover_failure(enb, pdu);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present,
|
||||
(int)unsuccessfulOutcome->procedureCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_warn("Not implemented(choice:%d)", pdu->present);
|
||||
break;
|
||||
}
|
||||
s1ap_handle_enb_configuration_transfer(enb, pdu, pkbuf);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_HandoverPreparation:
|
||||
s1ap_handle_handover_required(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_HandoverCancel:
|
||||
s1ap_handle_handover_cancel(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_eNBStatusTransfer:
|
||||
s1ap_handle_enb_status_transfer(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_HandoverNotification:
|
||||
s1ap_handle_handover_notification(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_Reset:
|
||||
s1ap_handle_s1_reset(enb, pdu);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present, (int)initiatingMessage->procedureCode);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome :
|
||||
successfulOutcome = pdu->choice.successfulOutcome;
|
||||
ogs_assert(successfulOutcome);
|
||||
|
||||
switch (successfulOutcome->procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup :
|
||||
s1ap_handle_initial_context_setup_response(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABSetup :
|
||||
s1ap_handle_e_rab_setup_response(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABModify :
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABRelease :
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_UEContextRelease :
|
||||
s1ap_handle_ue_context_release_complete(
|
||||
enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_HandoverResourceAllocation:
|
||||
s1ap_handle_handover_request_ack(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_WriteReplaceWarning:
|
||||
s1ap_handle_write_replace_warning_response(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_Kill:
|
||||
s1ap_handle_kill_response(enb, pdu);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present, (int)successfulOutcome->procedureCode);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome :
|
||||
unsuccessfulOutcome = pdu->choice.unsuccessfulOutcome;
|
||||
ogs_assert(unsuccessfulOutcome);
|
||||
|
||||
switch (unsuccessfulOutcome->procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup :
|
||||
s1ap_handle_initial_context_setup_failure(enb, pdu);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_HandoverResourceAllocation :
|
||||
s1ap_handle_handover_failure(enb, pdu);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present, (int)unsuccessfulOutcome->procedureCode);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_error("Unknown event %s", mme_event_get_name(e));
|
||||
ogs_warn("Not implemented(choice:%d)", pdu->present);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown event %s", mme_event_get_name(e));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,21 +191,14 @@ void s1ap_state_exception(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
mme_sm_debug(e);
|
||||
|
||||
switch (e->id)
|
||||
{
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_error("Unknown event %s", mme_event_get_name(e));
|
||||
break;
|
||||
}
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown event %s", mme_event_get_name(e));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue