ranap: Introduce ranap_new_msg_error_ind()

Change-Id: I58c75b3e0e0f33f48d077385ffac820a6b2be59e
This commit is contained in:
Pau Espin Pedrol
2025-08-28 17:06:05 +02:00
parent faf9462875
commit a812956681
3 changed files with 62 additions and 0 deletions

View File

@@ -14,3 +14,4 @@ libosmo-ranap new event RANAP_IU_EVENT_NEW_AREA
libosmo-ranap move declaration (backwards compatible): asn_debug, asn1_xer_print: use osmocom/iuh/common.h instead of iu_client.h
libosmo-ranap move definition (backwards compatible): enum ranap_nsap_addr_enc: use osmocom/ranap/ranap_common.h instead of iu_client.h
libosmo-ranap move declaration (backwards compatible): ranap_iu_vty_init, ranap_iu_vty_config_write: use osmocom/ranap/vty.h instead of iu_client.h
libosmo-ranap add API ranap_new_msg_error_ind()

View File

@@ -7,6 +7,7 @@
#include <osmocom/ranap/RANAP_GlobalRNC-ID.h>
#include <osmocom/ranap/RANAP_ChosenIntegrityProtectionAlgorithm.h>
#include <osmocom/ranap/RANAP_ChosenEncryptionAlgorithm.h>
#include <osmocom/ranap/RANAP_CriticalityDiagnostics.h>
#include <osmocom/ranap/RANAP_KeyStatus.h>
/*! \brief generate RANAP DIRECT TRANSFER message */
@@ -55,6 +56,12 @@ struct msgb *ranap_new_msg_reset2(RANAP_CN_DomainIndicator_t domain,
struct msgb *ranap_new_msg_reset_ack(RANAP_CN_DomainIndicator_t domain,
const RANAP_GlobalRNC_ID_t *rnc_id);
/*! \brief generate RANAP ERROR INDICATION message */
struct msgb *ranap_new_msg_error_ind(const RANAP_Cause_t *cause,
const RANAP_CriticalityDiagnostics_t *criticalityDiagnostics,
const RANAP_CN_DomainIndicator_t *domain,
const RANAP_GlobalRNC_ID_t *rnc_id);
/*! \brief generate RANAP INITIAL UE message */
struct msgb *ranap_new_msg_initial_ue(uint32_t conn_id, int is_ps,

View File

@@ -129,6 +129,60 @@ struct msgb *ranap_new_msg_reset_ack(RANAP_CN_DomainIndicator_t domain,
return msg;
}
/*! \brief generate RANAP ERROR INDICATION message */
struct msgb *ranap_new_msg_error_ind(const RANAP_Cause_t *cause,
const RANAP_CriticalityDiagnostics_t *criticalityDiagnostics,
const RANAP_CN_DomainIndicator_t *domain,
const RANAP_GlobalRNC_ID_t *rnc_id)
{
RANAP_ErrorIndicationIEs_t ies;
RANAP_ErrorIndication_t out;
struct msgb *msg;
int rc;
memset(&ies, 0, sizeof(ies));
if (cause) {
ies.presenceMask |= ERRORINDICATIONIES_RANAP_CAUSE_PRESENT;
memcpy(&ies.cause, cause, sizeof(ies.cause));
}
if (criticalityDiagnostics) {
ies.presenceMask |= ERRORINDICATIONIES_RANAP_CRITICALITYDIAGNOSTICS_PRESENT;
memcpy(&ies.criticalityDiagnostics, criticalityDiagnostics, sizeof(ies.criticalityDiagnostics));
}
if (domain) {
ies.presenceMask |= ERRORINDICATIONIES_RANAP_CN_DOMAININDICATOR_PRESENT;
ies.cN_DomainIndicator = *domain;
}
if (rnc_id) {
ies.presenceMask = RESETACKNOWLEDGEIES_RANAP_GLOBALRNC_ID_PRESENT;
OCTET_STRING_noalloc(&ies.globalRNC_ID.pLMNidentity,
rnc_id->pLMNidentity.buf,
rnc_id->pLMNidentity.size);
ies.globalRNC_ID.rNC_ID = rnc_id->rNC_ID;
}
memset(&out, 0, sizeof(out));
rc = ranap_encode_errorindicationies(&out, &ies);
if (rc < 0) {
LOGP(DRANAP, LOGL_ERROR, "error encoding ErrorIndication IEs: %d\n", rc);
return NULL;
}
msg = ranap_generate_initiating_message(RANAP_ProcedureCode_id_ErrorIndication,
RANAP_Criticality_ignore,
&asn_DEF_RANAP_ErrorIndication,
&out);
/* release dynamic allocations attached to dt */
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_ErrorIndication, &out);
return msg;
}
/*! \brief generate RANAP INITIAL UE message */
struct msgb *ranap_new_msg_initial_ue(uint32_t conn_id, int is_ps,
const RANAP_GlobalRNC_ID_t *rnc_id,