Files
openairinterface5g/openair3/M3AP/m3ap_MCE_handler.c
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
  scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly

For automated changes based on OAI PL v1.1:

    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
    perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml

The rest (cmake, files with missing license, cmake) manually.
2026-03-27 16:36:37 +01:00

100 lines
3.1 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
/*!
* \brief m3ap handler procedures for eNB
*/
#include <stdint.h>
#include "intertask_interface.h"
#include "oai_asn1.h"
#include "m3ap_common.h"
#include "m3ap_MCE_defs.h"
#include "m3ap_handler.h"
#include "m3ap_decoder.h"
#include "m3ap_ids.h"
//#include "m3ap_MCE_management_procedures.h"
#include "m3ap_MCE_generate_messages.h"
//#include "m3ap_MME_interface_management.h"
#include "m3ap_MCE_interface_management.h"
#include "assertions.h"
#include "conversions.h"
/* Handlers matrix. Only eNB related procedure present here */
static const m3ap_MCE_message_decoded_callback m3ap_MCE_messages_callback[][3] = {
{MCE_handle_MBMS_SESSION_START_REQUEST, 0, 0}, /* MBMSSessionStart */
{MCE_handle_MBMS_SESSION_STOP_REQUEST, 0, 0}, /* MBMSSessionStop */
{0, 0, 0}, /* Error Indication */
{0, 0, 0}, /* Reset */
{0, 0, 0}, /* ??? */
{MCE_handle_MBMS_SESSION_UPDATE_REQUEST, 0, 0}, /* MBMSSessionUpdate */
{0, 0, 0}, /* MCEConfigurationUpdate */
{0, MCE_handle_M3_SETUP_RESPONSE, 0} /* M3 Setup */
};
static char *m3ap_direction2String(int m3ap_dir) {
static char *m3ap_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(m3ap_direction_String[m3ap_dir]);
}
int m3ap_MCE_handle_message(instance_t instance,
sctp_assoc_t assoc_id,
int32_t stream,
const uint8_t *const data,
const uint32_t data_length)
{
M3AP_M3AP_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (m3ap_decode_pdu(&pdu, data, data_length) < 0) {
LOG_E(M3AP, "Failed to decode PDU\n");
return -1;
}
/* Checking procedure Code and direction of message */
if (pdu.choice.initiatingMessage.procedureCode > sizeof(m3ap_MCE_messages_callback) / (3 * sizeof(
m3ap_message_decoded_callback))
|| (pdu.present > M3AP_M3AP_PDU_PR_unsuccessfulOutcome)) {
LOG_E(M3AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
assoc_id, pdu.choice.initiatingMessage.procedureCode, pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for eNB (wrong direction).
*/
if (m3ap_MCE_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) {
LOG_E(M3AP, "[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.initiatingMessage.procedureCode,
m3ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* Calling the right handler */
LOG_I(M3AP, "Calling handler with instance %ld\n",instance);
ret = (*m3ap_MCE_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1])
(instance, assoc_id, stream, &pdu);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return ret;
}